|
|
 |
View previous topic :: View next topic |
 |
|
|
|
|
Author |
Message |
|
|
|
|
|
EmperorJon


Joined: 29 Dec 2008 Posts: 6665 on topic Location: Leicester

|
|
|
|
|
|
|
Back to top |
|
|
|
 |
|
|
|
|
|
Roger L.S. Griffiths

 
Joined: 12 Mar 2004 Posts: 5757 on topic Location: United Kingdom

|
Posted: Sun, 21. Mar 10, 00:38 Post subject: |
|
|
Here is my first stab at the main script
| Code: |
001 if [DOCKEDAT] == null
002 |[THIS] -> set local variable: name='pwrlink.active' value=[FALSE]
003 else
004 |$carrier1 = [DOCKEDAT] -> get current shield strength
005 |while [THIS] -> get local variable: name='pwrlink.active'
006 @ ||= wait 1000 ms
007 ||if [DOCKEDAT] == null
008 |||[THIS] -> set local variable: name='pwrlink.active' value=[FALSE]
009 ||else
010 |||$carrier2 = [DOCKEDAT] -> get current shield strength
011 |||$shield = [THIS] -> get shield percent
012 |||if $shield >= 50
013 ||||$dmg = ( $carrier1 - $carrier2 ) / 100
014 ||||$dmg = get maximum, $dmg, 0, null, null, null
015 ||||$ship = [THIS] -> get current shield strength
016 ||||$ship = $ship - $dmg
017 ||||$ship = get maximum, $ship, 0, null, null, null
018 ||||[THIS] -> set current shield strength to $ship
019 ||||$shield = [THIS] -> get shield percent
020 ||||if $shield >= 50
021 |||||$regen = [THIS] -> get power generator
022 |||||$laser = [DOCKEDAT] -> get current laser strength
023 |||||$max = [DOCKEDAT] -> get maximum laser strength
024 |||||$laser = $laser + ( $regen / 2 )
025 |||||$laser = get maximum, $laser, $max, null, null, null
026 |||||[THIS] -> set laser energy to $laser
027 ||||end
028 |||end
029 |||$carrier1 = $carrier2
030 ||end
031 |end
032 end
033 return null |
_________________ Roger (aka [SRK] Mr^Rabbit)
"Understanding is a three edged sword... your side, their side... and the Truth!" - J.J. Sheriden, Babylon 5 S4E6 T28:55
"May god stand between you and harm in all the dark places you must walk." - Ancient Egyption Proverb
"How do you eat an elephant? One bite at a time." - Unknown |
|
|
|
|
|
|
Back to top |
|
|
|
 |
|
|
|
|
|
EmperorJon


Joined: 29 Dec 2008 Posts: 6665 on topic Location: Leicester

|
|
|
|
|
|
|
Back to top |
|
|
|
 |
|
|
|
|
|
LV Moderator (Script&Mod)


Joined: 06 Nov 2002 Posts: 6299 on topic Location: The Dark Side

|
Posted: Sun, 21. Mar 10, 09:56 Post subject: |
|
|
p gen is recharge of shields time, poss laser also
the value will probably be held in tships, it is possible (but long and cpu intensive) to scan through allships in the game using maincodes and subtypes
| Code: |
006 $main = 8
007 $subs = get number of subtypes of maintype $main
009
010
011 while $subs > 0
012 |dec $subs =
013 |$ware = get ware from maintype $main and subtype $subs
018 end |
the 2 commands are in the trade menu and this one is retuning lasers, check the tutorial stickie for a list of the other maintypes
there is probably also an easier way but i've not long been awake 
_________________ LV's TC Scripts
Readme's For All My Scripts
I felt a great disturbance in the forum, Like millions of voices cried out in terror, then were silenced
LV has left the building |
|
|
|
|
|
|
Back to top |
|
|
|
 |
|
|
|
|
|
EmperorJon


Joined: 29 Dec 2008 Posts: 6665 on topic Location: Leicester

|
|
|
|
|
|
|
Back to top |
|
|
|
 |
|
|
|
|
|
Roger L.S. Griffiths

 
Joined: 12 Mar 2004 Posts: 5757 on topic Location: United Kingdom

 |
Posted: Sun, 21. Mar 10, 10:47 Post subject: |
|
|
| EmperorJon wrote: |
I'm confused now!
So you have Get Power Generator?
Is that for laser or shield? |
In the Script Editor, Get Power Generator is under weapon information thus I presume it is for the "Weapon Regen" if not then it's location is notionally a bug.
EDIT: Just done a debug test and it is the SHIELD power generator, so it's location is a bug.
_________________ Roger (aka [SRK] Mr^Rabbit)
"Understanding is a three edged sword... your side, their side... and the Truth!" - J.J. Sheriden, Babylon 5 S4E6 T28:55
"May god stand between you and harm in all the dark places you must walk." - Ancient Egyption Proverb
"How do you eat an elephant? One bite at a time." - Unknown
Last edited by Roger L.S. Griffiths on Sun, 21. Mar 10, 13:08; edited 1 time in total |
|
|
|
|
|
|
Back to top |
|
|
|
 |
|
|
|
|
|
EmperorJon


Joined: 29 Dec 2008 Posts: 6665 on topic Location: Leicester

|
|
|
|
|
|
|
Back to top |
|
|
|
 |
|
|
|
|
|
Roger L.S. Griffiths

 
Joined: 12 Mar 2004 Posts: 5757 on topic Location: United Kingdom

|
Posted: Sun, 21. Mar 10, 13:51 Post subject: |
|
|
Ok, I have some success in coding the script... it comes in 2 parts...
Carrier Power Link start script
| Code: |
001 $docked = [THIS] -> get ship array from sector/ship/station
002 $idx = size of array $docked
003 while $idx
004 |dec $idx =
005 |$ship = $docked[$idx]
006 @ |START $ship -> call script 'test.rg.pwrlink' :
007 end
008 return null |
Docked Ship Power Link script
| Code: |
001 infinite loop detection enabled=[FALSE]
002 $regen = [THIS] -> get power generator
003 $msg = 'Power Generator for ' + [THIS] + ' is ' + $regen
004 write to player logbook $msg
005 loop:
006 $shield = [THIS] -> get shield percent
007 while $shield < 100
008 @ |= wait 1000 ms
009 |$ship = [THIS] -> get current shield strength
010 |$max = [THIS] -> get maximum shield strength
011 |$ship = $ship + ( $regen / 2 )
012 |$ship = get maximum, $ship, $max, null, null, null
013 |[THIS] -> set current shield strength to $ship
014 |$shield = [THIS] -> get shield percent
015 end
016 $msg = 'Power Link engaging for ' + [THIS]
017 display subtitle text: text=$msg duration=3000 ms
018 $carrier1 = [DOCKEDAT] -> get current shield strength
019 while $shield >= 50
020 @ |= wait 1000 ms
021 |$carrier2 = [DOCKEDAT] -> get current shield strength
022 * Calculate excess shield damage to carrier
023 |$dmg = ( $carrier1 - $carrier2 ) / 100
024 |$dmg = get maximum, $dmg, 0, null, null, null
025 * Apply 1% of excess shield damage to docked ship
026 |$ship = [THIS] -> get current shield strength
027 |$ship = $ship - $dmg
028 |$ship = get maximum, $ship, 0, null, null, null
029 |[THIS] -> set current shield strength to $ship
030 * Check that docked ship has 50% or more remaining
031 |$shield = [THIS] -> get shield percent
032 |if $shield >= 50
033 * Pass on power from docked ship to carrier weapons
034 ||$laser = [DOCKEDAT] -> get current laser strength
035 ||$max = [DOCKEDAT] -> get maximum laser strength
036 ||$laser = $laser + ( $regen / 2 )
037 ||$laser = get maximum, $laser, $max, null, null, null
038 ||[DOCKEDAT] -> set laser energy to $laser
039 |end
040 |$carrier1 = $carrier2
041 end
042 $msg = 'Power Link disengaged for ' + [THIS]
043 display subtitle text: text=$msg duration=3000 ms
044 goto label loop
045 return null |
With just a Pirate Kestral docked at my Hyperion I can fire ISR continuously so the efficiency co-efficient (currently 50% for weapon power/docked shield regen) probably needs to be severely reduced if we are to continue using shield power for the script.
As a proof of concept the above works but it needs further refinement.
The Docked Ship Power Link script does not allow the Power Link to start unless the docked ship has 100% shields and will use the redirected power to charge the shields if necessary.
Once the Power Link has engaged the docked ship will redirect it's power to the Carrier's weapons and will sustain 1% of the excess damage that the carrier takes to it's shields. When the docked ship looses 50% or more of it's shields it will disengage and recharge the shields back to 100% before re-engaging.
_________________ Roger (aka [SRK] Mr^Rabbit)
"Understanding is a three edged sword... your side, their side... and the Truth!" - J.J. Sheriden, Babylon 5 S4E6 T28:55
"May god stand between you and harm in all the dark places you must walk." - Ancient Egyption Proverb
"How do you eat an elephant? One bite at a time." - Unknown |
|
|
|
|
|
|
Back to top |
|
|
|
 |
|
|
|
|
|
EmperorJon


Joined: 29 Dec 2008 Posts: 6665 on topic Location: Leicester

|
|
|
|
|
|
|
Back to top |
|
|
|
 |
|
|
|
|
|
Roger L.S. Griffiths

 
Joined: 12 Mar 2004 Posts: 5757 on topic Location: United Kingdom

 |
Posted: Sun, 21. Mar 10, 14:39 Post subject: |
|
|
| EmperorJon wrote: |
Nice!
I was going to make this, but you're doing it for me.
As long as I can use it in my Military plugin, that's fine. (Might be fine-tuned and changed though) |
Well feel free... just include me as a tiny footnote in the credits and we are even
EDIT 01-Apr-2010
And no this is not an April Fool
Although, I have authorised EmperorJon to include an implementation of the concept discussed here I would like to point towards my own implementation of it: Carrier Power Link System (CPLS).
_________________ Roger (aka [SRK] Mr^Rabbit)
"Understanding is a three edged sword... your side, their side... and the Truth!" - J.J. Sheriden, Babylon 5 S4E6 T28:55
"May god stand between you and harm in all the dark places you must walk." - Ancient Egyption Proverb
"How do you eat an elephant? One bite at a time." - Unknown
Last edited by Roger L.S. Griffiths on Thu, 1. Apr 10, 10:48; edited 1 time in total |
|
|
|
|
|
|
Back to top |
|
|
|
 |
|
|
|
|
|
LV Moderator (Script&Mod)


Joined: 06 Nov 2002 Posts: 6299 on topic Location: The Dark Side

|
Posted: Sun, 21. Mar 10, 15:23 Post subject: |
|
|
One problem i saw while skimming.
you should call this script (which appears ok in code) as a task.
otherwise it may sit dead in space while it's held in a loop.
get next available task then start task etc etc
as long as you don't start telling the ship to do things via this task script in will run at the same time as any ship command e.g. fight.attack.obj
_________________ LV's TC Scripts
Readme's For All My Scripts
I felt a great disturbance in the forum, Like millions of voices cried out in terror, then were silenced
LV has left the building |
|
|
|
|
|
|
Back to top |
|
|
|
 |
|
|
|
|
|
Roger L.S. Griffiths

 
Joined: 12 Mar 2004 Posts: 5757 on topic Location: United Kingdom

|
Posted: Sun, 21. Mar 10, 15:52 Post subject: |
|
|
| LV wrote: |
One problem i saw while skimming.
you should call this script (which appears ok in code) as a task.
otherwise it may sit dead in space while it's held in a loop.
get next available task then start task etc etc
as long as you don't start telling the ship to do things via this task script in will run at the same time as any ship command e.g. fight.attack.obj |
The intent in my script was that it would be the only command running on the fighter while it is docked and the fighter would cease to supply power if it undocks or is given another command and my initial testing proves it works as I intended.
_________________ Roger (aka [SRK] Mr^Rabbit)
"Understanding is a three edged sword... your side, their side... and the Truth!" - J.J. Sheriden, Babylon 5 S4E6 T28:55
"May god stand between you and harm in all the dark places you must walk." - Ancient Egyption Proverb
"How do you eat an elephant? One bite at a time." - Unknown |
|
|
|
|
|
|
Back to top |
|
|
|
 |
|
|
|
|
|
EmperorJon


Joined: 29 Dec 2008 Posts: 6665 on topic Location: Leicester

|
|
|
|
|
|
|
Back to top |
|
|
|
 |
|
|
|
|
|
Roger L.S. Griffiths

 
Joined: 12 Mar 2004 Posts: 5757 on topic Location: United Kingdom

|
Posted: Sun, 21. Mar 10, 16:15 Post subject: |
|
|
| EmperorJon wrote: |
| Yes, but that might not work as intended, because fighter set to protect carrier etc. will redock after the fight and not lend recharge. Ships set to follow the carrier won't, ships accidentally set to idle or standby won't... |
Perhaps, personally I would consider it a balancing feature, I was considering the recharge a role for the fighter rather than a carte-blanche bonus to the carrier while it is docked. If you retask the fighter to external detail then it returns, you would naturally have to reconnect all the cables for the power generator. I had been toying with something along the lines of it running in the background but I had concerns about the load on the processor.
But this is all down to design decision/intent at the end of the day and will come out in the wash.
| EmperorJon wrote: |
I'm working on somethin new now anyway. Capital ship explosions upon death.  |
Kewl, but I already thought there were explosions on Capital ship death... or are you talking about something a little different?
_________________ Roger (aka [SRK] Mr^Rabbit)
"Understanding is a three edged sword... your side, their side... and the Truth!" - J.J. Sheriden, Babylon 5 S4E6 T28:55
"May god stand between you and harm in all the dark places you must walk." - Ancient Egyption Proverb
"How do you eat an elephant? One bite at a time." - Unknown |
|
|
|
|
|
|
Back to top |
|
|
|
 |
|
|
|
|
|
EmperorJon


Joined: 29 Dec 2008 Posts: 6665 on topic Location: Leicester

|
|
|
|
|
|
|
Back to top |
|
|
|
 |
|
|
|
|
|
|
|
 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
 |
|
|
|
|
|