• 0

    posted a message on Triggering A.I to use skills

    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:

        Events
            Unit - Any Unit Becomes idle
            Unit - Any Unit is issued an order to  Stop
        Local Variables
            Target Unit = No Unit <Unit>
        Conditions
            Computer[(Owner of (Triggering unit))] == true
        Actions
            Variable - Set Target Unit = (Random Living unit from (Units in (Entire map) having alliance Enemy with player (Owner of (Triggering unit)) matching Excluded: Air, Missile, Dead, Hidden, with at most Any Amount))
            General - If (Conditions) then do (Actions) else do (Actions)
                If
                    Target Unit != No Unit
                    ((Triggering unit) Life (Percent) (Current)) > 90.0
                    (Distance between (Position of (Triggering unit)) and (Position of Target Unit)) <= 100.0
                Then
                    Unit - Order Hero[(Owner of (Triggering unit))] to (High Templar - High Templar - Psionic Storm targeting (Position of Target Unit)) (Before Existing Orders)
                    Unit - Order Hero[(Owner of (Triggering unit))] to (Sentry - Guardian Shield) (Before Existing Orders)
                    Unit - Order Hero[(Owner of (Triggering unit))] to (Raven - Raven - Seeker Missile Target Unit) (Before Existing Orders)
                    Unit - Order Hero[(Owner of (Triggering unit))] to (Ghost - Sniper Round Target Unit) (Before Existing Orders)
                    Unit - Order Hero[(Owner of (Triggering unit))] to ( Stop) (After Existing Orders)
    

    Hopefully, I'm not being annoying with all these questions ;o! Thank You!

    Posted in: Miscellaneous Development
  • 0

    posted a message on Triggering A.I to use skills

    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.

    Posted in: Miscellaneous Development
  • 0

    posted a message on Triggering A.I to use skills

    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!

    Posted in: Miscellaneous Development
  • 0

    posted a message on Triggering A.I to use skills

    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.

    Posted in: Miscellaneous Development
  • 0

    posted a message on Triggering A.I to use skills

    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!

    Posted in: Miscellaneous Development
  • 0

    posted a message on Triggering A.I to use skills

    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:

    Events
    	Game - Map initialization
    Local Variables
    	A = 0 <Integer>
    Actions
    	General - For each integer A from 1 to 6 with increment 1, do (Actions)
    		Actions
    			General - If (Conditions) then do (Actions) else do (Actions)
    				If
                                      (Status of player A) == Unused
                                      (Controller of player A) == Computer
                                   Then
                                      Variable - Set Computer[A] = true
    

    After this I make my attack trigger for the computer:

    Events
            Unit - Any Unit Becomes idle
    Local Variables
            A = 0 <Integer>
            Target Unit = No Unit <Unit[6]>
            Target Location = No Point <Point[6]>
    Actions
            Variable - Set Target Unit[1] = (Random Living unit from (Units in (Entire map) having alliance Enemy with player (Owner of (Triggering unit)) matching Excluded: Air, Missile, Dead, Hidden, with at most Any Amount))
            Variable - Set Target Location[1] = (Position of Target Unit[1])
            General - For each integer A from 1 to 6 with increment 1, do (Actions)
                Actions
                    General - If (Conditions) then do (Actions) else do (Actions)
                        If
                            And
                                Conditions
                                    Computer[A] == true
                                    Unit[A][1] == true
                        Then
                            Unit - Order Hero[A] to (High Templar - High Templar - Psionic Storm targeting (Center of (Unit group(Target Unit[1])))) (Replace Existing Orders)
                        Else
    

    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!

    Posted in: Miscellaneous Development
  • 0

    posted a message on Only spawn 1 unit problem

    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 ^_^!

    Posted in: Miscellaneous Development
  • 0

    posted a message on Only spawn 1 unit problem

    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!

    Posted in: Miscellaneous Development
  • 0

    posted a message on Only spawn 1 unit problem

    @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!

    Posted in: Miscellaneous Development
  • 0

    posted a message on Only spawn 1 unit problem

    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!

        Events
            Timer - Every 0.5 seconds of Game Time
        Local Variables
            Unit = (Random integer between 1 and 4) <Integer>
            Region = Location[(Random integer between 1 and 10)] <Region>
        Actions
            General - If (Conditions) then do (Actions) else do (Actions)
                If
                    Unit == 1
                Then
                    Unit - Create 1 Zealot for player 1 at (Center of Region) using default facing (No Options)
                    Variable - Set Spell_Unit[1] = (Last created unit)
                    Variable - Set Zealot[1] = true
                    Variable - Set Zergling[1] = false
                    Variable - Set Marine[1] = false
                    Variable - Set Stalker[1] = false
                    Camera - Pan the camera for player 1 to (Center of Region) over 0.3 seconds with Existing Velocity% initial velocity, 10% deceleration, and Do Not use smart panning
                Else
            General - If (Conditions) then do (Actions) else do (Actions)
                If
                    Unit == 2
                Then
                    Unit - Create 1 Zergling for player 1 at (Center of Region) using default facing (No Options)
                    Variable - Set Spell_Unit[1] = (Last created unit)
                    Variable - Set Zealot[1] = false
                    Variable - Set Zergling[1] = true
                    Variable - Set Marine[1] = false
                    Variable - Set Stalker[1] = false
                    Camera - Pan the camera for player 1 to (Center of Region) over 0.3 seconds with Existing Velocity% initial velocity, 10% deceleration, and Do Not use smart panning
                Else
            General - If (Conditions) then do (Actions) else do (Actions)
                If
                    Unit == 3
                Then
                    Unit - Create 1 Marine for player 1 at (Center of Region) using default facing (No Options)
                    Variable - Set Spell_Unit[1] = (Last created unit)
                    Variable - Set Zealot[1] = false
                    Variable - Set Zergling[1] = false
                    Variable - Set Marine[1] = true
                    Variable - Set Stalker[1] = false
                    Camera - Pan the camera for player 1 to (Center of Region) over 0.3 seconds with Existing Velocity% initial velocity, 10% deceleration, and Do Not use smart panning
                Else
            General - If (Conditions) then do (Actions) else do (Actions)
                If
                    Unit == 4
                Then
                    Unit - Create 1 Stalker for player 1 at (Center of Region) using default facing (No Options)
                    Variable - Set Spell_Unit[1] = (Last created unit)
                    Variable - Set Zealot[1] = false
                    Variable - Set Zergling[1] = false
                    Variable - Set Marine[1] = false
                    Variable - Set Stalker[1] = true
                    Camera - Pan the camera for player 1 to (Center of Region) over 0.3 seconds with Existing Velocity% initial velocity, 10% deceleration, and Do Not use smart panning
                Else
    
    Posted in: Miscellaneous Development
  • 0

    posted a message on Only spawn 1 unit problem

    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:

        Events
            Unit - Any Unit dies
        Actions
            General - If (Conditions) then do (Actions) else do (Actions)
                If
                    ((Closest unit to (Center of (Entire map)) in (Any units in (Entire map) owned by player 1 matching No Unit Filter, with at most Any Amount)) is alive) == false
                Then
                    Trigger - Run 1. Spawn  (Check Conditions, Don't Wait until it finishes)
    

    Not exactly sure what is wrong with my logic here. Any help would be appreciated. Thank You!

    Posted in: Miscellaneous Development
  • 0

    posted a message on WSAD movement angles

    I was using top view. Thanks your angles worked Deltafox ^_^!

    Posted in: Miscellaneous Development
  • 0

    posted a message on WSAD movement angles

    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:

            General - If (Conditions) then do (Actions) else do (Actions)
                If
                    And
                        Conditions
                            W_On[1] == true
                            A_On[1] == false
                            S_On[1] == false
                            D_On[1] == false
                Then
                    Unit - Order Spell_Unit[1] to ( Move targeting ((Position of Spell_Unit[1]) offset by 0.5 towards (Run_Angle[1] + 0.1) degrees)) (Replace Existing Orders)
                    General - Skip remaining actions
                Else
            General - If (Conditions) then do (Actions) else do (Actions)
                If
                    And
                        Conditions
                            W_On[1] == true
                            A_On[1] == true
                            S_On[1] == false
                            D_On[1] == false
                Then
                    Unit - Order Spell_Unit[1] to ( Move targeting ((Position of Spell_Unit[1]) offset by 0.5 towards (Run_Angle[1] + 45.0) degrees)) (Replace Existing Orders)
                    General - Skip remaining actions
                Else
            General - If (Conditions) then do (Actions) else do (Actions)
                If
                    And
                        Conditions
                            W_On[1] == true
                            A_On[1] == false
                            S_On[1] == false
                            D_On[1] == true
                Then
                    Unit - Order Spell_Unit[1] to ( Move targeting ((Position of Spell_Unit[1]) offset by 0.5 towards (Run_Angle[1] - 45.0) degrees)) (Replace Existing Orders)
                    General - Skip remaining actions
                Else
            General - If (Conditions) then do (Actions) else do (Actions)
                If
                    And
                        Conditions
                            W_On[1] == false
                            A_On[1] == true
                            S_On[1] == false
                            D_On[1] == false
                Then
                    Unit - Order Spell_Unit[1] to ( Move targeting ((Position of Spell_Unit[1]) offset by 0.5 towards (Run_Angle[1] - 90.0) degrees)) (Replace Existing Orders)
                    General - Skip remaining actions
                Else
            General - If (Conditions) then do (Actions) else do (Actions)
                If
                    And
                        Conditions
                            W_On[1] == false
                            A_On[1] == false
                            S_On[1] == false
                            D_On[1] == true
                Then
                    Unit - Order Spell_Unit[1] to ( Move targeting ((Position of Spell_Unit[1]) offset by 0.5 towards (Run_Angle[1] + 90.0) degrees)) (Replace Existing Orders)
                    General - Skip remaining actions
                Else
            General - If (Conditions) then do (Actions) else do (Actions)
                If
                    And
                        Conditions
                            W_On[1] == false
                            A_On[1] == false
                            S_On[1] == true
                            D_On[1] == false
                Then
                    Unit - Order Spell_Unit[1] to ( Move targeting ((Position of Spell_Unit[1]) offset by 0.5 towards (Run_Angle[1] + 180.0) degrees)) (Replace Existing Orders)
                    General - Skip remaining actions
                Else
            General - If (Conditions) then do (Actions) else do (Actions)
                If
                    And
                        Conditions
                            W_On[1] == false
                            A_On[1] == true
                            S_On[1] == true
                            D_On[1] == false
                Then
                    Unit - Order Spell_Unit[1] to ( Move targeting ((Position of Spell_Unit[1]) offset by 0.5 towards (Run_Angle[1] + 135.0) degrees)) (Replace Existing Orders)
                    General - Skip remaining actions
                Else
            General - If (Conditions) then do (Actions) else do (Actions)
                If
                    And
                        Conditions
                            W_On[1] == false
                            A_On[1] == false
                            S_On[1] == true
                            D_On[1] == true
                Then
                    Unit - Order Spell_Unit[1] to ( Move targeting ((Position of Spell_Unit[1]) offset by 0.5 towards (Run_Angle[1] + 225.0) degrees)) (Replace Existing Orders)
                    General - Skip remaining actions
                Else
    

    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!

    Posted in: Miscellaneous Development
  • To post a comment, please or register a new account.