ID:145030
 
Code:
battle
backgrounds
grasslands
icon = 'pics/backgrounds/Grassland01.png' //png battle background defined here


Problem description:
I cannot figure out how to get the sprite off the png icon.

If you log out mid battle then you log back in on the battle field. So i went to the login and, since they never lost their inbattle value of one i did...

mob/proc/Relocate()
if(src.human)
src.client.edge_limit = null
src.eye = null
src.loc = locate(11,21,1)
return
if(src.monster)
src.client.edge_limit = null
src.eye = null
src.loc = locate(2,9,1)
return

added the proc under the login thing
login()
src.Relocate()


since all battle backgrounds are on the 6th z, i even added a check under the move to see if walking on the picture did anything.

Move()
if(src.z==6)
src.inbattle = 0
src.Relocate()
src.client.edge_limit = null


yet nothing worked, any ideas?

if the png is bigger than 32px by 32px (i think thats the current icon_state size) then it will have its icon_states built to use


eg
obj
battle
backgrounds
layer = TURF_LAYER
grasslands
icon = 'pics/backgrounds/Grassland01.png'
icon_state = "1,1"
proc
display_battle_bg(var/Xsize=0,var/Ysize=0,var/startX=0,var/startY=0,var/startZ=0)
var/obj/backgrounds/T = new/obj/backgrounds
var/loop = 0
var/loop2 = 0
while(loop <= Ysize)
while(loop2 <= Xsize)
T = new/obj/backgrounds
T.icon = src.icon
T.icon_state = "[loop2+1],[loop+1]"
T.loc = locate(startX+loop2,startY+loop,startZ) // if you change this it can also be used to display on the hud
loop2 = 0
loop++
spawn(1) del(src)

then when the battle starts you have to workout what background you want and where its going to be then make it
mob
proc
battlebg(var/areatype="",var/X=0,var/Y=0,var/Z=0,var/sizeX=0,var/sizeY=0)
switch(areatype)
if("grasslands")
var/obj/battle/backgrounds/grasslands/T = new/obj/battle/backgrounds/grasslands
T.display_battle_bg(sizeX,sizeY,X,Y,Z)

this is just an example. (everyone else feel free to give a better example)