Hey guys,
I was taking a swing at modding the countdown mod Elgan made, and I wanted to add the feature where if a player picks up the radio he will not be able to die for 10 seconds.
I was successful in adding the timer after picking up the radio with "local.player stopwatch 10", but was unable to make the player un-killable.
The efforts I made to try and add this were based off of looking at scripts from other game types such as base-builder or Liberation, where in one case there was a thread that used "self immune" and the other did "local.player dog"
Both did not work for me in Countdown, however due to my lack of experience I may have placed them in the wrong area.
Here is what I had been working on.
Thanks
Code:// 22/11/2005 18:07 added in radio drop features main local.origin: spawn level.radio_model "targetname" "countdown_radio" "classname" "scriptmodel" //local.radio model "items/explosive.tik" //"items/walkietalkie.tik" local.radio = $countdown_radio local.radio notsolid local.radio hide if(local.origin[2] == "hog") { local.radio.origin = local.origin[1] //check if the radio is toching any of the players and wait until it is not to show it. while(1) { wait 1 // if the players are touching it then local.i wont == player size for(local.i=1;local.i <= $player.size ;local.i++ ) { if(local.radio istouching $player[local.i]) { break } } if(local.i == ($player.size + 1)) { break } } } else { local.radio.origin = local.origin } local.radio show local.radio solid local.radio.angles = ( 0 0 0 ) local.radio droptofloor local.radio light 1 0 0 50 local.hit_box = spawn trigger_multiple "spawnflags" 128 "targetname" "radio_box" local.hit_box setsize ( -20 -20 -20 ) ( 20 20 20 ) local.hit_box setthread shot local.hit_box.origin = local.radio.origin local.use_box = spawn trigger_use "targetname" "radio_use" local.use_box setsize ( -35 -35 -35 ) ( 35 35 35 ) local.use_box setthread use local.use_box.origin = local.radio.origin local.radio.use = local.use_box local.radio.shot = local.hit_box local.use_box glue local.radio local.hit_box glue local.radio local.max_idle = getcvar "countdown_idle" if(local.max_idle == "") { local.max_idle = 300 setcvar "countdown_idle" "300" } else { local.max_idle = int local.max_idle } if(local.max_idle == 0) { local.max_idle = -1 } local.idle = 0 while($countdown_radio) { wait 1 local.idle ++ if(local.idle == 60) { thread flash } if(local.idle == local.max_idle && ($countdown_radio)) { $countdown_radio.shot delete $countdown_radio.use delete $countdown_radio delete waitframe local.origin = waitexec HTR/setup.scr::getorigin exec HTR/radio.scr local.origin end } } end flash: local.state =1 while($countdown_radio) { wait 1 if($countdown_radio != NIL && $countdown_radio != NULL) { if(local.state ==1) { local.state = 0 $countdown_radio light 1 1 0 200 } else { local.state = 1 $countdown_radio light 1 0 1 200 } } } end shot: local.player = parm.other $countdown_radio physics_on $countdown_radio.velocity = ( 0 0 150 ) + local.player.forwardvector * 500 end use: local.player = parm.other if(local.player.using_pack == 1) { local.player iprint "You may not use the radio and jetpack" 1 end } if(level.last_had_radio == local.player) { local.player iprint "You may not pick up the radio next" 1 end } //clear the last player who had it. local.last_had_radio = NIL //remove this line, not sure why it's here //local.player.target = local.player local.team = local.player.dmteam local.team = waitexec global/strings.scr::to_upper local.team 0 iprintlnbold (local.team + " have the radio!") $countdown_radio.shot delete $countdown_radio.use delete $countdown_radio delete thread give_radio local.player end // give radio to the player give_radio local.player: local.player playsound m3l2_radio_pickup local.player attachmodel level.radio_model "Bip01 Pelvis" 0.8 "pelvis_radio" 1 -1 -1 -1 -1 ( 1.5 -4 -10.0 ) $pelvis_radio.angles = ( 0 90 90 ) local.player stopwatch 10 local.light = getcvar "countdown_light" if(local.light != "0") { local.player light 0 0 1 200 } local.player exec HTR/player_radio.scr end