Code:mob
icon = 'Universe X.dmi'
icon_state = "Mio"
Login()
usr.loc = locate(48,46,2)
..()
var
str = 1
hp = 50
def = 2
hun = 100
wak = 100
equipedaxe = 0
equipedshovel = 0
equipedhammer = 0
equipednsword = 0
equipedisword = 0
equipedgsword = 0
equipednknife = 0
equipedshirt = 0
Stat()
statpanel("Inventory")
stat(contents)
verb
say(msg as text)
oview() << "[usr]: [msg]"
ooc(msg as text)
world << "[usr]: [msg]"
go_to_sleep(msg as text)
usr << "You go to sleep..."
sleep(300)
usr.wak += rand(1,10)
turf
grass
icon = 'turf.dmi'
icon_state = "grass"
seawater
icon = 'turf.dmi'
icon_state = "seawater"
density = 1
landwater
icon = 'turf.dmi'
icon_state = "landwater"
density = 1
tree
icon = 'turf.dmi'
icon_state = "tree"
density = 1
opacity = 1
var
wood = /obj/wood
woodvalue = 10
proc
Deathcheck()
if (woodvalue <= 0)
oview() << "[usr]: Has chopped down tree!"
del(src)
verb
clientclick()
if (usr.equipedaxe >= 1)
oview() << "[usr]: Chops at tree!"
usr << "You chop at the tree!"
src.woodvalue -= usr.str
src += usr.contents
else if (usr.equipedaxe <=0)
usr << "You cant chop wood without an axe!"
ground
icon = 'turf.dmi'
icon_state = "ground"
cavewall
icon = 'turf.dmi'
icon_state = "cavewall"
density = 1
opacity = 1
cavefloor
icon = 'turf.dmi'
icon_state = "cavefloor"
obj
wood
icon = 'objects.dmi'
icon_state = "wood"
var
amount = 1
verb
get()
set src in view(1)
usr << "You grab some wood."
usr.contents += src
del(src)
hole
icon = 'turf.dmi'
icon_state = "hole"
axe
icon = 'tools.dmi'
icon_state = "axeunequiped"
overlay
icon = 'tools.dmi'
icon_state = "axeequiped"
var
amount = 1
verb
equip()
if (usr.equipedaxe <= 0)
overlays += /obj/axe/overlay
usr.equipedaxe += 1
usr << "You equip your axe."
else if (usr.equipedaxe >= 1)
usr << "You already have an axe equiped..."
unequip()
if (usr.equipedaxe >= 1)
overlays -= /obj/axe/overlay
usr.equipedaxe -= 1
usr << "You un-equip your axe."
else if (usr.equipedaxe <= 0)
usr << "You dont have a axe equiped..."
get()
set src in view(1)
usr << "You pick up a axe."
src += usr.contents
del(src)
shovel
icon = 'tools.dmi'
icon_state = "shovelunequiped"
overlay
icon = 'tools.dmi'
icon_state = "shovelequiped"
var
amount = 1
verb
equip()
if (usr.equipedshovel <= 0)
overlays += /obj/shovel/overlay
usr.equipedshovel += 1
usr << "you equip the shovel!"
else if (usr.equipedshovel >=1)
usr << "It appears you already have a shovel equiped..."
unequip()
if (usr.equipedshovel >= 1)
overlays -= /obj/shovel/overlay
usr.equipedshovel -= 1
usr << "You un-equip your shovel..."
else if (usr.equipedshovel <= 0)
usr << "It appears you dont have a shovel equiped..."
get()
set src in view(1)
usr << "You pick up a shovel!"
src += usr.contents
del(src)
redshirt
icon = 'Universe X.dmi'
icon_state = "redshirt"
overlay
icon = 'Universe X.dmi'
icon_state = "redshirt"
var
amount = 1
verb
wear()
if (usr.equipedshirt <= 0)
overlays += /obj/redshirt/overlay
usr.equipedshirt += 1
usr << "You put on the shirt."
else if (usr.equipedshirt >= 1)
usr << "You dont want to get to hot. You already have a shirt on..."
takeoff()
if (usr.equipedshirt >= 1)
overlays -= /obj/redshirt/overlay
usr.equipedshirt -= 1
usr << "you take off the shirt."
else if (usr.equipedshirt <= 0)
usr << "You seem not to be wearing one..."
get()
set src in view(1)
usr << "You pick up a shirt!"
src += usr.contents
drop()
set src in usr.loc
usr << "You drop the shirt..."
src -= usr.contents
world
turf = /turf/grass
Problem description:Eh alright. Well like the title says im kinda new to coding the programs. All the icons work fine but im troubled by the get and drop verbs here. To start i cant get() anything. It always comes up with a runtime error. Can someone tell me whats going wrong so I can fix it. Also any chance anyone knows how to make you start the game with things like a shirt and a axe?
ID:141431
Mar 10 2009, 5:07 am
|
|
In response to Ephemerality
|
|
m. sory didnt know.
mob there we go ^^ |
In response to TopPerception
|
|
For the runtime error, looks like the problem is here:
src.amount += usr.contents If you want to add the item to someone's inventory, you have to add it to their contents... so: usr.contents += src You also seem to be deleting the item once it's gotten, which probably isn't what you intended either. As far as giving them an item when they start, you'd just have to create the item and add it to their contents once they login... you can use the "new" proc for that, just check up on it in the DM Reference. |
In response to Ephemerality
|
|
ah! thank you very much. I think i tryed the code problem in the way you where saying but i was refrencing the src as /obj/whatever so thank you ^^. And yes, i will research the New proc.
|
Second, any additional info on the runtime error you're getting will help speed things up also.