I need to draw the effect TeslaZap between my players position, and between a trace hit position, for some reason my method just isn't working and i'd like to see how you all would do it because my way doesn't work.
[b][url=http://wiki.garrysmod.com/?title=CEffectData.SetStart]CEffectData.SetStart [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
[b][url=http://wiki.garrysmod.com/?title=CEffectData.SetOrigin]CEffectData.SetOrigin [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
No guarantees that the effect is made to use 2 points.
Is the origin the ending point, because this is the method i'm already using? And can you give me the name of a effect that does use two points for sure, so i can determine if it's my effect or not.
it was the effect, I guess the wiki lies to you.
[QUOTE=LauScript;27794967]Is the origin the ending point, because this is the method i'm already using? And can you give me the name of a effect that does use two points for sure, so i can determine if it's my effect or not.
it was the effect, I guess the wiki lies to you.[/QUOTE]
It's worse than GLADOS sometimes :S
Sorry to raise a year old thread, but I've come across the same issue and I've been looking everywhere for a fix. The quantum storage device does it this way and from what I've seen from the source sdk this is true, but nothing appears.
All I can think is that I'm not mounting a certain required game for it. Anyone else have any ideas? I'm going to try to find dog's gravgun effect.
[lua]
local eff = EffectData()
eff:SetEntity(self.Entity)
eff:SetStart(self.Entity:GetPos())
eff:SetOrigin(v:GetPos()+Vector(0,0,40))
eff:SetScale(5)
util.Effect("TeslaZap", eff)
[/lua]
[editline]1st August 2012[/editline]
nevermind dog's effect is just env_beams so I guess I'll try those.
Try using SetEntIndex instead of SetEntity.
Nothing. Also, "test_dispatcheffect teslazap 700 8 99 10" in console doesn't work either. Does it do anything for you? I guess I could be missing a game, but I doubt it. I'll download gmod beta and see if it works in there. If it doesn't I'll ask garry.
[lua]
local eff = EffectData()
eff:SetEntIndex(self.Entity:EntIndex())
eff:SetOrigin(self.Entity:GetPos()+Vector(0,0,200))
eff:SetAttachment(0)
eff:SetScale(5)
util.Effect("TeslaZap", eff)
[/lua]
Does Nothing. And
[quote=garry]still exists[/quote]
So idk if it's broken or if a material is missing or what. Can someone try it and tell me if it works for you?
This is how it works for c++
[code]
void CNPC_AttackHelicopter::CreateZapBeam( const Vector &vecTargetPos )
{
CEffectData data;
data.m_nEntIndex = entindex();
data.m_nAttachmentIndex = 0; // m_nGunTipAttachment;
data.m_vOrigin = vecTargetPos;
data.m_flScale = 5;
DispatchEffect( "TeslaZap", data );
}
[/code]
This is the effect
[code]
//-----------------------------------------------------------------------------
// Purpose: Tesla effect
//-----------------------------------------------------------------------------
void FX_BuildTeslaZap( const CEffectData &data )
{
// Build the tesla, only works on entities
C_BaseEntity *pEntity = data.GetEntity();
if ( !pEntity )
return;
Vector vColor( 1, 1, 1 );
BeamInfo_t beamInfo;
beamInfo.m_nType = TE_BEAMTESLA;
beamInfo.m_pStartEnt = pEntity;
beamInfo.m_nStartAttachment = data.m_nAttachmentIndex;
beamInfo.m_pEndEnt = NULL;
beamInfo.m_vecEnd = data.m_vOrigin;
beamInfo.m_pszModelName = "sprites/physbeam.vmt";
beamInfo.m_flHaloScale = 0.0;
beamInfo.m_flLife = 0.3f;
beamInfo.m_flWidth = data.m_flScale;
beamInfo.m_flEndWidth = 1;
beamInfo.m_flFadeLength = 0.3;
beamInfo.m_flAmplitude = 16;
beamInfo.m_flBrightness = 200.0;
beamInfo.m_flSpeed = 0.0;
beamInfo.m_nStartFrame = 0.0;
beamInfo.m_flFrameRate = 1.0;
beamInfo.m_flRed = vColor.x * 255.0;
beamInfo.m_flGreen = vColor.y * 255.0;
beamInfo.m_flBlue = vColor.z * 255.0;
beamInfo.m_nSegments = 20;
beamInfo.m_bRenderable = true;
beamInfo.m_nFlags = 0;
beams->CreateBeamEntPoint( beamInfo );
}
DECLARE_CLIENT_EFFECT( "TeslaZap", FX_BuildTeslaZap );
[/code]
So maybe this could be the lua equivalent. I'll try it when I get home.
[lua]for i = 1, 20 do
local tesla = ents.Create("env_beam")
tesla:SetKeyValue("Radius","10")
tesla:SetKeyValue("BoltWidth","2")
tesla:SetKeyValue("NoiseAmplitude","16")
tesla:SetKeyValue("framerate","1")
tesla:SetKeyValue("rendercolor","255 255 255")
tesla:SetKeyValue("renderamt","200")
tesla:SetKeyValue("life",".3")
tesla:SetKeyValue("texture","sprites/physbeam.vmt")
tesla:SetKeyValue("spawnflags","1")
tesla:SetEntity("LightningStart",ent1)
tesla:SetEntity("LightningEnd",ent2)
tesla:Spawn()
end
[/lua]
Tried this.
[lua]
hook.Add("EntityTakeDamage","Damage",function(vic,wep,att)
for i = 1, 20 do
local tesla = ents.Create("env_beam")
tesla:SetKeyValue("Radius","10")
tesla:SetKeyValue("BoltWidth","2")
tesla:SetKeyValue("NoiseAmplitude","16")
tesla:SetKeyValue("framerate","1")
tesla:SetKeyValue("rendercolor","255 255 255")
tesla:SetKeyValue("renderamt","200")
tesla:SetKeyValue("life",".3")
tesla:SetKeyValue("texture","sprites/physbeam.vmt")
tesla:SetKeyValue("spawnflags","1")
tesla:SetEntity("LightningStart",vic)
tesla:SetEntity("LightningEnd",att)
tesla:Spawn()
end
end)
[/lua]
The env_beams are created but nothing is getting rendered. Could someone who has used env_beam tell me the problem? I know sprites/physbeam isn't missing from the game because I can set entity's materials it with the material tool, but it isn't showing in mat_texture_list when the env_beams are created and it shows when I set an entity's material to it. I've tried both sprites/physbeam.vmt and sprites/physbeam for the env_beams.
[QUOTE=thegrb93;37061526]Tried this.
[lua]
hook.Add("EntityTakeDamage","Damage",function(vic,wep,att)
for i = 1, 20 do
local tesla = ents.Create("env_beam")
tesla:SetKeyValue("Radius","10")
tesla:SetKeyValue("BoltWidth","2")
tesla:SetKeyValue("NoiseAmplitude","16")
tesla:SetKeyValue("framerate","1")
tesla:SetKeyValue("rendercolor","255 255 255")
tesla:SetKeyValue("renderamt","200")
tesla:SetKeyValue("life",".3")
tesla:SetKeyValue("texture","sprites/physbeam.vmt")
tesla:SetKeyValue("spawnflags","1")
tesla:SetEntity("LightningStart",vic)
tesla:SetEntity("LightningEnd",att)
tesla:Spawn()
end
end)
[/lua]
The env_beams are created but nothing is getting rendered. Could someone who has used env_beam tell me the problem? I know sprites/physbeam isn't missing from the game because I can set entity's materials it with the material tool, but it isn't showing in mat_texture_list when the env_beams are created and it shows when I set an entity's material to it. I've tried both sprites/physbeam.vmt and sprites/physbeam for the env_beams.[/QUOTE]
it's probably becuase you're using a .vmt and not a .spr try "sprites/laserbeam.spr" and see if that works also try adding a tesla:Activate() under the spawn as well
Sorry, you need to Log In to post a reply to this thread.