Scripts / Script needed to dynamically spawn and kill enemies

Author
Message
Duncan Peck
10
Years of Service
User Offline
Joined: 25th Apr 2014
Location:
Posted: 31st Dec 2014 15:40 Edited at: 31st Dec 2014 16:30
So I'm working on a level... the problem is I need lots of AI Characters in the level but the load becomes all too much and the frame rate drops. So I was thinking.. the ideal solution would be to have the enemies from each area in my map spawn when the player enters a trigger zone... then for remaining enemies from previous areas to be automatically killed to save processing power... is this possible and will it work? Anyone know how to script these sorts of events and share with me how it can be done? I have no experience in LUA. Thanks in advance...



Edit: Just figured out how to spawn enemy from a trigger zone... insert enemy into map, select enemy and hit properties. The set spawn at start to no. Make a trigger zone in the "If used" field put the name of the enemy in. Easy... now I can spawn one enemy per trigger zone.. how to make it spawn multiple enemies? Call all the entities you want to spawn the same name.



All I need to know now is how to kill enemies when I walk into a trigger zone and I'm sorted
PM
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 31st Dec 2014 16:30 Edited at: 31st Dec 2014 16:41
I use a script to just spawn the enemies you want using the spawn command. More than one enemy, then use it several times for each enemy. For instance you could rename the plrinzone script to a new name and add this sort of thing.





Standard to normal but with the spawn lines added this would spawn the two entites when you enter the zone.



i imagine killing your enemies would be similar just reduce their health instead.



SPECS: Q6600 CPU. Nvidia 660GTX. 8 Gig Memory. Win 7.
Duncan Peck
10
Years of Service
User Offline
Joined: 25th Apr 2014
Location:
Posted: 31st Dec 2014 16:37 Edited at: 31st Dec 2014 16:49
Thanks for replying DVader... I'm assuming if I replace "Spawn" with "Destroy(e)" where e = the name of the enemy I want to it to kill that might work... just about to test it!



It works! I called it killstage1.lua and put this code in:







My first bit of Lua scripting Thanks for the help.
PM
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 31st Dec 2014 17:07
No problem Glad to help you get started.



SPECS: Q6600 CPU. Nvidia 660GTX. 8 Gig Memory. Win 7.

Login to post a reply

Server time is: 2024-05-07 22:57:32
Your offset time is: 2024-05-07 22:57:32