Scripts / Win by enemy defeat

Author
Message
Corvus
9
Years of Service
User Offline
Joined: 27th Jul 2015
Location:
Posted: 4th Aug 2015 07:52
How do you script it so the player wins by defeating a specific enemy?
Pirate Myke
Forum Support
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 4th Aug 2015 07:58
Moving this to the script section where it will get the attention it needs.

Please post in the appropriate sections.
Thank you.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit

SoUlFaThEr
9
Years of Service
User Offline
Joined: 20th Jul 2015
Location:
Posted: 4th Aug 2015 21:26
You want the game to end immediately upon killing that enemy?
The only stupid questions are those that were never asked.
PM
Bobby-Z
User Banned
Posted: 11th Aug 2015 23:22
I been tryna figure the same thing out aswell , I haven't figured that out yet but I did figure out something similar that might be of use , if you go to enemys entity properties , and where it says "if used" , add the value end_game_activator or what ever you want(note name isn't important , just remember what name you do use) , then add an item (to test I just used yellow coin , but you can use what ever you want as item) , in the items entity properties , change the name to match what you picked , so I used end_game_activator , so that's what I change name to , then for script , change the script to winitem.lua and change spawn at start ? to say No , this will make it so , player has to kill enemy , to spawn item , then collect item to win game then of course if you have new level to load at end game in the items entity window you would also add the name of level as the value for "if used" , anyways for the record not tryna say imma pro or nothing just figured something out while experimenting , and wanted to share incase it helps someone
Avram
GameGuru TGC Backer
18
Years of Service
User Offline
Joined: 3rd Sep 2006
Location: Serbia
Posted: 12th Aug 2015 01:01
Modify that particular enemy script so it has call to FinishLevel() within entity_exit() function (example: ai_soldier.lua):



Take a look on my tutorial to see how to create your own script to utilize this without copying and modifying ai_soldier.lua

Login to post a reply

Server time is: 2024-12-22 04:58:51
Your offset time is: 2024-12-22 04:58:51