Hello. I'm having some problems.
turf
LoseLife
density = 0
Enter(mob/M)
M.loc=locate(1,4,1)
usr.Life -= 1
usr.die()
When i fall down onto the above turf. it doesn't move me to the location as shown. instead i have to move east or west into it manualy for the thing to go into effect.
What i want to happen is that for when falling down i want it to instantly move the character to the stated location.
note: like in the megaman games. if u fall on spikes u move to another location.
please help some1
P.S. I'm not making a MegaMan Game, lol
ID:171714
![]() Aug 18 2004, 7:55 pm
|
|
![]() Aug 19 2004, 6:17 am
|
|
Erm, try Bump().
|
If you're using Bump, make the turf a mob, ...
mob/LoseLife Bump(M as mob) and so on... There's better ways of doing this but for a quick fix that'll do it. |
The Conjuror wrote:
If you're using Bump, make the turf a mob, ... Now I Get mob LoseLife Bump(M as mob) M.loc=locate(1,4,1) usr.Life -= 1 usr.die() and that gives a error:M.loc:undefined var |
Im sorry, to fix that just use src.loc...etc, but you've made me realize something I never knew, this entire time I thought that Bump() only reffered to mobs, especially when you define it as mob/Bump(m as mob), but now I know it doesn't because I quickely wrote the lines..
mob/Bump(m as mob) src.loc = locate(1,1,1) in a new enviro file and found that when I ran not only into a mob I created but also turfs I would be teleported back to 1,1,1.... I can't believe with all these years I never knew that. Sorry for the confusion, but thanks for making me realize this. |
for some reason it isn't working I have this
mob/LoseLife/Bump(M as mob) src.loc = locate(1,4,1) usr.Life -= 1 usr.die() And when I fall from a ledge in the game i'm working on, nothing happens. I don't know what is wong. Can some1 post what type of coding like is done in like the sidescroller games that makes this happem. I'm stuck. |
As I said, this will solve your problem but make other problems possibly.
mob/Bump(M as mob) src.loc = locate(whatever) etc just, mob/Bump, leave it at that and it should work but it may cause other problems. |
The Conjuror wrote:
As I said, this will solve your problem but make other problems possibly. That just makes it worse. That makes it to where when I bump into anything it moves me to the location. I'm making it to where when the user falls down onto it because of a gravity proc. then it moves the player to the location. |
Hell Ramen wrote:
> obj Should work. sorry Hell Ramen That doesn't work right. |
ElderKain wrote:
Hello. I'm having some problems. turf LoseLife density = 0 Entered(mob/M) if(ismob(M)) M.loc=locate(1,4,1) M.Life -= 1 M.die() |
ElderKain wrote:
When i fall down onto the above turf. it doesn't move me to the location as shown. instead i have to move east or west into it manualy for the thing to go into effect. This makes me think the problem is in your gravity proc, it seems like you are setting loc directly instead of using Move() to make them go south. Changing it that way could cause some adverse effects though, namely, if you ever lock movement for mobs some could be stuck in the air. So you can either use Move() in gravity and not lock movement (or not worry about people getting locked in air), or you can add a bit to the gravity proc to check if the players new location is of type /turf/LoseLife. |
Yeah, that would probably be it. You should use Move() as opposed to setting loc directly whenever possible.
Even better for gravity would be step(): step(src, SOUTH) |
This is the Gravity Proc I'm using
proc Note:It also requires a client addon also, mabue something needs done to it also client mabye some1 could show this Gravity proc addon thing, lol i'm kinda not that good at understanding coding, lol i'm sill adjusting to some terms in coding. |
There are some problems here. First things first, there is no difference between what you do for players facing east and players facing west, so use the logical or (||) operator.
proc Now we can take another chunk out of this using step() as Crispy suggested. =) proc This may look a bit confusing to you so allow me to explain. step(M,SOUTH) will return 1 if M is able to move south, and 0 otherwise. It will also move the player if it can, even when called from inside an if statement. You may also notice I changed the sleep() to a spawn(), that's because you are calling the Gravity proc from withing itself. If you use sleep() the Gravity proc won't continue until the Gravity proc returns, but the Gravity proc won't return because it, too, will be waiting for the Gravity proc to return. Do you get what I'm saying here? The Gravity proc will never return and it will keep calling more (which is what we call stacking) quickly crashing your game in the proccess. What spawn() does is call the Gravity proc again, but allow the first one to finish without waiting for a return value. =) Hope this helps. =) |
the thing with this
proc is that when jumping u can't change directions. the way it was, there was smooth turning. the user wouldn't thave to take an extra turn just to get it to go the opposite direction. but still this doesn't answer my first questiong of all. How can i get it to where when the user falls south due to the Gravity Proc, and when fallin' on cirtain area, it will move the user to the epecified location. There have been many attempts to help. but none have actualy worked right. |