• 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.

A question about Players within WE

Status
Not open for further replies.
Level 2
Joined
May 29, 2006
Messages
9
Hello, as you may or may not know I am currently making a TD. I'm having a problem with the computer player, in my case 11(green). Human creeps are spawned and moved correctly, but when neutral units are spawned, they just sit there. I believe this is because player 11 is set to a human race. How do I change it so I can spawn any unit from any race? Thanks.
 
Level 2
Joined
Apr 19, 2006
Messages
28
To change it:

-'Scenerio' tab
-'Player Properties'

You can set any player to any race from here... but just so you know. This should not have an effect on your commands to the troops. Check your triggers or post them so we can take a look see. :D

Good luck!

-Miz

ps. You can change any unit to any race. Simply change the 'Stats - race' value under the unit in the object editor.
 
Level 2
Joined
May 29, 2006
Messages
9
This is how my trigger is set up to have the units spawn and send them to the first locaiton.

Start Movement
Events
Time - Elapsed game time is 20.00 seconds
Conditions
Actions
Unit - Create 20 Chicken for Player 11 (Dark Green) at (Center of Spawn Region 1 <gen>) facing Default building facing degrees
Unit Group - Pick every unit in (Units in Spawn Region 1 <gen>) and do (Actions)
Loop - Actions
Unit Group - Add (Picked unit) to SpawnGroup1
Unit - Order (Picked unit) to Move To (Center of Movement Region 1a <gen>)
 
Level 2
Joined
Apr 19, 2006
Messages
28
What behavior are you seeing exactly? Sometimes when you give a 'mass send' command, the troops will be blocked by each other and not be able to go. You can fix this by changing their pathing from 32 to 0. Or you can send like this:

Start Movement
Events
-Time - Elapsed game time is 20.00 seconds
Conditions
Actions
-For each integer A from (1 - 20) do action
- -Loop actions
- -Unit - Create 1 Chicken for Player 11 (Dark Green) at (center of spawn Region 1 <gen>) facing [put your angle here from 0 - 360]
- -Unit Group - Add (last created unit) to SpawnGroup1
- -Unit - Order (last created unit) to Move To (Center of Movement Region 1a <gen>)

To make units move faster and not jam up, also put the angle you want them to face.

If they initially run right, angle = 0.
If they run up, angle = 90.
If they run left, angle = 180
Etc.

Good luck. Hope this fixes your issue. :)

-Miz
 
Level 2
Joined
May 29, 2006
Messages
9
Well when the chickens spawn, they just sit there. There is no movement from player 11 (green) at all. I'll try what you posted, thanks.

Edit - I got it working correcly. Now another question, how do you make a unit spawn one by one instead of all at the same time?

Also, I have 2 spawn points on my map. Units will spawn at the same time from each, those units will eventually cross paths, and go to the opposite spawn points. When the spawns reach the opposite spawn points, they will take lives from the player. I'm having a hard time achieving this. I can get them to spawn at both points easily but once the second spawn reaches a MovementRegion, it turns around. This makes sense though because of the triggers. Do I have to make another set of regions to accomplish this? Or can I use just the 1 set of regions that I already have for both spawns somehow?
 
Level 18
Joined
Jan 24, 2006
Messages
1,938
Just re-do your move triggers with if then else actions where the if checks what team the spawns belong too, unless both spawn points spawn units belonging to the same team, in which case I know a way but it's complicated =/.
 
Level 2
Joined
Apr 19, 2006
Messages
28
Zulli85 said:
... how do you make a unit spawn one by one instead of all at the same time?

Use the 'for each integer (a) from 1-30' trigger but insert a 'wait' command at the end of the for loop.

So if you tell it to wait 1 second, Your for loop will send 1 troop per second for 30 seconds.

Another way to do it is to make a trigger that is turned ON or OFF whenever you want to produce troops. This is a more elegant solution that will probably produce less lag. For instance

event
- every 1 second
condition
action
- create 1 chicken at region [A1]
- order last created unit to move-to region [A2]

Now use this command in another trigger to turn it on or off:

-trigger - turn on
and
-trigger - turn off

If you turn on the trigger above, and use a countdown timer to turn it off, you will have a clean troop producing trigger.

ps!!!! In the trigger above, replace "chicken" with a variable of type 'unit-type' or 'unit-type'-'array.' That way you can use this single trigger to produce the troops for the entire game. Just change the unit-type in the variable and your trigger will produce that troop. :) This makes it real easy with not so many different triggers. :)

Zulli85 said:
... Also, I have 2 spawn points on my map. Units will spawn at the same time from each, those units will eventually cross paths, and go to the opposite spawn points. When the spawns reach the opposite spawn points, they will take lives from the player. I'm having a hard time achieving this. I can get them to spawn at both points easily but once the second spawn reaches a MovementRegion, it turns around. This makes sense though because of the triggers. Do I have to make another set of regions to accomplish this? Or can I use just the 1 set of regions that I already have for both spawns somehow?

Set custom values for units from the right and units from the left. Say... if they spawn at the right side and move to the left, set a value of 1. If they spawn at the left side and move to the right, set a value of 2. Then do like Shados said. Like this:

event
- Unit enters region [A1]
condition
action
- if
- - [[condition]]
- - integer comparison (unit has custom value equal to 1)
- - [[then]]
- - order unit to move to unit [A2]
- - [[else]]
- - if
- - - [[condition]]
- - - integer comparison (unit has cusom value equal to 2)
- - - [[then]]
- - - order unit to attack-move to location of [town hall 001]
- - - [[else]]
- - - do nothing


Now the units with custom value of 1 will move to a different region while the units with a custom value of 2 will attack the town hall.

Good Luck! :D

-Miz
 
Level 18
Joined
Jan 24, 2006
Messages
1,938
Miznunkey said:
event
- Unit enters region [A1]
condition
action
- if
- - [[condition]]
- - integer comparison (unit has custom value equal to 1)
- - [[then]]
- - order unit to move to unit [A2]
- - [[else]]
- - if
- - - [[condition]]
- - - integer comparison (unit has cusom value equal to 2)
- - - [[then]]
- - - order unit to attack-move to location of [town hall 001]
- - - [[else]]
- - - do nothing


Now the units with custom value of 1 will move to a different region while the units with a custom value of 2 will attack the town hall.

What are you, a telepath? Thats the way I was going to say if the differents spawns were still on one team, 0.o

Oh and scratch the do nothing action, no point in having them and I think they cause leaks. Also, we have
  • tags here, make a trigger in WE then right-click on it and hit "copy as text" and then just post it inside [trigger] tags and walla![/color]
 
Level 2
Joined
Apr 19, 2006
Messages
28
Heh! :) Cool!

Thanks for the info on copying triggers!!!

A question about the 'do nothing' command. What do you put after the 'else' line if not 'do nothing'? I assume you don't leave it blank. Wouldn't there need to be some data after the 'else' for the If-then statement to compile?

-Miz

ps. I'm testing the trigger tag thingy!!!!! Disregard below. :)
[trigger:1:95da17554e]
End Melee
Events
Unit - A unit enters Melee Train Copy 3 <gen>
Unit - A unit enters Melee Train Copy 5 <gen>
Unit - A unit enters Melee Train Copy 7 <gen>
Unit - A unit enters Melee Train Copy 9 <gen>
Unit - A unit enters Melee Train Copy 4 <gen>
Unit - A unit enters Melee Train Copy 6 <gen>
Unit - A unit enters Melee Train Copy 8 <gen>
Unit - A unit enters Melee Train Copy 10 <gen>
Conditions
Actions
Set p = (Player number of (Owner of (Triggering unit)))
Set n = 1
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in Array_current_trainers) Greater than or equal to 12
(Custom value of (Triggering unit)) Not equal to 100
Then - Actions
Unit - Move (Triggering unit) instantly to (Center of Array_Train_Default_moveto)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Custom value of (Triggering unit)) Equal to 100
Then - Actions
Unit Group - Remove (Triggering unit) from Array_Train_me[n]
Unit Group - Remove (Triggering unit) from Array_current_trainers
Unit - Set the custom value of (Triggering unit) to 0
Unit - Set mana of (Triggering unit) to 100.00%
Unit - Move (Triggering unit) instantly to (Center of Array_Train_Default_moveto)
Else - Actions
Do nothing[/trigger:1:95da17554e]
 
Level 2
Joined
May 29, 2006
Messages
9
If you could re-post your triggers for the 2 sets of spawns like that, I would greatly appreciate it.
 
Level 18
Joined
Jan 24, 2006
Messages
1,938
Miznunkey said:
A question about the 'do nothing' command. What do you put after the 'else' line if not 'do nothing'? I assume you don't leave it blank. Wouldn't there need to be some data after the 'else' for the If-then statement to compile?
Leave it as nothing, the Do Nothing command itself literally does nothing, it just wastes space and as I said before I beleive it causes leaks. And why not just try it? If something doesn't compile then the editor tells you when you attempt to save the map. Oh, and we also now have
JASS:
 tags, so if you know JASS you can post any JASS triggers in them and they will e coloured/formatted correctly.[/color]
 
Level 2
Joined
Apr 19, 2006
Messages
28
Here is the trigger to send units when you use another trigger to turn-on/off this trigger when you need too

[trigger:1:898b64d55a]send units
Events
Time - Every 2.00 seconds of game time
Conditions
Actions
Unit - Create 1 unit_to_spawn[n] for Player 1 (Red) at (Center of (Playable map area)) facing 180.00 degrees
Unit - Order (Last created unit) to Move To (Center of p3 start <gen>)
Set n = (n + 1)[/trigger:1:898b64d55a]

This trigger uses a unit-type array to store the creeps to spawn. Notice how it increments at the end of each spawn. If you had a different unit in each array slot (example: unit_to_spawn(1) = footman, unit_to_spawn(2) = knight, etc.). It would spawn a different creep every 2 seconds.

Usually you would put the increment line of code (Set n = (n + 1)) in the trigger that you use to turn on this trigger. I put it in here just to show you how to do it.

This trigger checks custom values and sends units based on their custom values. The condition at the begining is to keep the trigger from being called whenever a non-custom-value-appropriate unit crosses it. It is not necessary, but will help with lag.


[trigger:1:898b64d55a]send units
Events
Unit - A unit enters p3 start <gen>
Conditions
Or - Any (Conditions) are true
Conditions
(Custom value of (Triggering unit)) Equal to 0
(Custom value of (Triggering unit)) Equal to 1
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Custom value of (Triggering unit)) Equal to 0
Then - Actions
Unit - Order (Triggering unit) to Move To (Center of (Playable map area))
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Custom value of (Triggering unit)) Equal to 1
Then - Actions
Unit - Order (Triggering unit) to Attack-Move To (Position of Barracks (custom) 0002 <gen>)
Else - Actions
[/trigger:1:898b64d55a]
 
Status
Not open for further replies.
Top