Does anyone know how to make it so when i pick up something (like a gun) i can see the icon in the inventory (p.s my gun doesnt even go in the inventory period).
Also when i click Equip it ats like Equip is the shoot verb itself.
obj
Hand_Gun
icon = 'Weapons.dmi'
icon_state = "1"
speed = 3
damage = 100
verb //Attaching the verb to the object prevents one from getting the verb before getting it.
Get()
set category = "Combat"
set src in oview(0)
if(Move(usr)) //If they pick it up...
usr << "You picked up a [src]."
Equip()
set category = "Combat"
set src in usr
usr.verbs += Shoot()
usr << "You now have a Hand_Gun equiped"
if(usr.gun == null) //Make sure he doesnt have a gun already equipped.
usr.gun = src
return
Unequip()
set category = "Combat"
if(usr.gun == src) //If hes got this gun equipped.
usr.gun = null //Unequip it.
return
Discription2()
set category = "Combat"
set name = "Discription"
usr << "A gun thats cool.[src.dis]"
Drop()
set category = "Combat"
set src in usr
if(src.equip == 1)
usr << "You cannot drop something that is equiped"
else
src.loc = usr.loc
usr << "You dropped [src]!"
proc/Shoot()
usr.projectile(new/obj/bullet(usr.loc),usr.dir,10)
mob
proc
projectile(obj/projectile,var/dir,var/delay) //The proc that makes the bullets work.
sleep(1)
walk(projectile,dir)
sleep(delay)
del(projectile)
obj
bullet //The bullet itself.
icon = 'weapons.dmi'
icon_state = "bullets"
density = 1
Bump(mob/M)
M.hp -= 50
del(src)
mob/var/gun=null
ID:173854
Nov 7 2003, 4:14 pm
|
|
Nov 7 2003, 4:54 pm
|
|
Well, you'll have to put SOMETHING in your inventory to have anything show up. No one can really help more without knowing how you have your inventory system set up.
|
In response to Jon88
|
|
Jon88 wrote:
Well, you'll have to put SOMETHING in your inventory to have anything show up. No one can really help more without knowing how you have your inventory system set up. mob Stat() statpanel("Stat") stat("",".:Fighting Stats:.") stat("Health:","[hp]") stat("Strength:","[str]") Update() stat("Defense:","[def]") stat("",".:Equipment Stats:.") stat("Armor:","[armor]") stat("",".:Combat Stats:.") stat("-Kills:","[kills]") stat("-Deaths:","[deaths]") statpanel("Inventory") Lol, now was that really nessecary? |
In response to Pagemaster
|
|
This should work
statpanel("Inventory") stat(src.contents) obj item icon = '' icon_state = "" verb Get() set src in oview(1) usr << "You picked up the [src.name]!" usr.contents += src That's just about it. |
Bump(mob/M)
M.hp -= 50 del(src) That will spam you with errors if the bullet hit anything that isn't a mob. |
In response to Garthor
|
|
Garthor wrote:
Bump(mob/M) Yea, you're right i forgot to bring that up. When hit a mob or something else it says runtime error: wrong type of value for list proc name: Equip (/obj/Hand_Gun/verb/Equip) usr: Pagemaster (/mob/char/Bill) src: Hand Gun (/obj/Hand_Gun) call stack: Hand Gun (/obj/Hand_Gun): Equip() <font color = red>Which is the same thing.</font color = red> By the way when i click "Equip" it shoots and thats wierd.So' i have no shoot verb when i click equip, but the gun is in my inventory, which is a step closer to finishing my problems'. |
In response to Codesterz
|
|
Codesterz wrote:
This should work Thanks, I found out my problem was forgeting to add the "stat(src.contents)", which then would have lead to "usr.contents += src". |
In response to Pagemaster
|
|
yep.....(i can only read the byond guides so little at a time)
|
In response to Pagemaster
|
|
Please dont tell me. I have to make another post cause i hate bumping posts.
|
Pagemaster wrote:
usr.verbs += Shoot() Here's the problem. That line is actually calling Shoot(), and then attempting to add the return value of Shoot() to usr.verbs. As Shoot() isn't returning anything, it returns null by default. The verbs list is a special list, which can only hold verbs, and null is not a verb; hence the runtime error. Now, you're trying to add Shoot() to the list of verbs. However, Shoot() is a global proc - what's with that? It should really be a proc belonging to some kind of object; it makes sense to use /obj/Hand_Gun (seeing as it's going to be used for the handgun) so that's what we'll do. (Changes below in bold.) <code>obj/Hand_Gun/proc/Shoot() usr.projectile(new/obj/bullet(usr.loc),usr.dir,10)</ code> Now that your proc is in the right place, you still need to fix your reference to the Shoot() verb. Firstly, no parentheses at the end, because then it thinks it's supposed to call the verb. Secondly, it needs the full type path to the verb (which in this case is /obj/Hand_Gun/proc/Shoot). Thirdly, it makes more sense to add it to the obj's verbs rather than the player's, because it's possible the player may have more than one gun. (And even if they don't, it doesn't hurt.) <code>src.verbs += /obj/Hand_Gun/proc/Shoot</code> Finally, you might want to remove the verb when they unequip the gun, so put this line just before "return" in Unequip(): <code>src.verbs -= /obj/Hand_Gun/proc/Shoot</code> |
In response to Pagemaster
|
|
No, that was the error Crispy told you to fix. The error I pointed out is that if it bumps into something that isn't a mob, it will try to access it's hp var, which it doens't have, because it's not a mob, so it will crash, and then bump into it again.
|