Code:
mob
Beasts
icon='Beasts.dmi'
Bat
icon_state = "Bat"
So basically in my game I have it where when you select a race your character enters the world, and when that happens a follower appears being your familiar or pet. I tried looking at demos and other questions on how to do a simple command and follow thing, but most had a bunch of coding that turned out to be wrong and I did not just want to copy and paste something I did not completely understand. Can anyone help me?
Code: mob |
Jul 29 2015, 6:01 pm
Best response
|
|
The simplest way is walk_to(your_follower, you) but if you don't like that, you'll have to do something else. Add the follower to your group var to use special group-related collision resolution.
|
If you're only taking 1 step at a time, you can probably get away with calling a follow function on your follower every time your mob takes a step. Pseudocode
mob/Move() Obvious breakdown with teleporting. |
In response to Dayvon64
|
|
What part are you confused about?
|
Would this be it?
mob |
Add the familiar to your group using Owner.group.Add(Familiar) you can place it in what ever code spawns it, such as
mob/verb/Familiarpls() Then in Move() you could tell it to step with you, like so mob/Move() |
So like this
mob |
Yes, I suppose. You copied what I had put up as an example, so I don't know if you grasp the concepts. If you have trouble let me know.
|
It would probably be best to make a list of all the pets the player has so something like this.
mob Then adding a pet mob/verb/AddPet() Then the movement, make sure you call ..() otherwise your player won't move. mob/Move() |
@Colesprite, you are moving the pets toward the player before calling the default action.
This is the third time I've said this this week, you MUST set the return value in Move() or it will always fail. mob/Move() Even with my improvements, this is a really problematic example. The mobs should have their own pathfinding or be force-following the player properly. Moving them every time the player moves is not good enough. |