• 0
caspe

Guild Announcement after Emergency Call ready

Question

Announcement after emergency call skill ready, also when EC skill used and try to use again it should show remaining time.

 

Share this post


Link to post
Share on other sites

7 answers to this question

  • 0

Logically through a script, you could initnpctimer() and then message() the AID. But I don't know how to do that through source.

Edit: just skimming through some source, I think you can use a combination of timer->gettick() and something else to perform the time counter. Not sure about sending a msg to the guild leader though. I think you can achieve the GL ID through sql query, im not sure about the announcement part tho.
Edit2: sorry, i dont actually have meaningful contribution, just rambling. Apologies.

Edited by Myriad

Share this post


Link to post
Share on other sites
  • 0

Thanks to @Smoke I made a source edit which will send a clif->message stating how long until ecall can be used again.
Unfortunately I couldn't figure out how to send an announcement once the timer is up.

PM me on herc discord if you are interested.

Edited by Myriad

Share this post


Link to post
Share on other sites
  • 0

Thanks to @Myriad now emergency call show remaining time

Here is changes:

skill.c

Spoiler

In skill.c, find:
-------------------
    if (sd)
        guild->block_skill(sd,skill->get_time2(skill_id,skill_lv));

In case GD_EMERGENCYCALL:
-------------------
Change to
-------------------
    if (sd)
    {
        guild->block_skill(sd,skill->get_time2(skill_id,skill_lv));
        pc_setglobalreg(sd, script->add_str("RECALL_DELAY"), time(0) + 300);
    }

message.conf

Spoiler

In conf/message.conf, add your custom message
-------------------
CUSTOM_MSG_NUMBER: You cannot use Emergency Call for another %d seconds.

clif.c

Spoiler

Find:

--------------------------------------------------------------------

if( pc_issit(sd) )
        return;

if( skill->not_ok(skill_id, sd) )
        return;

--------------------------------------------------------------------

Add this code after first if

-----------------------------------------------------------------------

if (skill_id == GD_EMERGENCYCALL &&
        sd->state.gmaster_flag &&
        pc_readglobalreg(sd,script->add_str("RECALL_DELAY")) > time(0))
    {
        char output[100];
        sprintf(output, msg_txt(CUSTOM_MSG_NUMBER), (DIFF_TICK(pc_readglobalreg(sd,script->add_str("RECALL_DELAY")), time(0)))); // You cannot use Emergency Call for another %d seconds.
        clif->message(sd->fd, output);
        clif->message(sd->fd, "Emergency Call failed.");
        return;
    }

 

Everything working fine except one compilation warning

map\skill.c(8111): warning C4244: 'function': conversion from 'time_t' to 'int', possible loss of data

Can someone help me to fix that. :innocent: using latest hercules revision. 

Edited by caspe

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now