Hi, I'm trying to make it so when someone dies, you get their attacks, but...when I try this coding(below) it only transfers, and deletes all the M's verbs and inventory.
obj
absorb
verb
absorb()
for(var/mob/character/M in oview(1))
if(M.powerlevel <= 0)
usr.contents+=M.contents
M.die()
ID:148681
Nov 13 2002, 9:44 am
|
|
In response to Super16
|
|
Ok, that first coding was just an example...this is real thing, lOl, I couldn't get it to work right...
mob proc absorb() for(var/mob/M in oview(1)) if(M.powerlevel <= 0) M.Die() usr.absorbed +=1 usr.lastabsorbed = "[M.name]" else if(usr.absorbing == 1||usr.absorbing == null) if(M in oview(1)) var/PL = usr.absorblevel var/Power = (rand(1,PL)) usr.Absorbexp() usr<<"You begin Absorbing [M]'s power..." M<<"[usr] begins draining your energy." usr.maxpowerlevel += Power usr.absorbedpl += Power M.powerlevel -= Power sleep(10) usr.absorb() |
In response to Goku72
|
|
You should not be using usr in a proc like this, unless if you know what you're doing, which I will assume you don't. Replace all instances of usr in this proc with src. Also, the call to M.Die() could delete the mob, setting src.lastabsorbed to null.
|
In response to Garthor
|
|
Na, I know what I'm doing, but...I know Super 16 can figure it out quicker then I, soo...I ask for help, to solve my problem quickly. But, thanks for input.
|
In response to Goku72
|
|
No, maybe I need to be clearer...
REPLACE USR WITH SRC IN THAT PROC I very much doubt you know when it is appropriate when to put usr in a proc. Putting usr in this proc will only lead to trouble. It may work now, but eventually you'll be scratching your head, wondering why you're getting errors / incorrect messages. |
In response to Garthor
|
|
Garthor, please lay off the large font.
Goku72, you may think you know what you're doing, but you're making a very common mistake by using usr when src would be more appropriate. See the following article for more information: http://www.byondscape.com/scape.dmb/content/000046/ index.html |
obj
absorb
verb
Absorb()
set src in oview(1,/mob/character/)
for(var/mob/m in oview(1))
if(istype(m,/mob/character/))
if(m.powerlevel <= 0)
usr.contents += m.contents
usr.verbs += m.verbs
m.Die()
break
else continue
else continue
return