Page 2 of 2

Posted: Sun Nov 19, 2006 11:36 am
by jv_map
Nope, there's no do { ... } while (...); in moh scripting. Only while and for.

Posted: Sun Nov 19, 2006 5:19 pm
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

Posted: Sun Nov 19, 2006 7:57 pm
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.

respawn

Posted: Sun Nov 19, 2006 8:15 pm
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

Posted: Sun Nov 19, 2006 8:24 pm
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

Posted: Wed Nov 22, 2006 1:07 am
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??

Posted: Fri Nov 24, 2006 3:18 am
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...

Posted: Fri Nov 24, 2006 8:46 pm
by SniperWolf
So with the code above the pieces would have to be script_objects correct??

Posted: Sat Nov 25, 2006 10:14 pm
by «{T§F}»Puckeye
They would have to be the same as the SMG target.

Posted: Sat Nov 25, 2006 11:29 pm
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.