Pro trigger makers needed: urgent help for hard trigger

Level 6
Joined
Aug 29, 2004
Messages
159
Hi guys,
This is a custom special ability i have made using triggers(don't want to use JASS).
The effect of the ability is: When you cast the ability (Chaotic Energy) a little ball of energy (Orb of Corruption Model) begins circling around you (Kil'Jaeden) on the sprite attatchment (im not sure if he even has one :? ) You can cast the ability up to three times to get three different energy balls circling around you (all on different sprite attatchments), so the trigger will check how many you have and attatch them accordingly. It also creates a EnergyUnit to follow behind you (its locustified and invisible). WHen an enemy comes within 512 of your hero, then the trigger should register this and univisible one of the EnergyUnits, which moves to the enemy unit and attacks it: because the EnergyUnit has a poisoned attack, this will drain X health per second off the enemy for a minute.

The only problem is i spent an hour writing the trigger and it doesnt work :wink:

So can anyone notice any glaring faults in this?:

Code:
Start Energy
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Chaotic Energy (2) 
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                DChaoticEnergyBalls[(Player number of (Owner of (Casting unit)))] Not equal to 3
            Then - Actions
                Set DChaoticEnergyCaster[(Player number of (Owner of (Casting unit)))] = (Casting unit)
                Set DChaoticEnergyBalls[(Player number of (Owner of (Casting unit)))] = (DChaoticEnergyBalls[(Player number of (Owner of (Casting unit)))] + 1)
                If (DChaoticEnergyBalls[(Player number of (Owner of (Casting unit)))] Equal to 1) then do (Special Effect - Create a special effect attached to the sprite + first of (Casting unit) using Abilities\Spells\Items\OrbCorruption\OrbCorruption.mdl) else do (Do nothing)
                Set DBallEffect1[(Player number of (Owner of (Casting unit)))] = (Last created special effect)
                If (DChaoticEnergyBalls[(Player number of (Owner of (Casting unit)))] Equal to 2) then do (Special Effect - Create a special effect attached to the (sprite + second) of (Casting unit) using Abilities\Spells\Items\OrbCorruption\OrbCorruption.mdl) else do (Do nothing)
                Set DBallEffect2[(Player number of (Owner of (Casting unit)))] = (Last created special effect)
                If (DChaoticEnergyBalls[(Player number of (Owner of (Casting unit)))] Equal to 3) then do (Special Effect - Create a special effect attached to the (sprite + third) of (Casting unit) using Abilities\Spells\Items\OrbCorruption\OrbCorruption.mdl) else do (Do nothing)
                Set DBallEffect3[(Player number of (Owner of (Casting unit)))] = (Last created special effect)
                Unit - Create 1 DChaoticEnergyUnit[(Level of Chaotic Energy  for (Casting unit))] for (Owner of (Casting unit)) at (Position of (Casting unit)) facing Default building facing degrees
                Animation - Change (Last created unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
                If (DChaoticEnergyBalls[(Player number of (Owner of (Casting unit)))] Equal to 1) then do (Set DEnergyBall1[(Player number of (Owner of (Casting unit)))] = (Last created unit)) else do (Do nothing)
                If (DChaoticEnergyBalls[(Player number of (Owner of (Casting unit)))] Equal to 2) then do (Set DEnergyBall2[(Player number of (Owner of (Casting unit)))] = (Last created unit)) else do (Do nothing)
                If (DChaoticEnergyBalls[(Player number of (Owner of (Casting unit)))] Equal to 3) then do (Set DEnergyBall3[(Player number of (Owner of (Casting unit)))] = (Last created unit)) else do (Do nothing)
            Else - Actions
                Do nothing

Code:
Move energy
    Events
        Time - Every 0.01 seconds of game time
    Conditions
    Actions
        If ((Integer((Distance between (Position of (Triggering unit)) and (Position of (Triggering unit))))) Greater than 0) then do (Unit - Move (Triggering unit) instantly to (Position of (Triggering unit))) else do (Do nothing)

Code:
Energy Variables
    Events
        Map initialization
    Conditions
    Actions
        Set DChaoticEnergyUnit[1] = Chaotic Energy1
        Set DChaoticEnergyUnit[2] = Chaotic Energy2
        Set DChaoticEnergyUnit[3] = Chaotic Energy3

Code:
AttackEnergy
    Events
        Time - Every 0.10 seconds of game time
    Conditions
    Actions
        For each (Integer A) from 1 to 10, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Number of units in (Units within 512.00 of (Position of DChaoticEnergyCaster[(Player number of (Player((Integer A))))]))) Greater than 0
                    Then - Actions
                        Unit Group - Remove all units from DPossTargets[(Player number of (Player((Integer A))))]
                        Unit Group - Pick every unit in (Units within 512.00 of (Position of DChaoticEnergyCaster[(Player number of (Player((Integer A))))]) matching ((((Matching unit) belongs to an enemy of (Owner of DChaoticEnergyCaster[(Player number of (Player((Integer A))))])) Equal to True) and (((Matching u and do (Actions)
                            Loop - Actions
                                Unit Group - Add (Picked unit) to DPossTargets[(Player number of (Player((Integer A))))]
                                Set DTarget[(Player number of (Player((Integer A))))] = (Random unit from DPossTargets[(Player number of (Player((Integer A))))])
                        Unit - Order DEnergyBall1[(Player number of (Player((Integer A))))] to Move To (Position of DTarget[(Player number of (Player((Integer A))))])
                        Wait until ((Integer((Distance between (Position of DEnergyBall1[(Player number of (Player((Integer A))))]) and (Position of DTarget[(Player number of (Player((Integer A))))])))) Less than or equal to 50), checking every 0.10 seconds
                        Unit - Order DEnergyBall1[(Player number of (Player((Integer A))))] to Attack DTarget[(Player number of (Player((Integer A))))]
                        Animation - Change DEnergyBall1[(Player number of (Player((Integer A))))]'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
                        Wait 0.10 seconds
                        Unit - Remove DEnergyBall1[(Player number of (Player((Integer A))))] from the game
                        For each (Integer A) from 1 to 10, do (Actions)
                            Loop - Actions
                                Set DChaoticEnergyBalls[(Integer A)] = (DChaoticEnergyBalls[(Integer A)] - 1)
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        DChaoticEnergyBalls[(Integer A)] Equal to 2
                                    Then - Actions
                                        Set DEnergyBall1[(Integer A)] = DEnergyBall2[(Integer A)]
                                        Set DEnergyBall2[(Integer A)] = DEnergyBall3[(Integer A)]
                                        Set DEnergyBall3[(Integer A)] = No unit
                                        Special Effect - Destroy DBallEffect1[(Integer A)]
                                        Special Effect - Destroy DBallEffect2[(Integer A)]
                                        If (DChaoticEnergyBalls[(Integer A)] Equal to 1) then do (Special Effect - Create a special effect attached to the (sprite + first) of DChaoticEnergyCaster[(Integer A)] using Abilities\Spells\Items\OrbCorruption\OrbCorruption.mdl) else do (Do nothing)
                                        Set DBallEffect1[(Integer A)] = (Last created special effect)
                                        If (DChaoticEnergyBalls[(Integer A)] Equal to 2) then do (Special Effect - Create a special effect attached to the (sprite + second) of DChaoticEnergyCaster[(Integer A)] using Abilities\Spells\Items\OrbCorruption\OrbCorruption.mdl) else do (Do nothing)
                                        Set DBallEffect2[(Integer A)] = (Last created special effect)
                                    Else - Actions
                                        Do nothing
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        DChaoticEnergyBalls[(Integer A)] Equal to 1
                                    Then - Actions
                                        Set DEnergyBall1[(Integer A)] = DEnergyBall2[(Integer A)]
                                        Set DEnergyBall2[(Integer A)] = No unit
                                        Special Effect - Destroy DBallEffect1[(Integer A)]
                                        If (DChaoticEnergyBalls[(Integer A)] Equal to 1) then do (Special Effect - Create a special effect attached to the (sprite + first) of DChaoticEnergyCaster[(Integer A)] using Abilities\Spells\Items\OrbCorruption\OrbCorruption.mdl) else do (Do nothing)
                                        Set DBallEffect1[(Integer A)] = (Last created special effect)
                                    Else - Actions
                                        Do nothing
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        DChaoticEnergyBalls[(Integer A)] Equal to 0
                                    Then - Actions
                                        Set DEnergyBall1[(Integer A)] = No unit
                                    Else - Actions
                                        Do nothing
                    Else - Actions
                        Do nothing

lol isnt that a lot of trigger? :wink: If anyone could be bothered reading through that, and, after reading it understand it (its about as complicated as it looks), any help would be VERY much appreciated. :D

Thankyou for bothering to read this. I'll give you a cookie if you can find out what's wrong
Bort
 
Level 8
Joined
Apr 3, 2004
Messages
507
Except for the Bloodmage and a few select other models, most units do *not* have the sprite attachments. Building models, however, do. If you change your Kil'jaeden model to a Bloodmage or building, you should be able to tell whether the special effects are attaching properly.

Either that, or you can attach them to things like "head", "hand, left", "hand, right", "weapon", etc., which virtually all unit models have.

If you so wish, I can rip open the Kil'jaeden model and see what attachment points he has.
 
Level 6
Joined
Aug 29, 2004
Messages
159
Could you do that for me Panto? That would be awesome, but yeah, i don't think he has those attatchments. Umm. Am i trying to attatch them the right way? ie to (sprite + first) or should it be (sprite,first) or what?

Thanks,
Bort
 
Level 16
Joined
Sep 3, 2004
Messages
2,086
Might as well screw the idea of having tem circle unless you ask Vex how he did it in the caster system.

You could do this

Code:
Events
Units starts the effect of ability
Conditions
Ability being cast equal to w/e
Actions
If-Chaosballvar less than 4
Set ChaosballVar[Index Conversion of Owner of Triggering unit]+

Then

Unit comes within 512 of Hero, create the ball which shadowstrike the hero, or even better, Kaboom it
 
Level 6
Joined
Aug 29, 2004
Messages
159
hmm Eurasia, that seems like it would get the job done, but it misses a lot of the things which i wanted it to have: for example the ability to have 3 Energy's and 3 only, or to have them showing up on you (unless i missed something in your trigger)

also, as i posted in another thread, there is NO way to use the 'Unit comes within range' Event to refer to a unit which you did not place in the editor: it will not refer to variables. :? Thats why a lot of the trigger seems more complicated than it should be.

Bort
 
Level 6
Joined
Aug 29, 2004
Messages
159
Will work in an arena

:roll: I don't get it... you're saying that the 'Unit within range' will work? I don't think it can: Its a specific unit event, and it will only specify units which have been physically created in the editor, not units created in game even if they are set to a unit-varible. At least, not that I've figured out, and no-one here seemed to know how to do it...
if you could tell me how, though, i'd be able to eliminate 10 or so lines of trigger...

thanks
Bort
 
Level 6
Joined
Aug 29, 2004
Messages
159
My god, this isn't pissing me off or anything!! :x :x :evil: :evil: :evil: :evil: :evil: :x :x :evil: :!: :!: :!:

dammit.

ok i've found numerous problems and fixed most of them, but this one has me stumped:



Start Energy
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Chaotic Energy
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
DChaoticEnergyBalls[(Player number of (Owner of (Casting unit)))] Not equal to 3
Then - Actions
Set DChaoticEnergyCaster[(Player number of (Owner of (Casting unit)))] = (Casting unit)
Set DChaoticEnergyBalls[(Player number of (Owner of (Casting unit)))] = (DChaoticEnergyBalls[(Player number of (Owner of (Casting unit)))] + 1)
If (DChaoticEnergyBalls[(Player number of (Owner of (Casting unit)))] Equal to 1) then do (Special Effect - Create a special effect attached to the weapon of (Casting unit) using Abilities\Spells\Items\OrbCorruption\OrbCorruption.mdl) else do (Do nothing)
Set DBallEffect1[(Player number of (Owner of (Casting unit)))] = (Last created special effect)
If (DChaoticEnergyBalls[(Player number of (Owner of (Casting unit)))] Equal to 2) then do (Special Effect - Create a special effect attached to the weapon of (Casting unit) using Abilities\Spells\Items\OrbCorruption\OrbCorruption.mdl) else do (Do nothing)
Set DBallEffect2[(Player number of (Owner of (Casting unit)))] = (Last created special effect)
If (DChaoticEnergyBalls[(Player number of (Owner of (Casting unit)))] Equal to 3) then do (Special Effect - Create a special effect attached to the weapon of (Casting unit) using Abilities\Spells\Items\OrbCorruption\OrbCorruption.mdl) else do (Do nothing)
Unit - Create 1 DChaoticEnergyUnit[(Level of Chaotic Energy for (Casting unit))] for (Owner of (Casting unit)) at (Position of (Casting unit)) facing Default building facing degrees


The problem lies somewhere within that red text. Between creating the special effect (it's now attatched to his weapon, seeing as he has no sprites) it doesn't create the DChaoticEnergyUnit behind him. But i cant find anything wrong in that particular stretch that makes it go bad :evil: :evil: !
Can anyone help me :?:

Thanks go out to anyone who reads this and knows of my plight
Bort
 
Level 2
Joined
Apr 16, 2004
Messages
10
instead of sprites my units, give units critter ability, give them 900 run speed, give them aloc, order them to follow the hero, problem solved if you want them to circle do move commands and do it every .2 seconds to command all 3 at once so less triggers p/ second order them to move 60 degrees at a time with polar offset, if you really need my help replay and i will give you my email address and i will do it for you


Jimmy
 
Level 6
Joined
Aug 29, 2004
Messages
159
Ok, new problem: The EnergyUnits which follow your demon... don't follow him. I've changed a condition within the attack trigger so that they should still keep following him no matter what, BUT they move EXTREMELY slowly, even when I set their movement speed to the highest possible. Also, they sometimes randomly stop moving: not because they are within range of a certain thing or anything like that, they just... stop moving.. and nothing will get them moving again. Also, the "Animation - Set units (last created unit)'s vertex shading to 100 100 100 with 100% transparency" doesn't make the EnergyUnits invisible. Anyone know why?

Can anyone help me out with these problems (especially Jimmy again)? Thanks for help
Bort
 
Top