Ok, this is directly connected with the thread on Vortezz's Multiple-Tiled Mobs Tutorial. Here is what I've got so far:
Move(Loc)
// delay movement
if(world.time < movetimer) return
movetimer = world.time + 5
..()
var/turf/T = locate(x,y + 1,z)
if(T)
top.loc = T
else
return
How this differs is in that else statement, where I changed top.loc = null to return, so it doesn't delete the poor guy's head. Unfortunately, this still allows the user to move over the head when they reach the top of the board.
What I would like to know is, what should come before that last return statement to prevent the player from moving overtop of his own tile(s)? Checking for the exsistance of the user's tile would be a way, but I still have no clue as to how to keep the user from moving in that specific direction...
ID:179804
Oct 31 2001, 8:34 pm
|
|
In response to Shadowdarke
|
|
Shadowdarke wrote:
Xooxer wrote: This code does nothing of the sort. The usr's mob is still capable of overlapping his own head, and detaching from the unit. Granted, it doesn't delete the character's head, but that was easily rectified on my side before I even posted this thread. What I need to to stop the movement if it would cuase any sort of detachment from the group. The if part is easy, it's actually stopping the movement that I can not do. Something like this I thought would work: return 0 but it didn't. It was one of the first things I tried. I need something in my code to tell DM not to move the usr's mob, from within the Move() proc... Anyone? |
In response to Xooxer
|
|
Xooxer wrote:
This code does nothing of the sort. The usr's mob is still capable of overlapping his own head, and detaching from the unit. Granted, it doesn't delete the character's head, but that was easily rectified on my side before I even posted this thread. Are you overiding mob move somewhere else? I ran a test case, which required a slight modification to the code, but it works fine like this: Move(Loc) // delay movement if(world.time < movetimer) return movetimer = world.time + 5 var/turf/T if(isturf(Loc)) T = locate(Loc:x,Loc:y + 1,Loc:z) if(!T) // can not move because the top would be gone return 0 else T = null . = ..() // do the default and store return value as . if(.) // if the body can move top.loc = T // move the top too return . // this line is automat What I need to to stop the movement if it would cuase any sort of detachment from the group. The if part is easy, it's actually stopping the movement that I can not do. return 0 will stop the mob from moving, unless you have code somewhere that doesn't check the return value and forces movement anyway. This part . = ..() if(.) is critical when you are overiding Move(), because it tests if the player did move, then makes other changes oonly if they had. If I didn't store the return value of the default proc and check it, I would be forcing the top to move even if the body had been blocked by something. What does your Move() code look like? |
In response to Xooxer
|
|
Move()
if (usr.y == 2) break /* checks user's loc. If near the top then break out of the Move Proc */ else ..() // Otherwise continue with Move() |
In response to Shadowdarke
|
|
I'll send you the code, as I'm discovering more quirks as I play around with this multi-tiled mob concept...
|
In response to Ernie Dirt
|
|
Ernie Dirt wrote:
Move()This would have to be if (usr.y == maxy-1) break in order to stop you from getting to the top. However, once you got to this y level, you would never be able to move again. If all you want to do is stop people from walking to the top of the map, I would just make an area and put a line of it across the top. area This should work for the single case of running off of the top of the map. It would not help in cases where you didn't want the head to overlap other dense turfs. |
Xooxer wrote:
Ok, this is directly connected with the thread on Vortezz's Multiple-Tiled Mobs Tutorial. Here is what I've got so far: i looked at the tutorial and i have one thing to say to Vortezz. <font size=8>WHAT AN EXELLENT CHOICE OF AN E-MAIL ADDRESS!</font> lol sorry [email protected] (whatevr) LMAO! |
In response to SSJ4_Satanic Bardock
|
|
Um, are you mental?
|
In response to Xooxer
|
|
Xooxer wrote:
Um, are you mental? As his legal counsel, I would advise him to say "Yes". |
The following code stops the player from moving if the movement would force his top off the map. It's not exactly what you asked for, but I think it's what you want :)
Move(Loc)
// delay movement
if(world.time < movetimer) return
movetimer = world.time + 5
var/turf/T = locate(Loc.x,Loc.y + 1,Loc.z)
if(!T) // can not move because the top would be gone
return 0
. = ..() // do the default and store return value as .
if(.) // if the body can move
top.loc = T // move the top too
return . // this line is automatic, but I included it for clarity