a line must be a line, but it doesnt...

waaaks!

Zinctified
Reaction score
255
i have a trigger where if u uses shockwave, it creates a line of instant thunder claps, but it doesnt work, yes it creates the thunder clap, but not in a line, only on 1000 away from my unit...

JASS:
function shockwave takes nothing returns nothing
 local unit cast = GetTriggerUnit()
 local location loc1 = GetUnitLoc(cast)
 local location loc2 = GetSpellTargetLoc()
 local location pol
 local real angle = AngleBetweenPoints(loc1,loc2)
 local integer l = GetUnitAbilityLevel(cast, 'A000')
 local integer n = 0
 loop
   exitwhen n >= 10
   set n = n + 1
   set pol = PolarProjectionBJ(loc1, 100*n, angle)
   call CasterCastAbilityLevelPointLoc(GetOwningPlayer(cast), 'A001', l, "thunderclap", pol, true)
   //function CasterCastAbilityLevelPointLoc takes player owner, integer abilid, integer level, string order, location loc, boolean instant returns unit 
   call RemoveLocation(pol)
 endloop
 call RemoveLocation(loc1)
 call RemoveLocation(loc2)
 set loc1 = null
 set loc2 = null
 set pol = null
 set cast = null
endfunction
 

Doomhammer

Bob Kotick - Gamers' corporate spoilsport No. 1
Reaction score
67
hmm, err.. try that :p

JASS:
function shockwave takes nothing returns nothing
 local unit cast = GetTriggerUnit()
 local location loc1 = GetUnitLoc(cast)
 local location loc2 = GetSpellTargetLoc()
 local location pol
 local real angle = AngleBetweenPoints(loc1,loc2)
 local integer l = GetUnitAbilityLevel(cast, 'A000')
 local integer n = 0
 loop
   exitwhen n >= 10
   set n = n + 1
   set pol = PolarProjectionBJ(loc1, 100*n, angle)
   call CasterCastAbilityLevelPointLoc(GetOwningPlayer(cast), 'A001', l, "thunderclap", pol, true)
   //function CasterCastAbilityLevelPointLoc takes player owner, integer abilid, integer level, string order, location loc, boolean instant returns unit
 endloop
 call RemoveLocation(pol) //only remove the location AFTER you finished using it
 call RemoveLocation(loc1)
 call RemoveLocation(loc2)
 set loc1 = null
 set loc2 = null
 set pol = null
 set cast = null
endfunction
 

Rheias

New Helper (I got over 2000 posts)
Reaction score
232
Doomhammer, no, he uses the point every loop run, he did it properly.

Try switching this:

local real angle = AngleBetweenPoints(loc1,loc2)

To:

local real angle = AngleBetweenPoints(loc2,loc1)

Might, just might work. Can you post a screenshot that we could see where the thunderclaps are actually being created?
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
LoL, brother...Paste your whole trigger next time :D
And your shockwave deals in instant time...=.=''

JASS:
set n = n + 1

Move this line after the RemoveLocation(pol)

First, I got problem in reading your script.
JASS:
call CasterCastAbilityLevelPointLoc(GetOwningPlayer(cast), 'A001', l, "thunderclap", pol, true)

This seems to be a function in CasterSystem. I don't know much of how it works because you didn't post its function at here

You know, units in Warcraft 3 need to rest too..
>>
JASS:
call CasterCastAbilityLevelPointLoc(GetOwningPlayer(cast), 'A001', l, "thunderclap", pol, true)

This 2 maybe your main problem...
You order the caster to cast 10 times instantly at diff point, I bet the caster only casted once or twice only...in random location between the loop.

You have tried adding a small TriggerSleepAction like 0.01 at the loop and see the working?
 

waaaks!

Zinctified
Reaction score
255
ill post screenies...but i dont have my pc right now...or u can test my map

Lotal(lure of the ancient lands) from members project
im not advertising my project, i just want help

to see the shockwave, you must use the tauren chieftain and use his first skill

i noticed that this is a bug, when we played earlier today

sorry if i cant post screenies :(

EDIT: this is for gals

i added a polled wait, but its too slow, like it didnt wait for 0.01, but waited for 0.10, and if i do that, the spell looks crappy, first the shockwave is realeased, then the thunder clap...and it runs slow

while im playing the map, i see that the 10 thunder claps are casted 1000 range away from the caster, because the thunder clap effect is kinda massive, just like casted many times

i cant post screenies, so the only thing i can give you the spell is by testing the map, and use tauren chieftain...

the map is just 257 kb, and it loads fast, so theres no problem loading the map

im really really sorry guys :(
 

Doomhammer

Bob Kotick - Gamers' corporate spoilsport No. 1
Reaction score
67
another thought along the same lines as Gals:
you're issueing an order, which may take time to execute.
Go for a little pause before the end of the loop

JASS:
loop
   exitwhen n >= 10
   set n = n + 1
   set pol = PolarProjectionBJ(loc1, 100*n, angle)
   call CasterCastAbilityLevelPointLoc(GetOwningPlayer(cast), 'A001', l, "thunderclap", pol, true)
   //function CasterCastAbilityLevelPointLoc takes player owner, integer abilid, integer level, string order, location loc, boolean instant returns unit
  call TriggerSleepAction(.1)
 endloop


Doomhammer, no, he uses the point every loop run, he did it properly.

Even though it may be doable, it's still an unnecessary function call, and has nothing to do in the loop. The location will be overwritten anyway. No need to destroy it again and again. The one and only place to destroy handles in this example is at the end of the function before nulling them.
 

Amrod

New Member
Reaction score
1
I just started using JASS (so i'm not very good at it) but you set your n to 0 and then increase it before your first use of n. So that means your
JASS:
PolarProjectionBJ(loc1, 100*n, angle)
will use n=1 and not n=0. Don't know if this is the actual problem but it might cause problems.

JASS:
local integer n = 0
 loop
   exitwhen n >= 10
     set n = n + 1
     set pol = PolarProjectionBJ(loc1, 100*n, angle)
 

waaaks!

Zinctified
Reaction score
255
thats why i set n = n + 1 so that when it reaches 10, the loop will stop, and if n is multiplied by 100 then, it will create a stomp to the offset...

i understand that u want to helped, thats why i didnt flamed so much, just joking i really dont want to flame anybody :p
 

Rheias

New Helper (I got over 2000 posts)
Reaction score
232
Waaaks! Please try to post screenshots as soon as possible, if I'll find your map I might test it, but I would rather see pics.

>Doomhammer

Precisely, you are overwriting the variable, so the information that you overwrote can't be accessed thus a leak. Just re-read a leaking tutorial.

As for adding a wait, Waaaks! said it is too slow. What does that castersystem function do? Does it create a new unit everytime, or order the same unit to do the same thing each time?
 

Arkan

Nobody rides for free
Reaction score
92
Timers are the only way if you desire a smooth waiting interval (or a periodic trigger).
 

Doomhammer

Bob Kotick - Gamers' corporate spoilsport No. 1
Reaction score
67
Waaaks! Please try to post screenshots as soon as possible, if I'll find your map I might test it, but I would rather see pics.

>Doomhammer

Precisely, you are overwriting the variable, so the information that you overwrote can't be accessed thus a leak. Just re-read a leaking tutorial.

I don't know where you've picked that up, yet I'm pretty sure you misunderstood something very fundamental: overwritten information won't create a leak, since the pointer is still referencing to the same point where the information stands, with the difference that the information has changed. Imagine a local variable like a hyperlink that refers to an image on a web site. let's say you replace the image with another image that has the same name, you still got one working hyperlink! (One hyperlink, not two!) It's pretty much the same thing here. We usually clear up the locals/pointers at the end of a function call to avoid "leaks", since the pointers, i.e. your local handles themselves occupy memory space which would otherwise be occupied for no inherent reason.
 

SFilip

Gone but not forgotten
Reaction score
634
> or order the same unit to do the same thing each time?
Well...it keeps one integer variable with the number of free casters and one group where you they're kept. If the group is empty it creates a new caster. Once he's done with whatever he's supposed to do he comes back to the group (was removed while being used) and ready to be used again.
With more need the number of casters increases of course.

As for the leak thing...Rheias is right.

> Imagine a local variable like a hyperlink that refers to an image
> let's say you replace the image with another image that has the same name
Yes, but PolarProjection does not change some existing location, it creates a new one, see for yourself:
Code:
function PolarProjectionBJ takes location source, real dist, real angle returns location
    local real x = GetLocationX(source) + dist * Cos(angle * bj_DEGTORAD)
    local real y = GetLocationY(source) + dist * Sin(angle * bj_DEGTORAD)
    [B]return Location(x, y)[/B]
endfunction
Location is a native that...well creates locations.

So doing local location l does not actually allocate the memory, but using any native that returns a location does and every location returned by a native has to be removed. Always, otherwise that's a leak.
 

Doomhammer

Bob Kotick - Gamers' corporate spoilsport No. 1
Reaction score
67
So doing local location l does not actually allocate the memory, but using any native that returns a location does and every location returned by a native has to be removed. Always, otherwise that's a leak.

I hardly ever use locations in loops, but then...good to heave learned something in my old days :D thanks
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
>>i added a polled wait, but its too slow, like it didnt wait for 0.01, but waited for 0.10, and if i do that, the spell looks crappy, first the shockwave is realeased, then the thunder clap...and it runs slow
The best solution:
Don't use loop, use timer call back..Accurate and Flexible
 

Doomhammer

Bob Kotick - Gamers' corporate spoilsport No. 1
Reaction score
67
since you're using CasterSystem and CSCache, simply attach the variables to your timer. That's how I could imagine the spell rewritten. I haven't tested it though.

JASS:
function shockwave_child takes nothing returns nothing
    local timer t=GetExpiredTimer()
    local unit u=GetAttachedUnit(t,"caster")
    local integer i=GetAttachedInt(t,"iterations")
    if i<GetAttachedInt(t,"max_iterations") then
        call CasterCastAbilityLevelPoint(GetOwningPlayer(u),'A001',GetUnitAbilityLevel(u,'A000'),"thunderclap",GetAttachedReal(t,"origin_x")+i*GetAttachedReal(t,"dist_x"),GetAttachedReal(t,"origin_y")+i*GetAttachedReal(t,"dist_y"),true)
        call AttachInt(t,"iterations",i+1)
    else
        call CleanAttachedVars(t)
        call ReleaseTimer(t)
    endif
endfunction

function shockwave takes nothing returns nothing
    local unit c = GetTriggerUnit()
    local location loc= GetSpellTargetLoc()
    local timer t=NewTimer()
    local real x=GetUnitX(c)
    local real y=GetUnitY(c)
    local real dx=GetLocationX(loc)-x
    local real dy=GetLocationY(loc)-y
    local real d=SquareRoot(dx*dx+dy*dy)
    call AttachObject(t,"caster",c)
    call AttachInt(t,"iterations",0)
    call AttachInt(t, "max_iterations",10)
    call AttachReal(t,"origin_x",x)
    call AttachReal(t,"origin_y",y)
    call AttachReal(t,"dist_x",dx/d*100)
    call AttachReal(t,"dist_y",dy/d*100)
    call TimerStart(t,0.01,true,function Shockwave_child)
    call RemoveLocation(loc)
    set loc=null
    set c=null
endfunction

//===========================================================================
function InitTrig_ImprovedShockwave takes nothing returns nothing
  call OnAbilityEffect('A000',"shockwave")
endfunction
 

Vexorian

Why no custom sig?
Reaction score
187
It looks like thunder clap is non-instant which doesn't make a lot of sense, so use false instead of true for the instant argument.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top