ID:175262
 
Yes another BUMP() question from me.
Is it possible for an obj created by a mob to take the mobs value(I don't know if I stated it correctly :( ) ...for example:

mob/Chicken
verb()
new obj//I forgot how make an obj, just pretend I did it and its in src.loc
walk(the obj, in src.dir)

Obj
Bla_Bla
BUMP()
mob that made it health += 5

Ok, so if anybody understands what I need and knows how to help me, please do.

Thank you for your time.
*Bump* I think it's legal, considering a day passed and its on the 4th page =(
In response to SSChicken
I dont understand what your having a prob with this.

mob/verb/Chicken()
var/NC = new /obj/Chiken(loc=locate(usr))
NC:owner = usr.key
NC: add the rest of the stats
walk(NC,usr.dir)
obj/Chicken
Bump(atom/a)
if(parent_type == /turf)
del src
else
do what ya want and remember since you made the owner var you can use
for(var/mob/M in world)
if(M.key == src.owner)
continue with what your doing
SSChicken wrote:
Yes another BUMP() question from me.
Is it possible for an obj created by a mob to take the mobs value(I don't know if I stated it correctly :( ) ...for example:

mob/Chicken
verb()
new obj//I forgot how make an obj, just pretend I did it and its in src.loc
walk(the obj, in src.dir)

Obj
Bla_Bla
BUMP()
mob that made it health += 5

Ok, so if anybody understands what I need and knows how to help me, please do.

Thank you for your time.

I think you mean "Is it possible for object1 to modify object2's (object2 was created by a verb belonging to object1) variables?". The answer would be yes. Give obj/bla_bla a variable to keep track of the mob/chicken that created it:

mob/Chicken
verb()
var/obj/Bla_Bla/moving_bla
moving_bla = new obj//I forgot how make an obj, just pretend I did it and its in src.loc
moving_bla.owner=src
walk(the obj, in src.dir)

Obj
Bla_Bla
var/mob/Chicken/owner
BUMP()
owner.health += 5
In response to Hendrix
Hendrix wrote:
I dont understand what your having a prob with this.

mob/verb/Chicken()
var/NC = new /obj/Chiken(loc=locate(usr))
NC:owner = usr.key
NC: add the rest of the stats
walk(NC,usr.dir)
obj/Chicken
Bump(atom/a)
if(parent_type == /turf)
del src
else
do what ya want and remember since you made the owner var you can use
for(var/mob/M in world)
if(M.key == src.owner)
continue with what your doing

You should whenever possible try to avoid using ":", its better in this case to do something like

mob/verb/chicken()
var/obj/Chicken/NC = new
NC.owner=usr.key
//add other stats
NC.loc=locate(usr.loc)
walk(NC,usr.dir)
obj/chicken
Bump(atom/a)
if(isturf(A))
del A
else
//do other stuff here<dm>

While : does work rather nicely and it does eliminate lots of compiler errors, but wont always work in the actual game...