ID:168770
 
obj
normal
gun
verb
Equip()
if(usr.weapon)
usr << "You are already armed."
else
usr.weapon = "[src]"
usr.verbs += /mob/player/normal/gun/Click
Unequip()
usr.weapon = null
usr.verbs -= /mob/player/normal/gun/Click
mob
player
normal
gun
Click(mob/M)
switch(usr:weapon)
if("Pistol")
sleep(6)
var/obj/munition/Bullet/B = new /obj/munition/Bullet(src.loc)
walk(B,usr.dir)


I need to know how to convert my code so the Click proc does not show up in the verb panel and the bullet shooting system causes the shot to trace the path to the target. I know what I have here is not even close...
What are you doing Click(mob/M) for if you planned on using usr later on anyway? Instead, replace all the usrs with M and do M.weapon instead of M:weapon.

Bobthehobo wrote:
I need to know how to convert my code so the Click proc does not show up in the verb panel and the bullet shooting system causes the shot to trace the path to the target. I know what I have here is not even close...

What do you mean by not make it show up in the verb panel?
In response to DeathAwaitsU
Um, usr is safe in Click(). Unless you've done some serious screwing with client/Click().

usr.weapon should be set to the gun that is equipped, not the name of the gun.
In response to Jp
Jp wrote:
Um, usr is safe in Click(). Unless you've done some serious screwing with client/Click().

Right you are. I forgot he was within Click().
In response to DeathAwaitsU
DeathAwaitsU wrote:
What are you doing Click(mob/M) for if you planned on using usr later on anyway? Instead, replace all the usrs with M and do M.weapon instead of M:weapon.

Bobthehobo wrote:
I need to know how to convert my code so the Click proc does not show up in the verb panel and the bullet shooting system causes the shot to trace the path to the target. I know what I have here is not even close...

What do you mean by not make it show up in the verb panel?
set category=null

?
Ignore them they're confused :D

Click() is a proc, not a verb, so don't add it to usr's verbs :)
else
usr.weapon = "[src]"
usr.verbs += /mob/player/normal/gun/Click //take that line out

Unequip()
usr.weapon = null
usr.verbs -= /mob/player/normal/gun/Click //and that

They're unneeded. You have everything else you need here:

mob
player
normal
gun
Click(mob/M)
switch(usr:weapon)
if("Pistol")
sleep(6)
var/obj/munition/Bullet/B = new /obj/munition/Bullet(src.loc)
walk(B,usr.dir)

When you click it, it'll use switch() to check your weapon. If its a Pistol, it'll use that weapon. If you have a differant weapon or no weapon, it won't do anything.
Just take out those two lines and I think it should work :D
Jp is right that the weapon var should not be set to a text value, but rather to the object itself serving as a weapon.

You should also get rid of the mob/M in Click() since you don't need it, and I strongly recommend you do some type casting inside if you want to use the weapon var. usr:weapon is abuse of the : operator. Either give the weapon var to all mobs, or type cast usr to a more specific type than /mob, or give all mobs a Fire() proc which will do this part for you.

Lummox JR