ID:175219
 
Ok I cooked up more coding, trying to figure out how to make this whole bullet thing...all I'm asking now is if someone would tell me if this would work. Before I change around most of my game only to find out it dosnt.

obj/shoot
verb
Shoot(mob/PC/M,mob/MM in world)
if(M.rightarm == "Pistol")
var/obj/shot/Dual_Pistol/Pistol = new(M.loc)
walk(Pistol,M.dir)
for(MM in view(1))
MM.health -= 10
M.points += 10
M <<"IT WORKS!!!!"


Thank you for your time.
Not very well, but you are somewhat on the right track. Here's a better way to use bullets:
obj
bullet //All types of bullets go here.
var/speed = 0
var/damage = 0
var/mob/owner
Move(newLoc)
for(var/mob/M in newLoc)
M.hurt(damage,ownder)
del(src)
..()
New(var/turf/L, var/d, var/mob/M)
..()
loc = L
dir = d
owner = M
walk(src,dir,10-speed)
Pistol
speed = 9
damage = 2
Rocket
speed = 2
damage = 10
obj
gun //All types of guns go here
var/ammotype
proc
Shoot(var/mob/M)
new ammotype(M.loc,M.dir,M)
onehanded
verb
Draw()
if(!usr.lefthand)
usr.lefthand = src
usr << "You hold the [src] in your left hand"
else if(!usr.righthand && usr.lefthand != src)
usr.righthand = src
usr << "You hold the [src] in your right hand"
Pistol
ammotype = /obj/bullet/Pistol
twohanded
verb
Draw()
if(!usr.lefthand && !usr.righthand)
usr.lefthand = src
usr.righthand = src
usr << "You hold the [src] in both hands"
Rocket_Launcher
ammotype = /obj/bullet/Rocket

mob
var/health = 25
var/obj/gun/lefthand = null
var/obj/gun/righthand = null //So you can use pistols akimbo
proc
hurt(var/damage, var/mob/hurter)
health -= damage
if(health <= 0)
world << "<FONT COLOR=RED>[src] was killed by [hurter]!</FONT>"
del(src)
verb
Shoot()
if(lefthand)
lefthand.Shoot(src)
if(righthand && righthand != righthand)
righthand.Shoot(src)


Wow, that's a lot more than I expected. It's pretty much a full-fledged gun system. I suggest you look through it, though, because there are some things you probably wouldn't want, and some things I didn't include, such as firing delay. You can fix the firing delay, however, by setting a variable on a gun to 0 when Shoot() is called, preventing it from shooting again until after a certain delay, like how you delay movement.
In response to Garthor
Ok what you gave me makes perfect sense, and after I adapted it to my game I recive some errors with the hurt proc

mob 
proc
hurt(var/damage, var/mob/hurter)
health -= damage
if(health <= 0)
world << "<FONT COLOR=RED>[src] was killed by [hurter]!</FONT>"
del(src)


The errors are:

NewWeaponsSystem.dm:98:error:-= :invalid proc definition
NewWeaponsSystem.dm:99:error:if :invalid proc definition
NewWeaponsSystem.dm:100:error::invalid proc definition

Everything else should work perfectly...I didn't try it out in runtime yet.

Thank you.
In response to SSChicken
You forgot to indent everything after hurt(...).
In response to Garthor
Right...sorry that was a stupid mistake, I posted too quickly. I would also like to add each weapon doing a different amount of damage to my game. I did this but It just dosn't add the 10 to usr.damage

obj/proc/adddamage()
if(usr.righthand == "Pistol")
usr.damage = 10
usr<<"All Mighty Chicken!!"
obj
weapon
var/ammotype
proc
Shoot(var/mob/M)
new ammotype(M.loc,M.dir,M)
onehanded
verb
Equip()
if(!usr.righthand)
usr.righthand = src
usr << "You hold the [src] in your right hand 1st worked"
adddamage()
//There is more here



There are no errors, its just that usr.damage dosn't become 10 when usr equips a pistol. I appreaciate all help given ^_^


In response to SSChicken
First of all, you shouldn't be using usr in procs, even if they are only called by verbs. Second, why have a variable belonging to the usr that determines damage when you can just use the damage based on the bullet object, like I showed?
In response to Garthor
Because I want many guns to use the same bullet but each gun to do a different amount of damage. EX: Both Pistol and MP use 9mm bullets but MP does more damage.
In response to SSChicken
Each gun has it's own bullet PROJECTILE. Different guns, however, can use the same ammo.
In response to Garthor
But my goal is for some guns to use the same bullets yet do different ammount of damage.
In response to SSChicken
Like I said, each gun has it's own PROJECTILE. AMMUNITION is completely different.