ID:141193
 
Code:
turf/healingpad
name = "healthorb"
density = 0
layer = 3
icon = 'healpad.dmi'
Exited(mob/M)
M.Mhealth=(M.Mmaxhealth)
M.Mmagic=(M.Mmaxmagic)
M.xsave= M.x
M.ysave= M.y
M.zsave=M.z


Problem description: It's not healing the player when I run into it, I want it to heal, and restore the player from here. I've tried using Entered() Enter() Exited() Exit(), and I still can't seem to get it right.

You definitely don't want Exited(), but the other three should all accomplish the same effect you're trying to get at. You also don't need the parentheses around "M.Mmaxhealth" and "M.Mmaxmagic".
In response to Spunky_Girl
Spunky_Girl wrote:
You definitely don't want Exited(), but the other three should all accomplish the same effect you're trying to get at. You also don't need the parentheses around "M.Mmaxhealth" and "M.Mmaxmagic".


I tried removing it, but still I'm not getting anything, the player walks over the pad, and nothing happens. =/
In response to KeyWielder000
Nothing is supposed to happen, seeing as you've only programmed it to happen once the player leaves the turf (I guess you didn't notice that when testing)*. What you want here is Entered() (note you should never use Enter()/Exit() for these kinds of things), you said you've tried it but it should pretty much have worked if you just did it similarly to how you've tried Exited(). Also, objs may also move between turfs, so to be robust you need to check that the movable in question is really a mob before doing mob-specific things, to prevent runtime errors.
turf/Some_Turf
Entered(mob/M)
if(ismob(M))
M << "You've entered the \"[src.name]\" turf!"
//do whatever you want here . . .
else
M << "Oh, you're an /obj, not a mob!\
Good thing I didn't try to set your non-existent HP var or something."


*EDIT: Also, these movement-system-overrides will only work for movements properly initiated with Move() or a similar proc, so if you do something screwy with moving like set loc directly, this kind of thing will fail. But, that should relatively rarely be the case with the usual 'BYOND normal built-in movement' method.
In response to Kaioken
turf/healingpad
name = "healthorb"
density = 0
layer = 3
icon = 'healpad.dmi'
Entered(mob/M)
if(ismob(M))
M.Mhealth=M.Mmaxhealth
M.Mmagic=M.Mmaxmagic
M.xsave= M.x
M.ysave= M.y
M.zsave=M.z
else
return


Is what I changed it to,
I make the player run over the healing pad, and yet, nothing.

can player variables not be changed by turf?

or am I doing something wrong?

Should I try using Bump?

that would only apply to solid objects correct?
In response to KeyWielder000
Variables can be changed by anything, and yes, you're correct about the bump. It should work, seriously. Try this, fully debugged :p

Entered(atom/movable/a)
world<<"Entered the pad"
if(ismob(a))
world<<"It is a mob!"
var/mob/M=a
M.Mhealth=M.Mmaxhealth
world<<"[M.health] - [M.Mmaxhealth]"
M.Mmagic=M.Mmaxmagic
M.xsave= M.x
M.ysave= M.y
M.zsave=M.z
world<<"Return 1"
return 1

In response to Mysame
This should work:

turf/healingpad
Entered(O)
if(ismob(O))
var/mob/M = O
M.Mhealth = M.Mmaxhealth
M.Mmagic = M.Mmaxmagic
M.xsave = M.x
M.ysave = M.y
M.zsave = M.z
..()


Entered() only works if the mob moved in with 'BYOND normal built-in movement' Move(), which means this doesn't work when you set the mob's location explicitly like using loc.

Example:

// if turf/healingpad location 1,1,1
usr.loc = locate(1,1,1)
In response to Mysame
Mysame wrote:
Variables can be changed by anything, and yes, you're correct about the bump. It should work, seriously. Try this, fully debugged :p

> Entered(atom/movable/a)
> world<<"Entered the pad"
> if(ismob(a))
> world<<"It is a mob!"
> var/mob/M=a
> M.Mhealth=M.Mmaxhealth
> world<<"[M.health] - [M.Mmaxhealth]"
> M.Mmagic=M.Mmaxmagic
> M.xsave= M.x
> M.ysave= M.y
> M.zsave=M.z
> world<<"Return 1"
> return 1



ugh, tried it, still no luck.
this should of been simple coding, I wonder why it's being like this?
In response to Samehada24
Samehada24 wrote:
This should work:

> turf/healingpad
> Entered(O)
> if(ismob(O))
> var/mob/M = O
> M.Mhealth = M.Mmaxhealth
> M.Mmagic = M.Mmaxmagic
> M.xsave = M.x
> M.ysave = M.y
> M.zsave = M.z
> ..()
>

Entered() only works if the mob moved in with 'BYOND normal built-in movement' Move(), which means this doesn't work when you set the mob's location explicitly like using loc.

Example:

> // if turf/healingpad location 1,1,1
> usr.loc = locate(1,1,1)
>


no, I'm using the basic built in move function.

still, I'm having no result.
..

I'm about to just make it an object with a verb.
to save time.

but I really want it to be walk-over heal.
ugh.
In response to KeyWielder000
Ok,
I tried this

turf/healingpad
name = "healthorb"
density = 0
layer = 4
icon = 'healpad.dmi'
Entered(mob/O)
if(ismob(O))
var/mob/M = O
M.SaveK()
return 1
else
return 1


instead of calling the actions to call a Proc instead.
Yet, I still get nothing.

Is there something in that code that's wrong?
My player can rape the heal pad, and still nothing.
.<
I can't figure it out...


In response to KeyWielder000
In my piece of code, did you get ANY of the output messages?

So no, you definitely;

1) Overwritten Move() in some way
2) Plainly didn't place the healingpad.
In response to KeyWielder000
I like to use "atom/a" in the Entered() argument; it's just habit o.O In your case, atom/movable/a would be better though, since turfs can't move, now can they? ^-^ I also uses areas for things like "pk zones" and whatnot, but you don't have to. Turf works just as fine.

turf/healing_pad
Entered(atom/movable/a)
if(ismob(a))
var/mob/m = a
m<<"You entered a healing pad"


Try that. If it doesn't work, like all the previous ones >_>, you definitely did something to your Move() proc, like Mysame said.
In response to Spunky_Girl
Spunky_Girl wrote:
I like to use "atom/a" in the Entered() argument; it's just habit o.O In your case, atom/movable/a would be better though, since turfs can't move, now can they? ^-^ I also uses areas for things like "pk zones" and whatnot, but you don't have to. Turf works just as fine.

> turf/healing_pad
> Entered(atom/movable/a)
> if(ismob(a))
> var/mob/m = a
> m<<"You entered a healing pad"
>

Try that. If it doesn't work, like all the previous ones >_>, you definitely did something to your Move() proc, like Mysame said.


The only problem with that theory is this:

area
safe_zone
Entered(atom/movable/O)
..()
if(ismob(O)) // We need to make sure that
var/mob/M = O // O is a mob, since objects
M.Safe = 1 // may not have a 'safe' var.
Exited(atom/movable/O)
..()
if(ismob(O))
var/mob/M = O
M.Safe = 0


Thats my safezone code..

and it works just fine.

turf/healingpad
name = "healthorb"
density = 0
layer = 4
icon = 'healpad.dmi'
Entered(atom/movable/O)
..()
if(ismob(O))
var/mob/M = O
M.SaveK()
M<<"You steped on a healing pad"
return 1


thats the healing pad code...
dosint work..


Is there any reason why the SafeZone would work..
yet.. The Healing pad wont?
It's odd that it seems to work for one..

Perhaps it's because I'm using a .dmp instead of the .dmm?
maybe converting the map could somehow fix this problem?
if so, how would I go about doing so?


Edit: I changed the map to a .dmm. yet the error still persist..
ugh...
In response to Spunky_Girl
Spunky_Girl wrote:
I like to use "atom/a" in the Entered() argument; it's just habit o.O

Of course, all that doesn't matter, you can define the argument's type as whatever (or nothing) and it won't make a difference in execution. The problem is evidently deeper than just being in the Entered() code, and that's something pretty difficult to help with. Even code like this would, of course, work fine in a new/fresh environment:
sound/xyz
turf/the_spot
Entered(sound/xyz/A) //type matters thy not
if(ismob(A))
world << "A mob entered [src]!"
else world << "Something different entered [src]!"

...but something in his project apparently conflicts with that.

KeyWielder, you need to look in your project for code potentially screwing with Move() or the way that players move. Also, with Entered() code like above, try running a testing verb like this and see what it gives you:
mob/verb/Test_E()
var/T = locate(/turf/the_spot) //put the turf type
if(!T)
src << "\red No turf of that type found on the map!"
else
src << "Turf '[T.name]' found at [T.x],[T.y],[T.z]"
T.density = 0 //make sure you can move to it...
if(src.Move(T))
src << "Movement to the turf succeeded. Entered() should have ran and outputted the debug message."
else src << "For some reason, movement to the turf failed!"

Post the results of the above.
In response to Kaioken
Ok so this is odd.

But I decided just for the hell of it, to change the name of the turf, and to update the map, with the turf with the new names..

and well...

It worked.
ahaha.

No idea why...
but apparently you dont want to use "healingpad" as a turf name.
changed it to "khoorb"

and now everything works perfectly.
odd eh?
In response to KeyWielder000
KeyWielder000 wrote:
The only problem with that theory is this:

There's not exactly a problem with the theory here, mind; [at least most of] the code you've been given should work, under normal circumstances.

Is there any reason why the SafeZone would work..
yet.. The Healing pad wont?
It's odd that it seems to work for one..

Well, apparently you've screwed something to do with the movement system or moving in your project... (?) This of course might also be in an external source like a library, so if you're using any movement-related or dodgy ones etc, you'll want to check them too.
Also, note the difference that one thing makes use of an area and the other of a turf. I'm guessing it'd work if you used an area for both.

Perhaps it's because I'm using a .dmp instead of the .dmm?
maybe converting the map could somehow fix this problem?

No, a .DMP is just the older name for a .DMM. The file format is exactly the same, and Dream Maker supports both. The only reason it was changed from .DMP to .DMM is that .DMP

if so, how would I go about doing so?
I changed the map to a .dmm.

Just noting, converting a file from one format to another isn't normally a matter of just changing the extension. If you rename "myfile.wav" to "myfile.mp3", it's still the same Wave file, only not it looks like an MP3. It's a .WAV file in disguise, if you will.
In response to KeyWielder000
Looks like you had a different Entered() override buried somewhere in the code under /turf/healingpad, and it ran instead of the ones you've been trying to use. Changing the turf type to something different made that one not take effect anymore.
Or, you had a different conflict. :P