Page 3 of 5
Posted: Tue Mar 16, 2004 2:00 pm
by dcoshea
Uh-oh, I think there might be a problem - I thought you could cue a camera just for one player, but the 'cuecamera' command applies to a ScriptThread object so I guess it's not specific to a player, it probably applies to everyone on the server? Can anyone confirm/deny this?
Regards,
David
Posted: Tue Mar 16, 2004 2:57 pm
by small_sumo
Yeah I think tom was telling me that the other day. Would you be a pal dcoshea and write me some code so I can test the quick switch to third person and back at death, at least it would save you from the "oh I'm shot I must look up at the sky". It just has to be better.

Posted: Tue Mar 16, 2004 3:09 pm
by dcoshea
I'm not sure how to just switch to 3rd person view. I know there's that "cg_3rd_person" variable, but if I "stufftext cg_3rd_person 1" to the player, will the player just see an error in their console saying it's a cheat-protected variable? I'm not sure. Someone (I think bdbodger (sp?)) mentioned something about setting this, so perhaps it works!
This code isn't tested and assumes that you CAN set "cg_3rd_person" via "stufftext". I hope it works for you, sorry I don't have time to test it or at least check if that "cg_3rd_person" stuff works. You can wait for me to test it if you like
Code: Select all
//
// First, code to detect when the player has died.
// NOTE: I'm not sure if this will accurately detect player death or not.
//
player_death_detect:
local.ALIVE = 1
local.DEAD = 2
while (1) {
for (local.i = 1; local.i <= $player.size; local.i++) {
local.player = $player[local.i]
if (!local.player.death_detect_state) {
//
// We haven't seen this player before, so
// initialise them to whatever their current
// state is. We treat their initial state as
// neither alive nor dead so we don't treat
// them as having just died at the start of
// the game.
//
if (isalive local.player) {
local.player.death_detect_state = local.ALIVE
} else {
local.player.death_detect_state = local.DEAD
}
} else {
if (local.player.death_detect_state == local.ALIVE
&& !isalive local.player) {
//
// Player just died
//
local.player.death_detect_state = local.DEAD
local.player thread player_died
} else if (local.player.death_detect_state == local.DEAD
&& isalive local.player) {
//
// Player is alive again
//
local.player.death_detect_state = local.ALIVE
}
}
}
wait 0.1
}
end
//
// player_died -
//
// Called when a player has died. self points to the Player object.
//
player_died:
self stufftext "cg_3rd_person 1"
// or should it be: self stufftext "cg_3rd_person" "1"
// I think the un-commented code is correct
wait 5
self stufftext "cg_3rd_person 0"
end
I hope it works without wasting too much of your time
Regards,
David
Posted: Tue Mar 16, 2004 3:41 pm
by small_sumo
Oh great thanks man, I will take it for a test drive tomorrow. I have 2 pcs here and will be able to give it a good go.

Posted: Tue Mar 23, 2004 10:48 am
by small_sumo
Ok thanks for your effort thus far, I have an error as follows.......
bad token:
TOKEN_LOGICAL_AND:
&&
&& !isalive local.player) { (maps/obj/obj_sumomod.scr, 41)
^
^~^~^ Script file compile error: Couldn't parse 'maps/obj/obj_sumomod.scr'
^~^~^ Game (Event: 'setthread', Object: 'Trigger') : Script 'maps/obj/obj_sumomod.scr' was not properly loaded
0 teams with 0 entities
ScriptMaster::GetScript: Script 'maps/obj/obj_sumomod.scr' was not properly loaded
I hope to get a reply, maybe we can work through it.
Thanks heaps.

Posted: Tue Mar 23, 2004 12:04 pm
by dcoshea
small_sumo wrote:Ok thanks for your effort thus far, I have an error as follows.......
bad token:
TOKEN_LOGICAL_AND:
&&
&& !isalive local.player) { (maps/obj/obj_sumomod.scr, 41)
^
I guess that is in this code:
Code: Select all
if (local.player.death_detect_state == local.ALIVE
&& !isalive local.player) {
//
// Player just died
//
local.player.death_detect_state = local.DEAD
local.player thread player_died
} else if (local.player.death_detect_state == local.DEAD
&& isalive local.player) {
Maybe the MOH script parser is stupid and can't handle lines that are split into two, and you should combine the lines starting with the '&&'s with the lines above them, i.e.:
Code: Select all
if (local.player.death_detect_state == local.ALIVE && !isalive local.player) {
//
// Player just died
//
local.player.death_detect_state = local.DEAD
local.player thread player_died
} else if (local.player.death_detect_state == local.DEAD && isalive local.player) {
Sorry about that, I stupidly assumed it was like C and not sensitive to line breaks, I guess I was wrong
Regards,
David
Posted: Tue Mar 23, 2004 1:40 pm
by jv_map
Yup sadly it has to be on 1 line

that also explains why you don't need to use semicolons ( ; ) at the end of each line (though you may add them without harming anything).
Posted: Tue Mar 23, 2004 2:09 pm
by dcoshea
jv_map wrote:Yup sadly it has to be on 1 line

that also explains why you don't need to use semicolons ( ; ) at the end of each line.
D'oh that never occured to me, thanks
Regards,
David
Posted: Sun Mar 28, 2004 5:46 pm
by small_sumo
Well ok I will make the adjustments and see how it goes. bdbodger did this for me and its quite good, what do you think? He sends to to spectator mode, but he is affraid it will cheese players off, I like how it shows you who killed you and where he did it from.
Check it out.
// SOUTHERN FRANCE
// ARCHITECTURE: SENN
// SCRIPTING: POWZER
main:
// set scoreboard messages
setcvar "g_obj_alliedtext1" "Southern France"
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" ""
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" ""
setcvar "g_scoreboardpic" "mohdm1"
// 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
level.script = maps/dm/mohdm1.scr
exec global/ambient.scr mohdm1
//exec global/ambient.scr mohdm2
//$world farplane 5000
//$world farplane_color (.333 .333 .329)
thread new_button ( 978 -7 75 ) ( 0 180 90 ) ( -1093.74 -829.67 448.13)
thread new_button ( 1014 -450.80 75 ) ( 0 90 90 ) ( -1093.74 -829.67 448.13)
thread player_death_detect
end
//-----------------------------------------------------------------------------
roundbasedthread:
// Can specify different scoreboard messages for round based games here.
level waitTill prespawn
level waittill spawn
// set the parameters for this round based match
level.dmrespawning = 0 // 1 or 0
level.dmroundlimit = 5 // round time limit in minutes
level.clockside = kills // set to axis, allies, kills, or draw
level waittill roundstart
end
//----------------------------------------------------------
new_button local.origin local.angles local.telepos:
local.ent = spawn script_model
local.ent model models/lights/ceilinglamp1.tik
local.ent.origin = local.origin
local.ang = local.angles
local.ang[2] = 0
local.ent.angles = local.ang
local.pos = (local.ent.origin + (local.ent.rightvector * 2))
local.ent.angles = local.angles
local.ent notsolid
local.ent dmg 0
local.ent scale 0.75
local.light = spawn script_model model "fx/corona_red.tik"
local.light hide
local.light.origin = local.ent.origin
local.light light 1 0 0 200
local.light lightoff
local.trigger = spawn trigger_use
local.trigger setsize ( -60 -60 -60 ) ( 60 60 60 )
local.trigger.origin = local.ent.origin
while(1)
{
local.trigger waittill trigger
local.player = parm.other
wait 3
if(local.player.useheld)
{
local.light show
local.light lighton
local.ent playsound alarm_switch //med_canteen
local.org = local.ent.origin
local.ent moveTo local.pos
local.ent move
wait 2
local.light lightOff
local.light hide
local.distance = ( vector_length( local.ent.origin - local.player.origin) + 128 )
while((local.player.useheld) && (vector_length( local.ent.origin - local.player.origin) < local.distance) && ( local.player.fireheld != 1))
waitframe
local.ent moveTo local.org
local.ent waitmove
wait 1
local.player tele local.telepos
}
}
end
//----------------------------------------------------------
player_death_detect:
spawn human/german_elite_gestapo.tik origin ( 633.19 -293.52 0.12)
local.ALIVE = 1
local.DEAD = 2
while (1)
{
for (local.i = 1; local.i <= $player.size; local.i++)
{
local.player = $player[local.i]
if (!local.player.death_detect_state)
{
if (isalive local.player)
{
local.player.death_detect_state = local.ALIVE
}
else
{
local.player.death_detect_state = local.DEAD
}
}
else
{
if (local.player.death_detect_state == local.ALIVE && !isalive local.player)
{
local.player.death_detect_state = local.DEAD
local.player thread player_died
}
else
{
if (local.player.death_detect_state == local.DEAD && isalive local.player)
local.player.death_detect_state = local.ALIVE
}
}
}
wait 0.1
}
end
//----------------------------------------------------------
player_died:
local.org = self.origin + ( 64 64 196)
local.angles = vector_toangles ( self.origin - local.org )
self stufftext "spectator"
self tele local.org
self.viewangles = local.angles
end
//----------------------------------------------------------
Posted: Sun Mar 28, 2004 7:57 pm
by agentmad007
mmm looks nice that kill cam story and is ti work really the script you just posted?
Posted: Mon Mar 29, 2004 11:27 am
by dcoshea
small_sumo wrote:He sends to to spectator mode, but he is affraid it will cheese players off, I like how it shows you who killed you and where he did it from.
How does it show you who killed you?
player_died:
local.org = self.origin + ( 64 64 196)
local.angles = vector_toangles ( self.origin - local.org )
self stufftext "spectator"
self tele local.org
self.viewangles = local.angles
It looks like it just makes you look at your dead body from a location above and offset a bit? I don't see how the script takes into account who killed you or anything? Sorry if I'm missing something obvious here!
Regards,
David
Posted: Mon Mar 29, 2004 1:24 pm
by bdbodger
It does not show you who killed you . You are right it just lets you see the spot you died and maybe who killed you . It is what it is nothing really spectaular . I never claimed it was anything more .
Posted: Mon Mar 29, 2004 2:23 pm
by small_sumo
Well I did a test on my 2 pcs here at home on lan and each time you are killed you spectate the guy who shot you ...........
What more can I say it's just awesome.
Posted: Mon Mar 29, 2004 11:42 pm
by dcoshea
Ok thanks for the confirmation Bdbodger!
small_sumo wrote:Well I did a test on my 2 pcs here at home on lan and each time you are killed you spectate the guy who shot you ...........
I guess that's because you only had two players
Code: Select all
player_died:
local.org = self.origin + ( 64 64 196)
local.angles = vector_toangles ( self.origin - local.org )
self stufftext "spectator"
self tele local.org
self.viewangles = local.angles
From Bdbodger's code there, I'm guessing he was hoping that when you issue "spectator", you'll be in free spectate mode where you can move to wherever you want, and hence he was teleporting you to somewhere where you could look at your corpse from (I was wondering if "tele" made your corpse move too). I guess from what you say above, small_sumo, it actually puts you into the mode where you spectate another player on the server

I wonder if there's a way to get directly into the free spectate mode? I don't see anything in the game classes
I wonder if you could not put the player in spectator mode, but quickly set their viewangles to be looking at the shooter, and until they're automatically moved to spectator (in the case of a round-based map - how quick does that happen?) they'll be looking at where they were shot from?
Regards,
David
Posted: Tue Mar 30, 2004 3:08 am
by bdbodger
well that bit of code still need work the command self stufftext "spectator" does put you in to spectator mode that is what is annoying about it . You will have to rechoose gun and team you can't just click the fire button and respawn . In this mode you can move like in noclip mode but you can't freelook either because of the viewangles statement or just that fact you are in spectator mode . I didn't know of an easy way to find who shot you are at least what direction you where shot from .