EnglishGermanFrenchRussianPolishItalianSpanish
Log inRegister
 
Need help with SIGNAL_KILLED and an OOS combat script
Post new topic Reply to topic Goto page 1, 2, 3  Next
View previous topic :: View next topic
Author Message
halo112358





Joined: 16 Feb 2006
Posts: 342 on topic
Location: Berkeley, CA, USA
Thank you for registering your game
modified
PostPosted: Mon, 7. May 07, 00:43    Post subject: Need help with SIGNAL_KILLED and an OOS combat script Reply with quote Print

I wrote a simulator script that spawns two groups of enemies, each with a leader and wingmen, then starts the two leaders to kill each other with !ship.cmd.attack.pl.

I did this so that I could log the results of OOS combat between two groups, I'll extend and generalize it a bit more once everything is working - for now I have a problem. Once the leader dies leadership is not handed off properly for OOS combats, it seems to work fine IS but OOS the two groups stop and do nothing once each lead ship dies.

I'm confused, IS it works great, OOS (which is what I really wanted) it breaks after the lead ships die.

here's the code

Here's what I'm doing:

Code:

096   $count =  size of array $pendingships
097   $spawnedShips =  array alloc: size=$count
098   $i = 0
099   while $i < $count
100    $type = $pendingships[$i]
101 @  $ship = [THIS] -> call script "aa.h.combatsimulator.spawnship" :  What kind of ship do you want?=$type  Owner Race=$groupowner  target sector=$sector  x=$x  y=$y  z=$z
102    $ship -> set local variable: name='h_grpPtr' value=$groupGlobal
103    if ( $groupLeader == null )
104     $groupLeader = $ship
105    else
106 @   START $ship -> call script "!ship.cmd.attacksame.std" :  the target=$groupLeader  stop if leader is docked=null
107    end
108    $spawnedShips[$i] = $ship
109    inc $i =
110   end


here's what's called after that subroutine, it starts the two leaders with a command to kill each other.

Code:

053   * start a fight
054 @ START $leadA -> call script "aa.h.combatsimulator.attack" :  the victim=$leadB
055 @ START $leadB -> call script "aa.h.combatsimulator.attack" :  the victim=$leadA
056   
057   while [TRUE]
058 @  = wait randomly from 300 to 900 ms
059    $killed = $grpPtrA[0]
060    $count = $grpPtrA[1]
061    skip if $killed != $count
062     break
063    $killed = $grpPtrB[0]
064    $count = $grpPtrB[1]
065    skip if $killed != $count
066     break
067   end


where aa.h.combatsimulator.attack contains this:

Code:

001   [THIS] -> start task 1 with script "!turret.killenemies.adv" and prio 0: arg1=1 arg2=null arg3=null arg4=null arg5=null
002   [THIS] -> start task 2 with script "!turret.killenemies.adv" and prio 0: arg1=2 arg2=null arg3=null arg4=null arg5=null
003   [THIS] -> start task 3 with script "!turret.killenemies.adv" and prio 0: arg1=3 arg2=null arg3=null arg4=null arg5=null
004   [THIS] -> start task 4 with script "!turret.killenemies.adv" and prio 0: arg1=4 arg2=null arg3=null arg4=null arg5=null
005   [THIS] -> start task 5 with script "!turret.killenemies.adv" and prio 0: arg1=5 arg2=null arg3=null arg4=null arg5=null
006   [THIS] -> start task 6 with script "!turret.killenemies.adv" and prio 0: arg1=6 arg2=null arg3=null arg4=null arg5=null
007 @ = [THIS] -> call script "!ship.cmd.attack.pl" :  victim=$vicitim
008 @ = [THIS] -> call script "!ship.cmd.killenemies.std" :
009   return null


aa.h.combatsimulator.spawnship does this:

Code:

gosub genRandomPosition
002   
003   $asdf =  create ship: type=$type owner=$ownerRace addto=$sector x=$x y=$y z=$z
004   *$asdf -> set race logic control enabled to [FALSE]
005   $asdf -> add default items to ship
006   $asdf -> connect ship command/signal SIGNAL_KILLED to script "aa.h.combatsimulator.killed" with prio 10000
007   return $asdf


I've tried with race logic on and off, it seems to make no difference.

Here's my custom signal_killed:

Code:

001   * we blew up, increment killed count for our group
002   $grpStateVar = [THIS] -> get local variable: name='h_grpPtr'
003   $grpStateAry = get global variable: name=$grpStateVar
004   $count = $grpStateAry[1]
005   $killed = $grpStateAry[0]
006   inc $killed =
007   $grpStateAry[0] = $killed
008   
009   $playtime = playing time
010   $kID = $killer -> get ID code
011   $msg = sprintf: fmt='%s killed by %s(%s)', [THIS], $killer, $kID, null, null
012   write to log file #9876  append=[TRUE]  printf: fmt='(%s) %s %s/%s', $playtime, $msg, $killed, $count, null
013   
014   * if we have followers, select a new leader
015   if [THIS] -> has formation ships
016    $newleader = [THIS] -> select new formation leader by: ship class=[TRUE] strength=[TRUE] min.speed=[TRUE]
017    [THIS] -> give formation leadership to $newleader
018   
019    START $newleader -> command $cmd : arg1=$cmdtarget, arg2=$cmdtarget2, arg3=$cmdpar1, arg4=$cmdpar2
020    if $killer -> exists
021     skip if not [THIS] -> is $killer a enemy
022      $newleader -> set relation against $killer to Foe
023     $attacker = [THIS] -> get attacker
024     if $attacker == $killer
025      $newleader -> send signal SIGNAL_ATTACKED : arg1=$killer, arg2=null, arg3=null, arg4=null
026     end
027    end
028   end
029   return null


This is a copy of stock signal_killed but with logging added at the beginning.

To clarify, everything (logging, spawning, initial combat) works like a charm, only the switching of group leadership and continuing to fight is broken - and only OOS.

So, um, help? Sad


_________________
*** modified ***



Last edited by halo112358 on Tue, 8. May 07, 08:19; edited 1 time in total
Back to top
View user's profile Send private message
xTemon





Joined: 09 Jan 2007
Posts: 774 on topic
Location: The other side of nowhere
Thank you for registering your game
PostPosted: Mon, 7. May 07, 22:05    Post subject: Reply with quote Print

I think the problem is in the first sections count Confused

Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
ttl





Joined: 06 Feb 2005
Posts: 536 on topic
Location: Helsinki, Finland
Thank you for registering your game
PostPosted: Mon, 7. May 07, 22:37    Post subject: Reply with quote Print

The killed signal doesn't work corectly OOS, as far as I understand. Like you don't get killed by who on the log message, when your ship dies OOS, but you do if IS.

People who know better can hopefully fill in.

Back to top
View user's profile Send private message
halo112358





Joined: 16 Feb 2006
Posts: 342 on topic
Location: Berkeley, CA, USA
Thank you for registering your game
PostPosted: Mon, 7. May 07, 23:02    Post subject: Reply with quote Print

Endremion wrote:
I think the problem is in the first sections count Confused


The count and the total are stored in a global that points to an array, each ship has a local containing the name of the global. When a ship dies the signal handler grabs the global and updates the killed count. It's confusing but the kill tracking works correctly.

The hand off of leadership and orders isn't working OOS and I'm not getting the data about the killer like I should.

In this trace the first group loses it's Centaur right off the bat and doesn't transfer leadership to a new ship, so they idle and get massacred.

Code:

(320659) START SECTOR (Unknown Sector)
(320659) ALPHA = ARRAY ( Kha'ak Centaur, Kha'ak Nova, Kha'ak Nova, Kha'ak Nova, Kha'ak Nova, Kha'ak Nova, Kha'ak Nova, Kha'ak Nova, ... )
(320659) BETA = ARRAY ( Xenon Centaur, Xenon Nova Vanguard, Xenon Nova Vanguard, Xenon Nova Vanguard, Xenon Nova Vanguard, Xenon Nova Vanguard, Xenon Nova Vanguard, Xenon Nova Vanguard, ... )
(320755) (Xenon Centaur) killed by (null) ( ??AA-00)
(320755) 1/10 killed
(320761) (Xenon Nova Vanguard) killed by (null) ( ??AA-00)
(320761) 2/10 killed
(320786) (Kha'ak Centaur) killed by (null) ( ??AA-00)
(320786) 1/10 killed
(320792) (Xenon Nova Vanguard) killed by (null) ( ??AA-00)
(320792) 3/10 killed
(320824) (Xenon Nova Vanguard) killed by (null) ( ??AA-00)
(320824) 4/10 killed
(320826) (Xenon Nova Vanguard) killed by (null) ( ??AA-00)
(320826) 5/10 killed
(320884) (Xenon Nova Vanguard) killed by (null) ( ??AA-00)
(320884) 6/10 killed
(320914) (Xenon Nova Vanguard) killed by (null) ( ??AA-00)
(320914) 7/10 killed
(320977) (Xenon Nova Vanguard) killed by (null) ( ??AA-00)
(320977) 8/10 killed
(321001) (Xenon Nova Vanguard) killed by (null) ( ??AA-00)
(321001) 9/10 killed
(321019) (Xenon Nova Vanguard) killed by (null) ( ??AA-00)
(321019) 10/10 killed
(321019) END
(321019) h_1 fight took (360) seconds
(321019) h_2 Alpha lost (1) ships
(321019) h_3 Beta lost (10) ships


I'm also very confused by what's going on with signal_killed OOS Sad


_________________
*** modified ***

Back to top
View user's profile Send private message
Red Spot





Joined: 04 Feb 2005
Posts: 3224 on topic
Location: The Netherlands
Thank you for registering your game
PostPosted: Tue, 8. May 07, 00:33    Post subject: Reply with quote Print

havent had to good a look at your scripts ..
though there is at least 1 suggestion I could make from what I did read ..

dont give the new-leader a command like your doing right now
the way the vanilla signal_killed works is that it is entirelly based on NPC-ships, meaning its very tempermental on playerowned ships and custom-commands (better said; it probably wont work!)

imo the "most secure and least problematic" method of starting a script/command on an object (ship/station/....) is by using the command
"<var/object> start task <var/number> with script <some script> prio <var/number> ............."

the "start command" command only works on vanilla commands and the "START script .." command has shown me some unexplainable behaviour so I'd try not to use it on ships (its not like its the plague, but .. er .. beter save than sorry ..Wink)



G


_________________
Last edited by Red Spot on Sat, 2. Jul 05, 20:05; edited 34 times in total
Back to top
View user's profile Send private message Visit poster's website
xTemon





Joined: 09 Jan 2007
Posts: 774 on topic
Location: The other side of nowhere
Thank you for registering your game
PostPosted: Tue, 8. May 07, 01:00    Post subject: Re: Need help with wingmen/leaders and OOS combat script Reply with quote Print

Quote:
Here's what I'm doing:

Code:

096   $count =  size of array $pendingships
097   $spawnedShips =  array alloc: size=$count
098   $i = 0
099   while $i < $count
100    $type = $pendingships[$i]
101 @  $ship = [THIS] -> call script "aa.h.combatsimulator.spawnship" :  What kind of ship do you want?=$type  Owner Race=$groupowner  target sector=$sector  x=$x  y=$y  z=$z
102    $ship -> set local variable: name='h_grpPtr' value=$groupGlobal
103    if ( $groupLeader == null )
104     $groupLeader = $ship
105    else
106 @   START $ship -> call script "!ship.cmd.attacksame.std" :  the target=$groupLeader  stop if leader is docked=null
107    end
108    $spawnedShips[$i] = $ship
109    inc $i =
110   end


First part, (missed that Rolling Eyes ), seems fine and I'm assuming it doesn't return there after moving on.

Quote:
here's what's called after that subroutine, it starts the two leaders with a command to kill each other.

Code:

053   * start a fight
054 @ START $leadA -> call script "aa.h.combatsimulator.attack" :  the victim=$leadB
055 @ START $leadB -> call script "aa.h.combatsimulator.attack" :  the victim=$leadA
056   
057   while [TRUE]
058 @  = wait randomly from 300 to 900 ms
059    $killed = $grpPtrA[0]
060    $count = $grpPtrA[1]
061    skip if $killed != $count
062     break
063    $killed = $grpPtrB[0]
064    $count = $grpPtrB[1]
065    skip if $killed != $count
066     break
067   end


I was thinking that the script's were logging the count and ending up with
Code:
skip if $killed != $count= 1
It might be a good idea to shift from 300 - 900 ms to 100-200 ms; I realize that it's only 3/10th's of a second to 9/10th's of a second, but it might make a difference.

Quote:
where aa.h.combatsimulator.attack contains this:

Code:

001   [THIS] -> start task 1 with script "!turret.killenemies.adv" and prio 0: arg1=1 arg2=null arg3=null arg4=null arg5=null
002   [THIS] -> start task 2 with script "!turret.killenemies.adv" and prio 0: arg1=2 arg2=null arg3=null arg4=null arg5=null
003   [THIS] -> start task 3 with script "!turret.killenemies.adv" and prio 0: arg1=3 arg2=null arg3=null arg4=null arg5=null
004   [THIS] -> start task 4 with script "!turret.killenemies.adv" and prio 0: arg1=4 arg2=null arg3=null arg4=null arg5=null
005   [THIS] -> start task 5 with script "!turret.killenemies.adv" and prio 0: arg1=5 arg2=null arg3=null arg4=null arg5=null
006   [THIS] -> start task 6 with script "!turret.killenemies.adv" and prio 0: arg1=6 arg2=null arg3=null arg4=null arg5=null
007 @ = [THIS] -> call script "!ship.cmd.attack.pl" :  victim=$vicitim
008 @ = [THIS] -> call script "!ship.cmd.killenemies.std" :
009   return null


Look's okay!

Quote:
aa.h.combatsimulator.spawnship does this:

Code:

gosub genRandomPosition
002   
003   $asdf =  create ship: type=$type owner=$ownerRace addto=$sector x=$x y=$y z=$z
004   *$asdf -> set race logic control enabled to [FALSE]
005   $asdf -> add default items to ship
006   $asdf -> connect ship command/signal SIGNAL_KILLED to script "aa.h.combatsimulator.killed" with prio 10000
007   return $asdf


I've tried with race logic on and off, it seems to make no difference.


I've heard that race logic is required for out of sector battles, but I'm not sure that it would make a difference here.

Quote:
Here's my custom signal_killed:

Code:

001   * we blew up, increment killed count for our group
002   $grpStateVar = [THIS] -> get local variable: name='h_grpPtr'
003   $grpStateAry = get global variable: name=$grpStateVar
004   $count = $grpStateAry[1]
005   $killed = $grpStateAry[0]
006   inc $killed =
007   $grpStateAry[0] = $killed
008   
009   $playtime = playing time
010   $kID = $killer -> get ID code
011   $msg = sprintf: fmt='%s killed by %s(%s)', [THIS], $killer, $kID, null, null
012   write to log file #9876  append=[TRUE]  printf: fmt='(%s) %s %s/%s', $playtime, $msg, $killed, $count, null
013   
014   * if we have followers, select a new leader
015   if [THIS] -> has formation ships
016    $newleader = [THIS] -> select new formation leader by: ship class=[TRUE] strength=[TRUE] min.speed=[TRUE]
017    [THIS] -> give formation leadership to $newleader
018   
019    START $newleader -> command $cmd : arg1=$cmdtarget, arg2=$cmdtarget2, arg3=$cmdpar1, arg4=$cmdpar2
020    if $killer -> exists
021     skip if not [THIS] -> is $killer a enemy
022      $newleader -> set relation against $killer to Foe
023     $attacker = [THIS] -> get attacker
024     if $attacker == $killer
025      $newleader -> send signal SIGNAL_ATTACKED : arg1=$killer, arg2=null, arg3=null, arg4=null
026     end
027    end
028   end
029   return null


It occur's to me that restarting the battle before logging it might be a good idea. null line 008 might help-at least that's what they tell you on the german forum Smile

Quote:
To clarify, everything (logging, spawning, initial combat) works like a charm, only the switching of group leadership and continuing to fight is broken - and only OOS.



Look's interesting..

What happens if two ship's get taken out at the same time by different attackers-or the same attacker?

I think the problem is modt likely in the signal_killed section given the following:

Quote:

Code:
(320659) START SECTOR (Unknown Sector)
(320659) ALPHA = ARRAY ( Kha'ak Centaur, Kha'ak Nova, Kha'ak Nova, Kha'ak Nova, Kha'ak Nova, Kha'ak Nova, Kha'ak Nova, Kha'ak Nova, ... )
(320659) BETA = ARRAY ( Xenon Centaur, Xenon Nova Vanguard, Xenon Nova Vanguard, Xenon Nova Vanguard, Xenon Nova Vanguard, Xenon Nova Vanguard, Xenon Nova Vanguard, Xenon Nova Vanguard, ... )
(320755) (Xenon Centaur) killed by (null) ( ??AA-00)
(320755) 1/10 killed
(320761) (Xenon Nova Vanguard) killed by (null) ( ??AA-00)
(320761) 2/10 killed
(320786) (Kha'ak Centaur) killed by (null) ( ??AA-00)
(320786) 1/10 killed
(320792) (Xenon Nova Vanguard) killed by (null) ( ??AA-00)
(320792) 3/10 killed
(320824) (Xenon Nova Vanguard) killed by (null) ( ??AA-00)
(320824) 4/10 killed
(320826) (Xenon Nova Vanguard) killed by (null) ( ??AA-00)
(320826) 5/10 killed
(320884) (Xenon Nova Vanguard) killed by (null) ( ??AA-00)
(320884) 6/10 killed
(320914) (Xenon Nova Vanguard) killed by (null) ( ??AA-00)
(320914) 7/10 killed
(320977) (Xenon Nova Vanguard) killed by (null) ( ??AA-00)
(320977) 8/10 killed
(321001) (Xenon Nova Vanguard) killed by (null) ( ??AA-00)
(321001) 9/10 killed
(321019) (Xenon Nova Vanguard) killed by (null) ( ??AA-00)
(321019) 10/10 killed
(321019) END
(321019) h_1 fight took (360) seconds
(321019) h_2 Alpha lost (1) ships
(321019) h_3 Beta lost (10) ships



It's actually quite difficult to tell exactly who the leader was Confused I'm assuming the Centaur-actually makes me think that, if you go back to the strength section for determining a new leader, it might just be that all the options are identical..

Not really much of a scripter myself, for obvious reasons I suppose Thinking

Good Luck!!

Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
halo112358





Joined: 16 Feb 2006
Posts: 342 on topic
Location: Berkeley, CA, USA
Thank you for registering your game
PostPosted: Tue, 8. May 07, 02:26    Post subject: Reply with quote Print

Thanks for all the replies, I'll make the suggested changes when I get home tonight Smile

ps: the initial leader of each group was the centaur.


_________________
*** modified ***

Back to top
View user's profile Send private message
Squelch





Joined: 15 May 2004
Posts: 249 on topic

Thank you for registering your game
PostPosted: Tue, 8. May 07, 02:31    Post subject: Reply with quote Print

I just compared your custom ship killed to the vanilla script. As it is the same, but includes the debug log output, I suspect Endremion is correct in saying it should come after.

How long does [THIS] exist after being killed?

It may be purely a timing issue. In that case perhaps a new variable set should be generated in signal killed for use by log at a less critical time

Back to top
View user's profile Send private message
halo112358





Joined: 16 Feb 2006
Posts: 342 on topic
Location: Berkeley, CA, USA
Thank you for registering your game
PostPosted: Tue, 8. May 07, 04:12    Post subject: Reply with quote Print

Ok, I've figured out what's happening - now I just need to figure out a clever way to fix it.

The real problem is that in OOS combat signal_killed is reporting $killer = null - this prevents signal_killed from ever calling signal_attacked on the new lead ship with $killer as it's target. Sad

This is the boilerplate code for handling SIGNAL_KILLED (stock x3 code):

Code:

018   * if we have followers, select a new leader
019   if [THIS] -> has formation ships
020    $newleader = [THIS] -> select new formation leader by: ship class=[TRUE] strength=[TRUE] min.speed=[TRUE]
021    [THIS] -> give formation leadership to $newleader
022   
023    START $newleader -> command $cmd : arg1=$cmdtarget, arg2=$cmdtarget2, arg3=$cmdpar1, arg4=$cmdpar2
024    write to log file #9876  append=[TRUE]  printf: fmt='(%s) newleader=(%s) cmd=(%s) targ1=(%s) param1=(%s)', $playtime, $newleader, $cmd, $cmdtarget, $cmdpar1
025    write to log file #9876  append=[TRUE]  printf: fmt='(%s) cmdtarg2=(%s) cmdparam2=(%s)', $playtime, $cmdtarget2, $cmdpar2, null, null
026    if $killer -> exists
027     skip if not [THIS] -> is $killer a enemy
028      $newleader -> set relation against $killer to Foe
029     $attacker = [THIS] -> get attacker
030     if $attacker == $killer
031      $newleader -> send signal SIGNAL_ATTACKED : arg1=$killer, arg2=null, arg3=null, arg4=null
032     end
033    end
034   end


If $killer == null then lines 026->033 are never executed and the new leader stops fighting and goes inactive.

edit2:

I've made the scripts more verbose by adding a custom SIGNAL_ATTACKED handler and logging the calling parameters. This signal works correctly both IS and OOS, SIGNAL_KILLED however does not Sad

I'm wondering now if this problem affects the default SIGNAL_KILLED script, I think that it does and that OOS combat is actually bugged in stock X3.

I only have one thing left to add: Sad Sad Sad

edit3: I've updated the combatsim.zip file that's hosted on google pages, the log output clearly shows that $killer is always null in OOS. This indicates to me that SIGNAL_KILLED is broken in some way.

http://halo112358.googlepages.com/combatsim.zip


_________________
*** modified ***

Back to top
View user's profile Send private message
B-O'F





Joined: 21 Feb 2004
Posts: 719 on topic

Thank you for registering your game
PostPosted: Tue, 8. May 07, 10:52    Post subject: Reply with quote Print

Hi halo112358,

I remember a problem with $killer not being used correctly in a stock script being discussed a long time ago - another variable was used instead. Whether this pertains to your problem, I am not sure.. I will try and find it and let you know the result later, but I have to go out now.

Boron - Ol Fh'art

[EDIT]
I found my text copy of this thread, but no pointer. It was "minor bug in signal captured " by Red Spot started Sat Jan 21, 2006, with posts from djssuk, moggy2, and Cycrow.. Extra search should be able to find it.

The really interesting bit is:-

Red Spot
Posted: Sat Jan 21, 2006 7:04 pm
naaa .. it is supposed to work like the signal.killed..

leader dies -> wingmen get leader command and signal.attacked gets triggered to attack the killer (in this case capturer)

but in this code the 'killer' argument from the signal.killed script is changed to 'privateer' .. but the actual variables using it not ..

so the new-leader never gets ordered to attack the capturer (being the player)
(the above code is just a part of the whole script)
G

[/EDIT}


_________________
Public Service announcement

Growing old is not a disease - it is a delayed symptom of birth trauma.
Back to top
View user's profile Send private message
jlehtone
Moderator
Moderator

MEDALMEDALMEDAL

Joined: 23 Apr 2005
Posts: 14590 on topic
Location: GalNet BBS
Thank you for registering your game
PostPosted: Tue, 8. May 07, 11:12    Post subject: Reply with quote Print

halo112358 wrote:
If $killer == null then lines 026->033 are never executed and the new leader stops fighting and goes inactive.

Wait, when the leader dies and a new lead is selected from the formation, does the new lead not start running the command that the previous leader did, and rest of formation replaces "old_lead" with "new_lead" in their escort commands?

And what line of boilerplate does that? 021?

What 026--033 do is retaliation of the kill. However, if the old_lead was already running "Attack All", so should the new_lead. 26--33 would just select a target for that activity, wouldn't it?


_________________
X3R 2.5 + BP 3.1.07; Goner Pancake Protector X
Insanity included at no extra charge.
There is no Box. I am the sand.
Back to top
View user's profile Send private message
halo112358





Joined: 16 Feb 2006
Posts: 342 on topic
Location: Berkeley, CA, USA
Thank you for registering your game
PostPosted: Tue, 8. May 07, 12:10    Post subject: Reply with quote Print

jlehtone wrote:
halo112358 wrote:
If $killer == null then lines 026->033 are never executed and the new leader stops fighting and goes inactive.

Wait, when the leader dies and a new lead is selected from the formation, does the new lead not start running the command that the previous leader did, and rest of formation replaces "old_lead" with "new_lead" in their escort commands?

And what line of boilerplate does that? 021?

What 026--033 do is retaliation of the kill. However, if the old_lead was already running "Attack All", so should the new_lead. 26--33 would just select a target for that activity, wouldn't it?


I'm not sure how the rest of the formation handles leadership change - I'm going to assume (and investigate tommorrow) that SIGNAL_FORMATIONLEADERCHANGED is thrown and the rest of the formation recieves a signal to now escort the new leader. If this isn't the case then the rest of the formation probably will not switch over and escort the new leader properly.

(edit: SIGNAL_FORMATIONLEADERCHANGED does nothing at all, the bound script consists of "return null")

So in response the the first question, I don't know yet and I'm a bit confused.

The second part I do know - if $killer is defined then 026-033 are executed and there is retaliation for the kill, the problem I'm seeing is that $killer is never defined for OOS combat.

Try grabbing the zip I put on googlepages and running aa.h.combatsimulator.cmd from the script editor, make sure to save first (don't pollute a save game with ships & globals Very Happy) then pick some sector that you aren't in as the target. You'll spawn 20 ships there, 2 centaur and 18 nova in two wings (10 ships per wing, one centaur and 9 escorts) that will then attempt to kill each other. You'll get a log of the combat in log09876.txt. There's a ton of debug output currently, but what you'll see is that for the SIGNAL_KILLED handler there is no proper $killer set - SIGNAL_ATTACKED however does seem to work properly and the attacker is defined.

Once you've run the command out of sector reload your save and run the command on the sector that the [PLAYERSHIP] is currently in - you'll see a fairly different behavior in the log, combat proceeds to completion and everything works as intended.

----
edit: I'm curious to know if SIGNAL_KILLED and !ship.signal.killed work properly at all, I'll inject a logging line and watch a standard game to see if there's any output that looks suspicious.

@B-O'F - I've checked !ship.signal.captured - it looks like that bug is fixed. I initially thought that I might be making that kind of mistake (calling a variable by the wrong name) but my logging script confirms that everything works as intended for IS (in sector) combat. It's OOS combat that's breaking.
----

edit2: This is moderately depressing, SIGNAL_KILLED is indeed broken for OOS combat.

try this script here - it will log all occurrences of SIGNAL_KILLED - for OOS kills $killer is _never_ defined.


_________________
*** modified ***

Back to top
View user's profile Send private message
jlehtone
Moderator
Moderator

MEDALMEDALMEDAL

Joined: 23 Apr 2005
Posts: 14590 on topic
Location: GalNet BBS
Thank you for registering your game
PostPosted: Tue, 8. May 07, 12:53    Post subject: Reply with quote Print

In sector, the stock formation leadership inheritance definitely does work. I think I've seen this occur OOS too, but not being sure, will recheck. Step one is to know for sure what ints do. When we know that we can point the finger on something. Wink

I would assume that the 26--33 part is a failback. Normal expectation is that the Leader does emit SIGNAL_ATTACKED before it dies. If it does not, it will at least emit SIGNAL_KILLED, and 26--33 in it is supposed to emit that SIGNAL_ATTACKED. Whether that works OOS is another thing.

One of the X2 bonuspack scripts (was it UT or BPH?) did report its killer, even from OOS. No idea how it did that, but overwrite of SIGNAL_KILLED handler seems logical. Has X3 broken something?

Btw, you could log the new leader in the signal-handler. Can one print the current command of it too?


_________________
X3R 2.5 + BP 3.1.07; Goner Pancake Protector X
Insanity included at no extra charge.
There is no Box. I am the sand.
Back to top
View user's profile Send private message
Cycrow
Moderator
Moderator



Joined: 15 Nov 2004
Posts: 17264 on topic
Location: Leamington Spa, England
Thank you for registering your game
PostPosted: Tue, 8. May 07, 13:02    Post subject: Reply with quote Print

i tested the killed signal and seems that killer is always null. The attacked signal returns the correct attacker OOS thou.

so if your looking for a work around, u could try having the SIGNAL ATTACK record the attack as a local varible on the ship, then when the ship is filled and $killer is null, just get this local varible that should be the last attacker.

it might not be 100% acurate, but it'll be better than not working at all


_________________
My Scripts | MY X3TC Scripts | X3 Plugin Manager | Custom Gui
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
halo112358





Joined: 16 Feb 2006
Posts: 342 on topic
Location: Berkeley, CA, USA
Thank you for registering your game
modified
PostPosted: Tue, 8. May 07, 13:59    Post subject: Reply with quote Print

Cycrow wrote:
i tested the killed signal and seems that killer is always null. The attacked signal returns the correct attacker OOS thou.

so if your looking for a work around, u could try having the SIGNAL ATTACK record the attack as a local varible on the ship, then when the ship is filled and $killer is null, just get this local varible that should be the last attacker.

it might not be 100% acurate, but it'll be better than not working at all


I noticed the same from my logging test, that's the workaround I came up with as well.

The thing that's going to be tricky is that SIGNAL_ATTACKED is only called when each attacker commences attack. It's possible for any number of attackers to fire on an attacked ship, and for any one of those to be the killer (regardless of who triggers last SIGNAL_ATTACKED). Without a reliable SIGNAL_KILLED trigger there's no way to guarantee that the last attacker is even alive.

The workaround is to store all attackers and then iterate the list and find the most recent that is still alive. Ugh.

I'll test it but I have a funny feeling that this custom handler is going to resolve OOS combat in a very different way than the stock scripts do. This means that my entire objective (running OOS combat simulations to ensure that ship balance changes aren't unbalancing OOS) is hosed.

Oh well.

If anyone has contact with the dev team can you pass this along? At this point I believe that there is a bug in handling SIGNAL_KILLED ($killer should always be set, and OOS it never is).

And one more thing - thanks a lot to everyone who offered advice, I really appreciate it.


_________________
*** modified ***



Last edited by halo112358 on Tue, 8. May 07, 14:14; edited 1 time in total
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic Reply to topic Goto page 1, 2, 3  Next
 
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
Control Panel
Login Data
The time now is Thu, 2. Sep 10, 21:24

All times are GMT + 2 Hours


Board Security

Copyright © EGOSOFT 1989-2009
Powered by phpBB © 2001, 2005 phpBB Group
Message Board Statistics Template created by Avatar & BurnIt!
Debug: page generation = 0.28433 seconds, sql queries = 70