Scripts / Destroy a large number of entityies from trigger zone?

Author
Message
rolfy
17
Years of Service
User Offline
Joined: 23rd Jun 2006
Location:
Posted: 30th Jul 2014 20:07 Edited at: 30th Jul 2014 20:09
I want to destroy a large number of entities from trigger, I can destroy any single object using it's number so far but lost as to how I would go about doing it wholesale.

A funny thing happened on the way to the forum...
rolfy
17
Years of Service
User Offline
Joined: 23rd Jun 2006
Location:
Posted: 30th Jul 2014 20:11 Edited at: 30th Jul 2014 21:27
For some weird reason the code snippet misses some part of the destroy command, will try again.





A funny thing happened on the way to the forum...
unfamillia
Forum Support
13
Years of Service
User Offline
Joined: 26th Jul 2010
Location: Preston, Lancashire
Posted: 30th Jul 2014 21:30
Can you not name all of the items the same and put that name in the ifused field of the trigger zone?

smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 30th Jul 2014 21:34 Edited at: 30th Jul 2014 21:36
easiest way to do it is to place the zone first and then place all the objects to be destroyed (this way you can get all the numbers much easier)



now you can use







and change the e+5 part to however many entities you have to be destroyed.

basically just need a for loop to cycle through the numbers of the entities to be destroyed

edit: nope, the ifused field is for spawning entities - might get more options later but i believe that is the only thing it does right now?

life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
rolfy
17
Years of Service
User Offline
Joined: 23rd Jun 2006
Location:
Posted: 30th Jul 2014 22:13 Edited at: 30th Jul 2014 22:38
Would have thought that 'ifused' worked with 'activateifused' and 'activated' in scripts for any purpose.



All the same placing objects after the trigger zone is not an option for me at this point as it is a fully built level I don't want to build again. Nor would naming all entities the same as there are so many and selecting some of these is difficult in fact some are impossible.



I could easily get the last (e) number placed up to the point I want destroyed as I haven't yet built the area I want intact/spawned. Would the for loop still work if zone is placed last rather than first? Or is it counting upward from the zone itself?



Thanks for the help.

A funny thing happened on the way to the forum...
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 30th Jul 2014 23:03
well i only had a quick look at it so maybe i just missed it but it seems like by default it is used to spawn entities
im not sure how you would go about making it do anything else as the field (ifused) is for the name of the entity(s) to affect - i have no idea about these fields as i never used fpsc so you would know more than me

yes in my code i started at the zone number + 1 (but this is merely for convenience)
i'm not 100% sure i'm following your last part but are u saying you want to remove everything before this last e number?
anyway you can simply replace the e+1, e+5 parts with the number range you want destroyed (so long as what you want removed is in sequence it'll work fine)

life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
rolfy
17
Years of Service
User Offline
Joined: 23rd Jun 2006
Location:
Posted: 30th Jul 2014 23:44 Edited at: 31st Jul 2014 00:22
Quote: "you can simply replace the e+1, e+5 parts with the number range you want destroyed (so long as what you want removed is in sequence it'll work fine)"
Yes I want t destroy all entities up to the trigger zone, sounds like this might do the trick



Will give it a try after finishing my gardening chores.



'Activateifused=x' should trigger the named entity in the ifused field to run whichever part of its script is prompted by 'activated=x', if that makes any sense.



In Classic .fpi you could have many differently activated numbers depending on conditions,'activateifused =1, =2, =3' etc to prompt different actions in the named entity script 'activated =1, =2, =3'....



activated =x could be whatever action you wanted.



For example:

within trigger entity script

plrdistancewithin=100:activateifused=1

plrdistancefurther=100:activateifused=2



within ifused entity script

activated =1:spawn

activated =2:destroy



I don't know how this would work in Lua but pretty sure you would have several ideas to try out



I have no way at this time of telling if this how the ifused field is working but the theory is that this is how it should work.

A funny thing happened on the way to the forum...
rolfy
17
Years of Service
User Offline
Joined: 23rd Jun 2006
Location:
Posted: 31st Jul 2014 17:10 Edited at: 31st Jul 2014 17:11
Thanks for the help smallg, got it working using negative values so all entities placed before the zone are destroyed, this works perfectly for me

A funny thing happened on the way to the forum...

Login to post a reply

Server time is: 2024-05-03 06:28:50
Your offset time is: 2024-05-03 06:28:50