Page 1 of 2

What do i write if waittill death doesnt work?

Posted: Wed Mar 09, 2005 9:58 pm
by Master-Of-Fungus-Foo-D
ell what do i write? I mean, if

Code: Select all

parm.other waitill death
doesnt work and

Code: Select all

if (parm.other.health == 0)
or 
while (parm.other.health == 0)
is crap what do i write to check if a player is dead.. i dont want to put a timelimit to my mod but i want to remove the stuff i glue to him when he dies...

any suggestions? :)

Posted: Wed Mar 09, 2005 10:52 pm
by lizardkid
waittill death doesnt work for players. also the health goes into the negatives, it isnt capped at zero (i think) so < 1 might be a better option.

Posted: Wed Mar 09, 2005 11:17 pm
by Master-Of-Fungus-Foo-D
what about <= 0? and how would i write that when if (parm.other.health <= 0 doesnt work?

Posted: Thu Mar 10, 2005 12:10 am
by wacko
why not something using isalive like

Code: Select all

for (local.i=1; local.i<=$player.size; local.i++) 
{ 
if !(isAlive $player[local.i])
{
remove the stuff
}
}

Posted: Thu Mar 10, 2005 6:57 am
by bdbodger
parm.other is a variable set by the game and changes every time a trigger is triggered so

if (parm.other.health == 0)

would not work anyway since a player with 0 health could not trigger a trigger .

Posted: Thu Mar 10, 2005 7:48 am
by Grassy
Yep Wacko is on the money!
or try;
local.player = parm.other
if!(isAlive local.player)
{
do some stuff
}

Posted: Thu Mar 10, 2005 1:31 pm
by Rookie One.pl
I've already said this - viewtopic.php?t=9855#74736.

Posted: Fri Mar 11, 2005 12:39 am
by Master-Of-Fungus-Foo-D
i used the search button but i forgot what it was called... or i didnt see it :? cant remember

Posted: Fri Mar 11, 2005 1:42 am
by Green Beret
thats the sucky thing abou tthe search.you search for waittill death,youll get every post with waittill in it,so i choose the least amount of info as possible.
like iprintln
instead of iprint text options.
the second search would get you all kinds of unwanted posts.

Posted: Fri Mar 11, 2005 11:32 am
by Rookie One.pl
Select the "Search for all terms" option. It's all explained on the search page.

Posted: Fri Mar 18, 2005 1:10 am
by Master-Of-Fungus-Foo-D
nope it dont work (wacko)

Code: Select all

for (local.i=1; local.i<=$player.size; local.i++)
{
if !(isAlive $player[local.i])
{
setcvar "cg_3rd_person" "0"
level.allieshasspy--
}
}
}
}// the extra two are for my above script ;)

Posted: Fri Mar 18, 2005 1:57 am
by Green Beret
does this help any?


dead:

while(1)
{
wait .5
for ( local.i = 1; local.i <= $player.size; local.i++ )
{
if !( IsAlive $player[local.i] && $player[local.i].died != 1)
{
$player[local.i].dead = 1
$player[local.i].died = 1
$player[local.i] thread death $player[local.i]
}
}
}
end
death local.guy:
if ( local.guy.dead == 1 && IsAlive local.guy )
{
local.guy.dead = 0
local.guy.died = 0
//code.this will happen on respawn
local.guy iprint "i respawned"//example
}
end

Posted: Fri Mar 18, 2005 8:59 am
by Grassy
Fungus, do you just want to monitor a player who has used a trigger?
Why do you need to monitor all connected players?

If it's monitoring a player who has used a trigger and has something bound or glued to him then this example works very well and is a lot simpler than scanning all irelevant players status.

This is a small part of a CTF game I made, but it will give you the idea.
The player only has a light put on him, but could also be something glued.

Code: Select all

//---------------------------------------------------------------------------
monitor_axis_object:
//---------------------------------------------------------------------------
  $axtrig waittill trigger
  local.player = parm.other
 
  if ((local.player.dmteam==allies) && (level.axisobj_stolen == 0) && (isAlive local.player))
  {
    local.player iprint "You must get the Captains Statue back to your stronghold as quickly as you can!"
    $axtrig delete
    $axisent delete
    
    level.axisobj_stolen = 1
    level.axisobj_carried = 1
    
    local.player light 0 0 1 100   // = blue
    local.player lighton
    iprintlnbold_noloc "The Allied Captains Statue has been stolen back!"
    waitthread al_checkloop local.player
  }
//rest of routine etc etc...

end

//---------------------------------------------------------------------------
al_checkloop local.player:
//---------------------------------------------------------------------------
    while(! level.axisobj_stolen==0)
    {
      if (! isAlive local.player )
      {
        // player died or dropped it
        waitthread axisobject local.player.origin
        level.axisobj_carried = 0
        iprintlnbold_noloc "The Captains Statue has been dropped somewhere"
        local.player lightoff
        break
      }
      if (local.player isTouching $axisjailbox)
      {
        waitthread axisobject local.player.origin
        level.axisobj_carried = 0
        iprintlnbold_noloc "Allies have their Captains Statue back in their stronghold.."
        local.player lightoff
        level.axisobj_stolen = 0
        wait 2
        teamwin allies
        end
      }
      wait 1
    }
end    
Grassy

Posted: Fri Mar 18, 2005 11:34 am
by Master-Of-Fungus-Foo-D
sweet grassy! thx.. ill see if this works :mrgreen:

Posted: Fri Mar 18, 2005 11:50 am
by Master-Of-Fungus-Foo-D
crap it didnt work :evil:
heres the whole enchilada... heres the setthread....

Code: Select all

airborne:
if (level.axishasspy != 3)
{
println "Be the otherteam... BE the other team :) "
local.lt = parm.other
if (local.pvt.dmteam == "axis" )
{
level.axishasspy++
setcvar "cg_3rd_person" "1" //debug 
local.lt takeall
local.lt model "player/allied_airborne.tik"
local.lt item weapons/colt45.tik
local.lt item weapons/BAR.tik
local.lt ammo mg 60
local.lt ammo pistol 4
local.lt useweaponclass mg
    while(level.axishasspy>0)
    {
      if (! isAlive local.lt )
      {
        setcvar "cg_3rd_person" "0"
        level.axishasspy--
        break
      }
}
}
    }
end