func_beam problem

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
User avatar
MPowell1944
Moderator
Posts: 287
Joined: Thu Jan 09, 2003 7:06 am
Location: Woodstock, GA
Contact:

func_beam problem

Post 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
Rindog
Corporal
Posts: 29
Joined: Wed Sep 24, 2003 6:34 pm

Post 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.
User avatar
MPowell1944
Moderator
Posts: 287
Joined: Thu Jan 09, 2003 7:06 am
Location: Woodstock, GA
Contact:

Post 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.
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 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).
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

you might try getting the tag position of one of the players bones instead of useing the origin .
Image
Post Reply