Page 1 of 1
ai respawn script question
Posted: Fri Mar 21, 2008 2:26 am
by snakejknight
ok, so i know the ai respawn script and decided to use it in my newish mod
when i compiled it, the ai spawned perfectly... but then they kept spawnin... over and over... forever
i even use the script generator app... compiled that script and the same problem occurred
why is this happening?
Code: Select all
(sleep_until (<= (ai_living_count S_E_P) 5) 5)
(ai_place S_E_P)
Posted: Fri Mar 21, 2008 3:55 am
by neodos
What script type are you using?
Continuous ?
Try this:
Code: Select all
(sleep_until (<= (ai_living_count S_E_P) 5) 5)
(ai_place S_E_P)
(sleep_forever)
Posted: Fri Mar 21, 2008 4:20 am
by Choking Victim
neodos wrote:What script type are you using?
Continuous ?
Try this:
Code: Select all
(sleep_until (<= (ai_living_count S_E_P) 5) 5)
(ai_place S_E_P)
(sleep_forever)
couldn't you just use the startup script type?
Posted: Fri Mar 21, 2008 5:20 am
by neodos
No because his script is waiting until something happens ( sleep_until) so it needs to be continous, but the sleep forever should fix that.
Posted: Fri Mar 21, 2008 8:32 am
by snakejknight
so the sleep forever will reset the script?
howecome this is in none of the tutorials?? haha
thanks... i'm gonna try that
Posted: Fri Mar 21, 2008 8:39 am
by neodos

you want it to restart?
Well i don't know what exactly does your script as i have never worked with Ai, i guess it's waiting to count if there is 5 ai alive it will place S_E_P, yes,no?
Sleep forever will stop the script.
Posted: Fri Mar 21, 2008 11:08 am
by snakejknight
thats what i thought it would do, and it did
i've had a similar problem before with a gravity script
Code: Select all
(script continuous gravity_button
(begin
(physics_set_gravity 1)
(if(player_action_test_melee)
(physics_set_gravity 0)
(player_action_test_reset))
)
)
this script was supposed to be 0 gravity while holding "B" but all it did was set gravity to 0 and kept it at 0, what happened was my "if" statement did not contain a "then" statement within the same brackets. To fix that i changed the brackets
Code: Select all
(script continuous gravity_button
(begin
(physics_set_gravity 1)
(if(player_action_test_melee)
(physics_set_gravity 0))
(player_action_test_reset)
)
)
a sleep statement is more than likely different in that it has no if/then attitude, rather it is a command..
Code: Select all
(script continuous ai_respawner_maybe
(begin
(sleep_until (<=(ai_living_count pop)5)150) -- this has 3 opening brackets, and three closing brackets
(ai_place pop)-- separate command
)
)
i think what is happening is that the script stays dormant "Until" the ai living count is under 5, then the script activates and is read after the "sleep" void command
i'm not sure this is the case, but it is the best thing i can come up with
i think i'm going to try to use an if statement instead of a sleep untill...
sound good?