2 Questions

Post your scripting questions / solutions here

Moderator: Moderators

Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

Rookie One wrote:No, Bjarne, this is exactly the same issue as I described in my previous post - it will be triggered before you choose the weapon.
Yes, but I was thinking that you use the scanner to test until the player has selected a weapon... and when a weapn has been selected: set the runspeed and mark the player as processed.

This presuppses that you can query the player for info on its weapon, but that part you are probably better informed on than me.
Admin .MAP Forums
Image
Head above heels.
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Rookie One wrote:Nah, I tell you, this doesn't work! :evil: Here's my thread:

Code: Select all

waitTillJoinGame:
   while (self.dmteam == "spectator" || !isAlive(self))
      waitframe
   local.trigger = spawn trigger_multiple origin self.origin
   local.trigger setsize ( -16 -16 -16 ) ( 16 16 16 )
   local.trigger waittill trigger
   self thread global/enemyterritory/class_handler.scr::determineClass
   self thread waitTillDeath
end
The determineClass thread reads the weapon the player's carrying and gives him a new, class-specific loadout, but it's called right at the moment of choosing a team... Aaargh!!! :evil: :evil: :evil:
Try it like this:

Code: Select all

waitTillJoinGame:
   while (self && (self.dmteam == "spectator" || !isAlive(self)))
      waitframe

   if(self) // just checks if player didn't leave battle
  {
     local.trigger = spawn trigger_multiple
     local.trigger setsize ( -16 -16 -16 ) ( 16 16 16 )
     local.trigger glue self
     local.chosen_team = self.dmteam
     while(self && self.dmteam == local.chosen_team)
     {
        local.trigger waittill trigger
        if(parm.other == self)
          break
     }

     local.trigger remove

     if(self && self.dmteam == local.chosen_team)
     {
       self thread global/enemyterritory/class_handler.scr::determineClass
       self thread waitTillDeath
     }
  }
end
I think this will work... only small problem would be if a player leaves when the thread is waiting for a trigger event... could fix that with a thread that does something along the lines of local.trigger activate $world after a given delay too 8-)
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 »

I don't quite get this, but...

What I've done is this: I've got a loop that waits a frame till the player joins a team or becomes alive. When he does, there's another loop that tries to set the class and it stops only when this is done. However, jv_map told me not to abuse weapon checking since it can cause lags and I wanted to avoid it... :( But what Elgan said is quite interesting. How to find out player's current leg state? When you're actually spawned you first land on the ground, right?
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
Elgan
Site Admin
Posts: 890
Joined: Tue Apr 13, 2004 10:43 pm
Location: uk
Contact:

Post by Elgan »

you u land when u spawn.
I mean like set some player flags and only when they have joined a team and landed do blah.



i dont think waitforstate works :( so u wud have to mess with exec scripts etc.

if u can work it maybe it wud be better to use jv's thing. I dunno. i want a muffin
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 »

jv_map wrote:I think this will work... only small problem would be if a player leaves when the thread is waiting for a trigger event... could fix that with a thread that does something along the lines of local.trigger activate $world after a given delay too 8-)
Sure it works... :?

Code: Select all

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached

trigger_multiple::glue : Cannot glue to master because of: MAX_GLUE_CHILDREN reached
And still nothing happens! :evil:
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

How often is waitTillJoinGame called?
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 »

I'm not sure myself how many times it was called... There was a bug that made the whole script execute a few times. :? And the cause was putting it into DMprecache.scr - it's called by the map script and then by the *_precache.scr... I removed the script call from there and now it's just called from the map script. I discovered this bug when I was spawning a player's model after his death (similar to what Mefy does in freeze tag) - when I looked at the model, the fps dropped from like 100 to 2,5... :shock:

Anyway, I'm still working on this. However, I'm sure the trigger method didn't work. Will post something when I got some other things running smoothly.
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
Post Reply