• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Need help with a GUI spell

Status
Not open for further replies.
Level 2
Joined
Dec 31, 2006
Messages
16
I have a prob about making one of my spells to work. Several errors occure and I have done almost anything to fix them but with no sucsess.

  • haunt
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Haunt
    • Actions
      • Countdown Timer - Start Whatever as a One-shot timer that will expire in 10.00 seconds
      • Wait 1.00 seconds
      • Unit - Hide HauntingUnit
      • Set Whatever = (Last started timer)
      • Set DyingHauntedUnit = (Dying unit)
      • Set HauntingUnit = (Casting unit)
      • Set HauntEDUnit = (Target unit of ability being cast)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (HauntEDUnit is alive) Equal to True
        • Then - Actions
          • Wait until (((HauntEDUnit is dead) Equal to True) or ((Elapsed time for Whatever) Greater than or equal to 9.50)), checking every 0.50 seconds
          • Unit - Move HauntingUnit instantly to (Position of HauntEDUnit)
          • Unit - Unhide HauntingUnit
        • Else - Actions
          • Unit - Move HauntingUnit instantly to (Position of DyingHauntedUnit)
          • Unit - Unhide HauntingUnit
This is the trigger and it think you can figure it out all by yourselves. Anyway the trigger must do the following:
1)-The casting unit dissapears and the targeted unit starts taking damage from the Shadow Strike (It is the base ability).
2)-When the suffering creature dies or the duration of the Haunt expires the Casting unit pops out whichever comes first.

I think it's all good but when I target a unit with this ability it dies instantly or my unit enters his body but it can't get out. I have tested this one several times and I have discovered that if I target a neutal passive unit it dies (Allways) and if I target a neutal hostile unit my unit can't pop out. It just stays there forever. However I doubt that this is the main problem...

I have also tried to make the controller of casting unit to still have vision of his hidden unit but if I make that I can't even enter the opposing unit.

Please tell me if there are errors or you have a better idea that works.
 
Level 19
Joined
Nov 16, 2006
Messages
2,165
Hmm , try :
Code:
haunt
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Haunt 
Actions
Set HauntingUnit = (Casting unit)
Set HauntEDUnit = (Target unit of ability being cast)
Countdown Timer - Start Whatever as a One-shot timer that will expire in 10.00 seconds
Set Whatever = (Last started timer)
Wait 1.00 seconds
Unit - Hide HauntingUnit
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(HauntEDUnit is alive) Equal to True
Then - Actions
Wait until (((HauntEDUnit is dead) Equal to True) or ((Elapsed time for Whatever) Greater than or equal to 9.50)), checking every 0.50 seconds
Unit - Move HauntingUnit instantly to (Position of HauntEDUnit)
Unit - Unhide HauntingUnit
Else - Actions
Unit - Move HauntingUnit instantly to (Position of HauntEDUnit)
Unit - Unhide HauntingUnit

Never set variables after a wait. Lets say, the wait resets (the units that have an action) it in a way.

Code:
Set DyingHauntedUnit = (Dying unit) // Why is this needed anyway?
There is no dying unit.
 
Level 5
Joined
Jan 5, 2007
Messages
40
Here is a leak check for you.

------------------
Total lines: 22

Location Leak Detection ON
Unit Group Leak Detection ON
Special Effect Leak Detection ON
Variable Removal Detection ON

(Line: 18 ) (Word: 7 ) Position Leak
Unit - Move HauntingUnit instantly to (Position of HauntEDUnit)
Unit - Move HauntingUnit instantly to ^Leak
(Suggested fix) Set L = (Position of HauntEDUnit)
(Suggested fix) Unit - Move HauntingUnit instantly to L
(Suggested fix) Custom Script: call RemoveLocation(udg_L)

(Line: 21 ) (Word: 7 ) Position Leak
Unit - Move HauntingUnit instantly to (Position of HauntEDUnit)
Unit - Move HauntingUnit instantly to ^Leak
(Suggested fix) Set L = (Position of HauntEDUnit)
(Suggested fix) Unit - Move HauntingUnit instantly to L
(Suggested fix) Custom Script: call RemoveLocation(udg_L)

Group variable has not been removed: Whatever

Completed
Total amount of leaks: 2
Leak Rating: Good
------------------

-Orc_Tamer
 
Last edited:
Level 2
Joined
Dec 31, 2006
Messages
16
Fl4meS thanks for the trigger!!! You saved me from my nightmares...

and OrcTamer i allready have a leakchecker but thanks.
 
Level 16
Joined
Oct 30, 2004
Messages
1,277
You could have done another thread for your question doos, but anyway the answer is simple. You order the unit to cast the spell which your custom spell is based on.
For example lets say you created a custom spell based on storm bolt, changed all the effects and stuff and renamed it to "throw a rock". Now if you want to order your unit to cast "throw a rock", you issue order it to cast storm bolt.
 
Status
Not open for further replies.
Top