Bully-Board
Bully Modding Section => Modding Questions/Help => Topic started by: Ming on July 05, 2021, 04:20:54 PM
-
HitEffect = function()
for NPC,Ped in {PedFindInAreaXYZ(0, 0, 0, 99999)} do
if PedIsHit(Ped) and PedIsValid(Ped) then
local hX, hY, hZ = PedGetHeadPos(Ped)
local Effect1 = EffectCreate("GymLightSmash", hX, hY, hZ)
EffectSlowKill(Effect1, 0.7)
end
Wait(0)
end
end
Why sometimes there is no trigger effect when Ped is attacked
-
Your code as-is doesn't work at all for me.
It just runs once and then stops working.
You want to put it in a loop and remove that "Wait(0)" from the for statement. I've never seen it used there.
while true do
for NPC,Ped in {PedFindInAreaXYZ(0, 0, 0, 99999)} do
if PedIsHit(Ped) and PedIsValid(Ped) then
local hX, hY, hZ = PedGetHeadPos(Ped)
local Effect1 = EffectCreate("GymLightSmash", hX, hY, hZ)
EffectSlowKill(Effect1, 0.7)
end
end
Wait(0)
end
This works fine.
-
Your code as-is doesn't work at all for me.
It just runs once and then stops working.
You want to put it in a loop and remove that "Wait(0)" from the for statement. I've never seen it used there.
while true do
for NPC,Ped in {PedFindInAreaXYZ(0, 0, 0, 99999)} do
if PedIsHit(Ped) and PedIsValid(Ped) then
local hX, hY, hZ = PedGetHeadPos(Ped)
local Effect1 = EffectCreate("GymLightSmash", hX, hY, hZ)
EffectSlowKill(Effect1, 0.7)
end
end
Wait(0)
end
This works fine.
Thank you so much