• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Whats wrong with this spell?

Status
Not open for further replies.
Level 8
Joined
Mar 3, 2009
Messages
327
When I use the spell the infernal is created in the middle of the map, as though temppoint[0] is a point with no value. The Last Created Unit is applied to my hero, which would have been created ages ago. I looked and I couldn't see any bugs, but then again, i never usually can. Help is appreciated, and please make your answer as complete as possible because i can only get on every few days.

  • Infernal
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Inferno
    • Actions
      • Custom script: local unit udg_tempunit
      • Wait 1.00 seconds
      • Set Temppoint[0] = (Target point of ability being cast)
      • Unit - Create 1 Infernal for (Owner of (Triggering unit)) at Temppoint[0] facing Default building facing degrees
      • Set tempunit = (Last created unit)
      • Hero - Disable experience gain for (Last created unit)
      • Hero - Modify Strength of (Last created unit): Set to (Strength of (Rally-Point of (Triggering unit) as a unit) (Include bonuses))
      • Hero - Modify Agility of (Last created unit): Set to (Strength of (Rally-Point of (Triggering unit) as a unit) (Include bonuses))
      • Unit - Add a (Real((Intelligence of (Triggering unit) (Include bonuses)))) second Generic expiration timer to (Triggering unit)
      • Animation - Play (Last created unit)'s birth animation
      • Unit Group - Pick every unit in (Units within 250.00 of Temppoint[0]) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) belongs to an enemy of Player 1 (Red)) Equal to True
            • Then - Actions
              • Unit - Cause (Triggering unit) to damage (Picked unit), dealing ((Real((Intelligence of (Triggering unit) (Include bonuses)))) x 3.00) damage of attack type Spells and damage type Magic
              • Unit - Order Dummy 0009 <gen> to Neutral - Hurl Boulder (Picked unit)
            • Else - Actions
      • Wait 2.37 seconds
      • Animation - Play tempunit's stand animation
EDIT: I fixed the point leak. don't comment on it.
 
Level 4
Joined
Jul 24, 2010
Messages
85
I'm very confused about your variable:

local unit udg_tempunit

local = use only in trigger
udg = user_defined_global can be used through all triggers in map.

Maybe it is because You've mix both kind of variable.
Also local variable must be set by using custom script !! << ONLY (or use jass)
If you set variable through GUI function, it will be Global (udg) not local.
 

sPy

sPy

Level 21
Joined
Apr 10, 2009
Messages
268
  • Infernal
    • Events
      • Unit - A unit starts the effect of an ability
    • Conditions
      • (Ability being cast) equal to Inferno
    • Actions
      • Custom script: local unit tempunit
      • Wait 1.00
      • Set Temppoint[0] = (Target point of ability being cast)
      • Unit - Create 1 Infernal for (Owner of (Triggering unit)) at Temppoint[0] facing Default building facing degrees
      • Custom script: set tempunit = GetLastCreatedUnit()
      • Custom script: call .........
      • Custom script: call .........
And so on.. everything that is related to tempunit has to be done in custom script I think, so I prefer convert to custom text for this...
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
You are using local variable shadowing and AFAIK that doesn't work anymore. I'm not positive though.

They were supposed to fix it, but it still works, like this:
  • Untitled Trigger 003
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Custom script: local unit udg_u1 = GetTriggerUnit()
      • Wait 2.00 seconds
      • Unit - Kill u1
TPOABC(Target point of ability being cast) I believe is not saved after the Wait.

I can confirm this.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Doesn't belong to the problem, but have you think about to make this easy spell without leaks and properly MUI?

He is learning it, give him time =D

As for the topic, after you set the local variable, you must set it by using "Set Variable" to follow what have you typed
In this case, you typed out udg_"tempunit"
So, you must set a following variable, like this:
  • Set tempunit = (Triggering unit)
It will eventually looks like this:
  • Custom script: local unit udg_tempunit
  • Set tempunit = (Triggering unit)
NOTE: Local variable ONLY works in that single trigger ONLY
For the use of other trigger, please use global variable, the "Set Variable" action
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
It will eventually looks like this:
  • Custom script: local unit udg_tempunit
  • Set tempunit = (Triggering unit)

Triggering unit works like a local variable, so you never need to do what you did there :)

And the issue with this spell is that you can't set target point of ability being cast after a wait, unless you use a local variable for that point. So you also have some learning to do :)
 
Level 8
Joined
Mar 3, 2009
Messages
327
the problem is that you used a wait then after it used the Target Point of ability being cast...

For the default GUI unit/point vars only TriggeringUnit is remembered after a wait...

Ah thanks. I thought it worked for more things. I don't think that explains all of the problems I was having though, how would the rest of you suggest making this spell? The rest of the thread didnt seem to actually agree on anything...

I'll make the local point when i get home. Unfortunately i forgot to put the map on this computer.
 

sPy

sPy

Level 21
Joined
Apr 10, 2009
Messages
268
You could replace the "wait 1.00 second" to a spell that requires 1.00 casting time. And when the 1.00 casting time spell is done, just do the actions below the "wait 1.00 second"

It should be something like this..
  • Events
    • unit starts effect
  • Conditions
    • ability = inferno
  • Actions
    • create unit
    • add 1.1+ timer to unit
    • add 1 second casting time ability
    • order
    • remove leak
  • Events
    • unit starts effect
  • Conditions
    • ability = 1 second casting ability
  • Actions
    • do the actions
 
Level 12
Joined
Dec 10, 2008
Messages
850
You could replace the "wait 1.00 second" to a spell that requires 1.00 casting time. And when the 1.00 casting time spell is done, just do the actions below the "wait 1.00 second"

It should be something like this..
  • Events
    • unit starts effect
  • Conditions
    • ability = inferno
  • Actions
    • create unit
    • add 1.1+ timer to unit
    • add 1 second casting time ability
    • order
    • remove leak
  • Events
    • unit starts effect
  • Conditions
    • ability = 1 second casting ability
  • Actions
    • do the actions

The problem with that is it becomes dependent on the actual spell too. It would be easier to save the point before the wait and reference it later. The only problem with that is the wait will more then likely screw up any MUI-ness of the ability.
 
Level 8
Joined
Mar 3, 2009
Messages
327
If I use the actual inferno ability, is there a way to retrieve the summoned unit? And I still need the expiration timer to be equal to the casters INT, so is there a way to remove the expiration timer in the object editor? The only reason im triggering it is because i need to set all of the stats, so now im thinking of basing it off the actual ability anyway...

EDIT: ive reworked my trigger. Heres what i have now:
  • Inferno
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Inferno
    • Actions
      • Custom script: local unit udg_tempunit
      • Set Temppoint[0] = (Target point of ability being cast)
      • Unit - Create 1 Infernal for (Owner of (Triggering unit)) at Temppoint[0] facing Default building facing degrees
      • Unit - Pause (Last created unit)
      • Unit - Hide (Last created unit)
      • Set tempunit = (Last created unit)
      • Animation - Play (Last created unit)'s birth animation
      • Unit - Add a (Real((Intelligence of (Triggering unit) (Include bonuses)))) second Generic expiration timer to (Last Created Unit)
      • Hero - Modify Strength of (Last created unit): Set to (Strength of (Triggering unit) (Include bonuses))*
      • Hero - Modify Agility of (Last created unit): Set to (Strength of (Triggering unit) (Include bonuses))*
      • Custom script: call RemoveLocation(udg_Temppoint[0])
      • Wait 0.70 seconds
      • Unit - Unhide (Last created unit)
      • Wait 1.67 seconds
      • Animation - Play (Last created unit)'s stand animation
      • Unit - Unpause tempunit
It works a lot better now. Theres still a problem though, last created unit gets applied to the fields with an asterisk. The animations and hiding work fine though. Does the infernal being a hero cause a delay?

EDIT: working fine now, found all the bugs. Thanks guys.
 
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,240
EDIT: ive reworked my trigger. Heres what i have now:
  • Inferno
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Inferno
    • Actions
      • Custom script: local unit udg_tempunit
      • Set Temppoint[0] = (Target point of ability being cast)
      • Unit - Create 1 Infernal for (Owner of (Triggering unit)) at Temppoint[0] facing Default building facing degrees
      • Unit - Pause (Last created unit)
      • Unit - Hide (Last created unit)
      • Set tempunit = (Last created unit)
      • Animation - Play (Last created unit)'s birth animation
      • Unit - Add a (Real((Intelligence of (Triggering unit) (Include bonuses)))) second Generic expiration timer to (Last Created Unit)
      • Hero - Modify Strength of (Last created unit): Set to (Strength of (Triggering unit) (Include bonuses))*
      • Hero - Modify Agility of (Last created unit): Set to (Strength of (Triggering unit) (Include bonuses))*
      • Custom script: call RemoveLocation(udg_Temppoint[0])
      • Wait 0.70 seconds
      • Unit - Unhide (Last created unit)
      • Wait 1.67 seconds
      • Animation - Play (Last created unit)'s stand animation
      • Unit - Unpause tempunit

You're not assigning a unit to tempunit. Also, the last created unit actions after thewaits wil bug if another instance of the spell is casted shortly after the first. Create a local variable for the last created unit, and assign the unit to the variable, use the variable in actions.
 
Status
Not open for further replies.
Top