Page 2 of 3
Posted: Fri Aug 05, 2005 10:52 am
by bdbodger
This is the mod he was talking about
user_medic_mod_and_paths.pk3
It has a script for mohdm1 and mohdm3 it spawns pathnodes and when you run the maps it creates .pth file for them . What you do is put the pak in main start the game and type
bind b pushmenu bot_spawn_menu or bind it to any key you want . I commented out the line
//exec global/healing.scr
You can try it if you want it is a sorta medic mod I'll explain later if you want me to what that is you may not want to use it . Ignore the medics in the spawning menu if you don't use it . Any way this mode spawns the ai at
level.botnode[0] = spawn info_pathnode origin ( 848.000 -216.000 48.125 ) spawnflags 4
level.botnode[1] = spawn info_pathnode origin ( 897.735 -392.451 48.125 ) spawnflags 4
They are the places that the pathnodes where spawned at if you try to use this mod in a map that already has a .pth file you need to spawn script_origins instead at what ever coords you want for the ai to spawn at .
So anyway download that and bind the menu and play mohdm1 or mohdm3 to see what he was on about .( you need to have JVbots on your system to use it )
Posted: Fri Aug 05, 2005 3:07 pm
by GiffE1118
FINALLY i got it to work thanks so much bdbodger ive been trying to get it to work for a while
Posted: Fri Aug 12, 2005 3:06 pm
by GiffE1118
1 questions bdbodger
in your healing.scr (in that bots scipt) you spawn and actor under the player crouched and hid the player. im working on a gametype and i need my player when dead (or dies and respawns) to spawn a actor under him crouched serverside so do anim i gues, i tried editing your script to my liking but still no work.
this was my whole script:
Code: Select all
main:
thread begin_tag_team
//AFTER THE FIRST ROUND I MUST MAKE A TEAM BALANCER
//WHICH BALANCES THE TEAM FOR THE FIRST 30 SECONDS THEN STOPS
//
//MAKE A CVAR? ON LIKE SORRIDS SPAWN SWAP? M6L3B?
begin_tag_team:
thread player_monitor
thread counter_setup
thread hud_counter
player_monitor:
while(1)
{
for(local.i = 1; local.i <= $player.size; local.i++)
{
if($player[local.i].health <= 0)
$player[local.i] thread wait_revive //IDENTIFIES THE PLAYER AS SELF
}
waitframe
}
end
//--------------------------------------------------------------------------------
//This is how to make the player change teams
//[THE PLAYER] stufftext ("join_team axis")
//[THE PLAYER] stufftext ("join_team allies")
wait_revive:
self threatbias ignoreme //WTF DOES THIS DO?
self notsolid
self stufftext "say WAS FROZEN"
local.team = self.dmteam
local.ent = self waitthread player_ai_model
self hide
self nodamage
self takeall
self.ent = local.ent
self.waiting = 1
self physics_off
self.isfrozen = 1
while(self.isfrozen = 1)
{
for(local.i=1;local.i<=$player.size;local.i++)
{
if($player[local.i] != self)
{
if(vector_within $player[local.i].origin self.origin 125 && $player[local.i].useheld == 1) //HOLDS USE & 125 UNITS AWAY
{
if($player[local.i].dmteam == "axis"
{
self stopwatch 5
$player[local.i] stopwatch 5
wait 5
self stufftext ("join_team axis")
$player[local.i] stufftext ("say MELTED A PLAYER FOR THE AXIS")
self.isfrozen = 0
}
if($player[local.i].dmteam == "allies"
{
self stopwatch 5
$player[local.i] stopwatch 5
wait 5
self stufftext ("join_team allies")
$player[local.i] stufftext ("say MELTED A PLAYER FOR THE ALLIES")
self.isfrozen = 0
}
}
}
}
waitframe
}
self.isfrozen = 0
if(self.isfrozen = 0 )
{
local.angle = local.ent.angle
self tele local.ent.origin
self.viewangles = ( 0 local.angle 0 )
local.ent setmotionanim (local.ent.weapongroup + "_pain_kneestostand")
local.ent waittill flaggedanimdone
local.ent delete
}
else
local.ent delete
self show
self physics_on
self threatbias 1000
wait 3
self solid
self takedamage
end
//--------------------------------------------------------
counter_setup:
while(1)
{
level.alliesteam = 0
level.axisteam = 0
waitframe
for(local.i=1;local.i <= $player.size;local.i++)
{
if($player[local.i].dmteam == "axis")
level.axisteam++
else if($player[local.i].dmteam == "allies")
level.alliesteam++
}
hud_counter:
while(1)
{
huddraw_align 200 left bottom
huddraw_font 200 facfont-20
huddraw_rect 200 40 -140 100 100
huddraw_color 200 1 1 1
huddraw_alpha 200 1
huddraw_string 200 ("Axis: " + level.axisteam)
huddraw_align 201 left bottom
huddraw_font 201 facfont-20
huddraw_rect 201 40 -115 100 100
huddraw_color 201 1 1 1
huddraw_alpha 201 1
huddraw_string 201 ("Allied: " + level.alliesteam)
huddraw_shader 202 ("textures/hud/allies")
huddraw_align 202 left bottom
huddraw_rect 202 10 -120 25 25
huddraw_color 202 1 1 1
huddraw_alpha 202 1.0
huddraw_shader 203 ("textures/hud/axis")
huddraw_align 203 left bottom
huddraw_rect 203 10 -145 25 25
huddraw_color 203 1 1 1
huddraw_alpha 203 1
}
wait .5
end
//----------------------------------------------------------------------
player_ai_model:
switch(self.model)
{
models/player/allied_airborne.tik:
local.ent = human/multiplayer_allied_airborne_soldier.tik
break
models/player/allied_pilot.tik:
local.ent = human/multiplayer_allied_pilot.tik
break
models/player/allied_sas.tik:
local.ent = human/multiplayer_allied_oss_man.tik
break
models/player/american_army.tik:
local.ent = human/multiplayer_allied_airborne_soldier.tik
break
models/player/american_ranger.tik:
local.ent = human/multiplayer_allied_1st-ranger_private.tik
break
models/player/german_afrika_Officer.tik:
local.ent = human/multiplayer_german_afrika_officer.tik
break
models/player/german_elite_officer.tik:
local.ent = human/multiplayer_german_elite_gestapo.tik
break
models/player/german_elite_sentry.tik:
local.ent = human/multiplayer_german_elite_sentry.tik
break
models/player/german_kradshutzen.tik:
local.ent = human/multiplayer_german_misc_kradshutzen.tik
break
models/player/german_panzer_grenadier.tik:
local.ent = human/multiplayer_german_panzer_grenadier.tik
break
models/player/german_panzer_obershutze.tik:
local.ent = human/multiplayer_german_panzer_obershutze.tik
break
models/player/german_panzer_shutze.tik:
local.ent = human/multiplayer_german_panzer_shutze.tik
break
models/player/german_panzer_tankcommander.tik:
local.ent = human/multiplayer_german_panzer_tankcommander.tik
break
models/player/german_waffenss_officer.tik:
local.ent = human/multiplayer_german_waffenss_officer.tik
break
models/player/german_waffenss_shutze.tik:
local.ent = human/multiplayer_german_waffenss_shutze.tik
break
models/player/german_wehrmacht_officer.tik:
local.ent = human/multiplayer_german_wehrmact_officer.tik
break
models/player/german_wehrmacht_soldier.tik:
local.ent = human/multiplayer_german_wehrmact_soldier.tik
break
models/player/german_winter_1.tik:
local.ent = human/multiplayer_german_winter_type1.tik
break
models/player/german_winter_2.tik:
local.ent = human/multiplayer_german_winter_type2.tik
break
models/player/german_worker.tik:
local.ent = human/multiplayer_german_misc_worker.tik
break
default:
if(self.dmteam == "allies")
local.ent = human/multiplayer_allied_airborne_soldier.tik
else
local.ent = human/multiplayer_german_wehrmact_soldier.tik
break
}
local.randnum = randomint 1000
self weaponcommand dual targetname ("weap" + local.randnum)
local.weap = $("weap" + local.randnum)
local.weap.targetname = ""
local.ent = spawn local.ent origin self.origin angles self.angles "gun" "none"
local.ent weapon_internal local.weap.model
local.ent notsolid
local.ent nodamage
local.ent threatbias ignoreme
end local.ent
//--------------------------------------------------------------------
Check_Win:
end
//HoW CAN I CHECK FOR A WIN WHEN EVERY FRAME
//THE TEAM COUNTER IS SET TO 0 THEN ADDED UP AGAIN
//
//Make a new counter? one that isnt as accurate? how do i do that?
it checked if they are dead then did the spawning of it. but did not work
my next idea is to check if they are dead then use elgans spawndetect to find the player after he spawns and create the actor
Posted: Sat Aug 13, 2005 7:40 am
by bdbodger
while(self.isfrozen = 1)
should be
while(self.isfrozen == 1)
it is a true or false statement and compares the values so you need to use == not =
if(self.isfrozen = 0 ) same with this statement you need to use ==
begin_tag_team:
thread player_monitor
thread counter_setup
thread hud_counter
end
player_monitor:
you need the end or you get the player_monitor thread running twice
Posted: Sat Aug 13, 2005 1:13 pm
by GiffE1118
oops stipid error. i will test out the new script wright a way. just got 1 question
so if i as a statemany like if i HAVE to use == in the parentthesis and regular = defines the thing?
will the ai being spawned be serverside? or will they have to get jv_bots?
EDIT nope still no ai showing up. may i should look into elgans spawn detection and use that along side a script that finds the dead player and identifies him a a causalty
Posted: Sun Aug 14, 2005 3:32 am
by bdbodger
== compares two values and returns true or false
if(local.a == local.b)
= assigns a value
local.b = 5
local.a = local.b
iprintln local.a
will print 5 on the screen
If you are spawning JVbot then yes they will need to have them the rest will be serverside .
Posted: Sun Aug 14, 2005 5:20 am
by Cobra {sfx}
Posted: Sun Aug 14, 2005 1:01 pm
by GiffE1118
thanx but i figureed out how to use bdbodgers way to spawn them (with his help) but your code looks good cause then i can add different player models other than the same airborne and nazi guy.
bdbodger wrote:== compares two values and returns true or false
if(local.a == local.b)
= assigns a value
local.b = 5
local.a = local.b
iprintln local.a
will print 5 on the screen
If you are spawning JVbot then yes they will need to have them the rest will be serverside.
thats a good explaination of the == thing, thats why alot of my scripts never worked even though they seemed like it would
as for the spawning the jvbot i really dont want to use any animations i just want a guy crouched. but i gues i one standing up would work to.
i though of spawning ascript model of the guy but i can spawn it when he dies no problem but i dont know how to remove the model once some one is vector_within $player[local.i].origin self.origin 125 && $player[local.i].useheld == 1) //HOLDS USE & 125 UNITS AWAY
and script models are standing

but if he has to stand straight then i gues i can just make him light or spawn beams like FT so he looks better than a stiff body.
just i dont know how to remove the guy
Posted: Sun Aug 14, 2005 4:12 pm
by bdbodger
local.ent = self waitthread player_ai_model
....
....
self.ent = local.ent
That is the spawned guy right so inside that if statement delete self.ent somewhere where you show the player again .
Posted: Sun Aug 14, 2005 6:46 pm
by GiffE1118
i had this in there which deletes the script model,
Code: Select all
self.isfrozen = 0
if(self.isfrozen == 0 )
{
local.angle = local.ent.angle
self tele local.ent.origin
local.ent delete
}
self show
self physics_on
wait 3
self solid
self takedamage
end
should i change local.ent to self.ent since thats what i defined it to?
and delete all the animations stuff so it just spawns the model
im going to test this out now
Posted: Sun Aug 14, 2005 10:09 pm
by GiffE1118
i tried putting what i had into a map script
Code: Select all
main:
// set scoreboard messages
setcvar "g_obj_alliedtext1" "Stalingrad"
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" ""
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" ""
setcvar "g_scoreboardpic" "mohdm6"
// call additional stuff for playing this map round based is needed
if(level.roundbased)
thread roundbasedthread
level waittill prespawn
//*** Precache Dm Stuff
exec global/DMprecache.scr
exec global/door_locked.scr::lock
level.script = maps/dm/mohdm6.scr
exec global/ambient.scr mohdm6
level waittill spawn
thread player_monitor
thread counter_setup
thread hud_counter
wait 20
println "STARTED PROPERLY
end
player_monitor:
println "moniter started"
while(1)
{
for(local.i = 1; local.i <= $player.size; local.i++)
{
if($player[local.i].health <= 0)
$player[local.i] thread wait_revive //IDENTIFIES THE PLAYER AS SELF
}
waitframe
}
end
//--------------------------------------------------------------------------------
//This is how to make the player change teams
//[THE PLAYER] stufftext ("join_team axis")
//[THE PLAYER] stufftext ("join_team allies")
wait_revive:
self notsolid
self stufftext "say WAS FROZEN"
local.team = self.dmteam
local.ent = self waitthread player_ai_model
local.ent.beams = waitthread player_ai_model
self hide
self nodamage
self takeall
self.ent = local.ent
self.ent.beams = local.ent.beams
self.waiting = 1
self physics_off
self.isfrozen = 1
while(self.isfrozen == 1)
{
for(local.i=1;local.i<=$player.size;local.i++)
{
if($player[local.i] != self)
{
if(vector_within $player[local.i].origin self.origin 125 && $player[local.i].useheld == 1) //HOLDS USE & 125 UNITS AWAY
{
if($player[local.i].dmteam == "axis"
{
self stopwatch 5
$player[local.i] stopwatch 5
wait 5
self stufftext ("join_team axis")
$player[local.i] stufftext ("say MELTED A PLAYER FOR THE AXIS")
self.isfrozen = 0
}
if($player[local.i].dmteam == "allies"
{
self stopwatch 5
$player[local.i] stopwatch 5
wait 5
self stufftext ("join_team allies")
$player[local.i] stufftext ("say MELTED A PLAYER FOR THE ALLIES")
self.isfrozen = 0
}
}
}
}
waitframe
}
//--------------------------------------------------------------
//| Spectator Mode |
//| This is enabled and keeps a player in spectator until he is|
//| Melted another player |
//| |
//| As of now the spectator can only veiw real players |
//--------------------------------------------------------------
while(self.isfrozen == 1)
{
self iprint "--Spectator Mode--"
self iprint "You are frozen and must wait for someone to melt you"
self spectator
wait 0.5
}
//--------------------------------------------------------------
//| Delete Frozen's |
//| This deletes the frozen body when |
//| self.isfrozen is set to 0 |
//| |
//| The Spectator Mode should auto-matically disable |
//--------------------------------------------------------------
if(self.isfrozen == 0 )
{
local.angle = local.ent.angle
self tele local.ent.origin
self.ent delete
local.ent.beams delete
}
self show
self physics_on
wait 3
self solid
self takedamage
end
//--------------------------------------------------------
counter_setup:
while(1)
{
level.alliesteam = 0
level.axisteam = 0
waitframe
for(local.i=1;local.i <= $player.size;local.i++)
{
if($player[local.i].dmteam == "axis")
level.axisteam++
else if($player[local.i].dmteam == "allies")
level.alliesteam++
}
hud_counter:
while(1)
{
huddraw_align 200 left bottom
huddraw_font 200 facfont-20
huddraw_rect 200 40 -140 100 100
huddraw_color 200 1 1 1
huddraw_alpha 200 1
huddraw_string 200 ("Axis: " + level.axisteam)
huddraw_align 201 left bottom
huddraw_font 201 facfont-20
huddraw_rect 201 40 -115 100 100
huddraw_color 201 1 1 1
huddraw_alpha 201 1
huddraw_string 201 ("Allied: " + level.alliesteam)
huddraw_shader 202 ("textures/hud/allies")
huddraw_align 202 left bottom
huddraw_rect 202 10 -120 25 25
huddraw_color 202 1 1 1
huddraw_alpha 202 1.0
huddraw_shader 203 ("textures/hud/axis")
huddraw_align 203 left bottom
huddraw_rect 203 10 -145 25 25
huddraw_color 203 1 1 1
huddraw_alpha 203 1
}
wait .5
end
//----------------------------------------------------------------------
player_ai_model:
switch(self.model)
{
models/player/allied_airborne.tik:
local.ent = human/multiplayer_allied_airborne_soldier.tik
break
models/player/allied_pilot.tik:
local.ent = human/multiplayer_allied_pilot.tik
break
models/player/allied_sas.tik:
local.ent = human/multiplayer_allied_oss_man.tik
break
models/player/american_army.tik:
local.ent = human/multiplayer_allied_airborne_soldier.tik
break
models/player/american_ranger.tik:
local.ent = human/multiplayer_allied_1st-ranger_private.tik
break
models/player/german_afrika_Officer.tik:
local.ent = human/multiplayer_german_afrika_officer.tik
break
models/player/german_elite_officer.tik:
local.ent = human/multiplayer_german_elite_gestapo.tik
break
models/player/german_elite_sentry.tik:
local.ent = human/multiplayer_german_elite_sentry.tik
break
models/player/german_kradshutzen.tik:
local.ent = human/multiplayer_german_misc_kradshutzen.tik
break
models/player/german_panzer_grenadier.tik:
local.ent = human/multiplayer_german_panzer_grenadier.tik
break
models/player/german_panzer_obershutze.tik:
local.ent = human/multiplayer_german_panzer_obershutze.tik
break
models/player/german_panzer_shutze.tik:
local.ent = human/multiplayer_german_panzer_shutze.tik
break
models/player/german_panzer_tankcommander.tik:
local.ent = human/multiplayer_german_panzer_tankcommander.tik
break
models/player/german_waffenss_officer.tik:
local.ent = human/multiplayer_german_waffenss_officer.tik
break
models/player/german_waffenss_shutze.tik:
local.ent = human/multiplayer_german_waffenss_shutze.tik
break
models/player/german_wehrmacht_officer.tik:
local.ent = human/multiplayer_german_wehrmact_officer.tik
break
models/player/german_wehrmacht_soldier.tik:
local.ent = human/multiplayer_german_wehrmact_soldier.tik
break
models/player/german_winter_1.tik:
local.ent = human/multiplayer_german_winter_type1.tik
break
models/player/german_winter_2.tik:
local.ent = human/multiplayer_german_winter_type2.tik
break
models/player/german_worker.tik:
local.ent = human/multiplayer_german_misc_worker.tik
break
default:
if(self.dmteam == "allies")
local.ent = human/multiplayer_allied_airborne_soldier.tik
else
local.ent = human/multiplayer_german_wehrmact_soldier.tik
break
}
local.ent = spawn local.ent origin self.origin angles self.angles "gun" "none"
local.ent notsolid
local.ent nodamage
local.origin = self.origin
local.ent.beams = waitthread spawn_beam_cylinder local.origin 15 ( 1 1 1 )
end local.ent local.ent.beams
//#######################################################################
spawn_beam_cylinder local.origin local.radius local.color:
local.beams[0] = waitthread spawn_doublebeam (local.origin + ( local.radius 0 0 )) local.color
local.beams[1] = waitthread spawn_doublebeam (local.origin + ( -(local.radius * 0.5) (local.radius * 0.866) 0 )) local.color
local.beams[2] = waitthread spawn_doublebeam (local.origin + ( -(local.radius * 0.5) -(local.radius * 0.866) 0 )) local.color
end local.beams
//######################################################################
spawn_doublebeam local.origin local.color local.bindent:
local.beams[0] = waitthread spawn_beam (local.origin + ( 0 0 40 )) ( local.origin + ( 0 0 130 )) local.color
local.beams[1] = waitthread spawn_beam (local.origin + ( 0 0 40 )) ( local.origin + ( 0 0 -50 )) local.color
end local.beams
//######################################################################
spawn_beam local.origin local.endpoint local.color:
local.ent = spawn func_beam
local.ent.origin = local.origin
local.ent endpoint local.endpoint
local.ent minoffset 0.0
local.ent maxoffset 0.0
local.ent scale 5.0
local.ent color local.color
local.ent alpha 1.0
local.ent endalpha 0.0
local.ent numsegments 5
local.ent activate
level.origin = local.origin
end local.ent
//--------------------------------------------------------------------
Check_Win:
end
//------------------------------------------------------------------
//|HoW CAN I CHECK FOR A WIN WHEN EVERY FRAME |
//|THE TEAM COUNTER IS SET TO 0 THEN ADDED UP AGAIN |
//| |
//|Make a new counter? one that isnt as accurate? how do i do that?|
//------------------------------------------------------------------
i added a bunch more but the script doesnt even run can u see any errors? i will tried testing it without the beams maybe thats screwing it up
Posted: Mon Aug 15, 2005 10:23 am
by bdbodger
main:
// set scoreboard messages
setcvar "g_obj_alliedtext1" "Stalingrad"
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" ""
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" ""
setcvar "g_scoreboardpic" "mohdm6"
// call additional stuff for playing this map round based is needed
if(level.roundbased)
thread roundbasedthread
level waittill prespawn
//*** Precache Dm Stuff
exec global/DMprecache.scr
exec global/door_locked.scr::lock
level.script = maps/dm/mohdm6.scr
exec global/ambient.scr mohdm6
level waittill spawn
thread player_monitor
thread counter_setup
thread hud_counter
wait 20
println "STARTED PROPERLY
end
player_monitor:
println "moniter started"
while(1)
{
for(local.i = 1; local.i <= $player.size; local.i++)
{
if($player[local.i].health <= 0)
$player[local.i] thread wait_revive //IDENTIFIES THE PLAYER AS SELF
}
waitframe
}
end
//--------------------------------------------------------------------------------
//This is how to make the player change teams
//[THE PLAYER] stufftext ("join_team axis")
//[THE PLAYER] stufftext ("join_team allies")
wait_revive:
self notsolid
self stufftext "say WAS FROZEN"
local.team = self.dmteam
local.ent = self waitthread player_ai_model // local.ent is the ai ok
local.ent.beams = waitthread player_ai_model // local.ent.beams is a second ai ?? the thread expects an entity to call the thread too like self waitthread above
self hide
self nodamage
self takeall
self.ent = local.ent
self.ent.beams = local.ent.beams
self.waiting = 1
self physics_off
self.isfrozen = 1
while(self.isfrozen == 1)
{
for(local.i=1;local.i<=$player.size;local.i++)
{
if($player[local.i] != self)
{
if(vector_within $player[local.i].origin self.origin 125 && $player[local.i].useheld == 1) //HOLDS USE & 125 UNITS AWAY
{
if($player[local.i].dmteam == "axis" ) // you missed a bracket
{
self stopwatch 5
$player[local.i] stopwatch 5
wait 5
self stufftext ("join_team axis")
$player[local.i] stufftext ("say MELTED A PLAYER FOR THE AXIS")
self.isfrozen = 0
}
if($player[local.i].dmteam == "allies" ) // you missed a bracket
{
self stopwatch 5
$player[local.i] stopwatch 5
wait 5
self stufftext ("join_team allies")
$player[local.i] stufftext ("say MELTED A PLAYER FOR THE ALLIES")
self.isfrozen = 0
}
}
}
}
waitframe
}
//--------------------------------------------------------------
//| Spectator Mode |
//| This is enabled and keeps a player in spectator until he is|
//| Melted another player |
//| |
//| As of now the spectator can only veiw real players |
//--------------------------------------------------------------
while(self.isfrozen == 1) )// endless loop keeps printing "You are frozen and must wait for someone to melt you should probably be in a separate thread called from this one before the while loop that starts above but after self.isfrozen = 1 so that it does not stop that while loop you have a endless loop inside a loop"
{
self iprint "--Spectator Mode--"
self iprint "You are frozen and must wait for someone to melt you"
self spectator
wait 0.5
}
//--------------------------------------------------------------
//| Delete Frozen's |
//| This deletes the frozen body when |
//| self.isfrozen is set to 0 |
//| |
//| The Spectator Mode should auto-matically disable |
//--------------------------------------------------------------
if(self.isfrozen == 0 )
{
local.angle = local.ent.angle
self tele local.ent.origin
self.ent delete
local.ent.beams delete
}
self show
self physics_on
wait 3
self solid
self takedamage
end
// count your { brackets in the thread above I think you are missing one of the } barackets
//--------------------------------------------------------
counter_setup:
while(1)
{
level.alliesteam = 0
level.axisteam = 0
waitframe
for(local.i=1;local.i <= $player.size;local.i++)
{
if($player[local.i].dmteam == "axis")
level.axisteam++
else if($player[local.i].dmteam == "allies")
level.alliesteam++
}
hud_counter:
while(1)
{
huddraw_align 200 left bottom
huddraw_font 200 facfont-20
huddraw_rect 200 40 -140 100 100
huddraw_color 200 1 1 1
huddraw_alpha 200 1
huddraw_string 200 ("Axis: " + level.axisteam)
huddraw_align 201 left bottom
huddraw_font 201 facfont-20
huddraw_rect 201 40 -115 100 100
huddraw_color 201 1 1 1
huddraw_alpha 201 1
huddraw_string 201 ("Allied: " + level.alliesteam)
huddraw_shader 202 ("textures/hud/allies")
huddraw_align 202 left bottom
huddraw_rect 202 10 -120 25 25
huddraw_color 202 1 1 1
huddraw_alpha 202 1.0
huddraw_shader 203 ("textures/hud/axis")
huddraw_align 203 left bottom
huddraw_rect 203 10 -145 25 25
huddraw_color 203 1 1 1
huddraw_alpha 203 1
}
wait .5
end
//----------------------------------------------------------------------
player_ai_model:
switch(self.model)
{
models/player/allied_airborne.tik:
local.ent = human/multiplayer_allied_airborne_soldier.tik
break
models/player/allied_pilot.tik:
local.ent = human/multiplayer_allied_pilot.tik
break
models/player/allied_sas.tik:
local.ent = human/multiplayer_allied_oss_man.tik
break
models/player/american_army.tik:
local.ent = human/multiplayer_allied_airborne_soldier.tik
break
models/player/american_ranger.tik:
local.ent = human/multiplayer_allied_1st-ranger_private.tik
break
models/player/german_afrika_Officer.tik:
local.ent = human/multiplayer_german_afrika_officer.tik
break
models/player/german_elite_officer.tik:
local.ent = human/multiplayer_german_elite_gestapo.tik
break
models/player/german_elite_sentry.tik:
local.ent = human/multiplayer_german_elite_sentry.tik
break
models/player/german_kradshutzen.tik:
local.ent = human/multiplayer_german_misc_kradshutzen.tik
break
models/player/german_panzer_grenadier.tik:
local.ent = human/multiplayer_german_panzer_grenadier.tik
break
models/player/german_panzer_obershutze.tik:
local.ent = human/multiplayer_german_panzer_obershutze.tik
break
models/player/german_panzer_shutze.tik:
local.ent = human/multiplayer_german_panzer_shutze.tik
break
models/player/german_panzer_tankcommander.tik:
local.ent = human/multiplayer_german_panzer_tankcommander.tik
break
models/player/german_waffenss_officer.tik:
local.ent = human/multiplayer_german_waffenss_officer.tik
break
models/player/german_waffenss_shutze.tik:
local.ent = human/multiplayer_german_waffenss_shutze.tik
break
models/player/german_wehrmacht_officer.tik:
local.ent = human/multiplayer_german_wehrmact_officer.tik
break
models/player/german_wehrmacht_soldier.tik:
local.ent = human/multiplayer_german_wehrmact_soldier.tik
break
models/player/german_winter_1.tik:
local.ent = human/multiplayer_german_winter_type1.tik
break
models/player/german_winter_2.tik:
local.ent = human/multiplayer_german_winter_type2.tik
break
models/player/german_worker.tik:
local.ent = human/multiplayer_german_misc_worker.tik
break
default:
if(self.dmteam == "allies")
local.ent = human/multiplayer_allied_airborne_soldier.tik
else
local.ent = human/multiplayer_german_wehrmact_soldier.tik
break
}
local.ent = spawn local.ent origin self.origin angles self.angles "gun" "none"
local.ent notsolid
local.ent nodamage
local.origin = self.origin
local.ent.beams = waitthread spawn_beam_cylinder local.origin 15 ( 1 1 1 )
end local.ent local.ent.beams
//#######################################################################
spawn_beam_cylinder local.origin local.radius local.color:
local.beams[0] = waitthread spawn_doublebeam (local.origin + ( local.radius 0 0 )) local.color
local.beams[1] = waitthread spawn_doublebeam (local.origin + ( -(local.radius * 0.5) (local.radius * 0.866) 0 )) local.color
local.beams[2] = waitthread spawn_doublebeam (local.origin + ( -(local.radius * 0.5) -(local.radius * 0.866) 0 )) local.color
end local.beams
//######################################################################
spawn_doublebeam local.origin local.color local.bindent:
local.beams[0] = waitthread spawn_beam (local.origin + ( 0 0 40 )) ( local.origin + ( 0 0 130 )) local.color
local.beams[1] = waitthread spawn_beam (local.origin + ( 0 0 40 )) ( local.origin + ( 0 0 -50 )) local.color
end local.beams
//######################################################################
spawn_beam local.origin local.endpoint local.color:
local.ent = spawn func_beam
local.ent.origin = local.origin
local.ent endpoint local.endpoint
local.ent minoffset 0.0
local.ent maxoffset 0.0
local.ent scale 5.0
local.ent color local.color
local.ent alpha 1.0
local.ent endalpha 0.0
local.ent numsegments 5
local.ent activate
level.origin = local.origin
end local.ent
//--------------------------------------------------------------------
Check_Win:
end
//------------------------------------------------------------------
//|HoW CAN I CHECK FOR A WIN WHEN EVERY FRAME |
//|THE TEAM COUNTER IS SET TO 0 THEN ADDED UP AGAIN |
//| |
//|Make a new counter? one that isnt as accurate? how do i do that?|
//------------------------------------------------------------------
Posted: Mon Aug 15, 2005 10:56 am
by bdbodger
let me be a bit clearer on the spectator loop you don't want that inside the first while loop or it won't loop like it should it will be stuck in the second loop . should be more like this
self.isfrozen = 1
self thread spectator
while(self.isfrozen == 1)
{
....
....
end
//--------------------------------------------------------------
//| Spectator Mode |
//| This is enabled and keeps a player in spectator until he is|
//| Melted another player |
//| |
//| As of now the spectator can only veiw real players |
//--------------------------------------------------------------
spectator:
while(self.isfrozen == 1)
{
self iprint "--Spectator Mode--"
self iprint "You are frozen and must wait for someone to melt you"
self spectator
wait 0.5
}
end
also this thread
player_monitor:
println "moniter started"
while(1)
{
for(local.i = 1; local.i <= $player.size; local.i++)
{
if($player[local.i].health <= 0)
$player[local.i] thread wait_revive //IDENTIFIES THE PLAYER AS SELF
}
waitframe
}
end
that will keep starting the wait_revive thread for that player you need a way to start the thread only once
player_monitor:
println "moniter started"
while(1)
{
for(local.i = 1; local.i <= $player.size; local.i++)
{
if($player[local.i].health <= 0 && $player[local.i].revive != 1)
$player[local.i] thread wait_revive //IDENTIFIES THE PLAYER AS SELF
}
waitframe
}
end
then set self.revive to 1 in the second thread and set it to 0 when the thread is about to end some thing like that anyway
Posted: Mon Aug 15, 2005 1:41 pm
by GiffE1118
ok i made those changes and i counted the brackets
but the script does not even start up it just clears the scoreboard
here are the changes i made
(highlighted in yellow)
main:
// set scoreboard messages
setcvar "g_obj_alliedtext1" "Stalingrad"
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" ""
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" ""
setcvar "g_scoreboardpic" "mohdm6"
// call additional stuff for playing this map round based is needed
if(level.roundbased)
thread roundbasedthread
level waittill prespawn
//*** Precache Dm Stuff
exec global/DMprecache.scr
exec global/door_locked.scr::lock
level.script = maps/dm/mohdm6.scr
exec global/ambient.scr mohdm6
thread player_monitor
thread counter_setup
thread hud_counter
level waittill spawn
end
player_monitor:
println "moniter started"
iprintlnbold_noloc ("monitor started")
while(1)
{
for(local.i = 1; local.i <= $player.size; local.i++)
{
if($player[local.i].health <= 0) && $player[local.i].revive != 1)
$player[local.i] thread wait_revive //IDENTIFIES THE PLAYER AS SELF
iprintlnbold_noloc ("player died")
}
waitframe
}
end
//--------------------------------------------------------------------------------
//This is how to make the player change teams
//[THE PLAYER] stufftext ("join_team axis")
//[THE PLAYER] stufftext ("join_team allies")
wait_revive:
self.revive = 1
iprintlnbold_noloc ("waiting for revive")
self notsolid
self stufftext "say WAS FROZEN"
local.team = self.dmteam
local.ent = self waitthread player_ai_model
local.ent.beams = waitthread spawn_beam_cylinder self.origin 15 ( 1 1 1 )
self hide
self nodamage
self takeall
self.ent = local.ent
self.ent.beams = local.ent.beams
self.waiting = 1
self physics_off
self.isfrozen = 1
self thread spectator
while(self.isfrozen == 1)
{
for(local.i=1;local.i<=$player.size;local.i++)
{
if($player[local.i] != self)
{
if(vector_within $player[local.i].origin self.origin 125 && $player[local.i].useheld == 1) //HOLDS USE & 125 UNITS AWAY
{
if($player[local.i].dmteam == "axis")
{
self stopwatch 5
$player[local.i] stopwatch 5
wait 5
self stufftext ("join_team axis")
$player[local.i] stufftext ("say MELTED A PLAYER FOR THE AXIS")
self.isfrozen = 0
self.revive = 0
}
if($player[local.i].dmteam == "allies")
{
self stopwatch 5
$player[local.i] stopwatch 5
wait 5
self stufftext ("join_team allies")
$player[local.i] stufftext ("say MELTED A PLAYER FOR THE ALLIES")
self.isfrozen = 0
self.revive = 0
}
}
}
}
waitframe
}
//--------------------------------------------------------------
//| Delete Frozen's |
//| This deletes the frozen body when |
//| self.isfrozen is set to 0 |
//| |
//| The Spectator Mode should auto-matically disable |
//--------------------------------------------------------------
if(self.isfrozen == 0 )
{
local.angle = local.ent.angle
self tele local.ent.origin
self.ent delete
local.ent.beams delete
}
self show
self physics_on
wait 3
self solid
self takedamage
end
//--------------------------------------------------------
//--------------------------------------------------------------
//| Spectator Mode |
//| This is enabled and keeps a player in spectator until he is|
//| Melted another player |
//| |
//| As of now the spectator can only veiw real players |
//--------------------------------------------------------------
spectator:
while(self.isfrozen == 1)
{
self iprint "--Spectator Mode--"
self iprint "You are frozen and must wait for someone to melt you"
self spectator
wait 0.5
}
end
//--------------------------------------------------------
counter_setup:
while(1)
{
level.alliesteam = 0
level.axisteam = 0
waitframe
for(local.i=1;local.i <= $player.size;local.i++)
{
if($player[local.i].dmteam == "axis")
level.axisteam++
else if($player[local.i].dmteam == "allies")
level.alliesteam++
}
hud_counter:
while(1)
{
huddraw_align 200 left bottom
huddraw_font 200 facfont-20
huddraw_rect 200 40 -140 100 100
huddraw_color 200 1 1 1
huddraw_alpha 200 1
huddraw_string 200 ("Axis: " + level.axisteam)
huddraw_align 201 left bottom
huddraw_font 201 facfont-20
huddraw_rect 201 40 -115 100 100
huddraw_color 201 1 1 1
huddraw_alpha 201 1
huddraw_string 201 ("Allied: " + level.alliesteam)
huddraw_shader 202 ("textures/hud/allies")
huddraw_align 202 left bottom
huddraw_rect 202 10 -120 25 25
huddraw_color 202 1 1 1
huddraw_alpha 202 1.0
huddraw_shader 203 ("textures/hud/axis")
huddraw_align 203 left bottom
huddraw_rect 203 10 -145 25 25
huddraw_color 203 1 1 1
huddraw_alpha 203 1
}
wait .5
end
//----------------------------------------------------------------------
player_ai_model:
switch(self.model)
{
models/player/allied_airborne.tik:
local.ent = human/multiplayer_allied_airborne_soldier.tik
break
models/player/allied_pilot.tik:
local.ent = human/multiplayer_allied_pilot.tik
break
models/player/allied_sas.tik:
local.ent = human/multiplayer_allied_oss_man.tik
break
models/player/american_army.tik:
local.ent = human/multiplayer_allied_airborne_soldier.tik
break
models/player/american_ranger.tik:
local.ent = human/multiplayer_allied_1st-ranger_private.tik
break
models/player/german_afrika_Officer.tik:
local.ent = human/multiplayer_german_afrika_officer.tik
break
models/player/german_elite_officer.tik:
local.ent = human/multiplayer_german_elite_gestapo.tik
break
models/player/german_elite_sentry.tik:
local.ent = human/multiplayer_german_elite_sentry.tik
break
models/player/german_kradshutzen.tik:
local.ent = human/multiplayer_german_misc_kradshutzen.tik
break
models/player/german_panzer_grenadier.tik:
local.ent = human/multiplayer_german_panzer_grenadier.tik
break
models/player/german_panzer_obershutze.tik:
local.ent = human/multiplayer_german_panzer_obershutze.tik
break
models/player/german_panzer_shutze.tik:
local.ent = human/multiplayer_german_panzer_shutze.tik
break
models/player/german_panzer_tankcommander.tik:
local.ent = human/multiplayer_german_panzer_tankcommander.tik
break
models/player/german_waffenss_officer.tik:
local.ent = human/multiplayer_german_waffenss_officer.tik
break
models/player/german_waffenss_shutze.tik:
local.ent = human/multiplayer_german_waffenss_shutze.tik
break
models/player/german_wehrmacht_officer.tik:
local.ent = human/multiplayer_german_wehrmact_officer.tik
break
models/player/german_wehrmacht_soldier.tik:
local.ent = human/multiplayer_german_wehrmact_soldier.tik
break
models/player/german_winter_1.tik:
local.ent = human/multiplayer_german_winter_type1.tik
break
models/player/german_winter_2.tik:
local.ent = human/multiplayer_german_winter_type2.tik
break
models/player/german_worker.tik:
local.ent = human/multiplayer_german_misc_worker.tik
break
default:
if(self.dmteam == "allies")
local.ent = human/multiplayer_allied_airborne_soldier.tik
else
local.ent = human/multiplayer_german_wehrmact_soldier.tik
break
}
local.ent = spawn local.ent origin self.origin angles self.angles "gun" "none"
local.ent notsolid
local.ent nodamage
local.origin = self.origin
end local.ent
//#######################################################################
spawn_beam_cylinder local.origin local.radius local.color:
local.beams[0] = waitthread spawn_doublebeam (local.origin + ( local.radius 0 0 )) local.color
local.beams[1] = waitthread spawn_doublebeam (local.origin + ( -(local.radius * 0.5) (local.radius * 0.866) 0 )) local.color
local.beams[2] = waitthread spawn_doublebeam (local.origin + ( -(local.radius * 0.5) -(local.radius * 0.866) 0 )) local.color
end local.beams
//######################################################################
spawn_doublebeam local.origin local.color local.bindent:
local.beams[0] = waitthread spawn_beam (local.origin + ( 0 0 40 )) ( local.origin + ( 0 0 130 )) local.color
local.beams[1] = waitthread spawn_beam (local.origin + ( 0 0 40 )) ( local.origin + ( 0 0 -50 )) local.color
end local.beams
//######################################################################
spawn_beam local.origin local.endpoint local.color:
local.ent = spawn func_beam
local.ent.origin = local.origin
local.ent endpoint local.endpoint
local.ent minoffset 0.0
local.ent maxoffset 0.0
local.ent scale 5.0
local.ent color local.color
local.ent alpha 1.0
local.ent endalpha 0.0
local.ent numsegments 5
local.ent activate
level.origin = local.origin
end local.ent
//--------------------------------------------------------------------
Check_Win:
end
//------------------------------------------------------------------
//|HoW CAN I CHECK FOR A WIN WHEN EVERY FRAME |
//|THE TEAM COUNTER IS SET TO 0 THEN ADDED UP AGAIN |
//| |
//|Make a new counter? one that isnt as accurate? how do i do that?|
//------------------------------------------------------------------
Posted: Mon Aug 15, 2005 3:38 pm
by bdbodger
if($player[local.i].health <= 0 ) && $player[local.i].revive != 1)
Take that bracket out . Also these two if statements should be if else statements
if($player[local.i].dmteam == "axis")
{
self stopwatch 5
$player[local.i] stopwatch 5
wait 5
self stufftext ("join_team axis")
$player[local.i] stufftext ("say MELTED A PLAYER FOR THE AXIS")
self.isfrozen = 0
self.revive = 0
}
if($player[local.i].dmteam == "allies")
{
self stopwatch 5
$player[local.i] stopwatch 5
wait 5
self stufftext ("join_team allies")
$player[local.i] stufftext ("say MELTED A PLAYER FOR THE ALLIES")
self.isfrozen = 0
self.revive = 0
}
in the first if statement if true you do
self stufftext("join_team axis")
but when the second if statement runs you switch them back again it should be like this
Code: Select all
if($player[local.i].dmteam == "axis")
{
self stopwatch 5
$player[local.i] stopwatch 5
wait 5
self stufftext ("join_team axis")
$player[local.i] stufftext ("say MELTED A PLAYER FOR THE AXIS")
self.isfrozen = 0
self.revive = 0
}
else
{
if($player[local.i].dmteam == "allies")
{
self stopwatch 5
$player[local.i] stopwatch 5
wait 5
self stufftext ("join_team allies")
$player[local.i] stufftext ("say MELTED A PLAYER FOR THE ALLIES")
self.isfrozen = 0
self.revive = 0
}
}