scoreboard messages

Post your scripting questions / solutions here

Moderator: Moderators

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

scoreboard messages

Post by solar »

How do I edit my script so when an objective is cleared it indicates as much with a message on the screen and changes the text on the right of the scoreboard??
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

setcvar

Post by tltrude »

You just change them in your script. Below is an example that keeps score, if the two variables are updated.

Code: Select all

setcvar "g_obj_alliedtext3" ("Allies points: "+ level.allies_points)  // when player hits tab
	setcvar "g_obj_axistext3" ("Axis points: "+ level.axis_points)  // when player hits tab  
Tom Trude,

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

Post by solar »

Yeah, that flew right over me and it doesn't address the pop-up message when the objective is cleared. I read this thread which is the only one I could find on the subject, tried it, but it didn't work.

viewtopic.php?t=2575&highlight=messages

Right now, I just have a basic scoreboard script and it looks like this:
main:

// set scoreboard messages
setcvar "g_obj_alliedtext1" "Blow the fuel farm"
setcvar "g_obj_alliedtext2" "Steal the plans"
setcvar "g_obj_alliedtext3" "Blow the test stand"
setcvar "g_obj_axistext1" "Protect the fuel farm"
setcvar "g_obj_axistext2" "Secure the plans"
setcvar "g_obj_axistext3" "Defend the test stand"
I have three objectives, two are exploders and one is a document. Can someone write the script for me please?
nuggets
General
Posts: 1006
Joined: Fri Feb 28, 2003 2:57 am
Location: U-england-K (england in the UK) :P
Contact:

Post by nuggets »

ahhh it's for DM

main:
setcvar "g_obj_alliedtext1" "Blow the fuel farm"
setcvar "g_obj_alliedtext2" "Steal the plans"
setcvar "g_obj_alliedtext3" "Blow the test stand"
setcvar "g_obj_axistext1" "Protect the fuel farm"
setcvar "g_obj_axistext2" "Secure the plans"
setcvar "g_obj_axistext3" "Defend the test stand"
end

//then on the triggers have setthread and the correct thread

fuel_farm:
if ( parm.other.dmteam == axis )
{
setcvar "g_obj_alliedtext1" "Blow the fuel farm"
setcvar "g_obj_axistext1" "Protecting the fuel farm [x]"
}
else
if ( parm.other.dmteam == allies )
{
if (( level.switch3owner == -1 ) || ( level.switch3owner == 0 )) //-1 meaning axis
{
setcvar "g_obj_alliedtext1" "The fuel farm has been blown [x]"
setcvar "g_obj_axistext1" "Depends if the fuel farm can be resecured"
}
}
end

//that kinda thing
hope this helps, prob not cos it's all foreign 2 me :-/
nuggets
General
Posts: 1006
Joined: Fri Feb 28, 2003 2:57 am
Location: U-england-K (england in the UK) :P
Contact:

Post by nuggets »

or

fuel_farm:
if ( parm.other.dmteam == allies )
{
setcvar "g_obj_alliedtext1" "[x] Fuel farm destroyed [x]"
setcvar "g_obj_axistext1" "! Fuel farm destroyed !"
}
hope this helps, prob not cos it's all foreign 2 me :-/
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

script

Post by tltrude »

post your whole script solar.
Tom Trude,

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

Post by solar »

Here you go Tom. BTW, the hangar door script is your handiwork- thx as usual- you rock!
script:

main:
// set scoreboard messages
setcvar "g_obj_alliedtext1" "Blow the fuel farm"
setcvar "g_obj_alliedtext2" "Steal the plans"
setcvar "g_obj_alliedtext3" "Blow the test stand"
setcvar "g_obj_axistext1" "Protect the fuel farm"
setcvar "g_obj_axistext2" "Secure the plans"
setcvar "g_obj_axistext3" "Defend the test stand"
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 m1l3a
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 = 3 // 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
$stand_bomb thread global/obj_dm.scr::bomb_thinker
thread desk_document_check
thread allies_win_bomb // Start the win check thread for allies
thread axis_win_timer // Start the win check thread for axis
end

// 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 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


//------------------------------
// 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
User avatar
mohaa_rox
Field Marshal
Posts: 2760
Joined: Mon Nov 11, 2002 7:05 am
Contact:

Post by mohaa_rox »

looking good. :wink: 8)
Live to map, not map to live.
-mohaa_rox, .map
moderator
nuggets
General
Posts: 1006
Joined: Fri Feb 28, 2003 2:57 am
Location: U-england-K (england in the UK) :P
Contact:

Post by nuggets »

right i'll give u the general idea...

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

desk_document_check:

$documents_trigger waittill trigger // waits until triggered
local.player = parm.other
if (local.player.dmteam == allies)
{
$documents playsound snd_papers
wait .2
$documents hide // Make the document disappear
setcvar "g_obj_alliedtext2" "Plans Stolen!!! [x]"
setcvar "g_obj_axistext2" "You've lost the plans"
level.targets_destroyed ++ // adds 1 to the number of targets destroyed
}

/*don't use goto if the axis try to steel the plans, if they can't get hem it'll keep looping and hog up memory
*/
end
hope this helps, prob not cos it's all foreign 2 me :-/
solar
Colour Sergeant
Posts: 99
Joined: Fri Mar 21, 2003 2:40 pm
Location: Toledo, OH

Post by solar »

That works great nuggets, thx, Now, how about the two bomb obj's? I can't see how to apply the same idea for the exploders.

Also, anyone got an idea how to flash a message on screen when these objectives are met? I want it to do the same thing it does in "The Hunt" when it says, "Allies have breached the perimeter"- but instead say "Fuel Farm has been destroyed" and "Test Stand has been destroyed"
nuggets
General
Posts: 1006
Joined: Fri Feb 28, 2003 2:57 am
Location: U-england-K (england in the UK) :P
Contact:

Post by nuggets »

put in the code

iprintlnbold_noloc "your message here"

(that's I P R I N Y L N B O L D ) not i print in bold as i previously though when starting scripting

you could create a trigger that matches the exploder triggers in size and give them setthread aswell,

then use pretty much the same code as b4
hope this helps, prob not cos it's all foreign 2 me :-/
nihilo
Sergeant Major
Posts: 107
Joined: Thu Mar 13, 2003 6:07 am

Post by nihilo »

you mean I P R I N T L N B O L D, right? :)
User avatar
mohaa_rox
Field Marshal
Posts: 2760
Joined: Mon Nov 11, 2002 7:05 am
Contact:

Post by mohaa_rox »

iprintlnbold
Live to map, not map to live.
-mohaa_rox, .map
moderator
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

bomb control threads

Post by tltrude »

I think you need a goto nugget, or the trigger will be disabled by axis players. You could put in another "if" for axis that just prints a message and resets the trigger. The "waittill" stops the thread from looping.

---------------------------------------------------------------

For your bombs, you can set up threads that will set off exploders, animations, and print messages. Here are a couple for a map I made that should give you the idea.

Code: Select all

level waittill prespawn:

	thread bomb1_exploded $bomb1
	thread bomb2_exploded $bomb2
end

// --------------------------------------------
// "Bomb 1 Exploded"
// --------------------------------------------

bomb1_exploded local.bomb1:

while (local.bomb1.exploded != 1)  // (!) means "is not"

		wait .1
iprintlnbold_noloc "Axis have destroyed the Sherman tank!"
$exploder1smashed show  // homemade extra exploder stuff
$exploder1fire anim start  // exploder is set off in the map, not here

end

// --------------------------------------------
// "Bomb 2 Exploded"
// --------------------------------------------

bomb2_exploded local.bomb2:

	while (local.bomb2.exploded != 1)

		wait .1	
	thread global/exploder.scr::explode 1  // explodes #set 1
	$well_speaker playsound explode_water2
	iprintlnbold_noloc "Axis have renewed their water supply!!"

end
In the second thread the bomb sets off an exploder for a script_object well cover. The first thread just check to see if the tank has exploded. You may be wondering where "local.bomb2.exploded" gets changed form 0 to 1. Well, it's in the obj_dm.scr script (the bomb thinker does it).

Because these threads wait for a bomb to explode, You can put your "setcvar" lines in them to change the scoreboard when a bomb goes off.

Hope that helps!
Tom Trude,

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

Post by solar »

Well, of course what I tried didn't work. I suk so bad at scripting :x Here's what I did. areas in yellow is what I added:

script
main:
// set scoreboard messages
setcvar "g_obj_alliedtext1" "[ ]Blow up the fuel farm"
setcvar "g_obj_alliedtext2" "[ ]Steal the plans"
setcvar "g_obj_alliedtext3" "[ ]Blow up the test stand"
setcvar "g_obj_axistext1" "Protect the fuel farm"
setcvar "g_obj_axistext2" "Secure the plans"
setcvar "g_obj_axistext3" "Defend the test stand"
setcvar "g_scoreboardpic" "none

level waittill prespawn

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

//------------------EDITED LINES--------------------
thread panelbomb_exploded $panel_bomb
thread standbomb_exploded $stand_bomb
end
//------------------CLOSE EDITED LINES---------------

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 = 3 // 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
$stand_bomb thread global/obj_dm.scr::bomb_thinker
thread desk_document_check
thread allies_win_bomb // Start the win check thread for allies
thread axis_win_timer // Start the win check thread for axis
end

//----------------------EDITED LINES-------------------
//panelbomb exploded
panelbomb_exploded local.panel_bomb:
while (local.panel_bomb.exploded != 1)
wait .1
iprintlnbold_noloc "Allies have destroyed the Fuel Farm!"
setcvar "g_obj_alliedtext1" "[X]Blow up the Fuel Farm"
setcvar "g_obj_axistext1" "Fuel Farm is destroyed"
end

//standbomb exploded
standbomb_exploded local.stand_bomb:
while (local.stand_bomb.exploded != 1)
wait .1
iprintlnbold_noloc "Allies have destroyed the Test Stand!"
setcvar "g_obj_alliedtext3" "[X]Blow up the Test Stand"
setcvar "g_obj_axistext3" "Test Stand is destroyed"
end
//----------------------CLOSE EDITED LINES--------------

// 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 thread
//------------------------------

desk_document_check:

$documents_trigger waittill trigger // waits until triggered
local.player = parm.other
if (local.player.dmteam == allies)
{
$documents playsound snd_papers
wait .2
$documents hide // Make the document disappear
setcvar "g_obj_alliedtext2" "[x]Steal the Plans"
setcvar "g_obj_axistext2" "You've lost the plans"
level.targets_destroyed ++ // adds 1 to the number of targets destroyed
}

end
So, where did I go wrong?? Is there anything I have to do with the .map file itself?? I wouldn't think so. I would think this can be done with just scripting but who knows?
Post Reply