• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

[Trigger] No point problem

Status
Not open for further replies.
Level 3
Joined
Aug 11, 2007
Messages
36
  • Flaming Leap
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Flaming Leap
    • Actions
      • Unit - Pause (Casting unit)
      • Set TempPoint = (Position of Hero[(Player number of (Triggering player))])
      • Animation - Play (Casting unit)'s dissipate animation
      • Selection - Remove (Triggering unit) from selection for (Triggering player)
      • Animation - Change Hero[(Player number of (Triggering player))]'s animation speed to 50.00% of its original speed
      • Unit - Create 1 Flaming Leap Dummy for (Triggering player) at TempPoint facing TempPoint
      • Unit - Order (Last created unit) to Human Blood Mage - Flame Strike (Target point of ability being cast)
      • Trigger - Add to End Flaming Leap <gen> the event (Unit - (Last created unit) Starts the effect of an ability)
That's the whole thing. Whenever I test it, the dummy just casts at the middle of the map.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
There is no triggering player here.
It should look something like this (you also don't need to set things for Hero[x] because its instant cast):


  • Unknown
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Water Flamethrower
    • Actions
      • Unit - Pause (Triggering unit)
      • Set Point[0] = (Position of (Triggering unit))
      • Set Point[1] = (Target point of ability being cast)
      • Animation - Play (Triggering unit)'s stand animation
      • Selection - Remove (Triggering unit) from selection for (Owner of (Triggering unit))
      • Animation - Change (Triggering unit)'s animation speed to 50.00% of its original speed
      • Unit - Create 1 Footman for (Owner of (Triggering unit)) at Point[0] facing Default building facing degrees
      • Unit - Order (Last created unit) to Human Blood Mage - Flame Strike Point[1]
      • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
      • Trigger - Add to (This trigger) the event (Destructible - (Last created destructible) dies)
      • -------- - --------
      • -------- Now im not sure if you fix this stuff at the other trigger but if not here it is --------
      • -------- - --------
      • Custom script: call RemoveLocation(udg_Point[0])
      • Custom script: call RemoveLocation(udg_Point[1])
      • Animation - Change (Triggering unit)'s animation speed to 100.00% of its original speed
      • Unit - Unpause (Triggering unit)
 
Level 3
Joined
Aug 11, 2007
Messages
36
There _is_ a triggering player because the trigger still makes a unit for the triggering player. And changing the spell to vaguely fit your design didn't work either.
  • Flaming Leap
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Flaming Leap
    • Actions
      • Unit - Pause (Casting unit)
      • Set TempPoint = (Position of (Casting unit))
      • Animation - Play (Casting unit)'s dissipate animation
      • Selection - Remove (Casting unit) from selection for (Owner of (Casting unit))
      • Animation - Change (Casting unit)'s animation speed to 50.00% of its original speed
      • Unit - Create 1 Flaming Leap Dummy for (Owner of (Casting unit)) at TempPoint facing TempPoint
      • Set TempPoint = (Target point of ability being cast)
      • Unit - Order (Last created unit) to Human Blood Mage - Flame Strike TempPoint
      • Trigger - Add to End Flaming Leap <gen> the event (Unit - (Last created unit) Starts the effect of an ability)
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Triggering Unit/Player means the Unit/Player who started the trigger (in other words - the event).

Since the event is "Unit casts a spell" , the "triggering" one will be a UNIT.

For Triggering Player references, you would need Player Events (for example "Player x types a message").

I would wish to see the other trigger you turned on so I can fully make my trigger to work with yours.

And I just noticed a problem I did aswell in my damage checker trigger.
Every time you will cast that spell a new event will be added to the other trigger, meaning in multiplying the times it will work.

After 10 castings the second trigger will work like a loop 10 times.

To fix that, you would need to set a Unit Variable for the Dummy every time the ability s being casted, and on another trigger with "time 0.00" add the event once with updating it to "Unit - Unit_Variable_You_Put_For_Dummy Starts the effect of an ability".

If you didn't understand one or more of the things I said, ask and ill be glad to explain.
 
Level 3
Joined
Aug 11, 2007
Messages
36
Oh... still confused why the trigger made a unit then.
  • End Flaming Leap
    • Events
    • Conditions
    • Actions
      • Set TempPoint = (Position of (Casting unit))
      • Unit - Move Hero[(Player number of (Owner of (Casting unit)))] instantly to TempPoint
      • Unit - Kill (Casting unit)
      • Unit - Unpause Hero[(Player number of (Triggering player))]
      • Animation - Play Hero[(Player number of (Triggering player))]'s stand animation
The important part is the
Unit - Order (Last created unit) to Human Blood Mage - Flame Strike (Target point of ability being cast)
why is that sending the unit to the center of the map?

Also, the event thing. It's already a specific unit event.
 
Level 3
Joined
Aug 11, 2007
Messages
36
  • Flaming Leap
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Flaming Leap
    • Actions
      • Unit - Pause (Casting unit)
      • Set TempPoint = (Position of (Casting unit))
      • Set TempLocs[1] = (Target point of ability being cast)
      • Animation - Play (Casting unit)'s dissipate animation
      • Selection - Remove (Triggering unit) from selection for (Owner of (Casting unit))
      • Animation - Change (Casting unit)'s animation speed to 50.00% of its original speed
      • Unit - Create 1 Flaming Leap Dummy for (Owner of (Casting unit)) at TempPoint facing TempPoint
      • Unit - Order (Last created unit) to Human Blood Mage - Flame Strike TempLocs[1]
      • Trigger - Add to End Flaming Leap <gen> the event (Unit - (Last created unit) Starts the effect of an ability)
Still not working. If anyone has any idea why, plz share :)
 
Level 6
Joined
Nov 28, 2007
Messages
203
This is wrong:
  • Selection - Remove (Triggering unit) from selection for (Owner of (Casting unit))
It should be casting unit instead of triggering unit. It doesn't solve your problem, though. Can't find what's wrong, but i've had a problem just like this b4.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Ok I now looked again at this and I don't see why my trigger shouldn't work.

Your second trigger is absoluthly unneeded.
The only thing it does is unpaush the hero and make him do his stand animation.

Bugs in your way:

• The unit is still at 50% of his animation speed after the casting
• You have 3 point leaks

You can use mine with 1 trigger and it would work exacly the same way without unneeded stuff.

In conclusion this is what you will need:
  • Unknown
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Ability
    • Actions
      • Unit - Pause (Triggering unit)
      • Set Point[0] = (Position of (Triggering unit))
      • Set Point[1] = (Target point of ability being cast)
      • Animation - Play (Triggering unit)'s stand animation
      • Selection - Remove (Triggering unit) from selection for (Owner of (Triggering unit))
      • Animation - Change (Triggering unit)'s animation speed to 50.00% of its original speed
      • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at Point[0] facing Default building facing degrees
      • Unit - Order (Last created unit) to Human Blood Mage - Flame Strike Point[1]
      • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
        • Custom script: call RemoveLocation(udg_Point[0])
      • Custom script: call RemoveLocation(udg_Point[1])
      • Animation - Change (Triggering unit)'s animation speed to 100.00% of its original speed
      • Unit - Unpause (Triggering unit)
And just a question - why do you remove the casting unit from the selection ?
Is there any point in it ?


humpadumpa: Casting Unit or Triggering Unit at this case are exacly the same thing.
The casting unit is the one that casted in the event.
The triggering unit is the one that was in the event.
Same thing.
 
Level 3
Joined
Aug 11, 2007
Messages
36
Is the call RemoveLocation completely necessary?

And really... the two triggers are needed. The dummy unit's spell has a range of 50 and so it has to move to the target while the caster is paused (the dummy is visible and creates a visual effect, I admit, not a good one)

AND FINALLY. Your trigger is ALMOST EXACTLY WHAT I HAVE. It doesn't work. Anyone have a real idea why?
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Every time you set a Point variable to a new point, it will NOT move the old point.
It will just make a new one, which means the old one stays there and leeches your memory while napping and eating and getting fat.

Thats the reason that you must use those custom scripts because every cast it will make 3 of those "leecher-points".

And can you please explain exacly what the spell does from the start to the end so I can understand what you did and why ?
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
In other words: you don't have to remove leaks, just like you don't have to clean your house. Sure it's going to be messy after a few years, but that's too bad for your visitors...

In WC3: your map is the "house" and your visitors are the players. Technically you don't have to clean leaks, but it will cause lag (terrible lag in the end, not just an average delay) when the leaks occur frequently.
 
In WC3: your map is the "house" and your visitors are the players. Technically you don't have to clean leaks, but it will cause lag (terrible lag in the end, not just an average delay) when the leaks occur frequently.

And if the leaks get bad enough the game crashes.

Usually it's okay to have a few leaks in your map, but any trigger which runs more than once should be completely leak-free.
 
Level 3
Joined
Aug 11, 2007
Messages
36
Okay, I get it. I didn't know the point still existed if the variable was reused. Moving on -

The spell would make the caster 'become' the dummy unit (large ball of fire model) and when the dummy unit casts the spell, the caster is moved there and some damage is dealt to nearby enemies. Deselecting is in fact useless, ignore that. If there's really no solution out there to fix this trigger, I have other ways to do it I guess.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Ok, your spell doesn't work because you have no waits and that makes the other trigger to kill the dummy right after its created.

Just as a side note "Add event - last created unit ..." won't work for you normaly because there can be a lot of units created.
I suggest you to set the dummy to a unit variable.

Anyway, if I understodd your spell the right way this is what you need

  • Unknown
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Unit - Hide (Triggering unit)
      • Set Point[0] = (Position of (Triggering unit))
      • Set Point[1] = (Target point of ability being cast)
      • Unit - Create 1 Footman for (Owner of (Triggering unit)) at Point[0] facing Default building facing degrees
      • Unit - Order (Last created unit) to Human Blood Mage - Flame Strike Point[1]
      • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
      • Wait 3.00 seconds
      • Unit - Move (Triggering unit) instantly to Point[1]
      • Custom script: call RemoveLocation(udg_Point[0])
      • Custom script: call RemoveLocation(udg_Point[1])
      • Unit - Unhide (Triggering unit)

The main problem here is the wait, of course.
You'll need to either use arrays for this with diffrent locations for each player, or use this nice way I just thought of - Using locations with variables in their arrays (thats the idea of humpadumpa) and removing them like any other point, just checked it a moment ago and it worked :)

For example:
  • Actions
    • Set Integer[(Player number of (Owner of (Triggering unit)))] = (Player number of (Owner of (Triggering unit)))
    • Set Point[Integer[(Player number of (Owner of (Triggering unit)))]] = (Target point of ability being cast)
    • Custom script: call RemoveLocation(udg_Point[udg_Integer[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))]])
Now im not really sure if this will make this ability MUI because I just made it up and didn't test it, but its worth a try.
If it will work its a pretty nice way to make things MUI without making the code x15 long :p

The full code in this case would be:

  • Unknown
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Unit - Hide (Triggering unit)
      • Set Heros[(Player number of (Owner of (Triggering unit)))] = (Triggering unit)
      • Set Integer[(Player number of (Owner of (Triggering unit)))] = (Player number of (Owner of (Triggering unit)))
      • Set Point[Integer[(Player number of (Owner of (Triggering unit)))]] = (Position of (Triggering unit))
      • Set Point[Integer[((Player number of (Owner of (Triggering unit))) + 10)]] = (Target point of ability being cast)
      • Unit - Create 1 Footman for (Owner of (Triggering unit)) at Point[(Player number of (Owner of (Triggering unit)))] facing Default building facing degrees
      • Unit - Order (Last created unit) to Human Blood Mage - Flame Strike Point[((Player number of (Owner of (Triggering unit))) + 10)]
      • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
      • Wait 3.00 seconds
      • Unit - Move Heros[(Player number of (Owner of (Triggering unit)))] instantly to Point[((Player number of (Owner of (Triggering unit))) + 10)]
      • Custom script: call RemoveLocation(udg_Point[udg_Integer[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))]])
      • Custom script: call RemoveLocation(udg_Point[udg_Integer[( GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit())) + 10 )]])
      • Unit - Unhide Heros[(Player number of (Owner of (Triggering unit)))]
As I said im not sure this will actualy work as I intended it to work, but its worth a try :)
 
Level 3
Joined
Aug 11, 2007
Messages
36
You see... I'm fairly certain it would be MUI because the way the dummy spell works.

The dummy unit MOVES at a 300 unit flying rate to the location. When it gets to a 50 unit range, it casts the spell which triggers the second spell to move the hero variable which is set long before then and never changes.

The problem is that the (Target point of ability being cast) is returning the middle of the map.

I don't need a wait, I CLEARLY see the dummy unit moving, but it moves to the middle of the map.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Haha problem solved.

All this time and it was just a problem with your point.
You probably set TempLocs[1] to somewhere else somewere in your triggers.
Just to check it out I made it 1000 and it worked.

Changes
• Changed the unit to be hidden to remove that pieces of armor of his.
• Removed location leaks.
 

Attachments

  • AlongTheRoadb2.w3x
    193.1 KB · Views: 33
Level 3
Joined
Aug 11, 2007
Messages
36
Thank you!

Fixed the trigger and gave me a valuable lesson about removing leaks :p

The location thing worked to fix it in your example except the actual teleporting part. Thus putting an end to your variable unit stuff :p I'm fairly certain the Last Created Unit is substituted THEN added, or else my whole map would be messed up in about a dozen ways.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
When I made a damage checker trigger (showing text with damage when a unit gets hit), each time a unit hit another unit it showed another text.

On the first hit it showed 1 text with the damage he has done.
On the second hit it showed TWICE the same text.
And so on.

That is because the first event occurs so it runs all the actions, but also the second one occurs so it runs them again, and also third occurs so it .... etc. etc.
 
Level 3
Joined
Aug 11, 2007
Messages
36
No idea, but the triggers as they were worked without a loop. Just tested using a game:message added to the End Flaming Leap trigger. Happened only once even after three runs.

And the Initialized trigger didn't work at all. It cast, it made the dummy, it didn't move the hero.

P.S. Thanks a ton. +rep. Putting map in Map Dev in a few seconds ^_^
 
Status
Not open for further replies.
Top