ID:163433
 
okay, there are 2 things for this topic...

1) If i have the same variable for more than one mob (health/maxhealth) how would i go about resetting the variable after i kill a mob. like, i kill a mob and the hp is the maxhealth again after it dies so i can kill another one.i figured this one out! now just the second one, please! :)

2) if i kill a mob and an overlay has it so it is laying on the ground dead, how can i make it so that if i shoot it again, the first mob wont pop up again?

thanks for your help! :)
For number 2...

Is the mob a player? I would just slam an overlay over the top of it if it is dead; I'd change the icon. We can't really help without seeing what you've coded for shooting. Chances are changing the mob's density to 0 would help (as bullets would just fly straight past it) but that really does depend on how you've done the shooting bit.

~Ease~
In response to Ease
im using rifhaven's shooting demo. so here it is...

mob
proc
shoot()
if(!src.fired)
src.fired = 1
src.ammo --
spawn(1)
src.fired = 0
var/obj/H = new/obj/bullet
H.dir = src.dir
H.loc = src.loc
while(H)
var nextLocation = get_step(H,H.dir)
var/turf/T = nextLocation
for(var/mob/M as mob in T)
if(M == src)
continue
hp -= dmg
var/icon/b = new('icons.dmi',"person3")
var/icon/c = new('icons.dmi',"person2")
M.overlays += c
sleep(1)
M.overlays += b
src << "\red You shot the zombie for [dmg] Health!"
src << " "
src << "\yellow Zombie's Health = [hp]/[maxhp]"
if(hp == 0)
src << "\red You killed the zombie!"
var/icon/A = new('icons.dmi',"person")
M.overlays += A
M.density = 0
reset()
continue
del(H)
if(T.density == 1)
del(H)
if(T.density == null)
del(H)
if(H)
step(H,H.dir)
sleep(1)


there you have it... if you need anything else just tell me and ill post it for you. :)

P.S. i changed the density to 0 and im still able to shoot it...
In response to Jman9901
any other help would be nice. :)
In response to Jman9901
Make the corpse an OBJ and when it dies, make it place the OBJ where the Zombie was located.
In response to LucifersHellion
you mean like an overlay?
In response to Jman9901
there is no need for an overlay. Just spawn a new obj with the same characteristics as the mob who died(i.e the mob's icon state & icon). And then relocate the original mob who died.
In response to Jman9901
No.. I mean an OBJ. Spawning where the mob died.
In response to LucifersHellion
so i just use a repop proc for the mob and put an object where the mob was?
In response to Jman9901
No. You relocate the mob to where it would normally be relocated, like if it is a player mob he/she would be relocated to his/her respawn point. Right after that you create an obj with the same icon and possibly icon_state depending on whether you have a "dead" icon_state. According to Lucifer the OBJ should be bypassed when shooting.

Hope that helps,
KirbyAllStar
In response to KirbyAllStar
can you please show an example? im having a hard time following for some reason... :|
In response to Jman9901
mob
proc
Die()
var/src_loc = src.loc //Storage variable for the location at time of death.
var/obj/corpse/C = new obj/corpse/ //New corpse
C.icon = src.icon //Set the icon
C.icon_state = "Corpse" //This may be better to go under the obj/corpse definition.
src.loc = locate(2,4,1) //Place your respawn point here
C.loc = src_loc //We use the previous storage variable because the src's location has changed.


Hope this helps,
KirbyAllStar
In response to KirbyAllStar
now it's making sense. respawn the mob and put the corpse object where the mob was... i get it. i thought he meant like overlays or something...
In response to Jman9901
Nah, I'm happy your understanding it now. Glad I could be of help.
In response to KirbyAllStar
im trying to code it now. im just used to overlays so its a little challenging.

thanks for everything! :)
In response to Jman9901
Anytime. And good job on not just trying to copy-paste the code. :-)

Just so you know, make the corpse Obj density=0. The shooting code will delete the bullet if it hits a solid atom.
In response to KirbyAllStar
okay. and i always like a challenge, even though i have a hard time with coding this, ill figure it out sometime. :)