• 🏆 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!

Spawning, Computer Issues, and Variables

Status
Not open for further replies.
Level 2
Joined
Feb 22, 2008
Messages
15
I am having issues with my Spawning triggers and moving triggers. I have manged to get the game to spawn the units correctly but the trigger that moves them seems to have broken. They move to the first movepoint where they all group and then patrol back and fourth to the spawn region.

My second problem is Computers. When I go to start the game for test, the Computer slots aren't there like I have them set in World Edit. I end up having to place them manually. I believe this may be part of my problem but I don't know.

I have recorded a demo of these and posted it on youtube here,
Please note that at the time of me typing up this post the Video wasn't processed completely

In case you can't read the Trigger window (I know it might be a bit too blurry) Here is the basic Command Line I've Used (Should give you the General Idea of how I ran the triggers)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Crypt 0091 <gen> is alive) Equal to True
Then - Actions
Unit - Create 3 Swordsman for Player 1 (Red) at (Center of West Barracks <gen>) facing Default building facing degrees
Else - Actions
Unit - Create 3 Swordsman for Player 1 (Red) at (Center of West Barracks <gen>) facing Default building facing degrees
Unit - Create 1 Paladin for Player 1 (Red) at (Center of West Barracks <gen>) facing Default building facing degrees

(That spawns for the west Side where we move to the Rally Point I have made for all the units to group together.) To rally them we use this Trigger

Move West Alliance
Events
Unit - A unit enters West Barracks <gen>
Unit - A unit enters Workshop West <gen>
Conditions
(Owner of (Triggering unit)) Equal to Player 1 (Red)
Actions
Unit - Order (Triggering unit) to Move To (Center of Human West Rally <gen>)
Then I move them to the first checkpoint in the bottom left of the map (Each side has a respective checkpoint)
Alliance Attack West 1
Events
Unit - A unit enters Human West Rally <gen>
Conditions
(Owner of (Triggering unit)) Equal to Player 1 (Red)
Actions
If ((Owner of (Triggering unit)) Equal to Player 1 (Red)) then do (Unit Group - Order (Units in Human West Rally <gen>) to Attack-Move To (Center of Left Alliance <gen>)) else do (Do nothing)

Did I mess up my Trigger Line somewhere?

Lastly, I have issues concerning Variables, I can't seem to grasp the use of them as I have included a few on my map, but they do not seem to work.

Any Help Would be Greatly Appreciated.:cool:
 
Level 16
Joined
Jul 21, 2008
Messages
1,121
Your computer problem can be fixed like this:
1. Go to Scenario -> Player Properties and set computers
2. Go to Scenario -> Force properties
3. Check Use Custom Froces and Fixed Player Setting

Try looking at this map. It may contain solution of your second problem:
 

Attachments

  • MovingUnits.w3x
    20.3 KB · Views: 51
Last edited:
Level 2
Joined
Feb 22, 2008
Messages
15
The first problem seems to be caused by the computer standard AI. That is, created units prefer to stay near the point where they were created.

To solve this, their owner must be a "none" player, not a "computer" player =P

If I set the Owner to none, Theoreticallally wont it make the unit do nothing But what the trigger states and have no allies or enemies?

The players now show up as computer like intened now i need to fix spawner issue

Also, I am unaware how to make a unit Noowner
 
Scenario > Player Settings > Player Properties

Just set Player 1 to "none", instead of "computer"
And then go to "forces" tab and select "Fixed Player Settings" :p

And yes, the unit won't have allies nor enemies, but you can change that via triggers. Make the player treat every other player as enemy/ally, as you wish (and vice versa, or else Player1 will attack the others, but the others won't attack him).

The "Computer" players' units will always want to go back to their creation point or their start location (I don't remember exactly which of them now)
 
Level 2
Joined
Feb 22, 2008
Messages
15
Okay, So Following your advice I set the players like you suggested and that fixed that bug. Now I have another problem, The units DO follow the rout Desired and attack the desired players when encountered however, the unit that enters the region that triggers the move ends up stuck until another unit moves and is stuck. For example The five men that go into the region, one of them becomes stuck until the siege unit spawns or the next wave spawns. Two ways I thought to fix it, Have a periodic refresh trigger that periodically orders all of Player 1's units in that region to move rather then a triggering unit entering the region. This did not work and resulted in No movement.

The other idea I have yet to test is to have all units spawn in that location. My concern is that the unit spawning there may not be considered a unit entering. More so, Even if it does not stick the origional units when they reach there first stop the unit who gets there and triggers the next move, ends up stuck. Any Ideas?
 
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Crypt 0091 <gen> is alive) Equal to True
    • Then - Actions
      • Unit - Create 3 Swordsman for Player 1 (Red) at (Center of West Barracks <gen>) facing Default building facing degrees
    • Else - Actions
      • Unit - Create 3 Swordsman for Player 1 (Red) at (Center of West Barracks <gen>) facing Default building facing degrees
      • Unit - Create 1 Paladin for Player 1 (Red) at (Center of West Barracks <gen>) facing Default building facing degrees
  • Move West Alliance
    • Events
      • Unit - A unit enters West Barracks <gen>
      • Unit - A unit enters Workshop West <gen>
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 1 (Red)
    • Actions
      • Unit - Order (Triggering unit) to Move To (Center of Human West Rally <gen>)
  • Alliance Attack West 1
    • Events
      • Unit - A unit enters Human West Rally <gen>
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 1 (Red)
    • Actions
      • If ((Owner of (Triggering unit)) Equal to Player 1 (Red)) then do (...) else do (Do nothing)

I just put your triggers in trigger tags, so we can see it better :p

First, the solution...
In the Alliance Attack West 1 trigger, you order all the units in Human West Rally region to move to the next checkpoint.
The problem is, the event Unit - A unit enters region will trigger when the unit is still OUT of the region. So when the first unit enters, it's not inside the region yet, and the trigger will order the units that has already entered the region (and not moved due to the same issue).

You should simply change the action (you don't need to use If/Then/Else, because the condition of the trigger already checks if the owner is Player1) to Unit - Issue order targeting a point (and not Unit Group). Order (Triggering Unit) to move to the next checkpoint.

Now, if you mind, your triggers have several leaks that should be removed, as it seems to be executed during the whole game.

Whenever you use "Center of (Region)", you should, instead, set a point variable to it; use it; and then use a custom script to remove it like I show below:

  • Set point = Center of (YourRegion)
  • Unit - Order (Triggering Unit) to Attack-Move point
  • Custom script: call RemoveLocation( udg_point )
The custom script is case sensitive, pay attention.
 
Last edited:
Level 2
Joined
Feb 22, 2008
Messages
15
Can you explain in more detail How Variables work/are set up or refered to? I know nothing of them and would greatly appreciate it.
 
Level 7
Joined
Jul 20, 2008
Messages
377
A variable just holds a single piece of data, be it integer (whole numbers only), real (can have decimal values), string, unit, item, unit group, etc. You can just store anything into a variable, provided the variable is of the same type as the data you're trying to put into it. An integer variable, for example, will NOT store an unit. The idea is that you can then retrieve whatever was in that variable later.

The usefulness of variables lies in the fact that you can change what's in a variable at any time, so a single trigger that asks for the variable's value at two different points in time may get different results, depending on what's in the variable. See what I mean?

You can set up global variables in the trigger editor by hitting Ctrl + B. Also consider reading this:

Learning Variable Basics

This really explains it well.
 
Level 2
Joined
Feb 22, 2008
Messages
15
So is holds the same Value as the term Variable does in Mathmatics, where if you have an equation within an equation, you can set an equation to equal the variable so that you don't have to repeat yourself later. Am I right?
 
Level 9
Joined
Nov 28, 2008
Messages
704
Your sort of right, depending on when you call the equation...

For example, if you made two global variables, Unit X and Unit Y, and then made a trigger which said Set Unit Y's Current Hp to Unit X's Current Hp + 5, then that is sort of like a math equation y = x + 5. Whenever you wanted to change their hp, you could set Unit Y to something and Unit X to something, then call that trigger which would then just use your variables.

Really, take a look at that tutorial. Youll have a hard time making maps without variables.
 
Level 2
Joined
Feb 22, 2008
Messages
15
Now I'm Really Stumped, I was making alot of progress up until I got to the point where I had to make another set of spawns for another half of my map. (Following what I learned above I got the units to spawn and attack move. However the desired spawn location is a bit quirky.

I intended them to spawn at one region if a building was alive, and when that building died respawn at a different region. The result ended up them spawning at the region as if the building was dead, and only once despite the trigger being periodic. (I have a trigger that occurs 10 seconds after gamestart and activates all my spawn triggers to begin. This trigger works)

DG Spawn 1
Events
Time - Every 90.00 seconds of game time
Conditions
Actions
If (((Triggering unit) is A structure) Equal to (Altar of Elders 0030 <gen> is alive)) then do (Unit - Create 10 Zombie for Player 11 (Dark Green) at (Center of Dark Green zombie Spawn Two <gen>) facing Default building facing degrees) else do (Unit - Create 10 Zombie for Player 11 (Dark Green) at (Center of Dark Green Zombie Spawn five <gen>) facing Default building facing degrees)

Also I can't find a tutorial for setting up Item Combining, Could someone point me to one?
 
Level 7
Joined
Jul 20, 2008
Messages
377
So is holds the same Value as the term Variable does in Mathmatics, where if you have an equation within an equation, you can set an equation to equal the variable so that you don't have to repeat yourself later. Am I right?

Almost.

In programming, the expression "var = 5" does not mean "var is equal to 5" as it would in math. Rather, it means "assign 5 to var."

The right side is assigned to the left side. Then when you ever need to use that value, whenever you ask for "var" it is like swapping the number 5 in there.
 
Status
Not open for further replies.
Top