Adding up Scores??
Moderator: Moderators
-
SniperWolf
- Colour Sergeant
- Posts: 89
- Joined: Sat Dec 18, 2004 5:14 am
- Location: New York, USA
- Contact:
Adding up Scores??
Is it possible to gather the Scores for a certain range?? I have it so it prints the point values of different parts of the targets on screen. Is there some kind of variable to get it to print with the time I get on the range??
Right now when I finish a range it prints:
"I finish the Rifle Range in 15.000 Seconds"
What I would like to do is to get it to print this:
"I finished the Rifle Range in 15.000 Seconds with a score of 30"
One pass threw my Rifle Range has you shooting at 3 different targets to get a Score. Each target has 11 different areas that can be shot to get a score ranging from 10 pts to 2 pts.
How would I pull the info from all 3 targets & have it add them together for a total score?
So if I went threw the range & hit 2 targets in the head & 1 in the chest that would add to 28 pts
I would need the script to do this:
target 1 score + target 2 score + target 3 score = Overall Rifle Range Score
Is it at possible?
Right now when I finish a range it prints:
"I finish the Rifle Range in 15.000 Seconds"
What I would like to do is to get it to print this:
"I finished the Rifle Range in 15.000 Seconds with a score of 30"
One pass threw my Rifle Range has you shooting at 3 different targets to get a Score. Each target has 11 different areas that can be shot to get a score ranging from 10 pts to 2 pts.
How would I pull the info from all 3 targets & have it add them together for a total score?
So if I went threw the range & hit 2 targets in the head & 1 in the chest that would add to 28 pts
I would need the script to do this:
target 1 score + target 2 score + target 3 score = Overall Rifle Range Score
Is it at possible?
Yes it can be done, I just don't know how to do it well. can track players scores but im not sure how to handle people coming and going from the server after its started.
I will post something I use from RicHard and maybe someone can help with the tracking business. Give me a day or two im trying to release my next set of maps.
I will post something I use from RicHard and maybe someone can help with the tracking business. Give me a day or two im trying to release my next set of maps.
-
SniperWolf
- Colour Sergeant
- Posts: 89
- Joined: Sat Dec 18, 2004 5:14 am
- Location: New York, USA
- Contact:
here goes (some help needed)
after main -
thread idplayer
above code
players coming and going from the server will change the order of score tracking. Maybe someone can help here ?
and below
not sure how your triggers to be added at local.stat
at the score event -
thread targetcount local.trooper
after main -
thread idplayer
Code: Select all
idplayer:
local.player = parm.other
local.id = waitthread trooperId local.player
end
trooperId local.player:
if ( $player == NULL )
{
end
}
for ( local.id = 1; local.id <= $player.size; local.id++ )
{
if ( $player[ local.id ] == local.player )
{
end local.id
}
}
end
above code
players coming and going from the server will change the order of score tracking. Maybe someone can help here ?
and below
not sure how your triggers to be added at local.stat
at the score event -
thread targetcount local.trooper
Code: Select all
targetcount local.trooper:
local.player = local.trooper
local.id = waitthread playerkingId local.player
if (level.targetscore$player[local.id] == NIL)
{
level.targetscore$player[local.id] = 0
}
level.targetscore$player[local.id] ++
local.stat = (level.target_trigger1 + level.target_trigger2 + level.target_trigger3) // not sure how your triggers can be added but do it here
if(level.targetscore$player[local.id] == 1)
{
local.player stufftext ("say " + "My first hit! " + " I have " + local.stat + " points")
}
else
{
local.player stufftext ("say " + " I got " + level.targetscore$player[local.id] + " hits!" + " totalling " + local.stat + " points")
}
endlocal
Well, the first thing I see wrong is the idplayer thread will not know who "local.player" is. You need a trigger at the enterance of the target range with a setthread. A welcome message can comfirm the player's id.
By the way, I think players are automattically assigned id numbers when they enter a map. But, I don't remember how it works -- it is probably a cvar.
By the way, I think players are automattically assigned id numbers when they enter a map. But, I don't remember how it works -- it is probably a cvar.
Last edited by tltrude on Wed Mar 07, 2007 11:08 pm, edited 1 time in total.
health
Also, did you know you can read the health (damage) of a trigger_multiple? Here is an example from my "gotterdammerung" map script.
In that example, the trigger was given a Key/Value health/800. But you can set, and reset, health in the script too. The fraction stuff was used to continuously print a percentage of the missle's health (level.misslehealth).
Code: Select all
missle_feedback:
local.originalhealth = $missle_ex_trigger.health
local.previoushealth = $missle_ex_trigger.health //initialize
while (1)
{
if !(isAlive $missle_ex_trigger)
{
end
}
if ($missle_ex_trigger.health < local.previoushealth)
{
local.misslefraction = ($missle_ex_trigger.health / local.originalhealth) * 100
local.misslefractioninteger = int local.misslefraction
local.previoushealth = $missle_ex_trigger.health
level.misslehealth = local.misslefractioninteger
}
wait .1
}
end
-
SniperWolf
- Colour Sergeant
- Posts: 89
- Joined: Sat Dec 18, 2004 5:14 am
- Location: New York, USA
- Contact:
Well there is already at the Range Entrance, the Timer Trigger is there but I could always add another if need be. Also the 11 trigger_multiples for each target have different targetnames, example: ltarget_trigger1, ltarget_trigger2 ect. Though some of the triggers are worth the same point values.
I'll try anything once, even twice if need be
So just let me know what I need to try & I'll give it a shot. And it doesn't matter to me who helps out, any help is greatly appreciated.
I'll try anything once, even twice if need be
So just let me know what I need to try & I'll give it a shot. And it doesn't matter to me who helps out, any help is greatly appreciated.
-
SniperWolf
- Colour Sergeant
- Posts: 89
- Joined: Sat Dec 18, 2004 5:14 am
- Location: New York, USA
- Contact:
you said three targets? - for each trigger you need to add a line. Make a var for each target - thats three i think and you said 11? triggers for each target?
init them when the start trigger is activated -
in each trigger put a line like - (I think this is what Tom was talking about )
or whatever the point value is. use the same line for all 11 triggers changing the point value accordingly.
then this line will work i think -
i think lol.
init them when the start trigger is activated -
Code: Select all
level.target_trigger1 = 0
level.target_trigger2 = 0
level.target_trigger2 = 0
Code: Select all
level.target_trigger1 = level.target_trigger1 +5then this line will work i think -
Code: Select all
local.stat = (level.target_trigger1 + level.target_trigger2 + level.target_trigger3) // not sure how your triggers can be added but do it here
i think lol.
-
SniperWolf
- Colour Sergeant
- Posts: 89
- Joined: Sat Dec 18, 2004 5:14 am
- Location: New York, USA
- Contact:
Viper, do you mean like this to init all the triggers like this?? And if this is right, where do I put it?? Main map script??
I mapped in the new trigger at the Rifle Range Entrance & added the following code to my map script.
I'm a little confused on where this part is to go:
And where exactly do you mean when you say to add this line to the triggers?? Key/Value it in or something different.
Code: Select all
//*** Left Rifle Target
level.ltarget_trigger1 = 0
level.ltarget_trigger2 = 0
level.ltarget_trigger3 = 0
level.ltarget_trigger4 = 0
level.ltarget_trigger5 = 0
level.ltarget_trigger6 = 0
level.ltarget_trigger7 = 0
level.ltarget_trigger8 = 0
level.ltarget_trigger9 = 0
level.ltarget_trigger10 = 0
level.ltarget_trigger11 = 0
Code: Select all
idplayer:
local.player = parm.other
local.id = waitthread trooperId local.player
end
trooperId local.player:
if ( $player == NULL )
{
end
}
for ( local.id = 1; local.id <= $player.size; local.id++ )
{
if ( $player[ local.id ] == local.player )
{
end local.id
}
}
end Code: Select all
targetcount local.trooper:
local.player = local.trooper
local.id = waitthread playerkingId local.player
if (level.targetscore$player[local.id] == NIL)
{
level.targetscore$player[local.id] = 0
}
level.targetscore$player[local.id] ++
local.stat = (level.target_trigger1 + level.target_trigger2 + level.target_trigger3) // not sure how your triggers can be added but do it here
if(level.targetscore$player[local.id] == 1)
{
local.player stufftext ("say " + "My first hit! " + " I have " + local.stat + " points")
}
else
{
local.player stufftext ("say " + " I got " + level.targetscore$player[local.id] + " hits!" + " totalling " + local.stat + " points")
}
endCode: Select all
level.target_trigger1 = level.target_trigger1 +5answered aboveSniperWolf wrote:Viper, do you mean like this to init all the triggers like this?? And if this is right, where do I put it?? Main map script??No, i think you just need one var for each 11 triggers - they total 33 right?Code: Select all
//*** Left Rifle Target level.ltarget_trigger1 = 0 level.ltarget_trigger2 = 0 level.ltarget_trigger3 = 0 level.ltarget_trigger4 = 0 level.ltarget_trigger5 = 0 level.ltarget_trigger6 = 0 level.ltarget_trigger7 = 0 level.ltarget_trigger8 = 0 level.ltarget_trigger9 = 0 level.ltarget_trigger10 = 0 level.ltarget_trigger11 = 0
put this line in each of the 11 trigers for each of 3 targets -
level.target_trigger1 = level.target_trigger1 +5 //or whatever pointvalue
then this one in each trigger for target 2
level.target_trigger2 = level.target_trigger2 +5 //or whatever pointvalue
then this one in each trigger for target 3
level.target_trigger3 = level.target_trigger3 +5 //or whatever pointvalue
I mapped in the new trigger at the Rifle Range Entrance & added the following code to my map script.I'm a little confused on where this part is to go:Code: Select all
idplayer: local.player = parm.other local.id = waitthread trooperId local.player end trooperId local.player: if ( $player == NULL ) { end } for ( local.id = 1; local.id <= $player.size; local.id++ ) { if ( $player[ local.id ] == local.player ) { end local.id } } end
after main endAnd where exactly do you mean when you say to add this line to the triggers?? Key/Value it in or something different.Code: Select all
targetcount local.trooper: local.player = local.trooper local.id = waitthread playerkingId local.player if (level.targetscore$player[local.id] == NIL) { level.targetscore$player[local.id] = 0 } level.targetscore$player[local.id] ++ local.stat = (level.target_trigger1 + level.target_trigger2 + level.target_trigger3) // not sure how your triggers can be added but do it here if(level.targetscore$player[local.id] == 1) { local.player stufftext ("say " + "My first hit! " + " I have " + local.stat + " points") } else { local.player stufftext ("say " + " I got " + level.targetscore$player[local.id] + " hits!" + " totalling " + local.stat + " points") } endCode: Select all
level.target_trigger1 = level.target_trigger1 +5
-
SniperWolf
- Colour Sergeant
- Posts: 89
- Joined: Sat Dec 18, 2004 5:14 am
- Location: New York, USA
- Contact:
Like This:
And like the for after main end??
Code: Select all
//*** Rifle Range Targets
//*** Left Target
thread ltarget1_triggered
ltarget1_triggered:
level.target_trigger1 = 0 // added this line
level.target_trigger1 = level.target_trigger1 +10 // added this line
local.player = parm.other
local.player stufftext "say I Scored 10 Points On The Left Target."
$ltarget1 hide
for (local.i = 1; local.i <= 11; local.i++)
$("ltarget_trigger" + local.i) nottriggerable
wait 10
$ltarget1 show
for (local.i = 1; local.i <= 11; local.i++)
$("ltarget_trigger" + local.i) triggerable
end
thread ltarget2_triggered
ltarget2_triggered:
level.target_trigger2 = 0 // added this line
level.target_trigger2 = level.target_trigger2 +10 //or whatever pointvalue
local.player = parm.other
local.player stufftext "say I Scored 10 Points On The Left Target."
$ltarget2 hide
for (local.i = 1; local.i <= 11; local.i++)
$("ltarget_trigger" + local.i) nottriggerable
wait 10
$ltarget2 show
for (local.i = 1; local.i <= 11; local.i++)
$("ltarget_trigger" + local.i) triggerable
end// Clan ?{T?F}? Boot Camp
// ARCHITECTURE: ?{T?F}??niperWolf
// SCRIPTING: ?{T?F}??niperWolf ( Minor Scripting)
// SCRIPTING: <TWL> Viper (Timer Scripts)
main:
//*** set scoreboard messages
setcvar "g_obj_alliedtext1" " Clan ?{T?F}?"
setcvar "g_obj_alliedtext2" " Boot Camp "
setcvar "g_obj_alliedtext3" " By "
setcvar "g_obj_axistext1" " ?{T?F}??niperWolf"
setcvar "g_obj_axistext2" " Timer Scripts"
setcvar "g_obj_axistext3" " By <TWL> Viper"
setcvar "g_scoreboardpic" "none"
targetcount local.trooper:
local.player = local.trooper
local.id = waitthread playerkingId local.player
if (level.targetscore$player[local.id] == NIL)
{
level.targetscore$player[local.id] = 0
}
level.targetscore$player[local.id] ++
local.stat = (level.target_trigger1 + level.target_trigger2 + level.target_trigger3) // not sure how your triggers can be added but do it here
if(level.targetscore$player[local.id] == 1)
{
local.player stufftext ("say " + "My first hit! " + " I have " + local.stat + " points")
}
else
{
local.player stufftext ("say " + " I got " + level.targetscore$player[local.id] + " hits!" + " totalling " + local.stat + " points")
}
end
level waitTill prespawn
//***Buzzer Sound
local.master = spawn ScriptMaster
local.master aliascache m6l3c_alarm sound/mechanics/Mec_Alarm_05.wav soundparms 1.0 0.0 1.0 0.0 160 1200 auto loaded maps "m dm moh obj train"
no
Nope, you just stuck one thread inside another. Take those lines back out and put them at the very bottom of the page.
A thread starts with a name and a colon (main:) and stops with the word "end". If you stick another end line in it, it will stop there.
main:
all the stuff
end // <--this is the end of the thread named main.
A thread starts with a name and a colon (main:) and stops with the word "end". If you stick another end line in it, it will stop there.
main:
all the stuff
end // <--this is the end of the thread named main.

