ID:270113
 
How would I make it so if you have a certain key in your invintory, you warp to a certain place?

obj/Key
var
GX
GY
GZ
BlueKey
GX = 5
GY = 9
GZ = 2
RedKey
GX = 19
GY = 22
GZ = 3
mob
verb
Use()
var/k = /obj/Key/ in usr.contents
var/gotoplace = input("Where to?") in list(k in usr.contents)
switch(gotoplace)
if(k)
usr.Move(locate(k.GX,k.GY,k.GZ))
I Really couldn't understand what u was trying to make the keys do, but if you was trying to make them teleport to different maps, try this maybe?
obj/Key
BlueKey
verb
Use()
set category = null
usr.Move(locate(5,9,2))
RedKey
verb
Use()
set category = null
usr.Move(locate(19,22,3))


The 'set category = null' is just really so it doesnt appear in the defualt Commands or something.
In response to Evidence
You can't set the category to null, because then it won't appear anywhere. You won't be able to use it. Just leave it blank so it appear in commands as the default. Also, you can do this to warp them.

usr.loc = locate(x,y,z) //set the locs of x, y , z
Dead_Demon wrote:
How would I make it so if you have a certain key in your invintory, you warp to a certain place?

> obj/Key
> var
> GX
> GY
> GZ
> BlueKey
> GX = 5
> GY = 9
> GZ = 2
> RedKey
> GX = 19
> GY = 22
> GZ = 3
> mob
> verb
> Use()
> var/k = /obj/Key/ in usr.contents
> var/gotoplace = input("Where to?") in list(k in usr.contents)
> switch(gotoplace)
> if(k)
> usr.Move(locate(k.GX,k.GY,k.GZ))
>



obj/Key
var
GX
GY
GZ
BlueKey
GX = 5
GY = 9
GZ = 2
RedKey
GX = 19
GY = 22
GZ = 3
mob
verb
Use()
var/list/keys=list()
for(var/obj/Key/K in src.contents)
keys+=K
var/obj/Key/gotoplace = input("Where to?") in keys
if(gotoplace)
usr.Move(locate(gotoplace.GX,gotoplace.GY,gotoplace.GZ))


I think that should work.
In response to Pyro_dragons
you right click the key to use the verb..
In response to Evidence
I was makin keys like in DWM2.