OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: Malm on 24 Feb 2005, 16:49:48

Title: Weird List trigger problem
Post by: Malm on 24 Feb 2005, 16:49:48
I got a problem that keeps nagging me. I had created one very small test scenario with one blue player and one opposing red AI. This AI is within the range of the trigger SECTION_C (Red, Activation Once).

For my little test scenario I had also created two setradiomsg's :  "SAVE" and "TEST"
Save uses LIST to save the array of objects within SECTION_C into zSectorCUnits.
Test just globalchat the variable zSectorCUnits.

I begin my little test scenario by doing a radio "SAVE". The globalchat informs me "[East Alpha Black:1] 1"

Then I kill East Alpha Black:1 and uses the radio "TEST" to verify zSectorCUnits. Since I did not uses "SAVE" after I killed him I expect the globalchat to reply "[East Alpha Black:1] 1" but instead it replies with  "[]" 0 ??

How can zSectorCUnits be changed without doing a LIST?


Init.sqs

zSectorCUnits = []

1 SETRADIOMSG "SAVE"
2 SETRADIOMSG "TEST"

EXIT

Save.sqs

HINT "Saving Sector C"
zSectorCUnits = LIST SECTOR_C;
PLAYER GLOBALCHAT FORMAT["%1 %2", zSectorCUnits, COUNT zSectorCUnits];

EXIT

Test.sqs

PLAYER GLOBALCHAT FORMAT["%1 %2", zSectorCUnits, COUNT zSectorCUnits];

EXIT


My goal is to use LIST to save a list of objects within SECTOR_C.  When all blue forces are out of the range of SECTOR_C another trigger "clearsector" are activated. Killed.sqs just does a DeleteVehicle.

ClearSector.sqs

? COUNT zSectorCUnits == 0 : GOTO "SectorEmpty"

HINT "Cleanup"

"IF (NOT ALIVE _x) THEN {[_x] exec ""killed.sqs""}" FOREACH zSectorCUnits

#SectorEmpty
EXIT

I have seen many scripts that perform something likewise but all of them uses ~# to determine some kind of delay before deleting the objects. However I want to use triggers to determine when the objects should be deleted.

Best regards
Malm
Title: Re:Weird List trigger problem
Post by: Malm on 26 Feb 2005, 16:43:48
Ok I admit that this question was not well formulated. I try to make it more simple.

_arrayEast = LIST EAST_TRIGGER

player globalchat format["%1", _arrayEast];
; this print [East Alpha Black:1] on my screen

~30
; within 30 seconds I kill all east units within radius of EAST_TRIGGER

player globalchat format["%1", _arrayEast];
;this print [] om my screen!!

What have happend to [East Alpha Black:1] ?


Any help would be highly appriciated

Title: Re:Weird List trigger problem
Post by: Planck on 26 Feb 2005, 17:02:44
I have a slight feeling that if you make a copy of an array, like a trigger list, when the array changes, so also does the copy.

So, when you kill the east soldier, he is no longer listed in the original array and is also no longer listed in the copy you so carefully made.

If you try something like:

_arrayEast = + EAST_TRIGGER

I think this makes a separate copy of the array which will not be affected by changes in the original array......I think   ::)

Try it out anyway.


Planck