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

Unit's AI Position Problem

Status
Not open for further replies.
Level 14
Joined
Nov 30, 2013
Messages
926
How this works?
- When every timer ends, it causes them to teleport into the next region. If being watched or watching the region that where it's going to teleport, it will cause them not to teleport until both of them is returned false. If they reached the second-to-the-last region but accidently being spotted, it will returned back to its starting point if not being viewed by the player.

What causes the problem
- Most of the If/Else statements were fine except for the last one that being indicated as "Failed to Jumpscare".
It'd run but they haven't teleported back into their starting point. Game text had shown itself but they still haven't teleported back.
After this happen, the trigger stills run as the other If/Else statements at the "Movement System" works, but it still doesn't change its position.

P.S
- These units have a Locust Ability so they'll be used at the Unit Group than identifying them if there are in what region.

Where's the triggers?
- Here

Unit's Movement Trigger
  • Red Golem AI
    • Events
      • Time - Every 0.06 seconds of game time
    • Conditions
    • Actions
      • Trigger - Turn off (This trigger)
      • -------- Temp Variable --------
      • Set GolemAI_VarID = 1
      • Set GolemAI_TempUnitType[GolemAI_VarID] = Red Golem
      • Set GolemAI_TempID[GolemAI_VarID] = 1
      • Set GolemAI_TempRivalID[GolemAI_VarID] = 2
      • Set GolemAI_TempAngle[0] = 270.00
      • Set GolemAI_TempAngle[1] = 270.00
      • Set GolemAI_TempAngle[2] = 180.00
      • Set GolemAI_TempAngle[3] = 90.00
      • Set GolemAI_TempAngle[4] = 90.00
      • Set GolemAI_MaxPathing[GolemAI_VarID] = 4
      • Set GolemAI_VarID = 0
      • -------- Temp Variable --------
      • Wait GolemAI_MoveTimer[GolemAI_TempID[1]] seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • isGameReady Not equal to True
        • Then - Actions
          • -------- Initiate Jumpscare --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • GolemAIPos[GolemAI_TempID[1]] Equal to 3
              • IsRearLightOn Equal to False
              • IsCamMoving Equal to False
              • GolemAI_IsGolemFlashed[GolemAI_TempID[1]] Equal to False
              • ((PlayerViewType Equal to 0) and (PlayerView Not equal to 1)) or (PlayerViewType Equal to 1)
              • GolemAIPos[GolemAI_TempRivalID[1]] Not equal to 4
            • Then - Actions
              • Set GolemAI_JumpscareRear = True
              • Set GolemAIPos[GolemAI_TempID[1]] = 4
              • If (DebugMode Equal to True) then do (Game - Display to (All players) the text: (|cffff0000Red Golem|r: + Jumpscared the player.)) else do (Do nothing)
            • Else - Actions
          • -------- Golem AI Movement System --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • GolemAIPos[GolemAI_TempID[1]] Equal to 2
              • (CamID Not equal to 0) and (IsRearLightOn Not equal to True)
              • GolemAIPos[GolemAI_TempRivalID[1]] Not equal to 3
            • Then - Actions
              • Set GolemAIPos[GolemAI_TempID[1]] = 3
              • If (DebugMode Equal to True) then do (Game - Display to (All players) the text: (|cffff0000Red Golem|r: + Walked to Rear Light Location.)) else do (Do nothing)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • GolemAIPos[GolemAI_TempID[1]] Equal to 1
              • GolemAIPos[GolemAI_TempRivalID[1]] Not equal to 2
              • (CamID Not equal to 2) and (CamID Not equal to 0)
            • Then - Actions
              • Set GolemAIPos[GolemAI_TempID[1]] = 2
              • If (DebugMode Equal to True) then do (Game - Display to (All players) the text: (|cffff0000Red Golem|r: + Walked to Main Hall.)) else do (Do nothing)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • GolemAIPos[GolemAI_TempID[1]] Equal to 0
              • GolemAIPos[GolemAI_TempRivalID[1]] Not equal to 1
              • (CamID Not equal to 3) and (CamID Not equal to 2)
            • Then - Actions
              • Set GolemAIPos[GolemAI_TempID[1]] = 1
              • If (DebugMode Equal to True) then do (Game - Display to (All players) the text: (|cffff0000Red Golem|r: + Walked to East Hall.)) else do (Do nothing)
            • Else - Actions
          • -------- Failed to Jumpscare --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • GolemAIPos[GolemAI_TempID[1]] Equal to 3
              • IsRearLightOn Equal to False
              • GolemAI_IsGolemFlashed[GolemAI_TempID[1]] Equal to True
              • CamID Not equal to 3
            • Then - Actions
              • Set GolemAIPos[GolemAI_TempID[1]] = 0
              • Set GolemAI_IsGolemFlashed[GolemAI_TempID[1]] = False
              • If (DebugMode Equal to True) then do (Game - Display to (All players) the text: (|cffff0000Red Golem|r: + Return back to spawn point.)) else do (Do nothing)
            • Else - Actions
          • -------- Golem AI Movement System --------
          • Unit Group - Pick every unit in Player12Golem and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of (Picked unit)) Equal to GolemAI_TempUnitType[GolemAI_TempID[1]]
                • Then - Actions
                  • Set TempPoint = (Center of RedGolemWayPoint[GolemAIPos[GolemAI_TempID[1]]])
                  • For each (Integer A) from 0 to GolemAI_MaxPathing[GolemAI_TempID[1]], do (Actions)
                    • Loop - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • GolemAIPos[GolemAI_TempID[1]] Equal to (Integer A)
                        • Then - Actions
                          • Unit - Move (Picked unit) instantly to TempPoint, facing GolemAI_TempAngle[(Integer A)] degrees
                        • Else - Actions
                  • Custom script: call RemoveLocation(udg_TempPoint)
                • Else - Actions
          • -------- Resetting Temporary Variable --------
          • Set GolemAI_MaxPathing[GolemAI_TempID[1]] = 0
          • Set GolemAI_TempUnitType[GolemAI_TempID[1]] = No unit-type
          • Set GolemAI_TempID[1] = -1
          • Set GolemAI_TempRivalID[1] = -1
          • For each (Integer A) from 1 to 10, do (Actions)
            • Loop - Actions
              • Set GolemAI_TempAngle[(Integer A)] = 0.00
          • -------- Resetting Temporary Variable --------
          • Trigger - Turn on (This trigger)
        • Else - Actions
          • Trigger - Turn off (This trigger)
Unit's Initialization Regions
  • Init Region
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- AI Waypoint --------
      • Set RedGolemWayPoint[0] = RedGolemPos1 <gen>
      • Set RedGolemWayPoint[1] = RedBlueGolemPos2 <gen>
      • Set RedGolemWayPoint[2] = RedBlueGolemPos3 <gen>
      • Set RedGolemWayPoint[3] = GolemPos4 <gen>
      • Set RedGolemWayPoint[4] = GolemJumpscareBack <gen>
      • Set BlueGolemWayPoint[0] = BlueGolemPos1 <gen>
      • Set BlueGolemWayPoint[1] = BlueGolemPos2 <gen>
      • Set BlueGolemWayPoint[2] = BlueGolemPos3 <gen>
      • Set BlueGolemWayPoint[3] = GolemPos4 <gen>
      • Set BlueGolemWayPoint[4] = GolemJumpscareBack <gen>
      • Set YellowGolemWayPoint[0] = YellowGolemPos1 <gen>
      • Set YellowGolemWayPoint[1] = RedBlueGolemPos2 <gen>
      • Set YellowGolemWayPoint[2] = RedBlueGolemPos3 <gen>
      • Set YellowGolemWayPoint[3] = GolemPos4 <gen>
      • Set YellowGolemWayPoint[4] = GolemJumpscareBack <gen>
 
Level 17
Joined
Mar 21, 2011
Messages
1,611
The triggers are really confusing, at least for me. I also did not fully understand what you want to do.
I wouldnt recommend you to use waits, replace it with a real variable that counts up every loop and check if it reached the max time.

Give some more information
 
Level 14
Joined
Nov 30, 2013
Messages
926
The triggers are really confusing, at least for me. I also did not fully understand what you want to do.
I wouldnt recommend you to use waits, replace it with a real variable that counts up every loop and check if it reached the max time.

Give some more information

Sorry about that. I'll explain it.
Don't worry about the wait command, I created a similar trigger which operates the other unit.


  • -------- Temp Variable --------
  • Set GolemAI_VarID = 1
  • Set GolemAI_TempUnitType[GolemAI_VarID] = Red Golem
  • Set GolemAI_TempID[GolemAI_VarID] = 1
  • Set GolemAI_TempRivalID[GolemAI_VarID] = 2
  • Set GolemAI_TempAngle[0] = 270.00
  • Set GolemAI_TempAngle[1] = 270.00
  • Set GolemAI_TempAngle[2] = 180.00
  • Set GolemAI_TempAngle[3] = 90.00
  • Set GolemAI_TempAngle[4] = 90.00
  • Set GolemAI_MaxPathing[GolemAI_VarID] = 4
  • Set GolemAI_VarID = 0
  • -------- Temp Variable --------
GolemAI_VarID - This only picks up the other variables' array.
GolemAI_TempUnitType - Picks up the selected unit to do some teleporting.
GolemAI_TempID - This gets the ID of the picked unit for this trigger.
GolemAI_TempRivalID - This gets the ID of its rival unit.
GolemAI_TempAngle - This allows to set the unit's facing angle when everytime it teleported.
GolemAI_MaxPathing - How far the unit can teleport. This proves useful through the For-Loop statement.

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • isGameReady Not equal to True
    • Then - Actions
      • -------- Initiate Jumpscare --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GolemAIPos[GolemAI_TempID[1]] Equal to 3
          • IsRearLightOn Equal to False
          • IsCamMoving Equal to False
          • GolemAI_IsGolemFlashed[GolemAI_TempID[1]] Equal to False
          • ((PlayerViewType Equal to 0) and (PlayerView Not equal to 1)) or (PlayerViewType Equal to 1)
          • GolemAIPos[GolemAI_TempRivalID[1]] Not equal to 4
        • Then - Actions
          • Set GolemAI_JumpscareRear = True
          • Set GolemAIPos[GolemAI_TempID[1]] = 4
          • If (DebugMode Equal to True) then do (Game - Display to (All players) the text: (|cffff0000Red Golem|r: + Jumpscared the player.)) else do (Do nothing)
        • Else - Actions
      • -------- Golem AI Movement System --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GolemAIPos[GolemAI_TempID[1]] Equal to 2
          • (CamID Not equal to 0) and (IsRearLightOn Not equal to True)
          • GolemAIPos[GolemAI_TempRivalID[1]] Not equal to 3
        • Then - Actions
          • Set GolemAIPos[GolemAI_TempID[1]] = 3
          • If (DebugMode Equal to True) then do (Game - Display to (All players) the text: (|cffff0000Red Golem|r: + Walked to Rear Light Location.)) else do (Do nothing)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GolemAIPos[GolemAI_TempID[1]] Equal to 1
          • GolemAIPos[GolemAI_TempRivalID[1]] Not equal to 2
          • (CamID Not equal to 2) and (CamID Not equal to 0)
        • Then - Actions
          • Set GolemAIPos[GolemAI_TempID[1]] = 2
          • If (DebugMode Equal to True) then do (Game - Display to (All players) the text: (|cffff0000Red Golem|r: + Walked to Main Hall.)) else do (Do nothing)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GolemAIPos[GolemAI_TempID[1]] Equal to 0
          • GolemAIPos[GolemAI_TempRivalID[1]] Not equal to 1
          • (CamID Not equal to 3) and (CamID Not equal to 2)
        • Then - Actions
          • Set GolemAIPos[GolemAI_TempID[1]] = 1
          • If (DebugMode Equal to True) then do (Game - Display to (All players) the text: (|cffff0000Red Golem|r: + Walked to East Hall.)) else do (Do nothing)
        • Else - Actions
      • -------- Failed to Jumpscare --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GolemAIPos[GolemAI_TempID[1]] Equal to 3
          • IsRearLightOn Equal to False
          • GolemAI_IsGolemFlashed[GolemAI_TempID[1]] Equal to True
          • CamID Not equal to 3
        • Then - Actions
          • Set GolemAIPos[GolemAI_TempID[1]] = 0
          • Set GolemAI_IsGolemFlashed[GolemAI_TempID[1]] = False
          • If (DebugMode Equal to True) then do (Game - Display to (All players) the text: (|cffff0000Red Golem|r: + Return back to spawn point.)) else do (Do nothing)
        • Else - Actions
      • -------- Golem AI Movement System --------
      • Unit Group - Pick every unit in Player12Golem and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Equal to GolemAI_TempUnitType[GolemAI_TempID[1]]
            • Then - Actions
              • Set TempPoint = (Center of RedGolemWayPoint[GolemAIPos[GolemAI_TempID[1]]])
              • For each (Integer A) from 0 to GolemAI_MaxPathing[GolemAI_TempID[1]], do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • GolemAIPos[GolemAI_TempID[1]] Equal to (Integer A)
                    • Then - Actions
                      • Unit - Move (Picked unit) instantly to TempPoint, facing GolemAI_TempAngle[(Integer A)] degrees
                    • Else - Actions
              • Custom script: call RemoveLocation(udg_TempPoint)
            • Else - Actions
      • -------- Resetting Temporary Variable --------
      • Set GolemAI_MaxPathing[GolemAI_TempID[1]] = 0
      • Set GolemAI_TempUnitType[GolemAI_TempID[1]] = No unit-type
      • Set GolemAI_TempID[1] = -1
      • Set GolemAI_TempRivalID[1] = -1
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • Set GolemAI_TempAngle[(Integer A)] = 0.00
      • -------- Resetting Temporary Variable --------
      • Trigger - Turn on (This trigger)
    • Else - Actions
      • Trigger - Turn off (This trigger)
GolemAIPos - This changes when everytime the unit moves. Also, this can allow the unit's position to be changed when this changes as well.
GolemAIPos[GolemAI_TempRivalID[1]] Not equal to X - When its rival is in the way, it will return false.
IsRearLightOn - Detects whenever the player's rear light is activated.
IsCamMoving - Detects when the player move its camera.
Player12Golem (Unit Group) - Picks up all the unit then find a unit which equivalent to the GolemAI_TempUnitType.
GolemAI_IsGolemFlashed - When the rear light is activated and the unit is being visible by that light, it will considered true.


I hope this is enough.
 
Level 14
Joined
Nov 30, 2013
Messages
926
you set GolemIsFlashed to False but never set it back to true, could that be the problem?

Nope, I forgot to mention that the GolemIsFlashed can set itself to true at the other trigger which can't be seen on this thread.
  • Rear Light
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
      • IsRearLightOn Equal to True
    • Actions
      • Set GolemAI_TempGroup = Player12Golem
      • Unit Group - Pick every unit in GolemAI_TempGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (GolemPos4 <gen> contains (Picked unit)) Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of (Picked unit)) Equal to Red Golem
                • Then - Actions
                  • Set GolemAI_IsGolemFlashed[1] = True
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of (Picked unit)) Equal to Yellow Golem
                • Then - Actions
                  • Set GolemAI_IsGolemFlashed[2] = True
                • Else - Actions
            • Else - Actions
      • Custom script: call DestroyGroup(udg_GolemAI_TempGroup)
      • Visibility - Create an initially Enabled visibility modifier for Player 1 (Red) emitting Visibility across RearViewRegion
      • Set RearViewFog = (Last created visibility modifier)
      • Visibility - Disable RearViewFog
      • Visibility - Destroy RearViewFog
 
Level 11
Joined
Mar 17, 2007
Messages
399
Regarding the map (I don't know what's changed since then) Something about this point doesn't add up & I don't think it even exists.

  • Set TempPoint = (Center of RedGolemWayPoint[GolemAIPos[GolemAI_TempID]])
The default location is RedGolemWayPoint[0] ?

You have a array inside the point though ?
 
Last edited:
Status
Not open for further replies.
Top