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
|
|
In response to Cyberlord34
|
|
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... |
In response to Saucepan Man
|
|
var/list/playermobs=list() Something like that should work nicely. |
In response to Vic Rattlehead
|
|
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() |
In response to Vic Rattlehead
|
|
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? |
In response to Andre-g1
|
|
I forgot to make it a temp var, my bad.
|
In response to Andre-g1
|
|
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...? |
In response to Saucepan Man
|
|
mob Something like that. |
In response to Saucepan Man
|
|
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 |
In response to Vic Rattlehead
|
|
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]. |
In response to Andre-g1
|
|
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... |
In response to Saucepan Man
|
|
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 :)
|
In response to Andre-g1
|
|
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
|
In response to Saucepan Man
|
|
Show the wander() proc, really. Adding the check I mentioned wouldn't stop you from adding confused movement at all.
|
In response to Andre-g1
|
|
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. |
In response to Saucepan Man
|
|
Can you show AI() also ?
[EDIT] Wander_Sentry() This is considering AI() sleeps, since I don't know what AI() does :P |
In response to Andre-g1
|
|
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 :\ |
In response to Saucepan Man
|
|
No problem, I'm here to help, or at least try ;)
Change the spawn in that proc to a sleep() and remove the Wander_Sentry() call and it should work fine. |
You could have something like this.
Thats just an example though.