- Joined
- Apr 1, 2010
- Messages
- 289
Hi I am working on making a system, that for advanced workers, ie something for city building games where you have jobs like farming, smithing, etc i have the movement triggers done, but the unit isn't moving, I have no clue clue why so any help would be appreciated
And here is the map
View attachment AdvancedworkerSystem.w3x
-
Pickup
-
Events
-
Conditions
-
Actions
-
Custom script: local unit udg_LocalUnit = udg_OrderedUnit
-
Custom script: local location udg_LocalPoint = udg_Pickup1
-
Custom script: local handle udg_LocalHandle = udg_Handle
-
Hashtable - Save True as (Key busy) of (Key LocalHandle) in (Last created hashtable)
-
Unit - Order LocalUnit to Move To LocalPoint
-
Wait until ((Distance between (Position of LocalUnit) and LocalPoint) Less than or equal to 30.00), checking every 1.00 seconds
-
For each (Integer A) from 1 to 6, do (Actions)
-
Loop - Actions
-
Hero - Give (Random item in (Region centered at LocalPoint with size (150.00, 150.00)) matching ((Item level of (Matching item)) Equal to 12)) to LocalUnit
-
-
-
Hashtable - Save False as (Key busy) of (Key LocalHandle) in (Last created hashtable)
-
Custom script: call RemoveLocation(udg_LocalPoint)
-
-
-
Dropoff
-
Events
-
Conditions
-
Actions
-
Custom script: local unit udg_LocalUnit = udg_OrderedUnit
-
Custom script: local location udg_LocalPoint = udg_DropOff1
-
Custom script: local handle udg_LocalHandle = udg_Handle
-
Hashtable - Save True as (Key busy) of (Key LocalHandle) in WorkersWorking
-
Unit - Order LocalUnit to Move To LocalPoint
-
Wait until ((Distance between (Position of LocalUnit) and LocalPoint) Less than or equal to 30.00), checking every 1.00 seconds
-
For each (Integer A) from 1 to 6, do (Actions)
-
Loop - Actions
-
Hero - Drop the item from slot (Integer A) of LocalUnit
-
-
-
Hashtable - Save False as (Key busy) of (Key LocalHandle) in WorkersWorking
-
Custom script: call RemoveLocation(udg_LocalPoint)
-
-
-
Forge
-
Events
-
Conditions
-
Actions
-
Custom script: local unit udg_LocalUnit = udg_OrderedUnit
-
Custom script: local unit udg_LocalUnit2 = udg_TargetUnit
-
Custom script: local unit udg_LocalUnit3
-
Custom script: local location udg_LocalPoint
-
Custom script: local handle udg_LocalHandle = udg_Handle
-
Hashtable - Save True as (Key busy) of (Key LocalHandle) in WorkersWorking
-
Set LocalPoint = (Position of LocalUnit2)
-
Unit - Order LocalUnit to Move To LocalPoint
-
Wait until ((Distance between (Position of LocalUnit) and LocalPoint) Less than or equal to 30.00), checking every 1.00 seconds
-
For each (Integer A) from 1 to 6, do (Actions)
-
Loop - Actions
-
Hero - Drop the item from slot (Integer A) of LocalUnit
-
Hero - Give (Random item in (Region centered at LocalPoint with size (150.00, 150.00)) matching ((Item level of (Matching item)) Equal to 12)) to LocalUnit2
-
-
-
Unit - Create 1 Timer for (Owner of LocalUnit) at LocalPoint facing Default building facing degrees
-
Set LocalUnit3 = (Last created unit)
-
Unit - Add a 4.99 second Generic expiration timer to LocalUnit3
-
Wait until ((LocalUnit3 is dead) Equal to True), checking every 5.00 seconds
-
For each (Integer A) from 1 to 6, do (Actions)
-
Loop - Actions
-
Set Item = (Item carried by LocalUnit2 in slot (Integer A))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Item level of Item) Equal to 12
-
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Item-type of Item) Equal to Iron
-
-
Then - Actions
-
Hero - Create Forged Iron and give it to LocalUnit2
-
-
Else - Actions
-
-
-
Else - Actions
-
-
-
-
For each (Integer A) from 1 to 6, do (Actions)
-
Loop - Actions
-
Hero - Drop the item from slot (Integer A) of LocalUnit2
-
Hero - Give (Random item in (Region centered at LocalPoint with size (150.00, 150.00)) matching ((Item level of (Matching item)) Equal to 13)) to LocalUnit
-
-
-
Set LocalUnit = No unit
-
Set LocalUnit2 = No unit
-
Set LocalUnit3 = No unit
-
Hashtable - Save False as (Key busy) of (Key LocalHandle) in (Last created hashtable)
-
Custom script: call RemoveLocation(udg_LocalPoint)
-
-
-
Anvil
-
Events
-
Conditions
-
Actions
-
Custom script: local unit udg_LocalUnit = udg_OrderedUnit
-
Custom script: local unit udg_LocalUnit2 = udg_TargetUnit2
-
Custom script: local unit udg_LocalUnit3
-
Custom script: local location udg_LocalPoint
-
Custom script: local handle udg_LocalHandle = udg_Handle
-
Hashtable - Save True as (Key Is busy) of (Key LocalHandle) in (Last created hashtable)
-
Set LocalPoint = (Position of LocalUnit2)
-
Unit - Order LocalUnit to Move To LocalPoint
-
Wait until ((Distance between (Position of LocalUnit) and LocalPoint) Less than or equal to 30.00), checking every 1.00 seconds
-
For each (Integer A) from 1 to 6, do (Actions)
-
Loop - Actions
-
Hero - Drop the item from slot (Integer A) of LocalUnit
-
Hero - Give (Random item in (Region centered at LocalPoint with size (150.00, 150.00)) matching ((Item level of (Matching item)) Equal to 12)) to LocalUnit2
-
-
-
Unit - Create 1 Timer for (Owner of LocalUnit) at LocalPoint facing Default building facing degrees
-
Set LocalUnit3 = (Last created unit)
-
Unit - Add a 4.99 second Generic expiration timer to LocalUnit3
-
Wait until ((LocalUnit3 is dead) Equal to True), checking every 5.00 seconds
-
For each (Integer A) from 1 to 6, do (Actions)
-
Loop - Actions
-
Set Item = (Item carried by LocalUnit2 in slot (Integer A))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Item level of Item) Equal to 12
-
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Item-type of Item) Equal to Forged Iron
-
-
Then - Actions
-
Hero - Create Iron Sword and give it to LocalUnit2
-
-
Else - Actions
-
-
-
Else - Actions
-
-
-
-
For each (Integer A) from 1 to 6, do (Actions)
-
Loop - Actions
-
Hero - Drop the item from slot (Integer A) of LocalUnit2
-
Hero - Give (Random item in (Region centered at LocalPoint with size (150.00, 150.00)) matching ((Item level of (Matching item)) Equal to 13)) to LocalUnit
-
-
-
Set LocalUnit = No unit
-
Set LocalUnit2 = No unit
-
Set LocalUnit3 = No unit
-
Hashtable - Save False as (Key Is busy) of (Key LocalHandle) in (Last created hashtable)
-
Custom script: call RemoveLocation(udg_LocalPoint)
-
-
-
WorkingLoop
-
Events
-
Time - Every 2.50 seconds of game time
-
-
Conditions
-
Actions
-
Set Workers = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Citizen))
-
Unit Group - Pick every unit in Workers and do (Actions)
-
Loop - Actions
-
Set HasJob = (Load (Key HasJob) of (Key (Picked unit)) from WorkersWorking)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
HasJob Equal to False
-
-
Then - Actions
-
Game - Display to (All players) the text: ! worker has starte...
-
-
Else - Actions
-
Set Unitready = (Load (Key busy) of (Key (Picked unit)) from WorkersWorking)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Unitready Equal to True
-
-
Then - Actions
-
Else - Actions
-
Game - Display to (All players) the text: a worker has starte...
-
Set WorkersJob = (Load (Key Job) of (Key (Picked unit)) from WorkersWorking)
-
Set ResetAction = (Load (Key Steps) of (Key (Picked unit)) from WorkersWorking)
-
Set TargetUnit = (Load (Key target) of (Key (Picked unit)) in WorkersWorking)
-
Set Handle = (Picked unit)
-
Set TargetUnit2 = (Load (Key target2) of (Key (Picked unit)) in WorkersWorking)
-
Set Pickup1 = (Load (Key pickup1) of (Key (Picked unit)) in WorkersWorking)
-
Set DropOff1 = (Load (Key dropoff1) of (Key (Picked unit)) in WorkersWorking)
-
Trigger - Run (Load WorkersJob of (Key Handle) in WorkersWorking) (ignoring conditions)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
WorkersJob Equal to ResetAction
-
-
Then - Actions
-
Hashtable - Save 1 as (Key Job) of (Key (Triggering unit)) in WorkersWorking
-
-
Else - Actions
-
-
Set WorkersJob = (WorkersJob + 1)
-
Hashtable - Save WorkersJob as (Key Job) of (Key (Picked unit)) in WorkersWorking
-
Custom script: call RemoveLocation( udg_Pickup1)
-
Custom script: call RemoveLocation( udg_DropOff1)
-
-
-
-
-
-
-
-
-
Pickup1
-
Events
-
Unit - A unit Begins casting an ability
-
-
Conditions
-
(Ability being cast) Equal to Pickup point
-
-
Actions
-
Set Pickup1 = (Target point of ability being cast)
-
Hashtable - Save Handle OfPickup1 as (Key pickup1) of (Key (Triggering unit)) in WorkersWorking
-
-
-
Dropoff1
-
Events
-
Unit - A unit Begins casting an ability
-
-
Conditions
-
(Ability being cast) Equal to DropOff
-
-
Actions
-
Set DropOff1 = (Target point of ability being cast)
-
Hashtable - Save Handle OfDropOff1 as (Key dropoff1) of (Key (Triggering unit)) in WorkersWorking
-
-
-
SetForge
-
Events
-
Unit - A unit Begins casting an ability
-
-
Conditions
-
(Ability being cast) Equal to Set Forge
-
-
Actions
-
Hashtable - Save Handle Of(Target unit of ability being cast) as (Key target) of (Key (Triggering unit)) in WorkersWorking
-
-
-
SetAnvil
-
Events
-
Unit - A unit Begins casting an ability
-
-
Conditions
-
(Ability being cast) Equal to Set Anvil
-
-
Actions
-
Hashtable - Save Handle Of(Target unit of ability being cast) as (Key target2) of (Key (Triggering unit)) in WorkersWorking
-
-
-
JobSmith
-
Events
-
Unit - A unit Begins casting an ability
-
-
Conditions
-
(Ability being cast) Equal to Blacksmith
-
-
Actions
-
Set Unitready = True
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Unitready Equal to True
-
-
Then - Actions
-
Hashtable - Save True as (Key HasJob) of (Key (Triggering unit)) in WorkersWorking
-
Hashtable - Save 4 as (Key Steps) of (Key (Triggering unit)) in WorkersWorking
-
Hashtable - Save 1 as (Key Job) of (Key (Triggering unit)) in WorkersWorking
-
Hashtable - Save False as (Key busy) of (Key (Triggering unit)) in WorkersWorking
-
Hashtable - Save Handle OfPickup <gen> as 1 of (Key (Triggering unit)) in WorkersWorking
-
Hashtable - Save Handle OfForge <gen> as 2 of (Key (Triggering unit)) in WorkersWorking
-
Hashtable - Save Handle OfAnvil <gen> as 3 of (Key (Triggering unit)) in WorkersWorking
-
Hashtable - Save Handle OfDropoff <gen> as 4 of (Key (Triggering unit)) in WorkersWorking
-
Game - Display to (All players) the text: This unit has taken...
-
-
Else - Actions
-
Game - Display to (All players) the text: You need to set all...
-
-
-
Custom script: call DestroyGroup(udg_Group)
-
-
View attachment AdvancedworkerSystem.w3x