multiple objectives problem (Bjarne)

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
solar
Colour Sergeant
Posts: 99
Joined: Fri Mar 21, 2003 2:40 pm
Location: Toledo, OH

multiple objectives problem (Bjarne)

Post by solar »

I'm trying to set up 3 objectives, two are exploders and one is a "steal document" obj. So far my first expoder works great and now I'm trying to set up the docs obj but it ain't working. I've looked at Bjarne's tut, but it throws me because he puts in two doc objs. (not your fault I'm a total putz when it comes to scripting, Bjarne). Specifically, the docs aren't even visible so could someone please look at my script and tell me what I've done wrong. Thx.
main:

// set scoreboard messages
setcvar "g_obj_alliedtext1"Blow the fuel farm ""
setcvar "g_obj_alliedtext2"Steal the plans ""
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1"Protect the fuel farm ""
setcvar "g_obj_axistext2"Secure the plans ""
setcvar "g_obj_axistext3" ""

setcvar "g_scoreboardpic" "none

level waittill prespawn

//hangar door timing
$hangardoor1 time 4 // travel time in seconds
$hangardoor2 time 4
$hangardoor3 time 4
$hangardoor4 time 4
thread hanger_doors
//stop timing

//***Precache Dm Stuff
exec global/DMprecache.scr
level.script=maps/obj/cust_obj_test.scr
exec global/ambient.scr cust_obj_test
thread global/exploder.scr::main

level waittill spawn

//obj setup
level.defusing_team = "axis" // Axis like the bombs unplanted
level.planting_team = "allies" // Allies will try to plant the bombs
level.targets_to_destroy = 2 // Number of targets in this map
level.bomb_damage = 200 // Default damage of the bomb
level.bomb_explosion_radius = 2048 // Default radius of bomb blast

// Set the parameters for round based match
level.dmrespawning = 0 // 1 or 0 (0=no respawn)
level.dmroundlimit = 5 // round time limit in minutes
level.clockside = axis // set to axis, allies, kills, or draw

// level waittill roundstart // Comment out this line using '//' before it to be able to set the bomb when alone on the map (

just for testing )

$panel_bomb thread global/obj_dm.scr::bomb_thinker // "panel_bomb" is the targetname set on the bomb in MOHRadiant
thread allies_win_bomb // Start the win check thread for allies
$panel_bomb thread axis_win_timer // Start the win check thread for axis

thread desk_document_check // Start the win check thread for allies
level waittill axiswin // If the end of the match is reached, the Axis win

end // end of main

// Allied victory test

allies_win_bomb:
while(level.targets_destroyed < level.targets_to_destroy) // While undestroyed objectives left
waitframe // chill out
teamwin allies // No objectives left allies win
end

// Axis victory test

axis_win_timer:
level waittill axiswin // At the end Axis win
end // end axis victory test

// Document checks

desk_document_check:

while(1)
{ // As long as 1 equals 1 ( that would be forever ) $documents_trigger waittill trigger // Dont execute past this line until

someone triggers the object
if (parm.other.dmteam == allies)
{ // parm.other is the triggerer ( testing here to ensure only allies can complete the ojective )
$documents hide // Make the document graphix disappear
level.targets_destroyed ++
break // break out of the while loop
}
waitframe // protection against making this thread use too much CPU
}
end // end allied victory test


//------------------------------
// Hanger doors thread
//------------------------------

hanger_doors:
$hangardoor_trigger waittill trigger
$hangardoor_trigger remove
$hangardoor_switch anim turn
$hangardoor_switch playsound alarm_switch
$hangardoor1 loopsound lighthouse_run
$hangardoor4 loopsound lighthouse_run

$hangardoor2 moveWest 336
$hangardoor2 move
$hangardoor3 moveEast 336
$hangardoor3 move

wait 4

$hangardoor2 moveWest 336
$hangardoor2 move
$hangardoor3 moveEast 336
$hangardoor3 move
$hangardoor1 moveWEst 336
$hangardoor1 move
$hangardoor4 moveEast 336
$hangardoor4 waitmove

$hangardoor1 loopsound lighthouse_run wait
$hangardoor4 loopsound lighthouse_run wait

end
TheShiznaeSpe
Major
Posts: 304
Joined: Wed Feb 05, 2003 11:45 pm
Location: US
Contact:

Post by TheShiznaeSpe »

try changing level.targets_to_destroy = 2 to level.targets_to_destroy = 3

that may help :D
solar
Colour Sergeant
Posts: 99
Joined: Fri Mar 21, 2003 2:40 pm
Location: Toledo, OH

Post by solar »

na, that ain't it. Anyone else wanna take a stab?
Desert Eagle
Captain
Posts: 237
Joined: Mon Jan 13, 2003 1:05 am
Location: Mapping Bunker
Contact:

Post by Desert Eagle »

spawn in the glowing document tik file, and give it a targetname, so when the trigger is activated the documents look like them are picked up.


waittill triggger
$document delete

as for the rest, sorry...not a master scripter either.
Desert-Eagle
....The Eagle Has Landed...
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

docs

Post by tltrude »

If you have two bombs and a document as the objectives, then the number of targets is three. But, untill you add the second bomb, "level.targets_to_destroy" should be two.


//------------------------------
// Document thread
//------------------------------

desk_document_check:

$documents_trigger waittill trigger // waits until triggered
local.player = parm.other
if (local.player.dmteam == axis)
{
goto desk_document_check
}
if (local.player.dmteam == allies)
{
$documents playsound snd_papers
wait .2
$documents hide // Make the document disappear
level.targets_destroyed ++ // adds 1 to the number of targets destroyed
}

end


Use the pulsating papers, so player know it is a target and targetname it "documents". The trigger use over the papers must have the targetname "documents_trigger". A bomb going off also adds 1 to the number of targets destroyed.
Tom Trude,

Image
solar
Colour Sergeant
Posts: 99
Joined: Fri Mar 21, 2003 2:40 pm
Location: Toledo, OH

Post by solar »

That's twice you've come through for me Tom. I'm starting to like this :D Thx
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

Papers sound

Post by tltrude »

The snd_papers sound works in multiplayer, but it is for showing your papers while in disguise. There is a sound called pickup_papers, but it is not normally multiplayer.
Tom Trude,

Image
Post Reply