How do I make someone move in the level editor?

I am making someone move in the level editor, but I don’t know what command to use.

You can make thangs move back and forth between two points with ai.patrols (at least, I think that’s what it’s called)

1 Like

Here are two ways I did it in my most recent level, binary search:
They’re both in the referee extraCode.

@person = @world.getThangByID "Taric"  
// Taric is the name of a paladin in the level
// later…
@person.moveXY xPos, yPos
// Taric moves to xPos,yPos

^ This acts in a similar way to the regular moveXY() that we have.
Second method: changing the target position

// where thing is an ice yak
thing.setTargetPos pos // pos is the position
thing.setAction 'move'
thing.rotation = thing.velocity.heading()

Omitting the rotation didn’t seem to change much.
This method sort of makes sense when you click on various thangs while playing levels – they usually have a target and an action.

Since the documentation wasn’t very helpful, I discovered both of them by looking at the code from other levels. You should try that too. Search the editor list for official levels that might have what you’re looking for. Look at the ref code in particular - it’s usually in the well (or in the frozen munchkin like in Binary Search).

Basically, there was a lot of guesswork involved in making that level.

2 Likes