whats the best way to go about forcing a certain player mimic the movements of another (be it a client or an NPC)?
So that whenever player A stepped in a given direction, player B would step in the same direction...
Note that I don't want north to mean north per se. Rather forwards = fowards.
(so if A is facing South and B is facing East, if A steps south, B will step East)
Im not asking for someone to just write the code for me, just a nudge in the right direction. PUN.
ID:273095
![]() Aug 30 2009, 9:27 pm
|
|
I want the user's movement to directly affect movement.
I guess I could have a before and after type check in the Move() proc. And then adjust the target mob accordingly. But I don't know if thats a very efficient way, beit CPU efficiency or code complexity efficiency... |
var/list/playermobs=list() Something like that should work nicely. |
It would work, for a good rollbacking issue as you didn't make the mob_controlled a tmp var.
Aside from that, even if you remove that return it won't move the mob. var/list/playermobs=list() |
Thanks very much, that's what I was leaning towards I think.
I do, however, leave the question open in case someone has any better suggestions? |
Ah - but what about when you want to prevent the target from moving itself and only you can move it, whether the target be human or computer controlled...
It could just be that I don't know enough about the Move()proc...? |
You'd have to freeze the mob.
mob [Edit] Made a slight mistake. Fixed. As far as moving and stopping npcs, you'll have to show how you handle their movement. :P |
Hm, no.
Move() doesn't work if you return 0, it works if you call ..(). Besides, if he tried something like that, the snippet I posted before wouldn't work, because it would stop the mob's movement completely. Check [link]. |
Um yeah. NPC movement.
I don't. I don't think. I have a Move() proc that applies to any and all mobs. Mobs' wander / attack/chase is controlled with step, step_to, step_towards, and step_away, where Bump() calls a punch/attack procedure... |
Show the wander proc, you'll have to add a check there to see if they're being controlled. If they are, simply don't call step :)
|
Darn. I was hoping there was a nicer way - I intend to add in various confused movements too. up = down||left right=up||down etc etc. QQ
|
Show the wander() proc, really. Adding the check I mentioned wouldn't stop you from adding confused movement at all.
|
Wander_Sentry() Probably could be slightly more efficient. Would making it a while() type loop be worthwhile? ._. 'respawn' is the mobs mapped location, thus assigned via the New() proc. |
Can you show AI() also ?
[EDIT] Wander_Sentry() This is considering AI() sleeps, since I don't know what AI() does :P |
mob/AI/VillageNinjas urgh. length(HuntList) for the win. Forgive some of my stupid questions. i.e. confused movement. In my mind i've got old methods that didn't work, but that was when i didn't know what i was doing. In short I end up missing now-obvious solutions :\ |
You could have something like this.
Thats just an example though.