var/O
O=/obj/Ship
new/O(usr.loc)
O.y-1,O.x-1
Problem description:
I'm trying to make it so the ship is made using the O var, so I can edit its loc.
ID:170402
Jan 29 2005, 11:08 am
|
|
Code:
var/O Problem description: I'm trying to make it so the ship is made using the O var, so I can edit its loc. |
In response to Spire8989
|
|
Spire8989 wrote:
WickedlyAndy wrote: > > var/atom/movable/O Problem description: Or maybe that... |
O is a type path, when you used new you didn't set that new object to a variable. I'm guessing you want O to become the ship, so what you would do is "O=new O(usr.loc)." Now O is an object (the one you created) and you can treat it like one. If you want to access /obj/Ship variables, though, you'll have to type cast O.
var/obj/Ship/O
|
In response to Spire8989
|
|
Place_Ship() Ships.dm:57:error:obj:undefined var Ships.dm:57:error:Ship:undefined proc Ships.dm:58:error:/M:undefined type path Ships.dm:58:error:usr.loc:bad variable definition Ships.dm:58:error:new :invalid variable name: reserved word Ships.dm:57:M :warning: variable defined but not used Ships.dm:59:x :warning: variable defined but not used Ships.dm:60:y :warning: variable defined but not used Ships.dm:61:z :warning: variable defined but not used Please help if you see what I'm doing wrong >.< I really have no clue and Is prolly something simple knowing my brain. |
In response to WickedlyAndy
|
|
WickedlyAndy wrote:
Place_Ship() Well, the main mistake here is just a simple one: You're indenting a block of code too far. Don't indent underneath the var/obj/Ship/M line. There are a few other mistakes though worth looking at. Here's one:
if(usr.Ship==1)
Never never test a true/false value against 1 and 0 like that. It's much safer to use if(var) and if(!var) instead, so in this case you should use if(usr.Ship). I believe you also want to reset usr.Ship to 0 after placing a ship. Then there's objecet initialization. This doesn't work: M=obj/Ship() That's a nonsense line. It's going to give you an error. What you need is M=new. Since M already knows it's an /obj/Ship, you can just use new. There's also the matter of placement. This is vastly inefficient: M.x = src.x-1 What makes more sense is to place M when it's initialized, like so: var/obj/Ship/M = new(get_step(usr, SOUTHWEST)) Of course, you're not limited to southwest placement. You can always look around for water, or make the water turf src for this verb, in which case you'd use M=new(src). Lummox JR |
Try that, I'm not good at this stuff though...