ID:264947
 
Code:
mob/proc/Cooldown(Name,Cooldown,obj/Skills/T,message=1)
if(!_Cooldowns)
_Cooldowns=new
if(T)
for(var/obj/Hud/slots/H in client.screen)
if(H.attacks==T)
T.overlays+=new/obj/Locked
spawn(T.Cooldown*10)
T.overlays-=T.overlays
if(client)
for(var/obj/Hud/slots/H in client.screen)
if(H.attacks==T)
H.overlays-=/obj/Locked
H.overlays-=/obj/Locked
H.overlays-=/obj/Locked
H.overlays-=/obj/Locked
if(_Cooldowns[Name]&&_Cooldowns[Name]>world.timeofday)
if(_Cooldowns[Name]>world.timeofday+(Cooldown*3)) _Cooldowns[Name]=world.timeofday+Cooldown
if(message)
usr<<output("You cannot use this ability yet. ([(_Cooldowns[Name]-world.timeofday)/10] Seconds Left)","output")
return 1
else
return 1

_Cooldowns[Name]=world.timeofday+Cooldown
return 0


Problem description:
Hello, I am having a problem having the overlay appear on-screen.I am not exactly sure what I am doing wrong.

P.S. I obtain the skill as follow;
src.attacks+=new/obj/Skills/thing1
Can I see the code for the skill, as well? I have my suspicions but I would like to confirm them before a potential goose chase.
In response to ShadowOfNight
Hey, thanks for taking the time to check this out. Here is a quick skill.
        icon='Skills.dmi'
Stance
description="A fighting stance."
icon_state="stance"
Cooldown = 5 // this just defines for my UI

Use(mob/User)
if(User.Cooldown("Stance",50,User))
return 1
else
if(User.stance == 0)
User.stance=1
User.frozen+=1
User.icon_state="stance"
view(6) << output("[User] enters stance","output")
else
User.stance=0
User.icon_state=""
User.frozen-=1
view(6) << output("[User] leaves his stance","output")
In response to Dranzer_Solo
In that code, you're passing a mob to "/obj/Skills/T"

Which, when you loop through the HUD skill cards you check if the Skill Card's "attacks" variable is equal to whatever you passed "T" to.

As well, such code has potential for bugs because H.attacks would have to reference the skill object, and not the skill's type or anything else.
In response to ShadowOfNight
So do I need to just change how my skills are defined or do I need to rework both?
In response to Dranzer_Solo
Assuming that in "Use(mob/User)" src is the object, try and replace User in 'Cooldown("Stance",50,User)' with src
In response to ShadowOfNight
Yea, I have tried that before and it doesn't change anything. Cooldown is being called and it works just fine. I am just not getting the overlay over the skill icon on my hotbar. There was a bit of code I forgot to mention, this is the drag and drop part of the code, where I drag the skill onto my hotkey bar.

obj
Skills
var/description="A skill"
proc/Use()
..()
New()
..()
var/icon/I = icon(src.icon,src.icon_state)
mouse_drag_pointer = I

MouseDrop(over_object,src_location,over_location)
if(istype(over_object,/obj/Hud/slots/))
for(var/I in usr.Slot)
if(usr.Slot[I]==src)
usr.Slot[I]=null
del(usr.SlotImage[I])
for(var/obj/Hud/slots/I2 in usr.client.screen)
if(I2.slot==I)
I2.mouse_drag_pointer=null
del(usr.SlotImage[over_object:slot])
usr.Slot[over_object:slot]=src
var/image/I=image(src.icon,over_object,icon_state=src.icon_state,layer=over_object:layer+1)
usr<<I
usr.SlotImage[over_object:slot]=I
over_object:mouse_drag_pointer=I
..()

//stance skill is after this
In response to Dranzer_Solo
What you are clicking in the hotbar is an image object, not the skill object. You need to figure out some way that works for you to either add an overlay to the slot that's above the image, OR, attempt to apply the skill object as an overlay instead of duping it's icon.