HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Posted trigger - grr it wont work.. why?

02-19-2004, 08:07 AM#1
Huh
Here's the trigger..

Code:
allyoursouls effects trigger
    Events
        Unit - A unit Begins channeling an ability
    Conditions
        (Ability being cast) Equal to (==) All Your Souls R Belong to Me 
    Actions
        Special Effect - Create a special effect at (Position of allyoursouls_caster) using Abilities\Spells\Items\AItb\AItbTarget.mdl
        Wait 2.00 seconds
        Unit Group - Pick every unit in (Units within 800.00 of (Position of allyoursouls_caster) matching (((Owner of (Matching unit)) Equal to (==) Player 11 (Dark Green)) and (((Matching unit) is alive) Equal to (==) True))) and do (Actions)
            Loop - Actions
                Unit Group - Add (Picked unit) to allyoursouls_unitgroup[0]
                Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Demon\DarkPortal\DarkPortalTarget.mdl
                Special Effect - Create a special effect attached to the overhead of (Picked unit) using Objects\InventoryItems\CrystalShard\CrystalShard.mdl
                Set allyoursouls_sfx = (Last created special effect)
                Wait 1.00 seconds
                Unit - Change ownership of (Picked unit) to (Owner of allyoursouls_caster) and Retain color
                Unit - Add a 60.00 second Generic expiration timer to (Picked unit)
                Wait 60.00 seconds
                Unit - Change ownership of (Picked unit) to Player 11 (Dark Green) and Retain color
                Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Orc\EtherealForm\SpiritWalkerChange.mdl
                Special Effect - Destroy allyoursouls_sfx

Any ideas? I'm trying to get control of all enemy units within 800 range of my hero. This is based off another persons spell and I'm trying to make an AoE version..

edit- had part of the trigger wrong. fixed it
02-19-2004, 08:21 AM#2
Alakafizz
Code:
(Units within 800.00 of (Position of [color=red]allyoursouls_caster[/color])
Unless you set that unit variable somewhere else, that's the problem.

Also, on a sidenote:
Code:
Set allyoursouls_sfx = (Last created special effect)
You'll lose control over your effects if there's more than one unit matching the Pick, since you only store it in 1 variable. Use an array.
02-19-2004, 08:26 AM#3
Huh
hm ok ill keep that in mind about the array. the "allyoursouls_caster" variable is set in another trigger. The trigger fires fine , displays the sfx etc, but the part where it should give me control of the target units never works. I have a single unit version and it works fine...
02-19-2004, 08:28 AM#4
Grater
you cannot have waits in a "pick every unit..." action.
02-19-2004, 08:39 AM#5
Huh
Ah HAH, that might be it. Let me drop these waits real quick and see if that doesnt fix it. I'm pretty sure I can make it work with no waits. I know ive seen the fact that waits cant be used in pick all units before, mustve forgot tho..

Yep that fixed it. Thanks for the brief, effective advice Grater :)

On a side note, how would I go about setting all those units picked to an array so my "destroy SFX" trigger works right? I tried changing the variable to array and setting it as "allyoursouls_sfx[0]" but its doing the same thing. I guess I'm still not too familar with the way arrays work.
02-19-2004, 08:53 AM#6
Alakafizz
You need an integer variable, "i":

Code:
allyoursouls effects trigger
    Events
        Unit - A unit Begins channeling an ability
    Conditions
        (Ability being cast) Equal to (==) All Your Souls R Belong to Me 
    Actions
        [color=red]Set i = 1[/color]
        Special Effect - Create a special effect at (Position of allyoursouls_caster) using Abilities\Spells\Items\AItb\AItbTarget.mdl
        Set allyoursouls_sfx[color=red][i][/color] = (Last created special effect)
        [color=red]Set i = i + 1[/color]
        Wait 2.00 seconds
        Unit Group - Pick every unit in (Units within 800.00 of (Position of allyoursouls_caster) matching (((Owner of (Matching unit)) Equal to (==) Player 11 (Dark Green)) and (((Matching unit) is alive) Equal to (==) True))) and do (Actions)
            Loop - Actions
                Unit Group - Add (Picked unit) to allyoursouls_unitgroup[0]
                Special Effect - Create a special effect at (Position of (Picked unit)) using  Abilities\Spells\Demon\DarkPortal\DarkPortalTarget
.mdl
                Set allyoursouls_sfx[color=red][i][/color] = (Last created special effect)
                [color=red]Set i = i + 1[/color]
                Special Effect - Create a special effect attached to the overhead of (Picked unit) using Objects\InventoryItems\CrystalShard\CrystalShard.mdl
                Set allyoursouls_sfx[color=red][i][/color] = (Last created special effect)
                [color=red]Set i = i + 1[/color]
                 Unit - Change ownership of (Picked unit) to (Owner of allyoursouls_caster) and Retain color
                Unit - Add a 60.00 second Generic expiration timer to (Picked unit)
                Unit - Change ownership of (Picked unit) to Player 11 (Dark Green) and Retain color
                Special Effect - Create a special effect at (Position of (Picked unit)) using  Abilities\Spells\Orc\EtherealForm\SpiritWalkerChan
ge.mdl
                Set allyoursouls_sfx[color=red][i][/color] = (Last created special effect)

Then in another trigger:
Code:
For each (Integer A) from 1 to i, do (Actions)
    Loop - Actions
        Special Effect - Destroy allyoursouls_sfx[i]

=)
02-19-2004, 08:58 AM#7
Huh
Thanks! That will help me enormously. its little bits and pieces of knowledge like that there that are helping me become better at this map making business. Much appreciated ^_^
02-19-2004, 09:07 AM#8
Grater
This situation pratically begs for Local variables, in this case you can use a nice little hack:

At the start of a trigger you do have these two lines:
Custom Script: local effect udg_TempEffect
Custom Script: local unit udg_TempUnit

Now in effect, in the rest of the trigger "TempEffect" and "TempUnit" are local variables which can be used in a GUI.

So what I would do is this:
Create a trigger with no events or condition, this trigger takes (picked unit) and changes owner, adds effect, waits, remove effect, resets owner. And it does this using the local variable method I mentioned above. Call it AllYourSoulsUnitActions or something.

So this trigger will contain everything in the "pick every... actions" part of the trigger you first posted, additionally at the front of the trigger have the following lines.
Code:
Custom Script: local effect udg_allyoursouls_sfx
Custom Script: local unit udg_PickedUnit = GetEnumUnit()
Custom Script: local unit udg_CastingUnit = GetSpellAbilityUnit()
Now for the rest of that trigger you can use the global SFX variable allyoursouls_sfx, the global unit variable PickedUnit to refer to the picked unit, CastingUnit to refer to the casting unit (create those last two global variables)

In your main trigger do this:
Pick every units in ...... and (do actions)
Run <AllYourSoulsUnitActions>

This basically creates a seperate trigger for every individual unit effected by the skill, ensuring that the SFX and waits are kept seperate for every unit.
02-19-2004, 09:46 AM#9
Cubasis
Ah, heh,

that's true, generally all Multiplayer Trigger spell desperately beg for local variables.... as that allows you to have many heros casting the same spell at the same time (and thus allows many heros to pick same hero), and also reduces the number of global variables needed.

Anyhow, i just wanted to privately announce that i'm writing a complete Jass article for the GUI person. This article will only request people to know alot about GUI, and to have interest in learning Jass (as you won't learn anything if you're lazy about it).

This article goes VERY smoothly into Jass, and does it by comparing all the different things in GUI with Jass, so you quickly begin to think in Jass terms.

I have already written chapter 1-2. Which are about Introduction/Functions (how they work, what they do, the syntax, blah), and the second is about Local variables and Control Statements (if, loop, bleh).

This is explained in very easy language (personally), and everybody should have a easy time learning if they only want to.

Later chapters will delve into very advanced concept like; The Return Bug and Using Game Cache as Object Orientation.

Cubasis

EDIT: I'll also have chapters about individual challenges/problems, like how to use jass to do different things like Trigger Spells and stuff like that. I'll also go into bug-fixing (where i'll offer my e-mail for people to send their code for private assistance)
02-20-2004, 12:27 AM#10
Huh
Quote:
Anyhow, i just wanted to privately announce that i'm writing a complete Jass article for the GUI person. This article will only request people to know alot about GUI, and to have interest in learning Jass (as you won't learn anything if you're lazy about it).

POST 'DAT SH*T!!
02-20-2004, 03:39 AM#11
Huh
Ok, I still havnt gone into using the info grater gave me (because honestly its a tad bit intimidating), but I went ahead and rewrote most of the trigger(s) with info from Alkafizz. Now, once again nothing is working... The spell starts out fine but when it hits the part to change the units to my control it does nothing. ANyhow I'll post the new trigger in its entirety (its alot longer because i made it a 5 lvl spell, each one is an if/than/else in the trigger).

Trigger 1:
Code:
allyoursouls learnt trigger
    Events
        Unit - A unit Learns a skill
    Conditions
        (Learned Hero Skill) Equal to (==) All Your Souls R Belong to Me 
    Actions
        Set allyoursouls_lvl = (allyoursouls_lvl + 1)
        Set allyoursouls_caster = (Casting unit)

Trigger 2:
Code:
allyoursouls effects trigger
    Events
        Unit - A unit Finishes casting an ability
    Conditions
        (Ability being cast) Equal to (==) All Your Souls R Belong to Me 
    Actions
        Set allyoursouls_integer = 1
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                allyoursouls_lvl Equal to (==) 1
            Then - Actions
                Special Effect - Create a special effect at (Position of allyoursouls_caster) using Abilities\Spells\Items\AItb\AItbTarget.mdl
                Set allyoursouls_sfx[allyoursouls_integer] = (Last created special effect)
                Set allyoursouls_integer = (allyoursouls_integer + 1)
                Wait 1.00 seconds
                Unit Group - Pick every unit in (Units within 800.00 of (Position of allyoursouls_caster) matching (((Owner of (Matching unit)) Equal to (==) Player 11 (Dark Green)) and (((Matching unit) is alive) Equal to (==) True))) and do (Actions)
                    Loop - Actions
                        Unit Group - Add (Picked unit) to allyoursouls_unitgroup
                        Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Demon\DarkPortal\DarkPortalTarget.mdl
                        Set allyoursouls_sfx[allyoursouls_integer] = (Last created special effect)
                        Set allyoursouls_integer = (allyoursouls_integer + 1)
                        Special Effect - Create a special effect attached to the overhead of (Picked unit) using Objects\InventoryItems\CrystalShard\CrystalShard.mdl
                        Set allyoursouls_sfx[allyoursouls_integer] = (Last created special effect)
                        Set allyoursouls_integer = (allyoursouls_integer + 1)
                        Unit - Change ownership of (Picked unit) to (Owner of allyoursouls_caster) and Retain color
                Wait 20.00 seconds
                Unit Group - Pick every unit in allyoursouls_unitgroup and do (Unit - Change ownership of (Picked unit) to Player 11 (Dark Green) and Retain color)
                Unit Group - Pick every unit in allyoursouls_unitgroup and do (Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Orc\EtherealForm\SpiritWalkerChange.mdl)
                Trigger - Run allyoursouls effects 2 <gen> (checking conditions)
                Unit Group - Order allyoursouls_unitgroup to Attack-Move To (Center of HeroSpawn <gen>)
                Unit Group - Remove all units of allyoursouls_unitgroup from allyoursouls_unitgroup
            Else - Actions
                Do nothing
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                allyoursouls_lvl Equal to (==) 2
            Then - Actions
                Special Effect - Create a special effect at (Position of allyoursouls_caster) using Abilities\Spells\Items\AItb\AItbTarget.mdl
                Set allyoursouls_sfx[allyoursouls_integer] = (Last created special effect)
                Set allyoursouls_integer = (allyoursouls_integer + 1)
                Wait 1.00 seconds
                Unit Group - Pick every unit in (Units within 800.00 of (Position of allyoursouls_caster) matching (((Owner of (Matching unit)) Equal to (==) Player 11 (Dark Green)) and (((Matching unit) is alive) Equal to (==) True))) and do (Actions)
                    Loop - Actions
                        Unit Group - Add (Picked unit) to allyoursouls_unitgroup
                        Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Demon\DarkPortal\DarkPortalTarget.mdl
                        Set allyoursouls_sfx[allyoursouls_integer] = (Last created special effect)
                        Set allyoursouls_integer = (allyoursouls_integer + 1)
                        Special Effect - Create a special effect attached to the overhead of (Picked unit) using Objects\InventoryItems\CrystalShard\CrystalShard.mdl
                        Set allyoursouls_sfx[allyoursouls_integer] = (Last created special effect)
                        Set allyoursouls_integer = (allyoursouls_integer + 1)
                        Unit - Change ownership of (Picked unit) to (Owner of allyoursouls_caster) and Retain color
                Wait 30.00 seconds
                Unit Group - Pick every unit in allyoursouls_unitgroup and do (Unit - Change ownership of (Picked unit) to Player 11 (Dark Green) and Retain color)
                Unit Group - Pick every unit in allyoursouls_unitgroup and do (Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Orc\EtherealForm\SpiritWalkerChange.mdl)
                Trigger - Run allyoursouls effects 2 <gen> (checking conditions)
                Unit Group - Order allyoursouls_unitgroup to Attack-Move To (Center of HeroSpawn <gen>)
                Unit Group - Remove all units of allyoursouls_unitgroup from allyoursouls_unitgroup
            Else - Actions
                Do nothing
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                allyoursouls_lvl Equal to (==) 3
            Then - Actions
                Special Effect - Create a special effect at (Position of allyoursouls_caster) using Abilities\Spells\Items\AItb\AItbTarget.mdl
                Set allyoursouls_sfx[allyoursouls_integer] = (Last created special effect)
                Set allyoursouls_integer = (allyoursouls_integer + 1)
                Wait 1.00 seconds
                Unit Group - Pick every unit in (Units within 800.00 of (Position of allyoursouls_caster) matching (((Owner of (Matching unit)) Equal to (==) Player 11 (Dark Green)) and (((Matching unit) is alive) Equal to (==) True))) and do (Actions)
                    Loop - Actions
                        Unit Group - Add (Picked unit) to allyoursouls_unitgroup
                        Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Demon\DarkPortal\DarkPortalTarget.mdl
                        Set allyoursouls_sfx[allyoursouls_integer] = (Last created special effect)
                        Set allyoursouls_integer = (allyoursouls_integer + 1)
                        Special Effect - Create a special effect attached to the overhead of (Picked unit) using Objects\InventoryItems\CrystalShard\CrystalShard.mdl
                        Set allyoursouls_sfx[allyoursouls_integer] = (Last created special effect)
                        Set allyoursouls_integer = (allyoursouls_integer + 1)
                        Unit - Change ownership of (Picked unit) to (Owner of allyoursouls_caster) and Retain color
                Wait 40.00 seconds
                Unit Group - Pick every unit in allyoursouls_unitgroup and do (Unit - Change ownership of (Picked unit) to Player 11 (Dark Green) and Retain color)
                Unit Group - Pick every unit in allyoursouls_unitgroup and do (Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Orc\EtherealForm\SpiritWalkerChange.mdl)
                Trigger - Run allyoursouls effects 2 <gen> (checking conditions)
                Unit Group - Order allyoursouls_unitgroup to Attack-Move To (Center of HeroSpawn <gen>)
                Unit Group - Remove all units of allyoursouls_unitgroup from allyoursouls_unitgroup
            Else - Actions
                Do nothing
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                allyoursouls_lvl Equal to (==) 4
            Then - Actions
                Special Effect - Create a special effect at (Position of allyoursouls_caster) using Abilities\Spells\Items\AItb\AItbTarget.mdl
                Set allyoursouls_sfx[allyoursouls_integer] = (Last created special effect)
                Set allyoursouls_integer = (allyoursouls_integer + 1)
                Wait 1.00 seconds
                Unit Group - Pick every unit in (Units within 800.00 of (Position of allyoursouls_caster) matching (((Owner of (Matching unit)) Equal to (==) Player 11 (Dark Green)) and (((Matching unit) is alive) Equal to (==) True))) and do (Actions)
                    Loop - Actions
                        Unit Group - Add (Picked unit) to allyoursouls_unitgroup
                        Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Demon\DarkPortal\DarkPortalTarget.mdl
                        Set allyoursouls_sfx[allyoursouls_integer] = (Last created special effect)
                        Set allyoursouls_integer = (allyoursouls_integer + 1)
                        Special Effect - Create a special effect attached to the overhead of (Picked unit) using Objects\InventoryItems\CrystalShard\CrystalShard.mdl
                        Set allyoursouls_sfx[allyoursouls_integer] = (Last created special effect)
                        Set allyoursouls_integer = (allyoursouls_integer + 1)
                        Unit - Change ownership of (Picked unit) to (Owner of allyoursouls_caster) and Retain color
                Wait 50.00 seconds
                Unit Group - Pick every unit in allyoursouls_unitgroup and do (Unit - Change ownership of (Picked unit) to Player 11 (Dark Green) and Retain color)
                Unit Group - Pick every unit in allyoursouls_unitgroup and do (Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Orc\EtherealForm\SpiritWalkerChange.mdl)
                Trigger - Run allyoursouls effects 2 <gen> (checking conditions)
                Unit Group - Order allyoursouls_unitgroup to Attack-Move To (Center of HeroSpawn <gen>)
                Unit Group - Remove all units of allyoursouls_unitgroup from allyoursouls_unitgroup
            Else - Actions
                Do nothing
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                allyoursouls_lvl Equal to (==) 5
            Then - Actions
                Special Effect - Create a special effect at (Position of allyoursouls_caster) using Abilities\Spells\Items\AItb\AItbTarget.mdl
                Set allyoursouls_sfx[allyoursouls_integer] = (Last created special effect)
                Set allyoursouls_integer = (allyoursouls_integer + 1)
                Wait 1.00 seconds
                Unit Group - Pick every unit in (Units within 800.00 of (Position of allyoursouls_caster) matching (((Owner of (Matching unit)) Equal to (==) Player 11 (Dark Green)) and (((Matching unit) is alive) Equal to (==) True))) and do (Actions)
                    Loop - Actions
                        Unit Group - Add (Picked unit) to allyoursouls_unitgroup
                        Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Demon\DarkPortal\DarkPortalTarget.mdl
                        Set allyoursouls_sfx[allyoursouls_integer] = (Last created special effect)
                        Set allyoursouls_integer = (allyoursouls_integer + 1)
                        Special Effect - Create a special effect attached to the overhead of (Picked unit) using Objects\InventoryItems\CrystalShard\CrystalShard.mdl
                        Set allyoursouls_sfx[allyoursouls_integer] = (Last created special effect)
                        Set allyoursouls_integer = (allyoursouls_integer + 1)
                        Unit - Change ownership of (Picked unit) to (Owner of allyoursouls_caster) and Retain color
                Wait 60.00 seconds
                Unit Group - Pick every unit in allyoursouls_unitgroup and do (Unit - Change ownership of (Picked unit) to Player 11 (Dark Green) and Retain color)
                Unit Group - Pick every unit in allyoursouls_unitgroup and do (Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Orc\EtherealForm\SpiritWalkerChange.mdl)
                Trigger - Run allyoursouls effects 2 <gen> (checking conditions)
                Unit Group - Order allyoursouls_unitgroup to Attack-Move To (Center of HeroSpawn <gen>)
                Unit Group - Remove all units of allyoursouls_unitgroup from allyoursouls_unitgroup
            Else - Actions
                Do nothing

Trigger 3:

Code:
allyoursouls effects 2
    Events
    Conditions
    Actions
        For each (Integer A) from 1 to allyoursouls_integer, do (Actions)
            Loop - Actions
                Special Effect - Destroy allyoursouls_sfx[allyoursouls_integer]

Trigger 4:

Code:
allyoursouls effects 3
    Events
        Unit - A unit Dies
    Conditions
        ((Dying unit) is in allyoursouls_unitgroup) Equal to (==) True
    Actions
        Unit - Explode (Dying unit)

OK there they are. As you can see, the part that tells the units to change control to me is in the 2nd trigger. Please help!
02-20-2004, 03:57 AM#12
Alakafizz
Heh, big one.

Code looks fine; try adding a "Game - Display Text To Players", where you print the "allyoursouls_caster" to the screen, to see if it's set. I cant think of anything else than this right now.


Btw, are the special effects created like they're supposed to, or not?
02-20-2004, 05:08 AM#13
Huh
Hahaha I was reading your reply, glanced over my last reply and saw the problem. I used "casting unit" instead of "learning unit" in my learn trigger. I had copied pasted it over so i mustve forgot to change it. 20 bucks says it works fine after i change that. Ill post a reply if things still dont run.

About the SFX, im about to find out ^_^. As you can see i changed them to arrays at your suggestion. BRB, gonna test this...

edit1: Hmm, well the spell works now properly. BUT, theres still this damn thing with the SFX where theyre not being destroyed like they should be. When the units change back to control of the computer the little gem art above their head is supposed to disappear but its not. Same goes if they die. it just stays there until the corpse days. I thought changing to SFX arrays would fix that but no deal. Any ideas man?

edit2: Ok, nothing I've tried gets rid of the SFX on the possessed (or formerly possessed) units until their corpse decays. I'm stuck because it looks pretty stupid when they revert back to normal and still have the art that represents the possession..

edit3: OK i fixed it. Apparently the particular model I was using to represent the soul possession SFX wasnt set to disappear for a long time, no matter what. Not sure how or why but thats the case. I changed it to a different model (this time based from a spell rather than an item model) and it works perfectly. Guess I have this spell all done now ;)

edit4: Correction, the model for the shadow orb fragment (which i was originally using) does indeed work fine. The problem laid in the trigger that was set to destroy the SFX. I had copied it just as Alkafizz said but there was an error. He had the looped action set as Special Effect - Destroy allyoursouls_sfx(allyoursouls_integer), when it shouldve been Special Effect - Destroy allyoursouls_sfx(integer a). This is apparnetly because I was using the "for each integer a" loop. My mistake for not catching that, but now I know and now the spell works the way I want. Yaay. Hopefully no more edits ^_^