Target System Bug

Scauldingpon

New Member
Reaction score
1
I made a really really low grade target system that will cast spells only on that target so you dont have to keep clicking everywhere. anyways.

What happens is that the dummyunit that is made becomes the new target everytime. so atm you can to repeat the first step every time i thought about making an ability call target or some bs like that to make it so that it wont change but i want to keep it as is. any insight?

Trigger:
  • Set target
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • ((Target unit of issued order) belongs to an enemy of (Triggering player)) Equal to (==) True
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
        • Then - Actions
          • Set Enemy = (Target unit of issued order)
          • Set Targetenemy = (Name of Enemy)
          • Game - Display to (All players) the text: (Your Enemy is + Targetenemy)
        • Else - Actions
          • Do nothing


Testing spell trigger
Trigger:
  • Testrangespell
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to (==) Howl of Terror
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Is Enemy near (Casting unit) and withing a range of 1000.00) Equal to (==) True
        • Then - Actions
          • Unit - Create 1 Dummyunit for (Owner of (Casting unit)) at (Position of (Casting unit)) facing (Facing of (Casting unit)) degrees
          • Unit - Add Storm Bolt to (Last created unit)
          • Unit - Order (Last created unit) to Human Mountain King - Storm Bolt Enemy
          • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
        • Else - Actions
          • Game - Display to (All players) the text: Your target is out ...
          • Do nothing


SO i figured why its setting the dummyunit to the target, because its being issued an order... any thoughts on how i can keep it kind the same but with out that bug?
 
Reaction score
456
Turn off the Set Target trigger just before you order the dummy, and then turn it back on after you've ordered the dummy.
 

Scauldingpon

New Member
Reaction score
1
wow, thats really easy, but i know this problem will come up later. with multiple players. i'd have to make each one for each player wont i? or would there be a way to make it so each player can have one with out having this trigger redone over and over?
 

elmstfreddie

The Finglonger
Reaction score
203
To have each player have one, just add an array to your variables and then in both triggers have the array set to (owner of (triggering unit))

For future reference this is called MPI...
 

Scauldingpon

New Member
Reaction score
1
To have each player have one, just add an array to your variables and then in both triggers have the array set to (owner of (triggering unit))

For future reference this is called MPI...

Not following. can you do a mock up so i can see what it looks like. and MPI? please elaborate.
 

Scauldingpon

New Member
Reaction score
1
So i tried making it so that the trigger was turned off and then turned back on after but it still sets the dummyunit as the target. but i put a 4 second wait and now it doesnt do it just have to wait forever to start casting again.
 
Reaction score
149
Change your current used variables into arrays,
Targeted is a Boolean array.

Trigger:
  • Untitled Trigger 001
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • ((Target unit of issued order) belongs to an enemy of (Owner of (Triggering unit))) Equal to True
      • Or - Any (Conditions) are true
        • Conditions
          • (Issued order) Equal to (Order(smart))
          • (Issued order) Equal to (Order(attack))
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Targeted[(Player number of (Owner of (Triggering unit)))] Equal to False
        • Then - Actions
          • Set Enemy[(Player number of (Owner of (Triggering unit)))] = (Target unit of issued order)
          • Set Targetenemy[(Player number of (Owner of (Triggering unit)))] = (Name of Enemy[(Player number of (Owner of (Triggering unit)))])
    • Game - Display to (All players) the text: (Your Enemy is + Targetenemy[(Player number of (Owner of (Triggering unit)))])
      • Else - Actions


Trigger:
  • Testrangespell
    • Events
    • Unit - A unit Begins casting an ability
    • Conditions
    • (Ability being cast) Equal to (==) Howl of Terror
    • Actions
    • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
    • (Is Enemy[(Player number of (Owner of (Casting unit)))] near (Casting unit) and withing a range of 1000.00) Equal to (==) True
    • Then - Actions
    • Unit - Create 1 Dummyunit for (Owner of (Casting unit)) at (Position of (Casting unit)) facing (Facing of (Casting unit)) degrees
    • Unit - Add Storm Bolt to (Last created unit)
    • Unit - Order (Last created unit) to Human Mountain King - Storm Bolt Enemy[(Player number of (Owner of (Casting unit)))]
    • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
    • Else - Actions
    • Game - Display to (All players) the text: Your target is out ...
    • Do nothing



If I were you, I'd probably use a targeting dummy spell for the first trigger, this would be easier to define when a unti is "targeted".
Or atleast add a condition "Unit type of (Triggering Unit) is Hero equal to True" or some sort of another condition.

Also, you have a couple of leaks, you should make a tempPoint variable which you would remove later. (Check out Leak tutorials in Resources section)
 

Scauldingpon

New Member
Reaction score
1
You only have a hero so there's no big problem there. i haven't had an issue of any of my units becoming the "Target" But thank you a lot! and with your set up would it make the dummy unit become the target?
 
Reaction score
149
Dummy unit become the target?

Do you ever order anything that's target is an enemy dummy unit?
Do you ever order your dummy unit to attack or "smart" some object?

If you answered no to these questions, then this will work. If not, you might try adding conditions like "(Triggering Unit) is a Hero equal to True" :)
 

Scauldingpon

New Member
Reaction score
1
Had to ask, i wasn't able to test it yet. But i am having a hard time finding some of the Actions. i just changed to the new jassnewgen.

Edit: NVM found them all.
 

Scauldingpon

New Member
Reaction score
1
where is the "(Is Enemy[(Player number of (Owner of (Casting unit)))] near (Casting unit) and withing a range of 1000.00) Equal to (==) True" is it bolean? if so there isnt a unit in range option.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top