• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Needing advanced help with triggers, regions and systems.

Status
Not open for further replies.
Level 4
Joined
Jul 18, 2008
Messages
76
Hey guys, here's the cheese.

Imagine a board game, lets say for example just a row with 10 squares which the player is about to walk over. Ive built up mine like this but larger, and im needing help how to make the player move from square to square.
Each square is also a region ofcourse, so when the player rolls it's twp dices (D6) and gets, lets say 5, the players unit is going to walk on each of the regions between the one he stood on and the one he will finally land on.
I want to use the (Move Instantly) command to each region, but somehow this has to be done smooth.

Reason i cant do this is because doing this manually and simple will take ages since the player can roll anything from 2 to 12 etc.(The Dice trigger is no problem im fine)
What i need is somehow a system that makes the regions into numbers so a trigger can recognise these numbers when the player roll his dice.
Meaning instead of saying - Move to Z, Move to X, Move to Y - it is instead going to do - Move (Players Rolled Dice) Steps.

Is this even possible? I know for sure people are pretty experienced here and might come up with something.. perhaps any use of hashtables?

Anyways i would really admire that sweet fellow who will make me happy with this.
 
Level 2
Joined
Aug 4, 2011
Messages
12
Just make location array squares(or x and y arrays) and set squares[0] = "first sq", set squares[1] = "second sq" etc... And make integer position = 0(lately array for multi-player) and move them like this:
JASS:
function s takes nothing returns nothing
   loop
      set position = position + 1
      call SetUnitPosition(moveUnit, GetRectCenterX(locations[position]), GetRectCenterY(locations[position]) )
      call TriggerSleepAction(1.00) //lately timer if u need
      set moveCount = moveCount - 1
      exitwhen (moveCount == 0)
   endloop
endfunction
 
Level 4
Joined
Jul 18, 2008
Messages
76
I have very bad knowledge with Jass and dont really know how to do what u actually posted there :p
 
Level 9
Joined
Apr 23, 2010
Messages
312
Set all your regions into a variable array like hexing said, each region has a differnet number.

Example
Set Region_var[0] = Region 001
Set Region_var[1] = Region 002
Set Region_var[2] = Region 003
ect..
You can then call the region number the unit is currently on add what number that unit rolled, and move that many spaces.

Example
Unit rolls 5.
Set Roll_var = rolled number
Move unit instantly to Region_var[CurrentReg_var + Roll_var]
That's the basic idea at least.
 
Level 4
Joined
Jul 18, 2008
Messages
76
Thanks thats exactly the help i need!
But how can i register the CurrentReg? A triggar cant load the region the unit is currently in right? I have to make a system with triggers to remember it?
 
Status
Not open for further replies.
Top