• 🏆 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] Spell Help :P

Status
Not open for further replies.
Level 14
Joined
Nov 2, 2008
Messages
579
Hey guys!

So I was wondering, why this spell isn't fully MUI. This is just an example spell i made, so i tried to keep it short. The problem is when an instance of the spell ends, the loop trigger is turned off and all instances end. I've literally tried everything -.-

  • Holy Shock
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to (==) Holy Shock
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Temp_Index[1] Equal to (==) 0
        • Then - Actions
          • Trigger - Turn on Holy Shock Loop <gen>
        • Else - Actions
      • Set Temp_Index[1] = (Temp_Index[1] + 1)
      • Set Temp_Index[2] = (Temp_Index[2] + 1)
      • Set Temp_Real3[Temp_Index[2]] = (1000.00 x (Real((Level of Holy Shock for (Triggering unit)))))
      • Set Temp_Unit[Temp_Index[2]] = (Triggering unit)
      • Set Temp_Real4[Temp_Index[2]] = 150.00
      • Set Temp_Real5[Temp_Index[2]] = 40.00
      • Set Temp_Real2[Temp_Index[2]] = 0.00
      • Set Temp_Real[Temp_Index[2]] = 0.00
      • Set Temp_Integer[Temp_Index[2]] = 0
  • Holy Shock Loop
    • Events
      • Time - Every 0.20 seconds of game time
    • Conditions
    • Actions
      • Do Multiple ActionsFor each (Integer Temp_Index[3]) from 1 to Temp_Index[2], do (Actions)
        • Loop - Actions
          • Set Temp_Integer[Temp_Index[3]] = (Temp_Integer[Temp_Index[3]] + 1)
            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Temp_Integer[Temp_Index[3]] Less than (<) (Integer(Temp_Real5[Temp_Index[3]]))
              • Then - Actions
                • Set Temp_Real[Temp_Index[3]] = (Temp_Real[Temp_Index[3]] + 25.00)
                • Set Temp_Real2[Temp_Index[3]] = (Temp_Real2[Temp_Index[3]] + 20.00)
                • Set Temp_Point[Temp_Index[2]] = (Position of Temp_Unit[Temp_Index[3]])
                • Set Temp_Point1[Temp_Index[3]] = (Temp_Point[Temp_Index[3]] offset by Temp_Real2[Temp_Index[3]] towards Temp_Real[Temp_Index[3]] degrees)
                • Special Effect - Create a special effect at Temp_Point1[Temp_Index[3]] using Abilities\Spells\Human\HolyBolt\HolyBoltSpecialArt.mdl
                • Special Effect - Destroy (Last created special effect)
                • Set Temp_Group[Temp_Index[3]] = (Units within Temp_Real4[Temp_Index[3]] of Temp_Point1[Temp_Index[3]])
                • Unit Group - Pick every unit in Temp_Group[Temp_Index[3]] and do (Actions)
                  • Loop - Actions
                    • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • ((Picked unit) is A structure) Equal to (==) False
                        • ((Picked unit) is alive) Equal to (==) True
                        • ((Picked unit) belongs to an enemy of (Owner of Temp_Unit[Temp_Index[3]])) Equal to (==) True
                      • Then - Actions
                        • Unit - Cause Temp_Unit[Temp_Index[3]] to damage (Picked unit), dealing Temp_Real3[Temp_Index[3]] damage of attack type Chaos and damage type Normal
                        • Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Human\Resurrect\ResurrectCaster.mdl
                        • Special Effect - Destroy (Last created special effect)
                      • Else - Actions
                • Custom script: call DestroyGroup( udg_Temp_Group[ udg_Temp_Index[3]] )
                • Custom script: call RemoveLocation( udg_Temp_Point[ udg_Temp_Index[3]] )
                • Custom script: call RemoveLocation( udg_Temp_Point1[ udg_Temp_Index[3]] )
              • Else - Actions
                • Set Temp_Index[1] = (Temp_Index[1] - 1)
                  • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Temp_Index[1] Equal to (==) 0
                    • Then - Actions
                      • Trigger - Turn off (This trigger)
                      • Set Temp_Index[2] = 0
                    • Else - Actions
http://www.hiveworkshop.com/forums/pastebin.php?id=2mo5z2 -> Test Map
 
Level 9
Joined
Aug 21, 2008
Messages
533
Just dont turn the trigger off =)
and instead of saving the unit in a variable give it into a unit group(which you Dont destroy cause you re use it)
in the loop just pick all units from group and do what you want wioth them.

You should also use a hashtable instead of vars with arrays
 
Level 9
Joined
May 30, 2008
Messages
430
  • Temp_Index[1] Equal to (==) 0
you should make a loop that set equal and true for every single variable or something like this the choose is yours have fun (this is only if u wanna stop this trigger from running "slowing down the game" have fun) :thumbs_up:
 
Level 8
Joined
May 21, 2008
Messages
218
I'm not sure but it looks like the problem lies in temp index two. It's hard to read GUI MUI spells because they all get really choppy and complicated, but it looks like your overwriting the temp index two variable. Double check that because as the programmer you understand your script a lot better than I do.
 
Level 14
Joined
Nov 2, 2008
Messages
579
Just don't turn off the trigger =)

If the trigger keeps running it won't be efficient.

and instead of saving the unit in a variable give it into an unit group(which you Don't destroy cause you re use it) in the loop just pick all units from group and do what you want with them.

I'm not sure if not destroying unit groups are healthy.

You should also use a hashtable instead of vars with arrays

I don't use hashtables. Thanks anyway.

I'm not sure but it looks like the problem lies in temp index two. It's hard to read GUI MUI spells because they all get really choppy and complicated, but it looks like your overwriting the temp index two variable. Double check that because as the programmer you understand your script a lot better than I do.

I'm not sure i know what you mean by 'overwriting'. Please elaborate and excuse my noob moment =P
 
Level 9
Joined
May 30, 2008
Messages
430
bah dude write what spell u are trying to do and i will do it for you. i was unable to get why u guys are doing 40+ lines of script for every single spell when u need less than 10 for most of them.
What a spell is
1. spell is casted
2. get units to be affected
3. apply the spell stats to the units
4. create some effects just to make fun for the kids!!! + 20 points
5. clean up the leaks (the sh1ts u make when u pick the units and create special effects)!!! + 10 points (we must all enjoy a game with no lag)



so i don't think those are 40 lines? or they are??
 
Level 14
Joined
Nov 2, 2008
Messages
579
The reason why I want to know why my spells aren't completely MUI is not because I want some spell in particular. I want to know how to make my spells completely MUI without asking for help, and it seems that every spell i make has this problem. I've read the tutorial by Kings several times now and still can't understand why I have this problem.
 
Level 9
Joined
May 30, 2008
Messages
430
it depend what spell u are trying to do. Some MUI spells require a complex loop systems with a lot of integers, some will require a unit group that will be refreshed from time to time and so on but there are few ways i learn them by reading other spells in the forum here and by help of few other ppl. but i still believe that every one have it's own way of creating spells MUI/MPI the problem is to find your own way. We here can help you to find your errors but not the way you must do them
 
Status
Not open for further replies.
Top