Count number of axis players
Moderator: Moderators
Count number of axis players
How can I make a script to count the number of axis players that are alive? Also, how can I disable the spawn for a certain team if a certain objective has been completed. This is all for AA.
-
Phil {sfx}
- Sergeant
- Posts: 67
- Joined: Thu Sep 30, 2004 2:08 pm
- Location: uk
- Contact:
Off the top of my head.
That will print the team numbers on the left were game messages are shown every 5 seconds.
EDIT:
oops, forgot about your spawn q,
targetname means your spawns targetname.
$targetname enablespawn & $targetname disablespawn turns them on and off.
I could explain the part about triggering them after a obj, but it will be easier for you to look in obj_team3.scr (Omaha) and see how it is done.
Code: Select all
main:
thread body_counter
end
//*****************
body_counter:
while(1)
{
level.allies = 0
level.axis = 0
for(local.i=1;local.i<=$player.size;local.i++)
{
if($player[local.i].dmteam=="allies")
{
level.allies++
}
else if($player[local.i].dmteam=="axis")
{
level.axis++
}
}
iprintln ("Axis: " + (level.axis))
iprintln ("Allied: " + (level.allies))
wait 5
}
end
EDIT:
oops, forgot about your spawn q,
targetname means your spawns targetname.
$targetname enablespawn & $targetname disablespawn turns them on and off.
I could explain the part about triggering them after a obj, but it will be easier for you to look in obj_team3.scr (Omaha) and see how it is done.
Senior Modder/Mapper/Scripter/Modeller @ www.mods-r-us.net
Something like this will do the job,
[/size]
Code: Select all
level.axis_in_game =0
level.allies_in_game =0
thread get_player_info
//-----------------
get_player_info:
//-----------------
while(1) // or make a call from a trigger instead of looping
{
for ( local.i=1 ; local.i <= $player.size ; local.i++ )
{
waitthread scan_players $player[local.i]
waitframe
}
waitframe
}
end
//------------------------
scan_players local.player:
//------------------------
local.trigger = spawn trigger_multiple
local.trigger.origin = local.player.origin
waitframe
waitframe
waitframe
local.trigger delete
if(isAlive local.player)
{
if ( local.player.dmteam == "axis" )
{
level.axis_in_game++
println "Z------ Axis in game = " level.axis_in_game
}
else if ( local.player.dmteam == "allies" )
{
level.allies_in_game++
println "Z------ Allies in game = " level.allies_in_game
}
}
endOk so how do I figure out the targetnames for the spawns? I need to figure this out for a stock map.Phil {sfx} wrote:Off the top of my head.
That will print the team numbers on the left were game messages are shown every 5 seconds.Code: Select all
main: thread body_counter end //***************** body_counter: while(1) { level.allies = 0 level.axis = 0 for(local.i=1;local.i<=$player.size;local.i++) { if($player[local.i].dmteam=="allies") { level.allies++ } else if($player[local.i].dmteam=="axis") { level.axis++ } } iprintln ("Axis: " + (level.axis)) iprintln ("Allied: " + (level.allies)) wait 5 } end
EDIT:
oops, forgot about your spawn q,
targetname means your spawns targetname.
$targetname enablespawn & $targetname disablespawn turns them on and off.
I could explain the part about triggering them after a obj, but it will be easier for you to look in obj_team3.scr (Omaha) and see how it is done.
-
Phil {sfx}
- Sergeant
- Posts: 67
- Joined: Thu Sep 30, 2004 2:08 pm
- Location: uk
- Contact:
Decompile it with a bsp 2 map prog, and look at them in radiant. (N - brings down the entity menu in rad to check the values, if they have any)
Your be lucky tho if all spawns have targetnames set in stock maps, the ones on omaha have them set cos there used.
Your be lucky tho if all spawns have targetnames set in stock maps, the ones on omaha have them set cos there used.
Senior Modder/Mapper/Scripter/Modeller @ www.mods-r-us.net
Do you know where I can find a bsp to map converter? I searched at mohfiles.com and groundforce1.com and I couldn't find one. I know I have seen one before, but I can't remember where I found it at.Phil {sfx} wrote:Decompile it with a bsp 2 map prog, and look at them in radiant. (N - brings down the entity menu in rad to check the values, if they have any)
Your be lucky tho if all spawns have targetnames set in stock maps, the ones on omaha have them set cos there used.
OK. This is what I have done so far:
I made a script that is enabled once a certain amount of objectives have been accomplished. It then takes away the players weapons and gives him noclip. So basically it is like he is in spectator. It then does not count him as being alive. That part works just fine. All I need now is a way to do this to axis players that are dead ONLY. I only know the way to find out if a player is alive. How do I find out if they are dead?
I made a script that is enabled once a certain amount of objectives have been accomplished. It then takes away the players weapons and gives him noclip. So basically it is like he is in spectator. It then does not count him as being alive. That part works just fine. All I need now is a way to do this to axis players that are dead ONLY. I only know the way to find out if a player is alive. How do I find out if they are dead?
-
Phil {sfx}
- Sergeant
- Posts: 67
- Joined: Thu Sep 30, 2004 2:08 pm
- Location: uk
- Contact:
Just a quick edit of the above script to this should do it for you, I dont know how exactly you want it to work but that should give you the idea of how to do it.
Code: Select all
main:
level.allies_dead = 0
level.axis_dead = 0
end
while(1)
{
for(local.i=1;local.i<=$player.size;local.i++)
{
if($player[local.i].dmteam=="allies")
{
$player[local.i] waittill death
level.allies_dead++
}
else if($player[local.i].dmteam=="axis")
{
$player[local.i] waittill death
level.axis_dead++
}
}
}
end
Senior Modder/Mapper/Scripter/Modeller @ www.mods-r-us.net
Sorry. I forgot to post an update.
I figured out how to figure out if they are dead.
What another guy and I are trying to figure out is how to disable the spawn for the axis only on an objective map. Like on SH TOW if the spawn was destroyed, they can no longer respawn. Yes, I looked at the script on SH, but couldn't find the script to not allow the players to respawn.
I figured out how to figure out if they are dead.
What another guy and I are trying to figure out is how to disable the spawn for the axis only on an objective map. Like on SH TOW if the spawn was destroyed, they can no longer respawn. Yes, I looked at the script on SH, but couldn't find the script to not allow the players to respawn.
-
agentmad007
- Brigadier General
- Posts: 570
- Joined: Tue Feb 24, 2004 3:52 pm
Takeover, setcurrent etc are set in the map bsp in SH.
TOW maps have control nodes and targets for triggers etc, ie; if a trigger is set it will update the setcurrent id to =1 or =0 depending on the team. Look in the SH sdk docs, there is a tute for TOW maps.
To enable - disable specific spawns then those spawns need to have a targetname so they can be controlled from script.
The other way I know of is to add right at the very top of your scr above main: new info_player_allied or axis spawn locations of the same number of original ones. Some players might still spawn in the old locations but most will spawn at the new ones. These new spawns can have targetnames that can be enabled/disabled in your scr..
TOW maps have control nodes and targets for triggers etc, ie; if a trigger is set it will update the setcurrent id to =1 or =0 depending on the team. Look in the SH sdk docs, there is a tute for TOW maps.
To enable - disable specific spawns then those spawns need to have a targetname so they can be controlled from script.
The other way I know of is to add right at the very top of your scr above main: new info_player_allied or axis spawn locations of the same number of original ones. Some players might still spawn in the old locations but most will spawn at the new ones. These new spawns can have targetnames that can be enabled/disabled in your scr..
They didn't give the spawnpoints targetnames in all of the stock maps so that won't help you . Also instead of decompileing the maps just open the bsp in notepad or wordpad and do a find for info_player_allied or info_player_axis it will be in the bsp in text form so you can tell if they have targetnames or not .

