/obj/Grindingweel
name="Grinding Wheel"
icon = 'objects.dmi'
icon_state = "grinder"
verb/Sharpon()
if((locate(/obj/dragonsword/) in usr.contents))
src.damage += 4
Problem description:
ID:139096
![]() Jul 1 2011, 9:14 am
|
|
Code:
/obj/Grindingweel Problem description: |
![]() Jul 1 2011, 9:15 am
|
|
Error is i can define objects verable even though i already did help
|
Well in this case, the "src" is your obj, the weapon, and you're trying to add a total of damage 4 to this object, since the usr is the one "clicking" the verb, adding damage of 4 to the usr should help. Also, /obj/Grindingweeel is a path, this isn't actually defining the obj, grindingweel,
obj/Grindingweel name="Grinding Wheel" icon = 'objects.dmi' icon_state = "grinder" verb/Sharpon() if((locate(/obj/dragonsword/) in usr.contents)) usr.damage += 4 should do it but I'm not quite sure what vars you're having trouble declining, if you could post the actual errors it would be quite helpful. |
Define damage. I imagine you're trying to increase how much damage the sword deals, so add to that variable. If that variable isn't defined, define it.
http://www.byond.com/developer/articles/start If you don't understand the concept of properly defining objects and variables, you should probably read a few tutorials before trying to make a game. |
A mob variable doesn't apply to objects, it only applies to mobs. If you define mob/var/damage, only mobs will have a damage variable. If you define obj/var/damage, only objects will have it.
If you want everything to have access to a variable, simply define var/damage. The same holds true further down the line, defining mob/player/var/damage will only give mob/player the damage variable, while defining mob/monster/var/damage would only give it to monsters. This becomes useful to know when you start working on projects that involve a lot of different variables/procedures. For example, if you only want the player to be able to pick up certain types of objects, you could define: obj/item/verb/Get() This would cause only objects of the obj/item variety to have the Get verb, meaning you can't pick up trees or projectiles(provided you define them under another type). It also means you only have to define the verb once, so you could do this: obj/item/verb/Get() obj/item/var/weight obj/item apple orange potion sword obj/landscape tree rock And the apple, orange, potion and sword objects would have the Get() verb and the weight variable, but tree and rock wouldn't. I still suggest reading at least ZBT, as it explains a lot of the basics of programming with BYOND and would help you understand what is going on better than my explanations would. |