The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm6 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm6 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm6 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Request for a gump to show cooldown of a skill
Author Message
Runcuks
Journeyman
*

Posts: 179
Likes Given: 5
Likes Received: 3 in 3 posts
Joined: Nov 2012
Reputation: 0



Post: #11
RE: Request for a gump to show cooldown of a skill
Try something like this maybe it will help Wink

[function haha]
trysrc <UID> dialogclose d_status
trysrc <UID> dialog d_status
10-25-2014 04:21 PM
Find all posts by this user Like Post Quote this message in a reply
Coruja
Sphere Developer
*****

Posts: 987
Likes Given: 5
Likes Received: 226 in 187 posts
Joined: Jul 2012
Reputation: 7

Dimension Shard

Post: #12
RE: Request for a gump to show cooldown of a skill
it's a bad idea use real time countdown on dialogs
if the countdown timer is 60 seconds, the server will send 60 dialogs to this player (1 new dialog at every second)

but to see how really bad it is, just imagine this same countdown now on 10 players, the server will send 600 dialogs in just 1 minute. And to make it even worse, imagine these same 10 payers with a 1 hour countdown, it will be 36000 dialogs

so if you really want use countdown on dialogs, I recommend use a lightweight dialog and update it only at every 5 or 10 seconds instead 1 second
10-26-2014 02:34 AM
Find all posts by this user Like Post Quote this message in a reply
UltimaAku
Journeyman
*

Posts: 125
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Feb 2013
Reputation: 1



Post: #13
RE: Request for a gump to show cooldown of a skill
That's a very fair point Coruja... I have come up with a temporary solution. Rather than having a real-time countdown on the dialog, i'll just simply change the picture on the dialogue to gray. then when the cooldown timer finishes, return it to it's normal colour.
10-26-2014 09:54 PM
Find all posts by this user Like Post Quote this message in a reply
Feeh
Sphere Developer
*****

Posts: 156
Likes Given: 6
Likes Received: 40 in 29 posts
Joined: Sep 2012
Reputation: 4



Post: #14
RE: Request for a gump to show cooldown of a skill
If you want a small dialog (in size and elements) you can send them each second.
A guy is using it on his server (and many other does use too); he can send 10 dialogs/sec to the player (video here) without lag issues, even with bigger gumps. This is tested on live servers but of course there are things you should know:

-Each dialog require you to send a very new dialog to the client, the bigger the dialog, the bigger will be the message sent. Players may experience some latency issue (assumingthey already have latency issues) if you do manage to send 10 dialog/sec. IMO 1 dialog/sec is enough.
-Client rendering is fully handled by software, so even if you create a big dialog with 3 elements, it will still be slow to render (specially clients <502)
-Number of elements also increase the rendering time
-Server will have to compile a new dialog each time a new one is sent. Since you can not cache a gump your best is to pre-render the dialog packet and send each one as needed. You will end with a really big script (and may not worth the effort).

I'm not saying "no you can't do that" or "it will not work", I'm just showing you that you should be warned with some details.

Coruja is right, each dialog for each player will cause an immense amount of data being processed and sent to your clients which will have to process these data. Your server can surely handle that but you may sacrifice some good amount of resources; you should always aim for the worst case

My suggestion is to do some optimization. If your cooldown time is fairly big (30,60..1000 secs) you can send them in order to only tell the player the exact moment when the timer decay, for example:

30 secs remaining...
20 secs...
10 secs...
5, 4, 3, 2, 1

It will be irrelevant to the player to know that he does have 27 seconds remaining, so only send the last five seconds with 1 sec resolution, assuming the last five seconds are the most important.

Lightweight dialog does apply, and if you want to show more than one cooldown to the player, show only one dialog, but your resolution will go crazy, since they will not end at same time.

Why not use the client buffer bar?

Feeh/Epila - Nightly releases / SphereWiki / Github Issues / Sphere's GitHub
(This post was last modified: 10-26-2014 10:59 PM by Feeh.)
10-26-2014 10:57 PM
Find all posts by this user Like Post Quote this message in a reply
UltimaAku
Journeyman
*

Posts: 125
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Feb 2013
Reputation: 1



Post: #15
RE: Request for a gump to show cooldown of a skill
Thank you all for your help! The script works perfectly now Smile I didn't get the countdown on, but it doesn't matter so long as it shows when the skill is on cooldown.

As my way of saying thanks, I'll drop off the script for the Blood Boil active and the gump for the Passive and active for you to utilize how you wish. I've modified it so it can work as an individual event while i had them grouped as a set of 4 races Smile

To start using the event to test it, set your event to e_draconian

To clear the event, remove the event e_draconian off yourself and set TAG.RACE to 0

The active ability allows the character to jump onto another character/npc thats in line of sight and a max of 8 spaces away, Then for 3 seconds, the user becomes immune to all forms of magic (even friendly) and all NPC damage. This skill has a 30 seconds cooldown from casting.

[EVENTS e_draconian]
ON=@LOGIN
SRC.DIALOG DRACONIAN_PA
SRC.TAG.RACE=2

[plevel 1]
UA

[DIALOG DRACONIAN_PA]
500,640
noclose
resizepic 0 0 9250 309 100
dtext 18 18 455 Passive - Tough Scales
dtext 180 18 455 Active - Blood Boil
gumppic 60 39 2246
IF (<SRC.TAG0.COOLDOWN>!=0)
gumppic 210 39 2295 0894
dtext 166 50 455 Cooldown 30 Seconds
ELSE
button 210 39 2295 2295 1 1 1
ENDIF

[DIALOG DRACONIAN_PA BUTTON]
ON=1
UA
DIALOG Draconian_PA

[function UA]
IF <SRC.RESTEST 1 i_timer_ua_draco1>
SRC.SYSMESSAGE You must wait until your skill becomes active again.
RETURN 1
ELSE
IF (<tag0.race>==2)
src.sysmessage Select your target.
TARGETFW f_race_draconian_charge
ENDIF

///Draconian Active - Blood Boil///

///Cooldown///

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

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

ON=@Equip
TIMER=1
SRC.DIALOGCLOSE DRACONIAN_PA
SRC.DIALOG DRACONIAN_PA

ON=@UNEQUIP

SRC.DIALOGCLOSE DRACONIAN_PA
SRC.DIALOG DRACONIAN_PA

ON=@Timer
// Take the effect we would like.
if ( <CONT> )
if ( <MORE1> )
MORE1 -= 1
CONT.TAG.COOLDOWN -= 1
TIMER=1
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

///Invul///
[ITEMDEF i_timer_UA_draco2]
NAME=Delay Teleport
ID=i_handr_1
TYPE=T_EQ_SCRIPT

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

ON=@EQUIP
TIMER=1
SRC.EVENTS=+e_draconian_charge //Immunity to magic
//SRC.TAG.SKINCOLOR=<SRC.COLOR>
//SRC.COLOR=098e

ON=@Timer
// Take the effect we would like.
if ( <CONT> )
if ( <MORE1> )
MORE1 -= 1
TIMER=1
return 1
else
CONT.SYSMESSAGE Your Blood Boil has worn off.
SOUND 1389
CONT.EVENTS=-e_draconian_charge
//CONT.COLOR=<CONT.TAG.SKINCOLOR>
//CONT.TAG.SKINCOLOR=
remove
endif
endif
// normal timer fall through is to delete the item
remove
return 1

[EVENTS e_draconian_charge]

ON=@SPELLEFFECT
//blocks all magic, even friendly magic.
SOUND=513
RETURN 1
ENDIF

ON=@GETHIT
//Blocks all NPC damage
if (<SRC.brain> = 0) // Prevents it working against other players
RETURN 0 // so players can still hit
ELSE
RETURN 1 // remove the damage
ENDIF
(This post was last modified: 10-26-2014 11:57 PM by UltimaAku.)
10-26-2014 11:56 PM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)