• 🏆 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!

need help with 2-step Spell

Status
Not open for further replies.
Level 2
Joined
Aug 16, 2018
Messages
7
so i made a spell that acts kinda like a boomerang(you create a unit and then it travels to a point but you can recall it whenever you want) the problem lies in replacing the abilities, they work just fine the first time you cast them untitled1.png untitled2.png
 

Attachments

  • aaa.w3x
    23.7 KB · Views: 47
Level 39
Joined
Feb 27, 2007
Messages
5,024
You can right-click your triggers, select "copy as text" and paste them here between [trigger][/trigger] tags instead of having to upload screenshots.

Tested the map and it appears to be a bug with the "For <unit> hide <ability>" that was added to the editor. If you disable it N times you must enable it N times before it shows back up on the command card. In this instance you disable the Pull ability twice: once in Pyrosphere pull and once in Pyrosphere die, but only enable it once: in Crear PyroEsfera. You can confirm this by doing either of the following (don't need to do both):
  • Disable or remove the Unit - For (Casting unit), Ability (Mago) E Pyroesfera Pull , Hide ability: True line in the Pyrosphere pull trigger.
  • Copy the Unit - For (Casting unit), Ability (Mago) E Pyroesfera Pull , Hide ability: False line in the Crear PyroEsfera trigger, and paste it immediately below the one that's already there (should be 2 in a row)

  • Either of the above will fix your issue.
Other things I suggest:
  • You are leaking a few locations. Read this tutorial to understand what a leak is, why you don't want them, and how to get rid of them: Memory Leaks
  • Use "Triggering Unit" instead of things like "Casting Unit" or "Buying Unit" whenever possible. Many of the special ones fail to work after the Wait command, but Triggering Unit will always work.
 
Last edited:
Level 2
Joined
Aug 16, 2018
Messages
7
You can right-click your triggers, select "copy as text" and paste them here between [trigger][/trigger] tags instead of having to upload screenshots.

Tested the map and it appears to be a bug with the "For <unit> hide <ability>" that was added to the editor. If you disable it N times you must enable it N times before it shows back up on the command card. In this instance you disable the Pull ability twice: once in Pyrosphere pull and once in Pyrosphere die, but only enable it once: in Crear PyroEsfera. You can confirm this by doing either of the following (don't need to do both):
  • Disable or remove the Unit - For (Casting unit), Ability (Mago) E Pyroesfera Pull , Hide ability: True line in the Pyrosphere pull trigger.
  • Copy the Unit - For (Casting unit), Ability (Mago) E Pyroesfera Pull , Hide ability: False line in the Crear PyroEsfera trigger, and paste it immediately below the one that's already there (should be 2 in a row)

  • Either of the above will fix your issue.
Other things I suggest:
  • You are leaking a few locations. Read this tutorial to understand what a leak is, why you don't want them, and how to get rid of them: Memory Leaks
  • Use "Triggering Unit" instead of things like "Casting Unit" or "Buying Unit" whenever possible. Many of the special ones fail to work after the Wait command, but Triggering Unit will always work.
Thanks for taking your time helping me, it worked like a charm.
Also i replaced the "Casting unit" for "Triggering Unit".
To take care of memory leaks:

  • Crear PyroEsfera
    • Acontecimientos
      • Unidad - A unit Inicia el efecto de una habilidad
    • Condiciones
      • (Ability being cast) Igual a (Mago) E PyroEsfera
    • Acciones
      • Unidad - Create 1 Dummy PyroEsfera for (Owner of (Triggering unit)) at ((Position of (Casting unit)) offset by 128.00 towards (Angle from (Position of (Triggering unit)) to (Target point of ability being cast)) degrees) facing (Facing of (Casting unit)) degrees
      • Set Skill_Esfera[(Player number of (Owner of (Triggering unit)))] = (Last created unit)
      • Set Skill_Esfera_punto[(Player number of (Owner of (Triggering unit)))] = (Target point of ability being cast)
      • Set Skill_Esfera_State[(Player number of (Owner of (Triggering unit)))] = 1
      • Unidad - Order (Last created unit) to Mover a Skill_Esfera_punto[(Player number of (Owner of (Triggering unit)))]
      • Unidad - For (Triggering unit), Ability (Mago) E Pyroesfera Pull , Hide ability: False
      • Unidad - For (Triggering unit), Ability (Mago) E PyroEsfera , Hide ability: True
      • Unidad - Order (Triggering unit) to Detener
      • Custom script: call RemoveLocation(udg_Skill_Esfera_punto[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))])
  • Pyrosphere die
    • Acontecimientos
      • Unidad - A unit Muere
    • Condiciones
      • (Unit-type of (Dying unit)) Igual a Dummy PyroEsfera
    • Acciones
      • Unidad - For Heroe[(Player number of (Owner of (Dying unit)))], Ability (Mago) E PyroEsfera , Hide ability: False
      • Unidad - For Heroe[(Player number of (Owner of (Dying unit)))], Ability (Mago) E Pyroesfera Pull , Hide ability: True
      • Unidad - Order Heroe[(Player number of (Owner of (Dying unit)))] to Detener
      • Unidad - Remove Skill_Esfera[(Player number of (Owner of (Dying unit)))] from the game
      • Set Skill_Esfera[(Player number of (Owner of (Dying unit)))] = Ninguna unidad
Is there another memory leak that im not aware of?
 
Level 39
Joined
Feb 27, 2007
Messages
5,024
The leaks aren't from your units (removing them manually and setting them to "no unit" is not necessary and doesn't fix anything), they're from locations. Position of (<some unit>) and Target Point of Ability Being Cast are the two I see. As per the tutorial I linked, the proper way to deal with those is:

  • Set YourPoint = (Position of (Triggering Unit))
  • -------- Do something with YourPoint, like create a unit --------
  • Custom script: call RemoveLocation(udg_YourPoint)
  • -------- change the name of the variable in the above line to match the name of your variable in the variable editor; leave the udg_ --------
You can also replace Dying Unit in the "A unit dies" event with Triggering Unit. Think about what unit causes the event to happen ("triggers it"); that unit is Triggering Unit. In a cast trigger Casting = Triggering, in a death trigger Dying = Triggering, in an order trigger Ordered = Triggering.
 
Status
Not open for further replies.
Top