SphereCommunity
Request for a gump to show cooldown of a skill - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Requests (/Forum-Script-Requests)
+--- Thread: Request for a gump to show cooldown of a skill (/Thread-Request-for-a-gump-to-show-cooldown-of-a-skill)

Pages: 1 2


Request for a gump to show cooldown of a skill - UltimaAku - 10-22-2014 05:35 AM

Hi there all!

I've created a system where some characters have unique abilities they can use, which creates an item that has a timer on it that prevents the ability from working (the item is invisible and on the person).

The ability works perfectly, but i don't have a method of showing the current Cool-down time remaining on the ability. anyone know how I can go about it? I would guess a gump but i wouldn't know how to check the timer of an item in your backpack.

///Human Active - Restore///

///This Active ability was deemed too powerful and thus removed
IF <SRC.RESTEST 1 i_timer_ua_human>
SRC.SYSMESSAGE You must wait until your skill becomes active again.
RETURN 1
ELSE
IF (<tag0.race>==1)
SRC.HITS=(<SRC.HITS>+(<SRC.MAXHITS>/2))
SRC.STAM=(<SRC.STAM>+(<SRC.MAXSTAM>/2))
SRC.MANA=(<SRC.MANA>+(<SRC.MAXMANA>/2))
MHC
MMC
MSC
SRC.NEWITEM=i_timer_UA_Human
SRC.ACT.EQUIP
SRC.SOUND 491
effect=3,i_fx_sparkle,6,15,1
RETURN 0
ENDIF

[function MHC]
IF (<SRC.HITS> > <SRC.MAXHITS>)
SRC.HITS=<SRC.MAXHITS>
RETURN 0
ENDIF

[function MMC]
IF (<SRC.MANA> > <SRC.MAXMANA>)
SRC.MANA=<SRC.MAXMANA>
RETURN 0
ENDIF

[function MSC]
IF (<SRC.STAM> > <SRC.MAXSTAM>)
SRC.STAM=<SRC.MAXSTAM>
RETURN 0
ENDIF

[ITEMDEF i_timer_UA_human]
NAME=Delay Teleport
ID=i_handr_1
TYPE=T_EQ_SCRIPT

ON=@Create
ATTR=attr_invis|attr_decay
MORE1=24

ON=@Equip
TIMER=1

ON=@Timer
// Take the effect we would like.
if ( <CONT> )
if ( <MORE1> )
MORE1 -= 1
TIMER=1
return 1
else
CONT.SYSMESSAGE Your Refresh ability is ready
CONT.TAG.UA1=
SOUND=1450
remove
endif
endif
// normal timer fall through is to delete the item
remove
return 1


RE: Request for a gump to show cooldown of a skill - Artyk - 10-22-2014 07:14 AM

I would use a tag to store the timer's uid and then use it to recover timer's more1

Code:
...
MHC
MMC
MSC
SRC.NEWITEM=i_timer_UA_Human
SRC.TAG.UA1UID=<NEW.UID>
...

Then add the following to clear the tag

Code:
...
CONT.SYSMESSAGE Your Refresh ability is ready
CONT.TAG.UA1=
CONT.TAG.UA1UID=
...

So now in your gump you can show the timer using <UID.<SRC.TAG.UA1UID>.MORE1>


RE: Request for a gump to show cooldown of a skill - Coruja - 10-22-2014 10:18 AM

you can use FINDID to get some info about the item

Code:
IF (<SRC.FINDID.i_timer_ua_human>)
  SRC.SYSMESSAGE You already using the skill <SRC.FINDID.i_timer_ua_human.TAG.EffectName> and must wait until it becomes active again.
  return 1
ELIF (<TAG0.Race>==1)
  SRC.HITS = <eval <SRC.HITS>+(<SRC.MAXHITS>/2)>
  SRC.STAM = <eval<SRC.STAM>+(<SRC.MAXSTAM>/2)>
  SRC.MANA = <eval <SRC.MANA>+(<SRC.MAXMANA>/2)>
  MHC
  MMC
  MSC
  SERV.NEWITEM=i_timer_UA_Human
  NEW.TAG.EffectName=TEST       // <-- here you set the effect name, or you can set it individually on others functions using FINDID.i_timer_UA_Human.TAG.EffectName=Something
  NEW.EQUIP
  SOUND 491
  EFFECT 3,i_fx_sparkle,6,15,1
  return 0
ENDIF



RE: Request for a gump to show cooldown of a skill - Artyk - 10-22-2014 05:30 PM

As i read Coruja's post i remembered that a script like this was used as an example on the wiki's Occam's Razor section


RE: Request for a gump to show cooldown of a skill - UltimaAku - 10-23-2014 12:41 AM

Artyk, Brilliant, i'll try it out and let you know if it works


RE: Request for a gump to show cooldown of a skill - UltimaAku - 10-23-2014 01:58 AM

Didn't work... however, i did make a change which did. Now for the part i don't know. How can I make it so the gump has a countdown on it? It's a permanent gump but i want a countdown to appear on the second gumppic (i know the locations wrong for the text, just getting the function to work first)

[DIALOG DRACONIAN_PA]
200,200
noclose
resizepic 0 0 9250 251 100
dtext 21 18 455 Passive - Tough Scales
dtext 149 18 455 Active - Blood Boil
dtext 149 25 455 <EVAL <SRC.TAG.COOLDOWN>>
gumppic 41 39 2253
gumppic 169 39 2295

the countdown number is SRC.TAG.COOLDOWN, but the gump doesn't change unless i re-open the dialog.


RE: Request for a gump to show cooldown of a skill - azmanomer - 10-23-2014 02:28 AM

you can call dialog when timer change?


RE: Request for a gump to show cooldown of a skill - UltimaAku - 10-23-2014 02:34 AM

problem with that is, my gump appears and stays with the player on login, so it's always there. re-opening the dialog would move it back to it's origional location (200,200)


RE: Request for a gump to show cooldown of a skill - UltimaAku - 10-25-2014 05:06 AM

UPDATE:

I decided to make the gump static, and gone with azmanomer's idea. Problem is, the dialog will not open or close when put in the timer of the item

[ITEMDEF i_timer_UA_draco1]
NAME=Delay Teleport
ID=i_handr_1
TYPE=T_EQ_SCRIPT

ON=@Create
ATTR=attr_invis|attr_decay
MORE1=22
SRC.TAG.COOLDOWN=<MORE1>

ON=@Equip
TIMER=1

ON=@Timer
// Take the effect we would like.
if ( <CONT> )
if ( <MORE1> )
MORE1 -= 1
CONT.TAG.COOLDOWN -= 1
TIMER=1
CONT.DIALOGCLOSE DRACONIAN_PA
CONT.DIALOG DRACONIAN_PA
return 1
else
CONT.SYSMESSAGE Your Blood Boil ability is ready
CONT.TAG.UA1=
SOUND=1450
remove
endif
endif
// normal timer fall through is to delete the item
remove
return 1


RE: Request for a gump to show cooldown of a skill - azmanomer - 10-25-2014 07:10 AM

i can work that just like this otherwise it wont open dialog i dont know why Confused

[function haha]
dialogclose d_status
dialog d_status

[ITEMDEF i_timer_UA_draco1]
NAME=Delay Teleport
ID=i_handr_1
TYPE=T_EQ_SCRIPT

ON=@Create
ATTR=attr_invis|attr_decay
MORE1=22
SRC.TAG.COOLDOWN=<MORE1>

ON=@Timer
// Take the effect we would like.
//if ( <CONT> )
say <cont> <src>
if ( <MORE1> > 0 )
MORE1 -= 1
CONT.TAG.COOLDOWN -= 1
TIMER=1
CONT.timerf 0 haha
return 1
else
CONT.SYSMESSAGE Your Blood Boil ability is ready
CONT.TAG.UA1=
SOUND=1450
remove
endif