shootable script_mover?


(mazdaplz) #1

how can i make a moving model that reacts to being shot?

i want to make a bullsye that acts as moving target and a script runs when it gets hit or destroyed by weapons

like in the map uje when u hit the moving duck it dies?


(C) #2
  • Create a script_mover with an origin-brush
  • Give it a scriptname and targetname “bullseye”
  • Check Solid
  • Give it a key: health with a large value: 32767
  • add a scriptblock for Your script_mover in mapscript with a pain event-handler
bullseye
{
	pain
	{
		// ouch! i'm hit..
	}
}

When the bullseye gets hit, the code in the pain event-handler will be executed… time for You to destroy the bullseye

If the script_mover runs out of health, the code of the death event-handler will be executed…(just something You would like to know)

With use of an accum it is easy to keep a record of howmany times the moving target has been hit:

bullseye
{
	spawn
	{
		wait 50
		accum 0 set 0
	}
	pain
	{
		// increase total hits
		accum 0 inc 1
	}
}

It is more difficult to process this script_mover-local accum into something usefull, like a score to display…


(mazdaplz) #3

nice one man, thanks