Multiple Hero Selection Spell. Not Working as expected.

Kelv

TH.net Regular
Reaction score
7
I changed a spell from a single hero, to a multiple hero spell, and I actually thought that the spell work easier and better, but I cant seem to get the spell to work. I have one trigger that splits all the heroes into two groups at the beginning of the game, into Alliance and Horde heroes. So I have this skill which is an alliance spell. My first trigger is this:
Code:
Manual Select
    Events
        Unit - A unit Sells a unit
    Conditions
        ((Sold unit) is A Hero) Equal to True
    Actions
        Unit Group - Pick every unit in (Units in (Playable map area) owned by (Owner of (Sold unit))) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Picked unit) is A Hero) Equal to False
                    Then - Actions
                        Unit - Remove (Picked unit) from the game
                        Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Human\MassTeleport\MassTeleportCaster.mdl
                        Special Effect - Destroy (Last created special effect)
                        Unit - Move (Sold unit) instantly to (Position of (Picked unit))
                        Neutral Building - Remove (Unit-type of (Sold unit)) from all marketplaces
                    Else - Actions
                        Do nothing
        Player Group - Pick every player in (All players) and do (Actions)
            Loop - Actions
                Player - Make (Unit-type of (Sold unit)) Unavailable for training/construction by (Picked player)
                Special Effect - Create a special effect at (Position of (Sold unit)) using Abilities\Spells\Human\MassTeleport\MassTeleportCaster.mdl
                Special Effect - Destroy (Last created special effect)
        Game - Display to (All players) the text: ((Name of (Owner of (Sold unit))) + ( has chosen:  + (Name of (Sold unit))))
        Item - Create Replenishment at (Center of (Playable map area))
        Hero - Give (Last created item) to (Sold unit)
        Selection - Select (Sold unit) for (Owner of (Sold unit))
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Owner of (Sold unit)) is an ally of Player 1 (Red)) Equal to True
            Then - Actions
                Unit Group - Add (Sold unit) to Ally_Heroes
            Else - Actions
                Unit Group - Add (Sold unit) to Horde_Heroes
Player 1 is a computer for the alliance, player 6 is a computer for the horde.

My second trigger, which is the spell trigger, is this:
Code:
Pray to Naaru
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Pray to Naaru 
    Actions
        Unit Group - Pick every unit in Ally_Heroes and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Random integer number between 1 and 100) Less than or equal to 80
                    Then - Actions
                        Wait 0.50 seconds
                        Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\Other\Monsoon\MonsoonBoltTarget.mdl
                        Wait 0.10 seconds
                        Special Effect - Destroy (Last created special effect)
                        Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\Undead\VampiricAura\VampiricAuraTarget.mdl
                        Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + ((Real((Level of Pray to Naaru  for (Triggering unit)))) x 150.00))
                        Floating Text - Create floating text that reads (Healed  + (String(((Level of Pray to Naaru  for (Triggering unit)) x 150)))) at (Position of (Picked unit)) with Z offset 0.00, using font size 10.00, color (0.00%, 0.00%, 100.00%), and 0.00% transparency
                        Floating Text - Change (Last created floating text): Disable permanence
                        Floating Text - Change the lifespan of (Last created floating text) to 3.50 seconds
                        Floating Text - Change the fading age of (Last created floating text) to 0.00 seconds
                        Floating Text - Set the velocity of (Last created floating text) to 15.00 towards 90.00 degrees
                        Wait 0.40 seconds
                        Special Effect - Destroy (Last created special effect)
                        Trigger - Run (This trigger) (ignoring conditions)
                    Else - Actions
                        Game - Display to (All allies of (Owner of (Triggering unit))) for 10.00 seconds the text: ((A'dal: Sorry  + (Name of (Owner of (Triggering unit)))) + , My powers are not strong enough.)
                        Floating Text - Create floating text that reads FAILED! at (Position of (Picked unit)) with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
                        Floating Text - Change (Last created floating text): Disable permanence
                        Floating Text - Change the lifespan of (Last created floating text) to 3.50 seconds
                        Floating Text - Change the fading age of (Last created floating text) to 0.00 seconds
                        Floating Text - Set the velocity of (Last created floating text) to 15.00 towards 90.00 degrees

Can anyone see any glitches in my code, aside from leaks? (If you notice there are likes (which I assume there are) feel free to call me out on them, it would be a help, but its not the point of the thread. Thanks for reading
 

Drunken_God

Hopes to get back into Mapmaking with SC2 :)
Reaction score
106
could it be that more then 1 hero cast this at the same time?
in each case this Special Effect - Destroy (Last created special effect) after a wait will remove any last created special effect(not only the one of the spell
 

Iwan_Krissov

New Member
Reaction score
18
Are you sure its not working?
I could imagine its working very slowly, because you have waits in your loop. Every time the trigger is called, it will have to wait about 1.00 secs within the loop. I dont know if this is working at all, using waits in loops, but it will definitely slow it down...#

EDIT:
No does not work at all, I tried out. Get rid of the waits inside the loop
 

Kelv

TH.net Regular
Reaction score
7
Okay, it seems to be working now, I haven't done that much testing. The problem is, what do I replace with those waits? I cant have the spell going off, maybe 1000 times in a second. I want the trigger to occur once a second.
 

Iwan_Krissov

New Member
Reaction score
18
Code:
Pray to Naaru
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Pray to Naaru 
    Actions
        Unit Group - Pick every unit in Ally_Heroes and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Random integer number between 1 and 100) Less than or equal to 80
                    Then - Actions
                        Trigger - Run Wait1 <gen> (ignoring conditions)
                        ...and so on

Code:
wait1
    Events
    Conditions
    Actions
        Wait 0.50 seconds
        Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\Other\Monsoon\MonsoonBoltTarget.mdl

perhaps something like this ... but there are surely other ways to do so, but I dont know them ...
 

Kelv

TH.net Regular
Reaction score
7
Okay, I would like to get some more input from someone that knows other ways.
+ rep for helping me realize the problem was with the waits.
 

cleeezzz

The Undead Ranger.
Reaction score
268
you could use timers but its takes a lot more work for something this simple.
 

Kelv

TH.net Regular
Reaction score
7
If I wanted to use timers, how would I do it. Would I need more than one trigger?
 

Kelv

TH.net Regular
Reaction score
7
bump, you can delete this please, I am looking from advice from someone with experience in triggers without waits.
 

cleeezzz

The Undead Ranger.
Reaction score
268
well..set a new variable, Timer, name it whatever you want.
and..

Code:
Pray to Naaru
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Pray to Naaru 
    Actions
        Unit Group - Pick every unit in Ally_Heroes and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Random integer number between 1 and 100) Less than or equal to 80
                    Then - Actions
                        Set Temp_Int [Playner number of (Owner of (Triggering Unit))) = 0
                        Timer - Start (My_Timer[(Player number of (Owner of (Triggering Unit))) as a repeating timer that will expire in .30 seconds.
can i just round the waits? lol.
Code:
My Timer
    Events
        Time - My_Timer[1] expires
        Time - My_Timer[2] expires
        Time - My_Timer[3] expires
        Time - My_Timer[4] expires
        Time - My_Timer[5] expires
        Time - My_Timer[6] expires
        Time - My_Timer[7] expires
        Time - My_Timer[8] expires
        Time - My_Timer[9] expires
        Time - My_Timer[10] expires
        Time - My_Timer[11] expires
        Time - My_Timer[12] expires
    Conditions
    Actions
        For each (Integer A) from 1 to 12, do (Actions)
            Loop - Actions
                Custom script:   if GetExpiredTimer() == udg_My_Timer[bj_forLoopAIndex] then
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Temp_Int[Integer A] = 1
                    Then - Actions
                        Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\Other\Monsoon\MonsoonBoltTarget.mdl
                        Special Effect - Destroy (Last created special effect)
                        Set Temp_Int[Integer A] = 2
                     Else - Actions
                            If - Conditions
                                 Temp_Int[Integer A] = 2
                            Then - Actions
                                 Blah balh
                Custom script:   endif
get it?

when it reaches the end of the trigger like lets say temp_int = 8 or 9
do- Pause My_Timer[Integer A] so it stops setting it off.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top