ID:148385
 
Im trying to make it for when you 'build' the castle its owner var becomes the 'usr' but it wont work, Can any one help me with this?, heres my code;

obj/castle2
var/owner=""
icon='Player.dmi'
icon_state="castle"
density=1
Click()
usr<<"Loading menu..."
sleep(10)
if(src.owner == usr)
usr<<"your the owner"
else
usr<<"blah"

obj/castle
icon='Player.dmi'
icon_state="castle"
DblClick()
if(usr.selected==1)
var/choice = input("What Would you like to do?") in list("un_select","Build","none")
if(choice=="Build")
usr.selected=0
usr.locked=1
suffix=null
new/obj/castle2(usr.loc)
for(var/obj/castle/o in usr)
del(o)
sleep(10)
usr.locked=0
for(var/obj/castle2/P in view(0))
P.owner=usr

if(choice=="un_select")
usr.selected=0
suffix=null

else
if(usr.selected==0)
var/c = input ("What would you like to do?") in list ("select","none")
if(c=="select")
usr.selected=1
suffix="selected"


-Thanks, Wanabe
Not a good way to do it. Just create the castle like this:

var/obj/castely2/P = new(usr.loc)

Then, P is the castle, and you can do whatever you want with it.
In response to Garthor (#1)
Garthor wrote:
Not a good way to do it. Just create the castle like this:

var/obj/castely2/P = new(usr.loc)

Then, P is the castle, and you can do whatever you want with it.

Ok thanks i'll try it...

[edit]
Yes, thank you Garthor :-), and i know that is an unstable way to do it, but i neaver new you could just do it like how you shown. Thanks!
[/edit]