• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Position of unit Variable trigger question

Status
Not open for further replies.
Level 10
Joined
Nov 5, 2008
Messages
536
  • Actions
    • Set Point1 = (Position of (Your unit))
I select "Set Variable" in the drop menu. This comes up: Set variable = value
I select my variable but what do I select to get this: (Position of (Your Unit))

Anyone knows?
 
Level 10
Joined
Nov 5, 2008
Messages
536
You are absolutly right, sir! I can select "Position of unit." However I want to create the (Your unit) in the field there "unit" is. I can only choose between picked unit, matching unit and a lot of event responses. The variable is a point variable. How do I find (Your Unit)?
Or is (Your unit) the same as triggering unit or matching unit or do I need to inseart a specifik unit there? (Although I don't want to do that, I want a specific type of units to be efected by the trigger) You see? The questions are all over my mind, tearing me up inside! Release me!
 
Level 4
Joined
Apr 20, 2009
Messages
106
There is no "Your Unit" and you have to make use of the options that it gives you. If you show us your trigger, we can help you figure out which of the options you should be using.
 
Level 3
Joined
Mar 25, 2009
Messages
32
trigger unit is for the unit event - cast a spell, start effect of the spell , unit die and etc.. matching unit for something been compare to like matching unit is an enemy to player etc...
 
Level 10
Joined
Nov 5, 2008
Messages
536
Here is a trigger I got from nice Pharaoh_

  • Move1
  • Events
    • Time - Every 0.06 seconds of game-time
  • Conditions
  • Actions
    • Set Point1 = (Position of (Your unit))
  • Move2
  • Events
    • Time - Every 0.08 seconds of game-time
  • Conditions
  • Actions
    • Set Point2 = (Position of (Your unit))
    • If/ Then/ Else
      • If (Conditions)
        • (Distance between Point2 and Point1) Equal to 0
      • Then (Actions)
        • Unit - Add Ability to (Your unit)
      • Else (Actions)
        • Unit - Remove Ability from (Your unit)
    • Custom script: call RemoveLocation (udg_Point2)
    • Custom script: call RemoveLocation (udg_Point1)
On my map I have a moveable building that players can build many of and when the building stands still it gets an aura.
When the building moves, the aura does not work.
But I do not get this trigger to work and I don't want to bother Pharaoh more
 
Level 4
Joined
Apr 20, 2009
Messages
106
Is the unit pre-placed onto the map? If so, you can select him. If not, you are going to need to store him to a variable when you make him. So create a Unit Variable (Mine will be Unit), and whatever trigger you use to place him on the map, place this right after when you make him:

  • Set Unit=(Last Created Unit)
Your trigger might look like:
  • Events, Conditions, Actions, stuff...
  • Unit - Create 1 Building for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
  • Set Unit = (Last created unit)
Get where I'm going with this?
 
Ah well, this is your problem. Well, have a look at QirajiLord's post.
If the unit is pre-set into the map (with the World Editor), then you will go to that button "Select Unit" in the Unit specification window.
If not, you need to know which unit you are going to set its position at.
E.g. There are: Position of (Last created unit/ Triggering unit/ Casting unit). Depending on your event - yours has nothing to do with a unit, you need to have the unit stored within the variable. If it is a created unit in-game, then in the trigger that you are about to create the unit, once you do so, store it. E.G.
Events
Player - Player 1 (Red) selects a unit
Conditions
Actions
Set Point = (Random Point in (Playable Map Area))
Unit - Create 1 Footman for (Player 1 (Red)) at Point1 facing default building degrees
Set Unit1 = (Last created unit) ----> Ok, we have the stored unit. In the trigger i gave you, have it: Set Point1 = (Position of (Unit1)).
Custom script: call RemoveLocation (udg_Point)
By using the same method, you can have other types of units, e.g. Casting unit goes for the event "A unit starts the effect of an ability/ begins casting an ability/ stops channeling an ability/..", Triggering unit refers to all events, and so on. You had better checked a tutorial to get clear view of how variables work.
 
Level 10
Joined
Nov 5, 2008
Messages
536
Thanks for your help! I have read the variable-tutorial, but I am not sure if I have understood it correctly. I am like an analphabet when it comes to math, triggering and that kind of logical thinking : /

Before I show you what I have done so far, I describe a few things first:

- On my map, which is a kind of custom melee map, workers for one of the races can construct a moveable building called WarCaravan. (Perhaps I make Warcaravan a unit trained from a building, but right now it is a building)

- Players can research an upgrade that gives an aura to the WarCaravan.

- When the Warcaravan stands still, the aura enables. When the Warcaravan moves, the aura is disabled.

- There are no WarCaravans from the start, players can only construct them. The only way for a Warcaravan to get into the game is from construction. There can be several in-game for different players at the same time.



I have created a Varible called WarCaravanVariable which I choosed as an "unit-type Variable" since there can be many of this unit.

  • Adding Aura to WarCaravan
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to War Caravan
    • Actions
      • Unit - Add War Caravan Aura (Neutral Hostile) to (Triggering unit)
      • Set WarCaravanVariable = (Unit-type of (Triggering unit))
I done as you said QirajiLord, if I got it right, and added the Set Variable at the bottom of the trigger that creates the unit.

  • Move1
  • Events
    • Time - Every 0.06 seconds of game-time
  • Conditions
  • Actions
    • Set Point1 = (Position of (Your unit))
At the Your Unit above, I choose "Position of (Triggering Unit)"
How does the trigger above know that it is the WarCaravan I refer to as triggering unit?



Well.. Even if someone answears, I have a feel that I won't get it right anyways.. . I have caused people a lot of headache with my request for this kind of trigger. Such a silly thing to have an aura that applies when the unit stands still only, but I really need that to work. So far I have managed to create triggers by people's instructions, but this time I don't get it right.

Althought this is not the Request-forum, I wonder if someone has the time and energy to create this trigger for me on my map if I send it to you?
 
Last edited:
Level 8
Joined
Nov 9, 2008
Messages
502
A better option might be to scrap this trigger and give the War Caravan an ability that when turned on stops movement. Then you coul easily trigger to give it an aura when the ability is used.
 
Level 10
Joined
Nov 5, 2008
Messages
536
Good idea!

I have made this trigger:

(WarCaravan Turn On is Berserk.)

  • Add WarCaravan Aura
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to War Caravan Turn On
    • Actions
      • Unit - Add War Caravan Aura to (Triggering unit)
      • Unit - Remove War Caravan Turn On from (Triggering unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to War Caravan
          • (Issued order) Equal to (Order(move))
        • Then - Actions
          • Unit - Remove War Caravan Aura from (Triggering unit)
          • Unit - Add War Caravan Turn On to (Triggering unit)
        • Else - Actions
I don't find anything to remove the movement from the WarCaravan, except for Pause which freezes the unit. But the problem with "pause" is that the unit needs to be paused for a set amount of time. I want the aura to be able forever, as long as the unit stands still and does nothing.

The trigger does not work yet, suggestions what I shall do from here?
 
Level 8
Joined
Nov 9, 2008
Messages
502
Ok I set this up in a map and works perfect. Here is what you need to do;

1. Find the tab 'Advanced' > go to Gamplay Constants...
Check the box in the top left to allow custom values
Find 'Movement - Unit Speed - Minimum'
Hold shift and click to edit the value to 0

2. Use Defend as the skill on your unit so make a custom spell based from it.
Find 'Data - Movement Speed Factor' and set to 1
Edit the spell further to remove any unwanted bonuses or special effects.

3. Create this trigger
  • Untitled Trigger 001
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Issued order) Equal to (Order(defend))
        • Then - Actions
          • Unit - Add Test Aura to (Triggering unit)
        • Else - Actions
          • Unit - Remove Test Aura from (Triggering unit)
Just to note if you are using Defend elsewhere in your map you will want to add a condition to this trigger;

  • (Unit-type of (Triggering unit)) Equal to Footman
...where Footman is your War Wagon.

Attached is the map I made it in just incase you need clarification.
The only thing I found was although Defend has a field for cooldown in the editor it seems to do nothing. I though maybe a cooldown would suit your spell seeing as it would be a bit imba if a player could turn it on/off instantly.
 

Attachments

  • temp.w3x
    16.6 KB · Views: 61
Level 10
Joined
Nov 5, 2008
Messages
536
  • Untitled Trigger 001
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Issued order) Equal to (Order(defend))
        • Then - Actions
          • Unit - Add Test Aura to (Triggering unit)
        • Else - Actions
          • Unit - Remove Test Aura from (Triggering unit)
Thank you very much toofless! It works perfect! Thank to all people who have gave me help, Pharaoh, Greystuff and QirajiLord! And all others if I have missed someone!
I also added Wait - 4 seconds before the Action that gives the Caravan it's Aura.




One last tiny question and this question is not so important, just a tiny side-thing. If there is a easy answear, please share it, but if it is to complicated just let it be :)

If the WarCaravan uses any other ability or buys a unit or trains a unit, the Aura is canceled. Is it possible to add something to the trigger so the aura disappear ONLY when Defend is turned off?
 
Level 8
Joined
Nov 9, 2008
Messages
502
Oh right haha. That was lazy checking on my account sorry :)

Update the trigger like so:

  • Untitled Trigger 001
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Issued order) Equal to (Order(defend))
          • (Issued order) Equal to (Order(undefend))
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Issued order) Equal to (Order(defend))
        • Then - Actions
          • Unit - Add Test Aura to (Triggering unit)
        • Else - Actions
          • Unit - Remove Test Aura from (Triggering unit)
 
Status
Not open for further replies.
Top