| 12-15-2006, 02:39 AM | #1 |
Is there something wrong with this function? I had to switch to "AddSpecialEffect" and use GetLocationX and Y to get my message across to the game; for some reason it wouldn't create the special effects. |
| 12-15-2006, 03:41 AM | #2 |
JASS:native AddSpecialEffectLoc takes string modelName, location where returns effect native AddSpecialEffect takes string modelName, real x, real y returns effect hope this help... anyway please show us what you put in your trigger, i've been using these special effect native and never encountered any problem =| |
| 12-15-2006, 04:15 AM | #3 |
Well, its somewhat classified of a trigger (its for an AoS I'm making, and I don't want details released yet) but the fact is I used JASS:AddSpecialEffectLoc JASS:AddSpecialEffect |
| 12-15-2006, 04:36 AM | #4 |
I am unaware of any general problems AddSpecialEffectLoc. It is used extensively in GUI code so it is unlikely that the problem is with the native. If you want help understanding why it failed for you, you are welcome to post code. |
| 12-15-2006, 04:52 AM | #5 |
I'm trying to be very scarce in what details I let out, but I'm sure this little snippet is harmless. JASS:if ModuloInteger(index, 120)==0 then set index2 = 0 loop exitwhen index2>24 set temp = BurnGround_GetLoc(centerX, centerY, radius) call AddTimedEffect("Environment\\SmallBuildingFire\\SmallBuildingFire2.mdl", GetLocationX(temp), GetLocationY(temp), 3) set index2=index2+1 endloop endif |
| 12-15-2006, 04:53 AM | #6 |
what does your Code:
call AddTimedEffect JASS:function CreateDelayedEffectEx_child takes nothing returns nothing local timer t = GetExpiredTimer() local effect e = GetAttachedEffect(t,"destroyeffect") if e!=null then call DestroyEffect(GetAttachedEffect(t,"destroyeffect")) endif call CleanAttachedVars(t) call ReleaseTimer(t) set t=null set e=null endfunction function CreateDelayedEffectEx takes string e, real x, real y, real d returns effect local effect f = AddSpecialEffect(e,x,y) local timer t = NewTimer() call AttachObject(t,"destroyeffect",f) call TimerStart(t,d,true,function CreateDelayedEffectEx_child) return f return null endfunction function CreateDelayedEffectExLoc takes string e, location l, real d returns effect return CreateDelayedEffectEx(e,GetLocationX(l),GetLocationY(l),d) endfunction |
| 12-15-2006, 06:13 AM | #7 |
Using the CS is excessive. TimerAttach function is perfect for this. JASS:function TimerAttach takes timer t, real time, real value, code func returns nothing call TimerStart(t, value, false, null) call PauseTimer(t) call TimerStart(t, time, false, func) endfunction // Only call on expired timer created by TimerAttach function GetTimerInt takes timer t returns integer return R2I(TimerGetRemaining(t) + 0.5) endfunction function TimedEffectEx takes nothing returns nothing call DestroyEffect(I2Effect(GetTimerInt(GetExpiredTimer()))) call DestroyTimer(GetExpiredTimer()) endfunction So just use: JASS:call TimerAttach(CreateTimer(), 3., H2I(AddTimedEffect("Environment\\SmallBuildingFire\\SmallBuildingFire2.mdl", GetLocationX(temp), GetLocationY(temp)), function TimedEffectEx) |
| 12-15-2006, 10:06 AM | #8 | |
In terms of functionality, my methods are fine. I knew that copying the code would not help at all it would just create a nag to focus on other functions which I have already made clear work perfectly. The bug at hand is that AddSpecialEffectLoc did not work at all. I did a test to see whether or not it would work by simply putting an -AddSpecialEffectLoc- by itself, and it showed up negative, that it did NOT work. At no time did I say my effect wasn't being deleted or my TimedEffect was not working correctly, which is part of the reason why I did not post my code in the first place, because people tend to assume others are complete idiots and that they can not do proper debugs by themselves. I will forgive Captain Griffen because zen87's post completely through off the basis of my thread, which was the bug occuring at AddSpecialEffectLoc. Here are some quotes to further support what I'm saying: Quote:
The fact that AddSpecialEffectLoc did not work in this particular case could have been many reasons, I have since moved on and simply used x/y values, which work perfectly. Now, please explain to me how AddSpecialEffect works perfectly (using LocationX and LocationY values for x/y values) whilst AddSpecialEffectLoc does not even create an effect. THIS is the question at hand, and I would appreciate it if this bug was focused on rather than code that I've already said works. |
| 12-15-2006, 12:30 PM | #9 |
Actually no. You are blaming a native function that was never the target of accusations before. 5 years and nothing like this 'bug' was ever reported, so we can be 99% sure that the problem is with something else. In fact, it could be that the issue is with the way BurnGround_GetLoc works. Really, it could be relying in return bug and there could be somehow issues with the casting. Or it could also be that you are removing the Location too soon. |
| 12-15-2006, 04:50 PM | #10 |
Just post the entire code, it will allow us to help with what the error is. If we don't know everything in the code, how will we be able to fully help? |
| 12-15-2006, 06:02 PM | #11 | |||
Vexorian, I -JUST- stated that I debugged it properly, and by that I mean instead of using any of my own functions I simply put a GetSpecialEffectLoc at a location of (0, 0), as I stated here: Quote:
Quote:
Edit: Also, since your word choice implies that you are telling -me- that I did not accuse the AddSpecialEffectLoc, you wouldn't mind reading the first sentence would you? Quote:
Also, a null location returns (0, 0), so even if I had removed it it would have still displayed an effect on the center of the map. I did a test in my map with AddSpecialEffect( string, GetLocationX(null), GetLocationY(null) ) and it simply put the effect at the center. |
| 12-15-2006, 08:16 PM | #12 |
I just used the function successfully. It may be a bugged world editor or wc3? |
| 12-15-2006, 08:56 PM | #13 |
Even if you are the debugging god we need to see your AddEffectTimedLoc implementation so we could see the context on how to make AddSpecialEffectLoc bug where AddSpecialEffect doesn't. |
| 12-15-2006, 09:12 PM | #14 |
Just post the whole code. Really, noone is or will ever be interested in "stealing" your code or map. No, there is no bug with AddSpecialEffect or the loc version. It is your code. And without it we cant help you. |
| 12-15-2006, 09:21 PM | #15 |
In your Resources > Submission section I have posted the BurnGround function, and my code is in there. I have recoded since this bug but the direct equivalent would be to replace where I have put "AddSpecialEffect" (for the timed effect array) with "AddSpecialEffectLoc", ofcourse with proper leak clearing. |
