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

(Solved) Simple Conveyor belt

Status
Not open for further replies.

Edy

Edy

Level 9
Joined
Nov 21, 2015
Messages
226
I need a someone to create a region (in a map) that will move units inside that region towards the back of that region, without pausing the unit so the unit can resist it (movement speed of 250 trying to force it will be still and over will be slow)- like a conveyor belt.
It should be like 5 range every 0.02 secs.

I don't know how to use call udg sooooo I suck at these things.
+rep and massive credits in my upcoming maps.

conveyor belt.png
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
I don't know how to use call udg sooooo I suck at these things.
In the time you've been a member of this site you could have learned the most miniscule bit about JASS to actually write efficient/leakless GUI code maybe... 7 times? That's if it took you 6 months to become familiar each time. The more you learn for yourself the more interesting things you can do with the World Editor, and the greater your vision becomes. I'm assuming you are going to want more than one conveyor in your map so here's an efficient way to do many:

  • Events
    • Time - Elapsed game-time is 0.50 seconds
  • Conditions
  • Actions
    • Set Conv_Period = 0.02 //to make the timer frequency easily controllable/editable
    • Set Conv_Speed = 250.00 //to easily make a default speed you can set this variable as distance per second here then use it below; for conveyors that need different speeds just set them manually below
    • -------- --------
    • Set Conv_Loop = 1
    • Set Conv_Region[Conv_Loop] = Conveyor Region 001 <gen>
    • Set Conv_MoveX[Conv_Loop] = (Conv_Speed x Conv_Period) //moves to the right by Conv_Speed per second
    • Set Conv_MoveY[Conv_Loop] = 0.00
    • -------- --------
    • Set Conv_Loop = 2
    • Set Conv_Region[Conv_Loop] = Conveyor Region 002 <gen>
    • Set Conv_MoveX[Conv_Loop] = 0.00
    • Set Conv_MoveY[Conv_Loop] = ((-1.00 x Conv_Speed) x Conv_Period) //moves down by Conv_Speed per second
    • -------- --------
    • Set Conv_Loop = 3
    • Set Conv_Region[Conv_Loop] = Conveyor Region 003 <gen>
    • Set Angle = 217.00
    • Set Conv_MoveX[Conv_Loop] = ((Sin(Angle) x Conv_Speed) x Conv_Period) //moves towards 217 degrees by Conv_Speed per second
    • Set Conv_MoveY[Conv_Loop] = ((Cos(Angle) x Conv_Speed) x Conv_Period)
    • -------- --------
    • SetConv_Total = Conv_Loop
    • Trigger - Add to THE OTHER TRIGGER <gen> the event Time - Every Conv_Period seconds of game-time
  • Events
  • Conditions
  • Actions
    • For each integer Conv_Loop from 1 to Conv_Total do (Actions))
      • Loop - Actions
        • Custom script: set bj_wantDestroyGroup = true //cleans a leak in the next line
        • Unit Group - Pick all units in Conv_Region[Conv_Loop] matching (((Matching Unit) is in group Conv_Exclude) equal to false) and do (Actions)
          • Loop - Actions
            • Set TempPoint1 = Position of (Picked Unit)
            • Set TempPoint2 = TempPoint1 offset by (Conv_MoveX[Conv_Loop], Conv_MoveY[Conv_Loop])
            • Unit - Move (Picked Unit) instantly to TempPoint2
            • -------- if the above line causes units to move dramatically because of collision issues then you can use these JASS versions which ignore collision and pathability: --------
            • Custom script: call SetUnitX(GetEnumUnit(), GetLocationX(udg_TempPoint2))
            • Custom script: call SetUnitY(GetEnumUnit(), GetLocationY(udg_TempPoint2))
            • -------- --------
            • Custom script: call RemoveLocation(udg_TempPoint1) //cleaning the point leaks
            • Custom script: call RemoveLocation(udg_TempPoint2) //keep the udg_ prefix but change the names to match your variables if they're not TempPoint1 and TempPoint2
 

Edy

Edy

Level 9
Joined
Nov 21, 2015
Messages
226
Geez, thx mate.
I've been absent from warcraft for quite some time. School, got employed etc. For my time with WE I've been mostly doing terrain and models for personal use so I don't have much experience with triggers. Thx a bunch :)
 
Status
Not open for further replies.
Top