• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Whats wrong with this?

Status
Not open for further replies.
Level 5
Joined
Jun 22, 2004
Messages
109
hey peeps heres a spell i made up...im having a couple of probs with it.. firstly after its done going throught every interger when the spell has finished its trigger, the units created do not retain the level of the original hero, secondly the dummy abulity i added does not go away, it stays there making it possible to click it and recast the spell. heres my "code" (duno how to use jass)

Mirror Split
Events
Unit - A unit Begins casting an ability

Conditions
(Ability being cast) Equal to Shadow Image
(Level of Shadow Image for (Casting unit)) Greater than or equal to 1

Actions
Set MirrorSplitCaster = (Triggering unit)
For each (Integer A) from 1 to 3, do (Actions)
Loop - Actions
Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Death's Shadow)) and do (Actions)
Loop - Actions
Set Shadowdummyunit = (Picked unit)
Unit Group - Add Shadowdummyunit to MirrorsplitGroup
Unit - Order Shadowdummyunit to Neutral Pandaren Brewmaster - Storm, Earth, And Fire
Hero - Set Shadowdummyunit Hero-level to ((Hero level of MirrorSplitCaster) x 1), Hide level-up graphics
Wait 1.00 seconds
Wait 6.00 seconds
Unit Group - Pick every unit in MirrorsplitGroup and do (Unit - Remove Shadow Image Dummy from Shadowdummyunit)
Wait 2.00 seconds
Unit Group - Remove all units from MirrorsplitGroup
 
Level 10
Joined
Jul 14, 2004
Messages
463
OK, if you put this code into "code" style, the spaces at the beginning of the line will not be killed and it's easier to understand:
Code:
Mirror Split
    Events
        Unit - A unit Begins casting an ability
   
    Conditions
        (Ability being cast) Equal to Shadow Image 
        (Level of Shadow Image  for (Casting unit)) Greater than or equal to 1
    
     Actions
        Set MirrorSplitCaster = (Triggering unit)
        For each (Integer A) from 1 to 3, do (Actions)
             Loop - Actions
                Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Death's Shadow)) and do (Actions)
                    Loop - Actions
                        Set Shadowdummyunit = (Picked unit)
                        Unit Group - Add Shadowdummyunit to MirrorsplitGroup
                        Unit - Order Shadowdummyunit to Neutral Pandaren Brewmaster - Storm, Earth, And Fire
                        Hero - Set Shadowdummyunit Hero-level to ((Hero level of MirrorSplitCaster) x 1), Hide level-up graphics
                        Wait 1.00 seconds
        Wait 6.00 seconds
        Unit Group - Pick every unit in MirrorsplitGroup and do (Unit - Remove Shadow Image Dummy  from Shadowdummyunit)
        Wait 2.00 seconds
        Unit Group - Remove all units from MirrorsplitGroup
There are some general problems in this "code":
-Event
For Spells you should always use "A unit starts the effect of an ability", there are some reasons for that which have been explained often => search for them or trust me! :wink:
-Wait in Loop
...is not allowed and makes the loop not work correctly (you can also read this in the explanations beneath every event and action in the trigger editor).
-"Unit Group - Pick every unit in MirrorsplitGroup and do (Unit - Remove Shadow Image Dummy from Shadowdummyunit)"
This loop is unnecessary, because it only removes the ability from the unit in the variable "Shadowdummyunit", but this as often as the number of units in "MirrorsplitGroup".

If you corrected these issues, try again and post the results! :)
 
Level 5
Joined
Jun 22, 2004
Messages
109
just a question, how can i space out the timings between each loop?? cause i want them to wait 1 second until it is cast again. and what do u mean by the last part? how can i make it remove the ability for each unit?

btw thx for answering, and i duno y the spaces dont work, i use copy as text and paste it here, but it shows up like that even though there are spaces in the place i pasted, it doesnt show in the final post :S
 
Level 10
Joined
Jul 14, 2004
Messages
463
The wait actions will work in the "For..." loops, but not in the "Pick every..." loops. The last is quite logical: The group might change every time the loop is executed. :wink: You have to think about if the group should be the current one each time the loop is executed or the one at the beginning of the spell. You can use it by picking a random unit of the group, doing the actions (including wait) and then removing the unit from the group. I will give you some detailed explanations, if you say to me which variation of the groups you want and still did not find it out by yourself. :)

The spaces problem is based on HTML, which ignores spaces at the beginning of each line and merges more than one space to a single one. Each of the spaces has to be replaced by an "& n b s p ;" to work at the beginning of the line, I think that's one of the things which this "code" mode does.
 
Level 5
Joined
Jun 22, 2004
Messages
109
yeah i want it to be the cureent group, i want to remove the ability from each of the last units that have been made after the last ability has been cast (in the for each interger a from 1 to 3...)
 
Level 10
Joined
Jul 14, 2004
Messages
463
I think the following should do what you want it to do, I think:

Used Variables
DeathsShadows, DoneDeathShadows : unit groups
Shadowdummyunit, MirrorSplitCaster : units
Code:
Mirror Split
    Events
        Unit - A unit starts the effect of an ability
   
    Conditions
        (Ability being cast) Equal to Shadow Image 
        (Level of Shadow Image  for (Casting unit)) Greater than or equal to 1
    
     Actions
        Set MirrorSplitCaster = (Casting unit)
        For each (Integer A) from 1 to 3, do (Actions)
             Loop - Actions
                Trigger - Run "Mirror Split Loop" (ignoring conditions)
                Trigger - Turn on "Mirror Split Loop"
                Wait for ("Mirror Split Loop" is off = True), checking every 1 seconds of gametime
        Wait 6.00 seconds
        Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Death's Shadow)) and do (Unit - Remove Shadow Image Dummy  from (Picked Unit))
        Wait 2.00 seconds
        Unit Group - Remove all units from DeathsShadows


Mirror Split Loop [<=new Trigger]
    Events
    Conditions
    Actions
        set DeathsShadows = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Death's Shadow))
        Unit Group - Pick every unit in DoneDeathShadows and do (Unit - Remove (Picked unit) from DeathsShadows)
        Set Shadowdummyunit = (Random unit from (DeathsShadows))
        Unit - Order Shadowdummyunit to Neutral Pandaren Brewmaster - Storm, Earth, And Fire
        Hero - Set Shadowdummyunit Hero-level to (Hero level of MirrorSplitCaster), Hide level-up graphics
        Unit Group - Add Shadowdummyunit To DoneDeathShadows
        Wait 1.00 seconds
        IF
          Number of units in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Death's Shadow)) equal to Number of units in DoneDeathShadows
        THEN
          Trigger - Turn off (this trigger)
        ELSE
          Trigger - Run (this trigger) (ignoring conditions)
I hope you know, that "Death's Shadow" must be a hero type unit (otherways you can't set the hero level) and that this spell will never be multiinstacable. :wink:

Now try this code and post the results!
 
Level 5
Joined
Jun 22, 2004
Messages
109
aight it didnt work, it kept splitting the unit... didnt stop, heres my code

Variables=Mirrorsplitgrou,MirrorsplitEND=unit groups
Shadowdummyunit,MirrorsplitCaster=Units

Trigger 1
Code:
Mirror Split
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Shadow Image 
        (Level of Shadow Image  for (Triggering unit)) Greater than or equal to 1
    Actions
        Set MirrorSplitCaster = (Triggering unit)
        For each (Integer A) from 1 to 3, do (Actions)
            Loop - Actions
                Trigger - Run Mirror split loop <gen> (ignoring conditions)
                Trigger - Turn on Mirror split loop <gen>
                Wait until ((Mirror split loop <gen> is on) Equal to False), checking every 1.00 seconds
        Wait 6.00 seconds
        Unit Group - Pick every unit in (Units in (Playable map area)) and do (Unit - Remove Shadow Image Dummy  from (Picked unit))
        Wait 2.00 seconds
        Unit Group - Remove (Matching unit) from MirrorsplitGroup

Trigger 2


Code:
Mirror split loop
    Events
    Conditions
    Actions
        Set MirrorsplitGroup = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Death's Shadow))
        Unit Group - Remove all units of MirrorsplitgroupEND from MirrorsplitGroup
        Unit Group - Pick every unit in MirrorsplitGroup and do (Actions)
            Loop - Actions
                Set Shadowdummyunit[1] = (Picked unit)
                Unit - Order Shadowdummyunit[1] to Neutral Pandaren Brewmaster - Storm, Earth, And Fire
                Hero - Set Shadowdummyunit[1] Hero-level to ((Level of MirrorSplitCaster) x 1), Hide level-up graphics
        Wait 1.00 seconds
        If ((Number of units in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Death's Shadow))) Equal to (Number of units in MirrorsplitgroupEND)) then do (Trigger - Turn off (This trigger)) else do (Trigger - Run (This trigger) (ignoring conditions))

Note that i changed from set shadowdummyunit1= random unit from unit group to pick every units in unit group, also i do not understand why these certain things are in your code..

Trigger - Run "Mirror Split Loop" (ignoring conditions)

Unit Group - Pick every unit in DoneDeathShadows and do (Unit - Remove (Picked unit) from DeathsShadows)

yeah so it didint stop splitting what do u think the prob may be? and note that i did set the second trigger as not initially on, and one more thing...
i could not find this in the triggers...

Wait for ("Mirror Split Loop" is off = True)
The part where it says Mirror split loop is off = true, there is only Mirrorsplit loop is on = True/false
 
Level 10
Joined
Jul 14, 2004
Messages
463
Hello,
The trick I used is that with the Trigger "Mirror Split Loop" I actually imitated a "Pick every unit..." loop:
I put all DeathShadow units into a group and remove again all of them, which are already done ("Pick every unit in DoneDeathShadows and do Remove (picked unit from DeathShadows"). Then I pick a unit from the remaining group, do the actions for it and mark it as done (by adding it to the DoneDeathShadows group). Then I wait a second and if there are still units which the actions didn't work on, the trigger is restarted (Run (this trigger) ignoring conditions). If there are no more units (The Done group includes all units that the spell should work on), the trigger turns off.
The main trigger simply starts the loop by running it the first time and turning it on and then waits to go on until it's turned off. You corrected the "Wait for condition..." function the right way, I didn't remember it exactly.

So try it again exactly as I showed it to you (except the wait for condition, which you should correct again). Then post again the results, we'll get this damn spell done together! :D

EDIT: I discovered a bug, here's the new version:
Used Variables
DeathsShadows, DoneDeathShadows : unit groups
Shadowdummyunit, MirrorSplitCaster : units
Code:
Mirror Split
    Events
        Unit - A unit starts the effect of an ability
   
    Conditions
        (Ability being cast) Equal to Shadow Image 
        (Level of Shadow Image  for (Casting unit)) Greater than or equal to 1
    
     Actions
        Set MirrorSplitCaster = (Casting unit)
        For each (Integer A) from 1 to 3, do (Actions)
             Loop - Actions
                Trigger - Run "Mirror Split Loop" (ignoring conditions)
                Trigger - Turn on "Mirror Split Loop"
                Wait for ("Mirror Split Loop" is on = False), checking every 1 seconds of gametime
        Wait 6.00 seconds
        Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Death's Shadow)) and do (Unit - Remove Shadow Image Dummy  from (Picked Unit))
        Wait 2.00 seconds
        Unit Group - Remove all units from DoneDeathShadows


Mirror Split Loop [<=new Trigger]
    Events
    Conditions
    Actions
        set DeathsShadows = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Death's Shadow))
        Unit Group - Pick every unit in DoneDeathShadows and do (Unit - Remove (Picked unit) from DeathsShadows)
        Set Shadowdummyunit = (Random unit from (DeathsShadows))
        Unit - Order Shadowdummyunit to Neutral Pandaren Brewmaster - Storm, Earth, And Fire
        Hero - Set Shadowdummyunit Hero-level to (Hero level of MirrorSplitCaster), Hide level-up graphics
        Unit Group - Add Shadowdummyunit To DoneDeathShadows
        Wait 1.00 seconds
        IF
          Number of units in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Death's Shadow)) equal to Number of units in DoneDeathShadows
        THEN
          Trigger - Turn off (this trigger)
        ELSE
          Trigger - Run (this trigger) (ignoring conditions)

I only corrected the wait for condition, added reset of "DoneDeathShadows", and removed useless reset of "DeathShadows" so there is not much to change for you.

Edited 2 times.
 
Level 5
Joined
Jun 22, 2004
Messages
109
OK, now what u gave me did not work, so i tired somthing on my own, and it worked perfectly :) heres what i did,

Code:
Mirror Split
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Shadow Image 
        (Level of Shadow Image  for (Triggering unit)) Greater than or equal to 1
    Actions
        Set MirrorSplitCaster = (Triggering unit)
        For each (Integer A) from 1 to 3, do (Actions)
            Loop - Actions
                Trigger - Run Mirror split loop <gen> (ignoring conditions)
                Trigger - Turn on Mirror split loop <gen>
                Wait until ((Mirror split loop <gen> is on) Equal to False), checking every 1.00 seconds
        Unit Group - Pick every unit in (Units owned by (Owner of MirrorSplitCaster) matching ((Unit-type of (Matching unit)) Equal to Death's Shadow)) and do (Hero - Set (Picked unit) Hero-level to (Level of MirrorSplitCaster), Hide level-up graphics)
        Unit Group - Pick every unit in (Units owned by (Owner of MirrorSplitCaster) matching ((Unit-type of (Matching unit)) Equal to Death's Shadow)) and do (Unit - Remove Shadow Image Dummy  from (Picked unit))
        Wait 2.00 seconds
        Unit Group - Remove (Matching unit) from MirrorsplitGroup

Second trigger

Code:
Mirror split loop
    Events
    Conditions
    Actions
        Set MirrorsplitGroup = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Death's Shadow))
        Unit Group - Pick every unit in MirrorsplitGroup and do (Actions)
            Loop - Actions
                Set Shadowdummyunit[1] = (Picked unit)
                Unit - Order Shadowdummyunit[1] to Neutral Pandaren Brewmaster - Storm, Earth, And Fire
                Hero - Set Shadowdummyunit[1] Hero-level to ((Level of MirrorSplitCaster) x 1), Hide level-up graphics
        Wait 1.00 seconds
        Trigger - Turn off (This trigger)

So basically instead of having the if statement in the second trigger, you just end the trigger and it will restart on its own, you dont need the second group so i removed that, and i noticed that after the trigger was finished my units did not gain the level of the original hero, so i had to ad that extra thing in order to allow them to gain that level. thx a lot for the help!!! appreciate it! :D
 
Level 10
Joined
Jul 14, 2004
Messages
463
OK, if that's what you wanted, it would have been easier. It doesn't wait the 1 second anymore for each unit, does it?

If it now works, it great, but now you can kill some things of it. If you just want to run the trigger "DSLoop" one time, you can kill these Trigger actions and just copy the actions of the loop trigger into the main trigger. If the loop trigger is not a loop anymore, you don't need it! :wink:
And now you set the hero level once in the loop trigger and once in the main trigger, so you can kill one of these aswell.

I don't know, if there are still some more mini issues, but the main objective is to make it run and it runs.

I said we would succeed. 8)
 
Level 5
Joined
Jun 22, 2004
Messages
109
thx a lot man :) im ganna implement it some more, i need to make it pick one of those units by random and replace that specific unit by the caster, so if the caster dies (like mirror image) the whole ability is turned off and the unit dies.
 
Status
Not open for further replies.
Top