ID:2242505
 
(See the best response by Nadrew.)
Code:
mob
proc
Shadow_Clone()
if(Cloneon)
// usr.overlays-='Base.dmi'
usr.str=usr.mstr
usr.def=usr.mdef
if(firing)
usr<<"<b>Calm the fuck down..."
return
if(usr.Clonedelay)
usr<<"You dont have enough balls for this kid"
return
usr.Handseals(3)
if(usr.canjutsu==0)
return
var/sdelay=10
for(var/obj/Techniques/Shadow_Clone/K in src)K.overlays+='timer.dmi'
usr.Clonedelay=1
spawn(sdelay)
for(var/obj/Techniques/Shadow_Clone/K in src)K.overlays-='timer.dmi'
usr.Clonedelay=0
view(10)<<"<b>[usr]Kage Bunshin no Jutsu"
usr<<"<b>You think you accomplished anything? you monumental fuck..."
usr.firing=1
spawn(50)
usr.firing=0
var/Q=new/mob/evilclone(locate(x+rand(1,6),y+rand(1,6),usr.z))
Q:cloneowner=usr
Q:dir=usr.dir
sleep(1)
for(var/mob/evilclone/M in oview(20))
if(M.cloneowner==usr)
M.name=usr.name
M.tai=usr.tai/4
M.icon='Base3.dmi'
M.nin=usr.nin/4
M.def=usr.def/4
M.speed=usr.speed/4
M.health=usr.health/4
M.chakra=usr.chakra/4
M.stamina=usr.stamina/4
M.isclone=1
M.shadowclone()
spawn(150)
for(var/mob/evilclone/C in world)
if(C.cloneowner==usr)
del C
mob
evilclone
health=25
clone=1
layer=10000000
mhealth=25
New()
new/obj/sandup(loc)
icon='Base3.dmi'
Bump(A)
..()
if(ismob(A))
if(A==cloneowner||A:cloneowner==cloneowner)return
src.LPunch()
Del()
new/obj/sanddown(loc)
..()


Problem description:
Someone please help.
For some reason when i execute the technique in game, the icon does not show up for the clone.
The same thing is happening for other objects too, like a waterfall and etc.
I have tried all i can but nothing seems to work. the icon layer is much higher than the turf layer. i don't understand
Best response
You're setting the layer TOO high, layers above around 1024 will be treated as EFFECTS_LAYER, which is handled uniquely. The default layer of /mob is fine.

The issue you're having is that you're overriding New() without calling ..(), so you're effectively preventing the mob from being created.

That's ignoring how overall poor the code is though.

For instance using usr in a proc, plus you don't need to use a loop to set the clone's variables, you already have a reference to it with the 'Q' variable, you just need to typecast that variable properly and set the values there. That's just at a glance though.
The issue you're having is that you're overriding New() without calling ..(), so you're effectively preventing the mob from being created.

The object exists prior to the point where New() is actually called, and the default action of New() doesn't actually do anything, so ..() doesn't need to be called unless you have other overrides in the project that do need to operate.
In response to Ter13
Ter13 wrote:
The issue you're having is that you're overriding New() without calling ..(), so you're effectively preventing the mob from being created.

The object exists prior to the point where New() is actually called, and the default action of New() doesn't actually do anything, so ..() doesn't need to be called unless you have other overrides in the project that do need to operate.

That'll teach me not to double check the reference =P

        New()
new/obj/sandup(loc)
icon='Base3.dmi'


I'm pretty sure you can't set an icon like that in New(). You either need to make that 'icon = icon('Base3.dmi'), or even better, just add it to the evilclone definition.

mob
evilclone
icon = 'Base3.dmi'
health=25
clone=1
layer=MOB_LAYER // unnecessary, but better than 10000000...
mhealth=25

I'm pretty sure you can't set an icon like that in New().

You can do that, but in the OP's case, the icon should be set in the mob definition itself as you suggested.
In response to Nadrew
Nadrew wrote:
You're setting the layer TOO high, layers above around 1024 will be treated as EFFECTS_LAYER, which is handled uniquely. The default layer of /mob is fine.

The issue you're having is that you're overriding New() without calling ..(), so you're effectively preventing the mob from being created.

That's ignoring how overall poor the code is though.

For instance using usr in a proc, plus you don't need to use a loop to set the clone's variables, you already have a reference to it with the 'Q' variable, you just need to typecast that variable properly and set the values there. That's just at a glance though.


I fixed the problem by removing that loop proc all together. By setting the variables using the Q variable, the problem is solved. Thank you so much.