![]() Sep 4 2002, 1:03 pm
In response to Malver
|
|
Oops, I know, I know, I meant to put a if(istype(P,obj/phaserbeam)), but I forget stuff.
|
Garthor wrote:
turf See? If you used the method I followed, then that would be reduced to only 1 line of code. :P |
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... :P |
Malver wrote:
Treasurecat wrote: 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 |
obj Eh...ten second coding. |
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 |
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 |
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 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? |
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 |
objI 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 |