Page 1 of 1
Watching for player death
Posted: Mon Aug 18, 2008 5:43 am
by Wierdo
I have been looking for a suitable means on knowing when a player dies. Cannot find this info. My goal is to make a map that does the old 95 C&C game in First Person. Just like Renegade, except with weapons that are more in line with the old game. I want it so EVA says "unit lost" when an allie - or even self dies.
Already have the old style barracks and powerplant made, will make them destroyable sometime. The old music plays mapwide as well.

Posted: Tue Aug 19, 2008 1:54 am
by 211476
change death animation sound to UnitLost.wav? not very good at scripting

death animation/sound?
Posted: Tue Aug 19, 2008 2:43 am
by Wierdo
What you say could be possible, but would require altering original game files. I still want it to fit inside the pk3. Besides, if I did that, I would override pain sounds in the process.
What I have below actually works, but with issues:
Code: Select all
eva:
if ($player[local.playtm].dmteam == "allies")
{
if ($player[local.playtm].health < 1)
{
$gdi_speaker playsound lost_snd
wait 6.5
}
}
wait .5
goto eva
end
If the player lay dead for more than 6.9 seconds, the report of "Unit Lost" will occur twice. Also, I am uncertian as to how the script will handle multiple dead units.
Posted: Wed Aug 20, 2008 6:42 am
by bdbodger
I don't think that works I mean you have an undefined local variable local.playtm . This may work
Code: Select all
eva:
while(1)
{
for(local.i=1;local.i <= $player.size;local.i++)
{
if ($player[local.i].isdead == NIL && $player[local.i].dmteam == "allies" && $player[local.i].health < 1)
{
$gdi_speaker playsound lost_snd
$player[local.i].isdead = 1
}
else
{
if ($player[local.i].isdead == 1 && $player[local.i].health >= 1)
$player[local.i].isdead = NIL
}
}
waitframe
}
end
Posted: Wed Aug 20, 2008 6:48 am
by bdbodger
I don't think that works I mean you have an undefined local variable local.playtm . This may work
Code: Select all
eva:
while(1)
{
for(local.i=1;local.i <= $player.size;local.i++)
{
if ($player[local.i].isdead == NIL && $player[local.i].dmteam == "allies" && $player[local.i].health < 1)
{
$gdi_speaker playsound lost_snd
$player[local.i].isdead = 1
}
else
{
if ($player[local.i].isdead == 1 && $player[local.i].health >= 1)
$player[local.i].isdead = NIL
}
}
waitframe
}
end
Posted: Wed Aug 20, 2008 11:53 pm
by Wierdo
I don't think that works I mean you have an undefined local variable local.playtm .
It did work, although it was flooding the console with error reports every 0.1 seconds.

And the sound effect would repeat every 7 seconds unless I decided to respawn. I tried your method, and it is waaaay better. No errors. No repeats.

Posted: Thu Aug 21, 2008 7:39 am
by bdbodger
Wierdo wrote:I don't think that works I mean you have an undefined local variable local.playtm .
It did work, although it was flooding the console with error reports every 0.1 seconds.

And the sound effect would repeat every 7 seconds unless I decided to respawn. I tried your method, and it is waaaay better. No errors. No repeats.

If the If statement failed then your old code would reapeat every .5 seconds if it succeded then there was a 6.5 second wait . If your playing alone then $player is you . If another player joins it forms an array so you have $player[1] and $player[2] so I assume you where playing alone . If you play from the maplist or by typing map mymap where mymap is the name of your map then your playing in single player not MP . Just some things to think about .