Page 1 of 1

How do I script a bomb timer?

Posted: Mon Dec 16, 2002 7:39 am
by mohaa_rox
Hello. How do I script a bomb timer, and when I press the use key button, the trigger_use triggers off the bomb?

Posted: Mon Dec 16, 2002 4:45 pm
by jv_map
I assume you'd just want to use the global Mohaa script for this purpose, global/obj_dm.scr? Here's how to use it, at least, that's what I think you should do when I'm reading through that script file. Somebody else might have more detailed info.

As I think it should be, you need to create a script_model in MOHRadiant where you want your bomb to be placed. Give it a targetname of for example 'bomb'. If you want your bomb to destroy a model, target the script_model to the model that has to be destroyed. Then add a key $destroyed_model value <filename of destroyed model .tik> to the destroyable model. If you want, you may target the destroyable model to a collision mask.

Then create a small trigger_use near the bomb. Targetname it something like 'bomb_trigger'.

Finally, reselect the script_model where the bomb should be placed and add the following keys / values:
  • key / value
    $trigger_name / targetname of the trigger_use
    #exploder_set / #set value of a optional group of exploders to activate
    $explosion_fx / filename of an explosion effect to spawn
    $explosion_sound / sound alias to use for explosion
    $killarea / optionally set this to a non-solid script_object
Then put the following lines in your script's main thread:

Code: Select all

level waittill spawn

level.defusing_team = "axis"
level.planting_team = "allies"

// set the parameters for this round based match
level.dmrespawning = 0 // 1 or 0 -> 1 means respawn, 0 is roundbased
level.dmroundlimit = 5 // round time limit in minutes
level.clockside = axis // set to axis, allies, kills, or draw -> axis win when timelimit is hit

level waittill roundstart
// waittill there is at least one allied and an axis player

$bomb thread global/obj_dm.scr::bomb_thinker
// where 'bomb' is the targetname of the script_model bomb
Gee that's been a long story :roll: . Hope it works and I'm not talking crap ;).

Posted: Tue Dec 17, 2002 4:30 am
by mohaa_rox
I know the script for obj, and the map too, but I wondered if we could do the same for SP maps.

Posted: Tue Dec 17, 2002 7:26 am
by jv_map
Yes you can.

Just create a trigger_use, and set 'setthread' to something like 'bomb'.

Then create a thread 'bomb:' in your script. Something like this should work:

Code: Select all

bomb:
	$player stopwatch 5
	wait 5
	// explosion code here
end

Posted: Tue Dec 17, 2002 8:03 am
by mohaa_rox
What is the explosion code?

Posted: Tue Dec 17, 2002 11:45 am
by jv_map
Depends on what kind of explosion you want. If you're using the global/exploders.scr file, it would just be:

Code: Select all

thread global/exploders.scr::explode 1
Where '1' is the #set of the exploder group. If you don't want to use that script it's going to be a little more complicated.