Needing advanced help with triggers, regions and systems.

Status
Not open for further replies.

Gnoren

Level 4
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.

hexing

Level 2
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``````

Gnoren

Level 4
I have very bad knowledge with Jass and dont really know how to do what u actually posted there

Gnoren

Level 4
i cant do this because i got no idea how the map works sorry

Then why do u bother to let me know -.-

13oot-Me

Level 9
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.

Gnoren

Level 4
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.

Replies
13
Views
1K
Replies
2
Views
635
Replies
4
Views
694
Replies
4
Views
732
Replies
4
Views
722