[Trigger] How do you trigger a conveyor belt

Status
Not open for further replies.
Level 29
Joined
Sep 26, 2009
Messages
2,594
determine the order in which items are moved. Put all items into item array, where the item with the lowest index will be the item moved first.
Then periodically every 0.03 second loop through all items on conveyor belt and move them a bit (e.g. by 20 units). Don't forget to set the locations into variables first, so you don't get memory leak.
 
I am not sure if there is an action called "for each item in region" (there is such a think in JASS i know), but if there is, you can just do that periodically every 0.03 seconds and move them in some direction, perhaps using polar offset. Otherwise, add a trigger with the event "a unit drops an item" (or whatever it is called), and then check "position of item is within region 'conveyor belt'", and if so, add the item to some kind of list of items within the belt. You also need a trigger for when a player picks up an item.

Really though, i could write a quick jass script which could do this for you in 5 minutes... you will not need to know jass to use it, just a single custom script line.
 
as Nichilus said..

  • Conveyor Init
    • Events
      • Map Initialization
    • Conditions
    • Actions
      • -------- The speed of the items------
      • Set Conveyor_Speed = 5
      • -------- The direction of the items------
      • Set Conveyor_Angle = 90
  • Conveyor Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Item - Pick every item in (Conveyor Region <gen>) and do (Actions)
        • Loop - Actions
          • Set - Item_Point[0] = (Position of Picked Item)
          • Set - Item_Point[1] = ((Item_Point[0]) offset by Conveyor_Speed towards Conveyor_Angle degrees
          • Item - Move (Picked Item) to Item_Point[1]
          • Custom script: call RemoveLocation (udg_Item_Point[0])
          • Custom script: call RemoveLocation (udg_Item_Point[1])
 
Status
Not open for further replies.
Top