1. Is it possible to save a persons "icon/overlays" in a list?
Some things to keep in mind:
1.1. What i want to "create" is an ability to copy a person, basically like the standard bushins in naruto for those who have seen it, but i want to "save" the person so i can turn back into him later on or at any given time.
1.2. I do not save overlays directly to a savefile. I use a list containing every item/clothing that the person is wearing and add the objects based on that upon loading the character, overlays are then removed before saving/quitting the game. At least that's what i think i'm doing :)
Now, Question 2. What is the proper way/or better way, of doing this:
obj
Bullet
density = 1
icon = 'effects.dmi'
icon_state = "bullet"
var/owner
var/dmg
New()
spawn(50) del(src)
..()
Bump(mob/M)
if(istype(M,/obj))
del(src)
return
if(istype(M,/mob))
view() << output("Test","SM")
var/dd = round(src.dmg - M.def)
if(dd <= 0)
dd = 1
M.hp -= dd
spawn() M.Health_Bar()
view() << output("[M] was hit by [src.owner]'s [src]! and did [dd] damage!","SM")
sleep(1)
del(src)
return
With this version it technically does what i want it to, though the text does not display in the SM output, damage however is dealth and Health_Bar() is called.
also as an addon: the way i create the object is very inefficient. (suits the rest of my coding i guess)
mob/verb/Do_This()
var/obj/A = new/obj/B // This is just as an example
A.owner = usr
A.dmg = usr.strength
A.loc = locate(usr.x,usr.y,usr.z) // Now this the biggest issue from my P.O.V.
walk(A,usr.dir,2)
This might be silghtly off balance since i just made it right now, anyways.. i Remember to have had it so it was to locate itself directly infront of the user, whichever direction he is facing. like this, however more efficient:
mob/verb/Do_This()
var/obj/A = new/obj/B
if(usr.dir == NORTH)
A.loc = locate(usr,NORTH)
if(usr.dir == SOUTH)
A.loc = locate(usr.SOUTH)
// or something like that, however within a simple line of code.
Anyways, Anyone who could help me out here?
Feel free to be as harsh as you need to.
For question 2, changes I suggest are:
Instead of view(), use view(src).
Instead of spawn(), use spawn(-1), so that you no longer need a sleep() at the end of the Bump() proc. spawn() queues up some command to execute as soon as the current thread sleeps, but with you deleting the obj and ending the proc before then, it never gets to do anything. spawn(-1) executes the code within it (until it reaches a sleep) BEFORE continuing on the main proc.
To get the location of a player, just use the loc variable, you don't need to use locate(). To get a step in the direction they're facing, use get_step(src, src.dir). Keep in mind that this might not be preferable as you would end up shooting through thin walls.