Scripts / [SOLVED] AI spawn again after death. Is it possible.

Author
Message
PCS
7
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 17th Nov 2021 17:52
Yes , i want to know if it is possible to respawn an NPC after you have killed it.
So is it possible when the Ai is shot to death to some how play the ragdoll and then only respawn it on a different place instead of removing it from the map.
Maybe something like this... the NPc don't really die but just before it die and the health runs out then the ragdoll are played and the AI gets respawn somewhere else.
Windows 10 Pro 64-bit
Intel(R) Core(TM) i5-4590S CPU @ 3.00GHz
RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11

The author of this post has marked a post as an answer.

Go to answer
PCS
7
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 17th Nov 2021 19:04
I have a script that can follow the player and spawn entities randomly around the player as the plyer moves thru the map witch is perfect for spawning small pick able rocks and other entities. it works perfectly. So i have copied that script and insert it in to the AI_soldier , witch now spawn soldiers randomly around the player ,and it does not matter were the player goes, That is why i would like to respawn the AI after or during death so that the AI can be used again and again, that means i can use only a small amount of soldier on the map, but it would looks like a lot of them keeps on coming for the player.
Windows 10 Pro 64-bit
Intel(R) Core(TM) i5-4590S CPU @ 3.00GHz
RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 17th Nov 2021 19:12
yes, you need to use Spawn(e) command with the AI entity number before the engine cleans them up - you can hide them elsewhere if they're not ready to be "alive" yet.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
PCS
7
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 17th Nov 2021 19:21 Edited at: 18th Nov 2021 10:50
The Spawn(e) command , were do i need to insert it in the ai exit part?




edited ;. nevermind.
Windows 10 Pro 64-bit
Intel(R) Core(TM) i5-4590S CPU @ 3.00GHz
RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 18th Nov 2021 17:04
you can call it anywhere really, depends how you are handling the respawning process - generally speaking you would likely have a control object/script that handles it
p.s. i have a respawner system that might help
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
PCS
7
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 18th Nov 2021 17:24
This post has been marked by the post author as the answer.
@smallg, thank you . I have looked at your respawner script it works very nicely.
I have joined it with the random follow spawn script that i got from my son. now the Ai will keep on following the player and respawn also on a random area around the player after the have died.
Windows 10 Pro 64-bit
Intel(R) Core(TM) i5-4590S CPU @ 3.00GHz
RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11

Login to post a reply

Server time is: 2024-05-02 06:48:09
Your offset time is: 2024-05-02 06:48:09