HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

AddSpecialEffectLoc

12-15-2006, 02:39 AM#1
xombie
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
zen87
Collapse 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
xombie
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
Collapse JASS:
AddSpecialEffectLoc
to perform an action, and it failed to do so. All of the syntax was correct as I checked it over hundreds of times, and when I switched to using
Collapse JASS:
AddSpecialEffect
using coordinates it worked perfectly. The fact that it worked when using a different function that gave the same result is an indication that the only thing at fault here was the function. This boggles me.
12-15-2006, 04:36 AM#4
PipeDream
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
xombie
I'm trying to be very scarce in what details I let out, but I'm sure this little snippet is harmless.
Collapse 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
AddTimedEffect calls upon AddSpecialEffect (not Loc) and currently works, the same as my AddTimedEffectLoc called AddSpecialEffectLoc, and didn't work. I also did some debugs to determine what was going wrong, and when I simply told it to do AddSpecialEffectLoc (not my home-made function) it still did not display a special effect. Now that I've replaced it with the AddSpecialEffect (not Loc) it works.
12-15-2006, 04:53 AM#6
zen87
what does your
Code:
  call AddTimedEffect
does ? Anyway i think i know what you are trying to do adi... you wanted to make an effect at certain location and then remove it after time t right ? If im not wrong you included some TriggerSleepAction or Pooled wait inside, well i can tell you that wont work, here is the timed effect im using in my map, it works perfectly, the problem is i used cs_cache there, for more detail refer to vex's caster sys

Collapse 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
Captain Griffen
Using the CS is excessive. TimerAttach function is perfect for this.

Collapse 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:

Collapse JASS:
call TimerAttach(CreateTimer(), 3., H2I(AddTimedEffect("Environment\\SmallBuildingFire\\SmallBuildingFire2.mdl", GetLocationX(temp), GetLocationY(temp)), function TimedEffectEx)
12-15-2006, 10:06 AM#8
xombie
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:
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.
Does this not say that "AddSpecialEffect" worked perfectly? Oh my! It does! If I had used a PolledWait, would this be the case? Omg! No it wouldn't have! Please I would never post false information about my own code, so assume I know what I'm talking about before recommending that my functions are not working when clearly its the function that I have singled out.

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
Vexorian
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
wyrmlord
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
xombie
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:
I did a test to see whether or not it would work by simply putting an -AddSpecialEffectLoc- by itself,
So in other words, no, and my comment about posting code is being further fortified every single time somebody comes in here thinking I'm an idiot and refers to other functions rather than the problem at hand. ALSO, I have already stated that I used the location x/y VALUES for the x/y on AddSpecialEffect, so even if the location returned was buggy, the x/y would have therefore not worked, but they did.
Quote:
(using LocationX and LocationY values for x/y values)
Christ if nobody wants to accept that I am capable of debugging my own code, then don't post here. I'm not going to bother defending myself several hundred times over the -exact- same thing.

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:
Is there something wrong with this function?

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
Ryude
I just used the function successfully. It may be a bugged world editor or wc3?
12-15-2006, 08:56 PM#13
Vexorian
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
iNfraNe
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
xombie
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.