resurectable SOLVED


(mazdaplz) #1

ive been searching and i found some stuff that did not work in my script, ive been tryin some more alternatives but with no luck. maybe you can give me some insight since i found the solution that they use for tanks wont work for some reason.

i need to bring back a script_mover from death, it’s along a splinepath.
i gave it a globalaccum 0 of 0, and a globalaccum 1 of 0. in death(script) first 0 becomes 1 and second accum is set to 1.
at the first stop of the splinepath 2 triggers are executed:

  1. a simple trigger that lowers accum 0 unless it’s 0.
    2 a simple trigger that checks if accum is 0 is 0 and if globalaccum 1 is 1, then it triggers a “resurrect” script on the mover.

mover
{
spawn
{
wait 20
followspline 0 spl_01 50000 length 32 wait
trigger self splinepath
globalaccum 0 set 0
globalaccum 1 set 0
}
death
{
wm_announce “mover is dead!”
setstate mover invisible
globalaccum 0 set 1
globalaccum 1 set 1
}
rebirth
{
setstate mover default // “we are visible again”
}
trigger splinepath
{
trigger mumbo jumbo //trigger that lowers accum0
trigger mumbo2 jumbo2 //triggr tht lowrs ac1 n’ triggrs resrct
followspline 0 spl_01 390 wait length 374
followspline 0 spl_02 390 wait length 374
followspline 0 spl_03 390 wait length 374
followspline 0 spl_04 390 wait length 374
trigger self splinepath //restart spline
}
trigger resurrect
{
alertentity mover // “we are alive again”
}

//////////////////////////////////////////////////////////////////////

mumbo //for time of mover’s malfunction (target_script_trigger)
{
trigger jumbo
{
globalaccum 0 abort_if_equal 0
globalaccum 0 inc -1
}
}

mumbo2 //check if new mover is ready (another target_s_t)
{
trigger jumbo2
{
globalaccum 0 abort_if_not_equal 0
globalaccum 1 abort_if_not_equal 1
trigger mover resurrect // “come back to life!”
globalaccum 1 set 0 //reset to functional mover
}
}
//////////////////////////////////////////////////////////////////////

if you feel it’s weird that i use 2 globalaccums it’s because i need the mover to be dead a couple of rounds and then pop back in at the first position. that could theoreticaly be done by settin accum 0 to 3 in death and giving it 3 rounds to lower.

well anyway this doesnt work. if anyone knows why i’d be so grateful!
thx

BTW im using globals for several reasons so i wouldnt be too happy to get rid of them, oh and i have the resurectable flag checked too, obviously.


(mazdaplz) #2

now that i think of it i could get rid of the second accum and maybe add a little wait, because there might just be a misunderstanding there. hmmm
i will try this and see where i can go


(mazdaplz) #3

ok, so it works fine now but the mover never goes invisible in death?

when it dies it’s still there. anyone?


(murka) #4

shure the script_mover has a targetname of mover?


(C) #5

I tried this out:

A script_mover with: solid=checked and health=1 will act like this:

  • When damaged the death-event code will be executed, and the script_mover seems to disappear from the map.
    Not even the pain event-code will be executed…

The same script_mover with: resurectable=checked and some event-handlers… :


script_mover_scriptname
{
	// ... code

	rebirth
	{
		wm_announce "event rebirth"
	}
	death
	{
		wm_announce "event death"
		alertentity script_mover_scriptname
	}
}

…will act like this:

  • When damaged the death-event code will be executed, which in turn triggers the rebirth-event. The script_mover will die and immediately will live again. The script_mover will be alive and visible, but has no health anymore… it cannot be damaged anymore, nor die.
  • If the script_mover was following a path when it got damaged, it just keeps on going, like it was never dead and got reborn (Your case).

I don’t know if it is possible to restore health for the script_mover with etpro-script (at the desired moment)…i haven’t tested this.

If You would use a func_constructible (like a tank), Your script_mover would need a team to repair it when it has died… and only 1 team can damage the script_mover. This may be no valid option for You…


As for Your script… i am missing a } to close the mover-scriptblok. :slight_smile:

In the mover spawn-event, You set the globalaccums after You trigger a routine that uses these globalaccums… lucky for You that these values are both 0 allready.

When i look at Your script, i beleive You put in the 2 target_script_triggers so You could use a func_timer sometime lateron… otherwise i don’t see any need for these target_script_triggers.
Your resurrect routine only gets called every full spline-route now.
In Your case, i would script it like this:

// accum 0: dead=0, alive=1
mover
{
	spawn
	{
		wait 50
		accum 0 set 1
		followspline 0 spl_01 50000 length 32 wait 
		trigger self splinepath
	}
	death
	{
		accum 0 set 0
	}
	rebirth
	{
		accum 0 set 1
	}
	trigger splinepath
	{
		trigger self resurect
		followspline 0 spl_01 390 wait length 374 
		followspline 0 spl_02 390 wait length 374 
		followspline 0 spl_03 390 wait length 374 
		followspline 0 spl_04 390 wait length 374 
		trigger self splinepath
	}
	trigger resurect
	{
		accum 0 abort_if_equal 1
		alertentity mover
//		followspline 0 spl_01 50000 length 32 wait 
	}
}

(mazdaplz) #6

oh yea i missed it when i put the code in here :stuck_out_tongue: stupid brackets lol

anyway you were right about the mover being on a spline. i discovered that by adding a setposition moverx (some mover hidden inside a hollow piece of land) to the “death” trig i could reset my mover to the first splinepoint. then by adding “wait 1” i could effectively make it die inside the spline!!! but the alertentity had to be inside the death script also? (misteriously) and i had to manually time the thing so it was later reset. but i was going to have problems because the mover had to be in zinc with some effects, i needed the “inactive” period for the mover to be variable not constant. now im thinking i could use a func_timer to continuously check if the thing was dead to do something about that spline in real time. or maybe it would just be better to have a lot of hidden movers, and just bring them up as they die? i dont plan to have them infinitely by any means, in fact i was going to use an accum to make it stop at one time or another.

im hesitant to do it the func_timer way because that would mean to re-time everything. and im ironically looking for what seems to be a small change in the script, i used to code so i can remember some of the logic involved in it, and i just cant believe scripting is so unforgiving


(mazdaplz) #7

today… I DID IT.

a resurectable script_mover that can die at any point in a splinepath without writing a “check” script or recurring to func_timers.
in fact my entity count is low, i only have 4 splinepaths and the mover can be killed at any point.

i had to rely on very unorthodox scripting like putting wait 1 for no reason on some places and using the targetname to trigger stuff, because using trigger self was violently closing wolfenstein; among other things. i have no idea if my script is reliable but im 89% sure.

as for the map. well i had to use a spacebar a few times heh