• EffectData Help
    4 replies, posted
Okay so basically I'm trying to create a sphere around an Entity now the sphere is working 100% fine, my only problem is that the Effect i am using needs to be removed the same time as the entity does. But there are multiple ways that the entity can be removed from the world and since this is my first time using Effects as far as i know the only way to "destroy" the effect is after it's timer ran out.. I'm just wondering if someone can steer me in the right direction (I want to try to fix it for myself, I've gone through the wiki and nothing really stood out for me about removing a EffectData before it's actually meant to) I tried doing this: [CODE] function ENT:WarningSphere(armed) local e = EffectData() if armed then e:SetOrigin(self:GetPos()) e:SetRadius(1000) e:SetMagnitude(0.5) e:SetScale(3600) end if not armed then e:SetOrigin(self:GetPos()) e:SetRadius(1000) e:SetMagnitude(0.5) e:SetScale(0.3) end util.Effect("sphere_entity", e, true) end [/CODE] I know why this didn't work, but i just am honestly stumped on what to do haha Thanks for any help guys! :3
e:SetEntity(self) in your effect init: self.myent = data:GetEntity() think: if !IsValid(self.myent) then return false end
Thank you so much, The only other problem i have is the Entity has 2 states, Armed and not Armed, Is there any way to disable it when it's not armed, because the Entity is still in the world when it's disarmed, this only deletes it on pickup. Thanks for the help so far though! :3
Use SetNWBool/GetNWBool
That you guys very much, My problem is sorted! :)
Sorry, you need to Log In to post a reply to this thread.