One involving lists...
since I suck with them.
First question.
When I add an object to a mobs contents, I can right click it if it's being viewed in the statpanel and access it's verbs.
However, when I add an object to a list variable I created (I thought was the same thing...) for a mob, and try to access it in the statpanel the verbs do not show up when I right click on it.
Is there a way to get around this from happening?
Secondly, if you wanted to have a mob walk to another mob on the map...
what would be better to use if you wanted it to just keep walking no matter what but with lag equal to a walkspeed variable?
I seem to be swinging towards step_towards in a while loop and keeping the movement speed in check through Move() being edited
but I was wondering if this would have any complications?
var/turf/D=DD.loc //DD is the target
while(O) // O being the mobile
step_towards(O,D)
if(O.loc==D.loc)
del(O)
if(!O)
return
welp any opinions are appreciated, or ways that you may have an object walk towards another object!
ID:268919
Dec 27 2004, 8:00 pm
|
|
In response to Lummox JR
|
|
thanks again Lummox, always a great help :)
BTW- I took your advice about not using vars[] for things, it took me a month or so to recode everything but I think it was worth it, since I switched over to just using a general object instead of variables since it seems soooo much easier to work with, and more customization. :) |
Yes. Use "set src" on those verbs in a way that allows them to be used wherever they're actually stored. The reason the verbs don't appear is that an obj in a list isn't necessarily also in your contents.
If you have a while() loop for that, why would you need to edit Move()? The loop could handle the movement delay.
Well, that would, since D is a turf and D.loc is an area. For that reason O.loc will never be D.loc. In fact if DD is a mob standing on turf D, O.loc will probably never be D either. I'd use get_dist() to check if the mob O has arrived.
I recommend using step_to() in place of step_towards(), since it uses automatic pathfinding.
Lummox JR