ID:176394
 
1st:When I try to run this code with the game, I get multiple errors and it's really starting to drive me nuts. I know I messed up on the Usr thing, but I'm too lazy to go and check it right now. :P

turf
halfpipe
ladder
icon = 'halfpipe.dmi'
icon_state = "ladder"
if(usr.skating = 1)
density = 1
usr << "You can't climb a ladder while skating!"
else
density = 0
2nd:My game is a skateboarding game, right? Well in it, I have ramps that you can launch off of and do tricks. Problem is, I can't figure out how to do this.

Here's what I need help with:
Ramps that are dense from 3 sides
The one side that isn't dense should move the person like this:
______
/ \
/ \
/ \
P R \

P= Person
R = Ramp
/_= Direction of Travel/Movement


Hope I explained clearly enough! If not, just ask and I'll fix it.
{EDIT} Okay, the code didn't space out as it should have, and \ should be at the end of the _'s. Lol. I'm confusing. ^_^
Tiko587 wrote:
1st:When I try to run this code with the game, I get multiple errors and it's really starting to drive me nuts. I know I messed up on the Usr thing, but I'm too lazy to go and check it right now. :P
turf
halfpipe
ladder
icon = 'halfpipe.dmi'
icon_state = "ladder"
if(usr.skating = 1)
density = 1
usr << "You can't climb a ladder while


turf
halfpipe
ladder
icon = 'halfpipe.dmi'
icon_state = "ladder"
Enter(F)
if(F.skating == 1)
F << "You can't climb a ladder while Skating"
return 0
else
return ..()

I think that should work... This will check whether the player is skater when they try to enter it, if F.skating==1, it tells them they cant and doesnt allow them to enter and makes it like the density is 1, if it isnt 1 it allows them to enter as if its density was 0
In response to Nick231
One problem Nick: When I compile the game, I get this error:
Turfs.dm:220:error:F.skating:undefined var

Thanks anyway, Nick! Now, if someone could fix me up with the second question (and help with the error on the first!), the game should be ready for Beta!
In response to Tiko587
Mob
Skater
var
skating

That is what you need to do to define a variable, you should type this in yourself using tabs.
Also you should change skater to whatever your players mob is.
Tiko587 wrote:
1st:When I try to run this code with the game, I get multiple errors and it's really starting to drive me nuts. I know I messed up on the Usr thing, but I'm too lazy to go and check it right now. :P

turf
halfpipe
ladder
icon = 'halfpipe.dmi'
icon_state = "ladder"
if(usr.skating = 1)
density = 1
usr << "You can't climb a ladder while skating!"
else
density = 0

turf/halfpipe
icon = 'halfpipe.dmi'
icon_state = "ladder"
if(usr.skating = 1)
density = 1
usr << "You can't climb a ladder while skating!"
else
density = 0

That should solve all the errors. You main problem was indentation.

~Cable
In response to Cable
Cable wrote:
Tiko587 wrote:
1st:When I try to run this code with the game, I get multiple errors and it's really starting to drive me nuts. I know I messed up on the Usr thing, but I'm too lazy to go and check it right now. :P

turf
halfpipe
ladder
icon = 'halfpipe.dmi'
icon_state = "ladder"
if(usr.skating = 1)
density = 1
usr << "You can't climb a ladder while skating!"
else
density = 0

turf/halfpipe
icon = 'halfpipe.dmi'
icon_state = "ladder"
if(usr.skating = 1)
density = 1
usr << "You can't climb a ladder while skating!"
else
density = 0

That should solve all the errors. You main problem was indentation.

That, and not putting the code in a proc. Duh!

An if() statement just floating around in the middle of the turf definition is gonna do diddly squat. Also, fiddling around with density is wrong when Enter() is clearly what you'd want to use.

And in Enter(), don't use usr.

Lummox JR
In response to Lummox JR
Okay, cool. Now all I need is someone to help me with the Ramp code. Anyone. Thank you!!!

~~~Tiko587~~~
In response to Lummox JR
Lummox JR wrote:

That, and not putting the code in a proc. Duh!

An if() statement just floating around in the middle of the turf definition is gonna do diddly squat. Also, fiddling around with density is wrong when Enter() is clearly what you'd want to use.

And in Enter(), don't use usr.

Lummox JR

Gimme a break, i'm new :-P

~Cable
In response to Tiko587
what you could do for only entering from one side is to do this sort of thing.

turf/halfpipe
Enter(mob/M)
if(M.dir == NORTH)
..()
else
return

I'm not exactly sure if that will work, but i bilieve it will. Change the dir to anyway that the mob is coming from to jump.
In response to Tazor07
Tazor07 wrote:
what you could do for only entering from one side is to do this sort of thing.

turf/halfpipe
Enter(mob/M)
if(M.dir == NORTH)
..()
else
return

I'm not exactly sure if that will work, but i bilieve it will. Change the dir to anyway that the mob is coming from to jump.

It won't work, because calling ..() doesn't necessarily return its value, which you need to do. That should be .=..() or return ..() instead.

Lummox JR