What do i write if waittill death doesnt work?

Post your scripting questions / solutions here

Moderator: Moderators

Master-Of-Fungus-Foo-D
Muffin Man
Posts: 1544
Joined: Tue Jan 27, 2004 12:33 am
Location: cali, United States

What do i write if waittill death doesnt work?

Post 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? :)
Image
The Fungus Theme song!!!

Code: Select all

while (local.player istouching self)
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post 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.
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
Master-Of-Fungus-Foo-D
Muffin Man
Posts: 1544
Joined: Tue Jan 27, 2004 12:33 am
Location: cali, United States

Post by Master-Of-Fungus-Foo-D »

what about <= 0? and how would i write that when if (parm.other.health <= 0 doesnt work?
Image
The Fungus Theme song!!!

Code: Select all

while (local.player istouching self)
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post 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
}
}
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post 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 .
Image
Grassy
First Lieutenant
Posts: 221
Joined: Sun Aug 22, 2004 11:36 am

Post by Grassy »

Yep Wacko is on the money!
or try;
local.player = parm.other
if!(isAlive local.player)
{
do some stuff
}
An ambiguous question will get a similar answer...
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

I've already said this - viewtopic.php?t=9855#74736.
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
Master-Of-Fungus-Foo-D
Muffin Man
Posts: 1544
Joined: Tue Jan 27, 2004 12:33 am
Location: cali, United States

Post 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
Image
The Fungus Theme song!!!

Code: Select all

while (local.player istouching self)
Green Beret
Major General
Posts: 746
Joined: Mon Apr 19, 2004 12:21 pm
Contact:

Post 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.
Image
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

Select the "Search for all terms" option. It's all explained on the search page.
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
Master-Of-Fungus-Foo-D
Muffin Man
Posts: 1544
Joined: Tue Jan 27, 2004 12:33 am
Location: cali, United States

Post 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 ;)
Image
The Fungus Theme song!!!

Code: Select all

while (local.player istouching self)
Green Beret
Major General
Posts: 746
Joined: Mon Apr 19, 2004 12:21 pm
Contact:

Post 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
Image
Grassy
First Lieutenant
Posts: 221
Joined: Sun Aug 22, 2004 11:36 am

Post 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
An ambiguous question will get a similar answer...
Master-Of-Fungus-Foo-D
Muffin Man
Posts: 1544
Joined: Tue Jan 27, 2004 12:33 am
Location: cali, United States

Post by Master-Of-Fungus-Foo-D »

sweet grassy! thx.. ill see if this works :mrgreen:
Image
The Fungus Theme song!!!

Code: Select all

while (local.player istouching self)
Master-Of-Fungus-Foo-D
Muffin Man
Posts: 1544
Joined: Tue Jan 27, 2004 12:33 am
Location: cali, United States

Post 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
Image
The Fungus Theme song!!!

Code: Select all

while (local.player istouching self)
Post Reply