Toribash
Original Post
Lua Script Question
I'd like to create a set of moves the enemy would do as the combat start..
Example, match start, random choosing of set moves, then the bot does all the moves and stops moving afterwards.. I've tried modifying Opener.LUA but.. it just made the bot go crazy heh... anyone has an example of what I should do?
Originally Posted by Arzhul View Post
I'd like to create a set of moves the enemy would do as the combat start..
Example, match start, random choosing of set moves, then the bot does all the moves and stops moving afterwards.. I've tried modifying Opener.LUA but.. it just made the bot go crazy heh... anyone has an example of what I should do?

Each of the players have 20 joints, from 0 to 19. You can use a for loop to cycle through them.

On each for, say the counter is i:


for i=0,19 do
--code
end
Then, you need to set the joint's state: 1 - Extend, 2 - Contract, 3 - Hold, 4 - Relax


for i=0,19 do

set_joint_state(0--[[player is 0 for red]]--, i, 3)

end
That will hold all. Now, easiest way to make a set of moves... make a number 20 digits long, with each digit corresponding to a joint. Meaning 3333..[20digits]...333 would hold all, then use math.random(0, [number-of-moves]) to make it choose.