• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

Trigger Help Needed!

Status
Not open for further replies.
Level 10
Joined
Sep 3, 2009
Messages
458
Well Basically I'm working on a system...well It's not much a system it's like an add-on or something to spells. Here's the ability:

Quick Strike

Execute: Target Point
Atk 30 Uses 3 Cool 5

Dash quickly to a point, dealing damage to nearby enemy units and knocks them back due to the velocity of the dash.
_____________________________________

OK now this is just one of the other spells I'm thinking about making. The "Uses 3" in the spell description is the amount of uses before the spell will go on cooldown which is 3 uses. I have achieved in reseting the ability cooldown already. In fact I have succesfully emulated what I wanted it to look like. The spell is MUI, effects and actions execute perfectly (Disregard the knockback part haven't done it yet) except for when I count how many times the caster used the spell. As far as I know, if I had two units and cast the ability one after the other, they will share the number of counted uses.

Example:

Unit A Casts spell
Uses[A] = Uses[A] + 1 // Uses[A] = 1, Uses = 0
_______________________
Unit B Casts spell
Uses = Uses + 1 //Uses = 2, Uses[A] = 1
_______________________
Unit A Casts spell
Uses[A] = Uses[A] + 1 //Uses[A] = 3, Uses = 2 This will now go in cool down but it shouldn't yet
_______________________

Triggers

  • Quick Strike Start
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to (==) Quick Strike
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • QSIndex[1] Equal to (==) 0
        • Then - Actions
          • Trigger - Turn on Quick Strike Loop <gen>
        • Else - Actions
      • -------- --- --------
      • Set QSIndex[1] = (QSIndex[1] + 1)
      • Set QSIndex[2] = (QSIndex[2] + 1)
      • Set QSCaster[QSIndex[2]] = (Triggering unit)
      • Set QSPoint[QSIndex[2]] = (Position of (Triggering unit))
      • Set QSTargetPoint[QSIndex[2]] = (Target point of ability being cast)
      • Set QSDamage[QSIndex[2]] = (Real((30 + (Strength of (Triggering unit) (Include bonuses)))))
      • Set QSAngle[QSIndex[2]] = (Angle from QSPoint[QSIndex[2]] to QSTargetPoint[QSIndex[2]])
      • Set QSDistance[QSIndex[2]] = (Distance between QSPoint[QSIndex[2]] and QSTargetPoint[QSIndex[2]])
      • Set QSDistanceTraveled[QSIndex[2]] = 0.00
      • Set QSCheck[QSIndex[2]] = 0
      • Set QSUses[QSIndex[2]] = (QSUses[(QSIndex[3] - 1)] + 1)
      • Set QSEffect = Objects\Spawnmodels\Naga\NagaDeath\NagaDeath.mdl
      • Animation - Change (Triggering unit)'s animation speed to 50.00% of its original speed
      • Custom script: call RemoveLocation (udg_QSPoint[udg_QSIndex[2]])
      • Custom script: call RemoveLocation (udg_QSTargetPoint[udg_QSIndex[2]])
  • Quick Strike Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Do Multiple ActionsFor each (Integer QSIndex[3]) from 1 to QSIndex[2], do (Actions)
        • Loop - Actions
          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • QSCheck[QSIndex[3]] Equal to (==) 0
            • Then - Actions
              • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • QSDistanceTraveled[QSIndex[3]] Greater than or equal to (>=) QSDistance[QSIndex[3]]
                • Then - Actions
                  • Set QSPoint[QSIndex[3]] = (Position of QSCaster[QSIndex[3]])
                  • Set QSGroup = (Units within 200.00 of QSPoint[QSIndex[3]] matching (((Matching unit) belongs to an enemy of (Owner of QSCaster[QSIndex[3]])) Equal to (==) True))
                  • Unit Group - Pick every unit in QSGroup and do (Actions)
                    • Loop - Actions
                      • Unit - Cause QSCaster[QSIndex[3]] to damage (Picked unit), dealing QSDamage[QSIndex[3]] damage of attack type Spells and damage type Normal
                  • Animation - Change QSCaster[QSIndex[3]]'s animation speed to 100.00% of its original speed
                  • Special Effect - Create a special effect at QSPoint[QSIndex[3]] using QSEffect
                  • Special Effect - Destroy (Last created special effect)
                  • Custom script: call DestroyGroup (udg_QSGroup)
                  • Custom script: call RemoveLocation (udg_QSPoint[udg_QSIndex[3]])
                  • Custom script: call RemoveLocation (udg_QSTargetPoint[udg_QSIndex[3]])
                    • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • QSUses[QSIndex[3]] Equal to (==) 3
                      • Then - Actions
                        • Set QSUses[QSIndex[3]] = 0
                        • Set QSCheck[QSIndex[3]] = 1
                      • Else - Actions
                        • Unit - Remove Quick Strike from QSCaster[QSIndex[3]]
                        • Unit - Add Quick Strike to QSCaster[QSIndex[3]]
                        • Set QSCheck[QSIndex[3]] = 1
                • Else - Actions
                  • Set QSPoint[QSIndex[3]] = (Position of QSCaster[QSIndex[3]])
                  • Set QSTargetPoint[QSIndex[3]] = (QSPoint[QSIndex[3]] offset by 50.00 towards QSAngle[QSIndex[3]] degrees)
                  • Unit - Move QSCaster[QSIndex[3]] instantly to QSTargetPoint[QSIndex[3]]
                  • Custom script: call RemoveLocation (udg_QSPoint[udg_QSIndex[3]])
                  • Custom script: call RemoveLocation (udg_QSTargetPoint[udg_QSIndex[3]])
                  • Set QSDistanceTraveled[QSIndex[3]] = (QSDistanceTraveled[QSIndex[3]] + 50.00)
            • Else - Actions
              • Set QSIndex[1] = (QSIndex[1] - 1)
                • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • QSIndex[1] Equal to (==) 0
                  • Then - Actions
                    • Set QSIndex[2] = 0
                    • Trigger - Turn off (This trigger)
                    • Game - Display to (All players) the text: off
                  • Else - Actions
Help is very much appreciated to at least ease my pain of looking at the screen for hours and finding a loophole for this ^_^. Thanks in advance! + rep too!
 
Uhm I meant

  • Set QSUses[QSIndex[2]] = (QSUses[(QSIndex[3-1])] + 1)
is equal to

  • Set QSUses[QSIndex[2]] = (QSUses[(QSIndex[2])] + 1)
These are the one's you gave me. Basically 3 - 1 = 2, which is the same as your next example.

But weirdly even though I changed it to what you told me, nothing happened it still shared the same cast counts.
 
You can use the normal World Editor for the hashtable stuff and then copy that over onto JNGP, but it still kind of sucks how some of the functionality isn't available for hashtables when using JNGP.
 
Let me guess, when the 1st instance of the spell finishes the whole trigger shuts down?

I need the actual problem description as the current one seems vague.

If it is the problem when the 1st one finishes and ends all next ones then i already see the issue.

Well technically yes. When you cast the spell all instances will be back to zero.

Well the problem is that for every unit having the spell, they can use that for 3 times in a row. After that it will reset and the normal cooldown will go. Basically

If ( Number of uses for caster >= 3 )

then
Set Number of uses for caster = 0

else
Remove Ability X
Add Ability X
(I use this so that the cooldown of the ability will reset)

I increase the number of uses for caster in the first trigger

The problem is that if two units where to cast one at a time, their "no of uses for caster" variable will get mixed up.
 
Add a control array boolean.

The issue is following:
1st instance check variable is set to 1.
Every 0.03 seconds index[1] reduces because of that since every 0.03 seconds the check var is 1 and it goes on and reduces the index[1].
Fix:
  • If - Conditions
    • Boolean_Var[1] Equal to False
  • Then - Actions
    • Set Boolean_Var[1] = True
    • Set QSIndex[1] = (QSIndex[1] - 1)
    • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • QSIndex[1] Equal to (==) 0
    • Then - Actions
      • Set QSIndex[2] = 0
      • Trigger - Turn off (This trigger)
      • Game - Display to (All players) the text: off
    • Else - Actions
  • Else - Actions
That should fix it.
 
Well here's what I came up with:

  • Quick Strike Start Copy
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to (==) Quick Strike
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Percentage mana of (Triggering unit)) Greater than or equal to (>=) 20.00
        • Then - Actions
          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • QSIndex[1] Equal to (==) 0
            • Then - Actions
              • Trigger - Turn on Quick Strike Loop Copy <gen>
            • Else - Actions
          • -------- --- --------
          • Set QSIndex[1] = (QSIndex[1] + 1)
          • Set QSIndex[2] = (QSIndex[2] + 1)
          • Set QSCaster[QSIndex[2]] = (Triggering unit)
          • Set QSPoint[QSIndex[2]] = (Position of (Triggering unit))
          • Set QSTargetPoint[QSIndex[2]] = (Target point of ability being cast)
          • Set QSPower[QSIndex[2]] = (((Mana of (Triggering unit)) + 20.00) / 100.00)
          • Set QSDamage[QSIndex[2]] = (QSPower[QSIndex[2]] x (Real((30 + (Intelligence of (Triggering unit) (Include bonuses))))))
          • Set QSAngle[QSIndex[2]] = (Angle from QSPoint[QSIndex[2]] to QSTargetPoint[QSIndex[2]])
          • Set QSDistance[QSIndex[2]] = (Distance between QSPoint[QSIndex[2]] and QSTargetPoint[QSIndex[2]])
          • Set QSDistanceTraveled[QSIndex[2]] = 0.00
          • Set QSCheck[QSIndex[2]] = 0
          • Set QSUses[QSIndex[2]] = (QSUses[(QSIndex[3] - 1)] + 1)
          • Set QSEffect = Abilities\Spells\Orc\WarStomp\WarStompCaster.mdl
          • Set QSBolean[1] = False
          • Animation - Change (Triggering unit)'s animation speed to 50.00% of its original speed
          • Custom script: call RemoveLocation (udg_QSPoint[udg_QSIndex[2]])
          • Custom script: call RemoveLocation (udg_QSTargetPoint[udg_QSIndex[2]])
        • Else - Actions
  • Quick Strike Loop Copy
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Do Multiple ActionsFor each (Integer QSIndex[3]) from 1 to QSIndex[2], do (Actions)
        • Loop - Actions
          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • QSCheck[QSIndex[3]] Equal to (==) 0
            • Then - Actions
              • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • QSDistanceTraveled[QSIndex[3]] Greater than or equal to (>=) QSDistance[QSIndex[3]]
                • Then - Actions
                  • Set QSPoint[QSIndex[3]] = (Position of QSCaster[QSIndex[3]])
                  • Set QSGroup = (Units within 200.00 of QSPoint[QSIndex[3]] matching (((Matching unit) belongs to an enemy of (Owner of QSCaster[QSIndex[3]])) Equal to (==) True))
                  • Unit Group - Pick every unit in QSGroup and do (Actions)
                    • Loop - Actions
                      • Unit - Cause QSCaster[QSIndex[3]] to damage (Picked unit), dealing QSDamage[QSIndex[3]] damage of attack type Spells and damage type Normal
                  • Animation - Change QSCaster[QSIndex[3]]'s animation speed to 100.00% of its original speed
                  • Special Effect - Create a special effect at QSPoint[QSIndex[3]] using QSEffect
                  • Special Effect - Destroy (Last created special effect)
                  • Custom script: call DestroyGroup (udg_QSGroup)
                  • Custom script: call RemoveLocation (udg_QSPoint[udg_QSIndex[3]])
                  • Custom script: call RemoveLocation (udg_QSTargetPoint[udg_QSIndex[3]])
                    • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • QSUses[QSIndex[3]] Equal to (==) 3
                      • Then - Actions
                        • Set QSUses[QSIndex[3]] = 0
                        • Set QSCheck[QSIndex[3]] = 1
                      • Else - Actions
                        • Unit - Remove Quick Strike from QSCaster[QSIndex[3]]
                        • Unit - Add Quick Strike to QSCaster[QSIndex[3]]
                        • Set QSCheck[QSIndex[3]] = 1
                • Else - Actions
                  • Set QSPoint[QSIndex[3]] = (Position of QSCaster[QSIndex[3]])
                  • Set QSTargetPoint[QSIndex[3]] = (QSPoint[QSIndex[3]] offset by 50.00 towards QSAngle[QSIndex[3]] degrees)
                  • Unit - Move QSCaster[QSIndex[3]] instantly to QSTargetPoint[QSIndex[3]]
                  • Custom script: call RemoveLocation (udg_QSPoint[udg_QSIndex[3]])
                  • Custom script: call RemoveLocation (udg_QSTargetPoint[udg_QSIndex[3]])
                  • Set QSDistanceTraveled[QSIndex[3]] = (QSDistanceTraveled[QSIndex[3]] + 50.00)
            • Else - Actions
              • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • QSBolean[1] Equal to (==) False
                • Then - Actions
                  • Set QSBolean[1] = True
                  • Set QSIndex[1] = (QSIndex[1] - 1)
                    • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • QSIndex[1] Equal to (==) 0
                      • Then - Actions
                        • Set QSIndex[2] = 0
                        • Trigger - Turn off (This trigger)
                        • Game - Display to (All players) the text: off
                      • Else - Actions
                • Else - Actions
Nothing seems to change. The Uses[] variable get's mixed up
 
well tried it still doesent work. I feel hopeless now T.T

EDIT: OK I have a simpler question:

When you cast the spell the index will be Caster[index[2]] right? And every time you cast the spell the index will change.


This is assuming that the trigger is not yet set back to zero.

Caster Is MyUnit
First casts
Index[2] + 1 = 1
Caster[index[2]] (which is equal to Caster[1])
Second Cast
Index[2] + 1 = 2
Caster[index[2]] (which is Caster[2])

Then Player2Unit Casts the spell
index[2] + 1 = 3
Caster[index[2]] (whichis Caster[3])

Now my question is how do you get MyUnit's previous index?
 
Last edited:
Status
Not open for further replies.
Back
Top