Page 1 of 1

func_beam problem

Posted: Thu Feb 17, 2005 10:13 pm
by MPowell1944

Code: Select all

local.player = parm.other

local.beam = spawn func_beam origin local.start endpoint local.end maxoffset 0
local.start = $player.origin + ( 0 0 93 )
local.end = $player.origin + ( 0 0 105 )
local.beam doActivate
local.beam color (1 0 0)
local.beam.scale = 6
local.beam shader ("textures/hud/axis")
local.beam numsegments 1

while(isAlive local.player)
{
if(local.player.dmteam == "spectator")
{
local.beam remove
end
}
wait .001
local.beam.origin = local.player.origin
}
local.beam remove

end
With that code above, I am trying to spawn an axis avatar on top of an allied player when they touch said trigger. However, when I touch the trigger, the func_beam stretches from where I first spawned to where I am currently moving. Can someone have a look at that code and let me know what I am doing wrong. I want it to stay on top of my head but it won't. Check the picture to see what I am talking about.

Image

Posted: Thu Feb 17, 2005 11:34 pm
by Rindog
local.player = parm.other

local.beam = spawn func_beam
local.beam.origin = local.player.origin + ( 0 0 93 )
local.beam endpoint (local.player.origin + ( 0 0 105 ))
local.beam minoffset 0.0
local.beam maxoffset 0.0
local.beam color (1 0 0)
local.beam.scale = 6
local.beam shader ("textures/hud/axis")
local.beam numsegments 1
local.beam activate

while(isAlive local.player)
{
if(local.player.dmteam == "spectator")
{
local.beam remove
end
}
wait .001
local.beam.origin = local.player.origin + ( 0 0 93 )
local.beam endpoint = local.player.origin + ( 0 0 105 )
}
local.beam remove

end


I didn't test it, but I used Mefys CTF mod as a guide. I do know that the way you were setting the origin was part of your problem. $player.origin would be undefined in MP.

Posted: Thu Feb 17, 2005 11:57 pm
by MPowell1944
That code works good. If only the avatar's position was updated when a player crouched like a real avatar does. This beam looks like it has been attached externally, especially when I move. Even with the .001 wait, it still lags behind a player when they run.

Posted: Mon Feb 21, 2005 1:04 pm
by Rookie One.pl
I believe you can do the thing with crouching detection. AFAICR jv_map's snow contest gave you snowballs when you were crouching, so look into that.

If this mod isn't meant to be server-side only, you can do avatars that look and behave exactly like the originals by TIKIs (see jv_bot).

Posted: Mon Feb 21, 2005 2:41 pm
by bdbodger
you might try getting the tag position of one of the players bones instead of useing the origin .