ID:146920
 
obj/firearm/deagle
icon = 'firearms.dmi'
icon_state = "Desert Eagle"
verb
Get()
set src in oview(1)
usr.contents += src
usr << "You pick up [src]."

Drop()
set src in oview(1)
usr.contents -= src
usr << "You toss aside your [src]"

Equip()
if(usr.RightHand == 1)
usr << "Your already holding something."
else
usr.ratk += src.Firepower
src.verbs += typesof(/mob/firearm/verb/Shoot)

obj
Muffin/// Makes the bullet that is shot
icon='projectiles.dmi'/// Uses its icon
icon_state="muffin"
density=1/// Makes it unable to go through
Bump(mob/M)/// if it hits someone, it kills them
if(istype(M,/mob))/// Makes sure that what it hits is a mob
del(src)/// Deletes them

mob
proc
projectile(obj/projectile,var/dir,var/delay)/// Proc that shoots it
walk(projectile,dir)/// Makes the bullet go in your direction
sleep(delay)/// delays it slightly
del(projectile)/// deletes the bullet when its stopped



mob/firearm
verb
Shoot()/// The shoot verb
usr.projectile(new/obj/Muffin(usr.loc),usr.dir,40)


eh...

what i'm wanting for this to do is that when you equip the deagle, you get the shoot verb, but nothing happens, i dont even get any errors.

Thx in advance for any and all help...
it should be usr.verbs, what your telling it is to give the gun the verb
Well, for one, you may want to make that verb part of "firearm," that that all of your objects inherit it. Then, you can add and subtract the shoot verb based on whether or not the firearm is equipped. Quite honestly, even though some may say its bad design, I'd make Shoot() a proc, and add it to the firearm's verbs list when Equip() is successful (src.verbs += obj/firearm/proc/Shoot), and remove it when the firearm is unequipped.
In response to Igmolicious
obj/firearm/deagle
icon = 'firearms.dmi'
icon_state = "Desert Eagle"
verb
Get()
set src in oview(1)
usr.contents += src
usr << "You pick up [src]."

Drop()
set src in oview(1)
usr.contents -= src
usr << "You toss aside your [src]"

Equip()
if(usr.RightHand == 1)
usr << "Your already holding something."
else
usr.ratk += src.Firepower
src.verbs += obj/firearm/proc/Shoot


mob/firearm/proc
Shoot()/// The shoot verb
usr.projectile(new/obj/Muffin(usr.loc),usr.dir,40)


eh...is this what you were saying? forgive me if i misunderstood
In response to Zero's Baby
eh, i dont think so...
In response to Pakbaum
Yep, except that the Shoot proc down at the bottom should be under obj/firearm/proc :)
In response to Igmolicious
obj/firearm/deagle
icon = 'firearms.dmi'
icon_state = "Desert Eagle"
verb
Get()
set src in oview(1)
usr.contents += src
usr << "You pick up [src]."

Drop()
set src in oview(1)
usr.contents -= src
usr << "You toss aside your [src]"

Equip()
if(usr.RightHand == 1)
usr << "Your already holding something."
else
usr.ratk += src.Firepower
src.verbs += obj/firearm/proc/Shoot

obj/firearm/proc
Shoot()/// The shoot verb
usr.projectile(new/obj/Muffin(usr.loc),usr.dir,40)


ok, this is what i have now, is this right? and if it is... it's giving me these errors

loading Nightwatch.dme
objects.dm:391:error:obj:undefined var
objects.dm:391:error:firearm:undefined var
objects.dm:391:error:proc:undefined var
objects.dm:391:error:Shoot:undefined var


In response to Pakbaum
Heh. Sorry. Forgot. You need to have:

/obj/firearm/proc/Shoot

The first slash is required.
In response to Igmolicious
obj
Bullet/// Makes the bullet that is shot
icon='projectiles.dmi'/// Uses its icon
icon_state="bullet"
density=1/// Makes it unable to go through
Bump(mob/M)/// if it hits someone, it kills them
if(istype(M,/mob))/// Makes sure that what it hits is a mob
M.HP -= 10
del(src)
DeathProc(M)

mob
proc
projectile(obj/projectile,var/dir,var/delay)/// Proc that shoots it
walk(projectile,dir)/// Makes the bullet go in your direction
sleep(delay)/// delays it slightly
del(projectile)/// deletes the bullet when its stopped



obj/firearm/proc
Shoot()/// The shoot verb
usr.projectile(new/obj/Bullet(usr.loc),usr.dir,40)
usr.Bullets -= 1


How come it says

projectiles.dm:10:error:DeathProc:undefined proc

?
In response to Pakbaum
Pakbaum wrote:
How come it says

projectiles.dm:10:error:DeathProc:undefined proc

?

From what I've seen so far, if your calling a proc from an obj, you'd have to do obj/proc, but i'm not sure since "I r Newbl@r"
In response to Pakbaum
Do you have a proc named DeathProc?
In response to Lenox
do what?
In response to Pakbaum
Do you have a death proc named DeathProc?
In response to Hell Ramen
I was asking lenox

And yes, DeathProc()
In response to Pakbaum
Show us how you defined it.
In response to Hell Ramen
mob/proc/DeathProc(mob/defender)
if(defender.HP <= 0)
if(defender.client)
defender << "You were killed!"
defender.HP = defender.MaxHP
defender.MP = defender.MaxMP
defender.loc = locate(3,3,1)
else
src << "You killed [defender]!"
givingexpnum = 10
for(var/mob/T in oview())
if(T.guild == src.guild)
givingexpnum += 1
src.guildexp = src.expgiven
for(var/mob/U in oview())
if(U.guild == src.guild)
U << "You gain [round(guildexp/givingexpnum)] experience!"
U.exp += round(guildexp/givingexpnum)
src << "You gain [round(guildexp/givingexpnum)] experience!"
src.exp += round(guildexp/givingexpnum)
del(defender)
In response to Pakbaum
You need to give the bullet an owner. Then do owner.DeathCheck(M) I think.
In response to Hell Ramen
how would i give it an owner?
In response to Pakbaum
I've always had to make a proc like this for objs.

obj/proc/WTF()
WTF()
return


and I believe he's suggesting to do like (Example: usr.WTF() where usr is the user who executed the verb.)