In response to Malver
Oops, I know, I know, I meant to put a if(istype(P,obj/phaserbeam)), but I forget stuff.
In response to Garthor
Garthor wrote:
turf
Water
Enter(O)
if(O.CanCrossWater) return 1
else return 0

See? If you used the method I followed, then that would be reduced to only 1 line of code. :P
In response to Garthor
Garthor wrote:
Oops, I know, I know, I meant to put a if(istype(P,obj/phaserbeam)), but I forget stuff.

Actually, you're the one who told him to get rid of it.

Garther wrote:
The...


if(!istype(P, /obj/phaserbeam))
return ..()

shouldn't be there,

:P
In response to Malver
Ahh nevermind. I was tired.
In response to Malver
Malver wrote:
Treasurecat wrote:
now the prblem is that the del command is deleting my phaserbeam befor it gets a chance to hit anyone how can I fix this? the code seems to also negate the walk command making the phaserbeam just sit there. I dont know what part of the code does this.

The code for a moving projectile (and deleting it upon striking a mob) is all in the demo that I supplied you with. Just look through it, or even just copy the firing portion of it. It may take a few moments to clearly identify what's what, but I think you're smart enough to figure it out. :)

your demo has help me to understand some of this however I looked through it today and I dont understand why this doesnt work.

obj
phaser
icon = 'phaser.dmi'
icon_state = "phaser"
verb/fire_phaser()
var/obj/phaserbeam/P = new(locate(usr.x,usr.y,usr.z))

walk(P,usr.dir,1)


turf/Enter(obj/phaserbeam/P)
if(!istype(P,/obj/phaserbeam))
for(var/mob/romulan/M in src)
if(istype(M,/mob/romulan)

M.hp -= 5
del(P)
return FALSE

return ..()

not only will this not work but im getting an error on M.hp it says its missing a comma or right paren
I dont know why the compiler doesnot like that line
please let me know if im overlooking something
thanks
In response to Treasurecat
There needs to be another ) after if(istype(M,/mob/romulan)
In response to Garthor
obj
phaser
icon = 'phaser.dmi'
icon_state = "phaser"
verb/fire_phaser()
var/obj/phaserbeam/P = new(locate(usr.x,usr.y,usr.z))
walk(P,usr.dir,1)
obj
phaserbeam
icon = 'blah.dmi'
Bump(atom/A)
if(ismob(A))
var/mob/romulan/M = A
M.Health -= 100
else return

Eh...ten second coding.
In response to Thief Jack
ok first of all thanks for your help. I understand there are a bunch of ways to do this I would be happy with just one that works.

obj
phaser
icon = 'phaser.dmi'
icon_state = "phaser"
verb/fire_phaser()
var/obj/phaserbeam/P = new(locate(usr.x,usr.y,usr.z))

walk(P,usr.dir,1)


phaserbeam
icon = 'person.dmi'
icon_state = "deadrom"
Bump(atom/A)
if(ismob(A))
var/mob/romulan/M = A
M.Health -= 100
else return


ive tried using the bump() before and it always gives me an error I have no ideah why. it says its an undifined proc

turf/Enter(obj/phaserbeam/P)
if(!istype(P,/obj/phaserbeam))
for(var/mob/romulan/M in src)
if(istype(M,/mob/romulan))

M.hp -= 5
del(P)
return FALSE

return ..()

this code will compile with no errors now(thanks for pointing out what I missed ")" ) however what happens is the phaserbeam will travel to the romulan hit him but wait tell he moves out of the way then keep on going. this frustrates me because I see the del(P) yet the program wants to ignore it or its ignoring the loop completely. thank you guys for your help so far im close but still not there yet please help


In response to Garthor
obj
phaser
icon = 'phaser.dmi'
icon_state = "phaser"
verb/fire_phaser()
var/obj/phaserbeam/P = new(locate(usr.x,usr.y,usr.z))

walk(P,usr.dir,1)


phaserbeam
icon = 'person.dmi'
icon_state = "deadrom"
Bump(atom/A)
if(ismob(A))
var/mob/romulan/M = A
M.hp -= 5
else return



ok im getting two empty type name errors on bump(atom/a) and verb/firephaser() I double checked my indentation please help
In response to Garthor
Cool this code works some what.

obj
phaser
icon = 'phaser.dmi'
icon_state = "phaser"
verb/fire_phaser()
var/obj/phaserbeam/P = new(locate(usr.x,usr.y,usr.z))
walk(P,usr.dir,1)


phaserbeam
icon = 'person.dmi'
icon_state = "deadrom"
Bump(atom/A)
if(ismob(A))
var/mob/romulan/M = A
var/obj/phaserbeam/P
M.hp -= 5
del(P)
else return

however del(P) still wont work and I get this selection when I fire phaser. it asks me if I want to fire other things in my inventory. could some one look at this code and help me out thanks.
In response to Treasurecat
In phaserbeam.Bump(), you are creating a var called P, not assigning anything to it, and then deleting nothing. I'm guessing it's the phaserbeam itself you want to delete. If so, remove the P var from phaserbeam.Bump() and just use src.

As for the selection, I'm not seeing any input for the phaser.fire_phaser() verb in this code. In other words, I don't see why you would be getting a selection. Do you have another fire_phaser() verb for mob or something?
In response to ACWraith
ACWraith wrote:
In phaserbeam.Bump(), you are creating a var called P, not assigning anything to it, and then deleting nothing. I'm guessing it's the phaserbeam itself you want to delete. If so, remove the P var from phaserbeam.Bump() and just use src.

thanks it worked





As for the selection, I'm not seeing any input for the phaser.fire_phaser() verb in this code. In other words, I don't see why you would be getting a selection. Do you have another fire_phaser() verb for mob or something?

I only have one other obj in my inventory it asks if I want to fire my phaser or that no other fire_phaser commands are in my code. does anyone have any ideahs what im doing to creat the selection screen?
obj
phaser
icon = 'phaser.dmi'
icon_state = "phaser"
verb/fire_phaser()
var/obj/phaserbeam/P = new(locate(usr.x,usr.y,usr.z))
walk(P,usr.dir,1)


phaserbeam
icon = 'person.dmi'
icon_state = "deadrom"
Bump(atom/A)
if(ismob(A))
var/mob/romulan/M = A

M.hp -= 5
del(src)
else return

In response to Treasurecat
obj
phaser
icon = 'phaser.dmi'
icon_state = "phaser"
verb/fire_phaser()
var/obj/phaserbeam/P = new(locate(usr.x,usr.y,usr.z))
walk(P,usr.dir,1)
I figured out why the selection screen kept coming up it was a indentaion problem

obj
phaser
icon = 'phaser.dmi'
icon_state = "phaser"
verb/fire_phaser()
var/obj/phaserbeam/P = new(locate(usr.x,usr.y,usr.z))
walk(P,usr.dir,1)
thanks for your help
Page: 1 2