Pop-Up Target Help

Post your scripting questions / solutions here

Moderator: Moderators

jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Nope, there's no do { ... } while (...); in moh scripting. Only while and for.
Image
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

Actually its not that hard
smgtargets_run:

local.last = 0
while (1)
{

//choose what target will appear

local.smgpopup = ((randomint (6)) + 1)

if(local.smgpopup == local.last)
continue

local.last = local.smgpopup

switch (local.smgpopup)
{
case 1:
level.smgtarget = spawn func_crate model $smgtarget1.brushmodel origin $smgtarget1.origin
level.smgtarget health 1
break
case 2:
level.smgtarget = spawn func_crate model $smgtarget2.brushmodel origin $smgtarget2.origin
level.smgtarget health 1
break
case 3:
level.smgtarget = spawn func_crate model $smgtarget3.brushmodel origin $smgtarget3.origin
level.smgtarget health 1
break
case 4:
level.smgtarget = spawn func_crate model $smgtarget4.brushmodel origin $smgtarget4.origin
level.smgtarget health 1
break
case 5:
level.smgtarget = spawn func_crate model $smgtarget5.brushmodel origin $smgtarget5.origin
level.smgtarget health 1
break
case 6:
level.smgtarget = spawn func_crate model $smgtarget6.brushmodel origin $smgtarget6.origin
level.smgtarget health 1
break

}
level.smgtarget waittill death
wait 1
}

end
The continue forces it back to the top of the while loop
Image
SniperWolf
Colour Sergeant
Posts: 89
Joined: Sat Dec 18, 2004 5:14 am
Location: New York, USA
Contact:

Post by SniperWolf »

Thanks bdbodger. It works great! Now to do some research on the drawhud for a Obstacle Course Timer & info on respawning a func_crate.
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

respawn

Post by tltrude »

Here is how I made creates that explode and then respawn.

Code: Select all

	level waittill prespawn

	thread boomcrate ( -680 -3160 38 ) (0 0 90) // origin and angles 
	thread boomcrate ( -144 -3160 0 ) (0 90 0) // origin and angles
	thread boomcrate ( 480 -3160 23 ) (90 0 0) // origin and angles  

	level waittill spawn

end


//------------------------------------------------> 
// EXPLOSIVE CRATE SPAWN THREAD 
//------------------------------------------------> 

boomcrate local.origin local.angles: 

   local.crate = spawn script_model 
   local.crate model "models/static/indycrate.tik" 
   local.crate.origin = local.origin + ( 0 0 -64 )
   local.crate.angles = local.angles
   local.crate time 0.001
   local.crate moveUp 64
   local.crate move 
   local.trigger = spawn trigger_multiple "spawnflags" "128" "health" "1" 
   local.trigger.origin = local.origin 
   local.trigger setsize ( -27 -38 0) (27 38 49)
   local.trigger.rotatedbbox = 1 
   local.trigger.angles = local.angles 

   local.trigger waittill trigger 

   exec global/model.scr local.origin // default is explosion mine 
   radiusdamage (local.origin + ( 0 0 64)) 250 256 // numbers are damage and radius 
   local.crate remove 
   wait 20 
   thread boomcrate local.origin local.angles

end
Notice that the coordinates and angles are add in prespawn. The crates respawn by poping up from the ground after 20 seconds, so they don't trap a player on the spot -- they are just pushed up out of the way.

If you want to see the creates in action, download my "Altelevator" tutorial map.

http://smallsumo.punkassfraggers.com/tl ... evator.zip
Image
Tom Trude,

Image
SniperWolf
Colour Sergeant
Posts: 89
Joined: Sat Dec 18, 2004 5:14 am
Location: New York, USA
Contact:

Post by SniperWolf »

Thanks for the quick reply tltrude. But what I did was make different sections of a target(head, torso, etc) func-crates. So when they are hit the are destroyed. Easy to score if that parts not there :D None of this its on the line stuff. But when we have Boot Camps there are usually 3 or more people trying out. They all run all the of the same range back to back. So what I want to do is made it so say after 5 seconds or so, the part that was destroyed respawns & is ready for the next person. Or would it be better to make it a script_object & use "show" & "hide" commands?? I'm not even sure if you can respawn a func_crate.

SniperWolf
SniperWolf
Colour Sergeant
Posts: 89
Joined: Sat Dec 18, 2004 5:14 am
Location: New York, USA
Contact:

Post by SniperWolf »

Is it possible to modify the pop-up target script so it just waits & shows a certain script_object???

I could make all the different body parts different script_objects & when shot hide them for 15 seconds & show them again. Kinda like the pop-up targets.

Where would I start??
«{T§F}»Col.§niperWolf
Visit Clan «{T§F}» at:http://www.clantsf.org
User avatar
«{T§F}»Puckeye
Private
Posts: 7
Joined: Sun Sep 03, 2006 3:51 am
Location: Joliette, Québec, Canada
Contact:

Post by «{T§F}»Puckeye »

I think I got an idea Sniper....

We could just spawn all the targets every so often or upon the use of a switch.

I mean we can spawn the targets for the SMG range and they get destroyed when hit right? So basically before each test we spawn all three targets with the same code as the SMG targets (except three commands per targets one for each piece) adapted to show the 9 pieces.

Code: Select all

level.smgtarget = spawn func_crate model $smgtarget1.brushmodel origin $smgtarget1.origin
level.smgtarget health 1 
Then once a recruit went through we use the switch again or wait for the respawn (using a delay of 15 seconds or so).

I think this could work well.

For the clock for the obstacle course I'm wondering if we could have two switches one at the start and one at the finish lines, we could start a timer and from there could we show that timer on a scoreboard?

I'm wondering what the drain on a server could be if we tried showing a live timer up to the tenth (0.1) of a second, keeping in mind that the recruits run through max 2 at a time? Or would it be better to just show the time at the end of the run...

I believe it would be possible to spawn the right numbers on a scoreboard to show the end time... But for a live one I'm unsure if or how it could be done... I talked with Sniper about that scoreboard and maybe we could use lights (like on real older scoreboard before video existed lol) basically those lights would be used as pixels (very big pixels) to show the numbers...
Brigadier General Puckeye
Image
SniperWolf
Colour Sergeant
Posts: 89
Joined: Sat Dec 18, 2004 5:14 am
Location: New York, USA
Contact:

Post by SniperWolf »

So with the code above the pieces would have to be script_objects correct??
«{T§F}»Col.§niperWolf
Visit Clan «{T§F}» at:http://www.clantsf.org
User avatar
«{T§F}»Puckeye
Private
Posts: 7
Joined: Sun Sep 03, 2006 3:51 am
Location: Joliette, Québec, Canada
Contact:

Post by «{T§F}»Puckeye »

They would have to be the same as the SMG target.
Brigadier General Puckeye
Image
SniperWolf
Colour Sergeant
Posts: 89
Joined: Sat Dec 18, 2004 5:14 am
Location: New York, USA
Contact:

Post by SniperWolf »

ok, script_objects then. Can you make a complete code(all 3 parts) for one part of the target to test? Use the name rifletarget1a in the code. Then I can map it in as a script_object & test it out.
«{T§F}»Col.§niperWolf
Visit Clan «{T§F}» at:http://www.clantsf.org
Post Reply