sacr1ficez Posted March 5, 2019 Posted March 5, 2019 Hey, i can't make this function works. It's all about position in Vector3, no idea why this don't wanna work. Working code: createEffect(effect, Vector3(getElementPosition(getLocalPlayer())), 0, 0, 0) Not working code: createEffect(effect, Vector3(posX, posY, posZ), 0, 0, 0) Any idea why this don't wanna work? Without errors/warnings in debugscript 3, i got a output so it means that trigger works, but effect don't creates.
sacr1ficez Posted March 5, 2019 Author Posted March 5, 2019 It's weird situation, i don't really understand why it's happening. I already solved it by using client-side event. But maybe there's other solution. -- server function weaponEffects(weapon, endX, endY, endZ, hitElement, startX, startY, startZ) -- triggering custom event using onPlayerWeaponFire... addEventHandler("onPlayerWeaponFire", getRootElement(), weaponEffects) -- client function onPlayerClientWeaponFire(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement) -- creating effect with hitX, hitY, hitZ, and it magically works. addEventHandler("onClientPlayerWeaponFire", getRootElement(), onPlayerClientWeaponFire)
Moderators IIYAMA Posted March 6, 2019 Moderators Posted March 6, 2019 @majqq Did you checked if those are actual numbers? (and not strings. In that case you wouldn't see the difference in the outputChatBox.) Also you do not need to use Vector3 in the second example, it can be filled in without. That will save you another function execution. 1
sacr1ficez Posted March 6, 2019 Author Posted March 6, 2019 @IIYAMA yup. Did it multiple times. No matter if it's Vector or not. It doesn't work for data sent by trigger.
Moderators IIYAMA Posted March 6, 2019 Moderators Posted March 6, 2019 1 hour ago, majqq said: @IIYAMA yup. Did it multiple times. No matter if it's Vector or not. It doesn't work for data sent by trigger. Hmm indeed strange. And what if you re-parse it? function reParseNumber(number) return tonumber(tostring(number)) end 1
sacr1ficez Posted March 6, 2019 Author Posted March 6, 2019 1 hour ago, IIYAMA said: Hmm indeed strange. And what if you re-parse it? function reParseNumber(number) return tonumber(tostring(number)) end Same results, without creating effect. Anyway it's solved, so i'll leave as it is. local x, y, z = reParseNumber(posX), reParseNumber(posY), reParseNumber(posZ) createEffect(effect, x, y, z, 0, 0, 0) 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now