Triggered Ability Help

Mullit

New Member
Reaction score
51
Code:
Tsunami
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Tsunami 
    Actions
        Set TempPoint = (Position of (Casting unit))
        For each (Integer A) from 1 to 16, do (Actions)
            Loop - Actions
                Unit - Create 1 dummy for (Owner of (Casting unit)) at TempPoint facing ((Facing of (Casting unit)) + (22.50 x (Real((Integer A))))) degrees
                Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
                Unit - Add Crushing Wave  to (Last created unit)
                Unit - Order (Last created unit) to Undead Dreadlord - Carrion Swarm (TempPoint offset by 50.00 towards (Facing of (Last created unit)) degrees)
        Custom script:   call RemoveLocation (udg_TempPoint)

What that should do is cast crushing wave 16 times, 22.5 degrees apart around the caster so that they are evenly spaced. Instead what happens is there are 16 cast in a fan shape infront of the caster. Could someone please tell me what is wrong with it and does 'facing of unit' create a memory leak?
 

Miz

Administrator
Reaction score
424
doesn't the effects have a size? or you could use the doodad waves
but I have done speical effects before but I never change its sizes
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
"Casting unit" is highly unstable in triggers that do their own casting.
Put it in a variable first.


Set Angle = Facing of Casting unit
For each Integer ...
- Create the unit with whatever facing
- ...
- Unit - Order ... towards Angle
- Set Angle = Angle + 22.5


> does 'facing of unit' create a memory leak?

Reals don't leak.

"Point offset ..." creates a new point though...
 

SFilip

Gone but not forgotten
Reaction score
634
> towards (Facing of (Last created unit))
I wouldn't rely on this if I were you...better use
towards (22.50 x (Real((Integer A))))
And just for the record polar offset is a leak, make another point variable and clean it.
 

Mullit

New Member
Reaction score
51
Code:
Tsunami
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Tsunami 
    Actions
        Set TempCaster = (Casting unit)
        Set TempPoint = (Position of TempCaster)
        Set TempReal = (Facing of TempCaster)
        For each (Integer A) from 1 to 16, do (Actions)
            Loop - Actions
                Unit - Create 1 dummy for (Owner of TempCaster) at TempPoint facing Default building facing degrees
                Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
                Unit - Add Crushing Wave  to (Last created unit)
                Set TempCastPoint = (TempPoint offset by 50.00 towards TempReal degrees)
                Unit - Order (Last created unit) to Undead Dreadlord - Carrion Swarm TempCastPoint
                Set TempReal = (TempReal + 22.50)
        Custom script:   call RemoveLocation (udg_TempPoint)
        Custom script:   call RemoveLocation (udg_TempCastPoint)

Ok I changed the trigger to this but now it does it in a fan to the top right of the caster no matter what direction it's facing:banghead:
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
Can your dummy move?
If not, it should.


You need to destroy "TempCastPoint" more often... every time you're done using it, not just at the end.
 

Mullit

New Member
Reaction score
51
I moved the action to inside the loop after i used the variable.

The dummy unit could move but it had collision size of 16 so i changed it to 0. I didnt think this mattered if it has locust ability but i changed it anyway. this made some improvement, the fan had more space between each wave but it still ended up looking like the pic attached with the same arrangement no matter the facing of the caster.
 

Attachments

  • tsunami.JPG
    tsunami.JPG
    111 KB · Views: 78

Sim

Forum Administrator
Staff member
Reaction score
534
> Set TempReal = (TempReal + 22.50)

At some point it will become higher than 360, thus stopping at 360 because angles don't go above 360. Correct me if I'm wrong but I think this is the problem. One thing can indicate if it is:

Cast the spell to an angle of 0 degree at start. Cast it at the right of your unit.

O = your caster
--> = Direction of the spell

O --> (CAST IT HERE)

And it should do a complete loop.

How to fix that? Use if-then-else to check if TempReal Equal to 360, and if it is, Set it to 0.
 

Sim

Forum Administrator
Staff member
Reaction score
534
How does it work then. It itself becomes 0 after 360?

Sounds like it doesn't to me.
 

Sooda

Diversity enchants
Reaction score
318
1) Make loop.
2) Use If/ Then/ Else Multiple Actions
3) For first condition use:
Code:
If degrees is greater or equal to 337.5
For calculating degrees then use formulae: ("Old degrees"+ "New degrees")- 360, it means if it is (337.5+ 22.5)- 360 it would be 0 (East) and (360+ 22.5)- 360= 22.5
4) To "Else actions" just + 22. 5 degrees beacasue it is below 337.5 then.
It aquires double actions but only one is ran at a time when in loop. Problem solved ?
 

Mullit

New Member
Reaction score
51
tried your way sooda and still no difference to the result.:(

btw the spell is based off channel, is there any fields in the object editor that could be causing this?
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
[barely on topic]

People, please, there's absolutely no problem in getting sine or cosine of angles way outside the 0 - 360 range...

Sin(100) = Sin(100 + 360) = Sin(100 + 2 * 260) = ... = Sin(100 + x * 360) = Sin(100 - 360) = Sin(100 - 2 * 360) = ... = Sin(100 - x * 360) (x being any integer)

Try it with a calculator.



[slightly more on topic]

It it "worked better" when setting the collision to 0, there might be some other options or features with your dummy.
 

Mullit

New Member
Reaction score
51
I tried changing the turn rate of my dummy incase it wasnt turning to the cast point quick enough before the trigger made it cast. The spell now works correctly every so often and is seemingly random for the rest of the times its cast. or maybe it just randomly looks right every so often:p
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
Well, given it's getting better the more you change your dummy, let's try some more stuff.

Like turning it into a flying unit that would fly at ground level.
With 500+ as movement speed.



Alternatively, create it at TempCastPoint and order it to "wave" at TempPoint...
 

Mullit

New Member
Reaction score
51
changed movement type of dummy to flying and it works perfect every time now :D. heres a screenie to show you it in action.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top