Adding the if statement made the units not do anything again. It seems whenever the condition Computer[#] == True is added, they don't do anything. So I'm guessing the computers aren't being set properly?
----------
EDIT: I figured it out. I had to use (Status of Player A) == Unused because it wasn't recognizing the computers any other way from all the tests I ran. It runs pretty good now, but there is 1 problem. Lets say the Zealot is told to cast PSI Storm. Instead of casting it on the unit, it will go to the last known position the unit was at and cast it there. I can't figure out how to fix this. I'm sure it has something to do with "Random Living unit etc..." variable. Here's the code:
Thank You, but there are some problems with that. When you move 1 step in-game; the game takes over your unit and makes you cast a spell even when you're not idle. I was also hoping this would continuously loop for the computer. Meaning, once they cast the spell, they either keep attacking that same unit or go to a different one right away. Right now, they use the spell and then just stop until the next unit that goes idle. Also, they only move 1 at a time instead of every computer always moving around.
I tried it with the loop again with the condition, so only computer players end up moving, but that loop just seems to not do anything.
Thanks for helping with the arrays. I changed the code to what you wrote but the computer still won't do anything. I'm pretty sure they have the energy to cast the storm, as I gave the units 500 energy to start with.
I removed that Condition and the computer still didn't do anything. I'm pretty sure I used the Target Unit and Target Location arrays the wrong way. Since there can be up to 5 computers in the map, I didn't want all of them to have the same target.
Unit[A][1] checks which player has triggered this and the 1 is the unit that has the spell. Problem is, the computer never does anything in-game. I really have no idea what I'm doing wrong here. Any help is appreciated! Thank You!
After switching to your concept, I really don't ever want to go back to my old way, lol. I like the simplicity of it and how much easier it is to read now. BTW, you'll make an awesome teacher ^_^!
Thank You for explaining! Yes, I am new to triggering and have never messed with the WC3 editor. I'm pretty sure I understood most of what you wrote. But 1 problem I'm having; how would I tell if Player 1, 2, 3,or 4 has a certain unit? I was trying to do this:
EDIT: NVM, I figured it out. I'm so stupid >_<, I had totally forgot about the Zealot, Zergling, Marine, Stalker variable when I started making this mouse click trigger. Understand everything now ^_^! Thanks again!
@Pinworm45 & xenrathe: I tried both your ways but it was still spawning units even when you had one already.
@Vicboy: Your way worked, its just that I have no idea how or why it works. Can you explain the logic behind it please? But 1 thing I noticed was that you assigned the Hero variable to already placed units on the map. In mine there are no units previously placed, so I will be unable to do that.
I'm having a problem where when your unit dies, it creates a new one right away. It does this for 4 players. It works sometimes, then at other times the trigger will start creating units for you even when your current one is alive. I set it up like this:
This does work, but the unit ends up moving the wrong way. W = Right, S = Left, A = Down, D = Up, and I have no idea why. Any help would be appreciated! Thank You!
0
Adding the if statement made the units not do anything again. It seems whenever the condition Computer[#] == True is added, they don't do anything. So I'm guessing the computers aren't being set properly?
----------EDIT: I figured it out. I had to use (Status of Player A) == Unused because it wasn't recognizing the computers any other way from all the tests I ran. It runs pretty good now, but there is 1 problem. Lets say the Zealot is told to cast PSI Storm. Instead of casting it on the unit, it will go to the last known position the unit was at and cast it there. I can't figure out how to fix this. I'm sure it has something to do with "Random Living unit etc..." variable. Here's the code:
Hopefully, I'm not being annoying with all these questions ;o! Thank You!
0
Thank You, but there are some problems with that. When you move 1 step in-game; the game takes over your unit and makes you cast a spell even when you're not idle. I was also hoping this would continuously loop for the computer. Meaning, once they cast the spell, they either keep attacking that same unit or go to a different one right away. Right now, they use the spell and then just stop until the next unit that goes idle. Also, they only move 1 at a time instead of every computer always moving around.
I tried it with the loop again with the condition, so only computer players end up moving, but that loop just seems to not do anything.
0
I did give them the skills as I can cast them myself. Map attached below.
Key:
Main is where computer players are determined and Attack under the folder Computer is the trigger to make them attack.
Right & Left click casts your spells.
WSAD moves your unit.
Thank You!
0
Thanks for helping with the arrays. I changed the code to what you wrote but the computer still won't do anything. I'm pretty sure they have the energy to cast the storm, as I gave the units 500 energy to start with.
0
I removed that Condition and the computer still didn't do anything. I'm pretty sure I used the Target Unit and Target Location arrays the wrong way. Since there can be up to 5 computers in the map, I didn't want all of them to have the same target.
Thanks for the response!
0
I'm having trouble in coding the A.I to use skills on a random unit in the map. First, I check if they're any computer players by:
After this I make my attack trigger for the computer:
Unit[A][1] checks which player has triggered this and the 1 is the unit that has the spell. Problem is, the computer never does anything in-game. I really have no idea what I'm doing wrong here. Any help is appreciated! Thank You!
0
After switching to your concept, I really don't ever want to go back to my old way, lol. I like the simplicity of it and how much easier it is to read now. BTW, you'll make an awesome teacher ^_^!
0
Thank You for explaining! Yes, I am new to triggering and have never messed with the WC3 editor. I'm pretty sure I understood most of what you wrote. But 1 problem I'm having; how would I tell if Player 1, 2, 3,or 4 has a certain unit? I was trying to do this:
EDIT: NVM, I figured it out. I'm so stupid >_<, I had totally forgot about the Zealot, Zergling, Marine, Stalker variable when I started making this mouse click trigger. Understand everything now ^_^! Thanks again!
0
@Pinworm45 & xenrathe: I tried both your ways but it was still spawning units even when you had one already.
@Vicboy: Your way worked, its just that I have no idea how or why it works. Can you explain the logic behind it please? But 1 thing I noticed was that you assigned the Hero variable to already placed units on the map. In mine there are no units previously placed, so I will be unable to do that.
Thank You!
0
I'm doing random unit creation from 4 units and spawn in either 1 of 10 spots. This trigger is initially off. Hope this helps a bit o.o!
0
I'm having a problem where when your unit dies, it creates a new one right away. It does this for 4 players. It works sometimes, then at other times the trigger will start creating units for you even when your current one is alive. I set it up like this:
Not exactly sure what is wrong with my logic here. Any help would be appreciated. Thank You!
0
I was using top view. Thanks your angles worked Deltafox ^_^!
0
Hi, I have read some WSAD tutorials and watched some videos but I don't seem to get why my WSAD moves the wrong way. My trigger is like this:
This does work, but the unit ends up moving the wrong way. W = Right, S = Left, A = Down, D = Up, and I have no idea why. Any help would be appreciated! Thank You!