![]() |
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 |
RE: Request for a gump to show cooldown of a skill - Runcuks - 10-25-2014 04:21 PM Try something like this maybe it will help ![]() [function haha] trysrc <UID> dialogclose d_status trysrc <UID> dialog d_status RE: Request for a gump to show cooldown of a skill - Coruja - 10-26-2014 02:34 AM 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 RE: Request for a gump to show cooldown of a skill - UltimaAku - 10-26-2014 09:54 PM 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. RE: Request for a gump to show cooldown of a skill - Feeh - 10-26-2014 10:57 PM 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? RE: Request for a gump to show cooldown of a skill - UltimaAku - 10-26-2014 11:56 PM Thank you all for your help! The script works perfectly now ![]() 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 ![]() 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 |