Jump to content

bWolfie

Members
  • Content Count

    848
  • Joined

  • Last visited

  • Days Won

    34

Posts posted by bWolfie


  1. First create a table, perhaps called orcs_memory
    Btw, this is just off the top of my head. I cannot confirm works.

    Create table with the following columns:
    
    party_id (needs to be integer)
    party_name (needs to be string)
    time (needs to be string)
    
    Then, the moment your instance completes,
    you can the add following script:
    
    .@PID = getcharid(CHAR_ID_PARTY);
    .@PN$ = getpartyname(.@PID);
    .@time$ = ...(I wrote in the last post how to get this)
    
    query_sql("INSERT INTO `orcs_memory` VALUES (" + .@PID + ", '" + escape_sql(.@PN$) + "', '" + .@time$ + "')");
    
    And then for your npc, the sql query:
    
    prontera,150,150,3	script	Orcs Memory Rank	CLEAR_NPC,{
    	query_sql("SELECT `party_name`, `time` FROM `orcs_memory` ORDER BY `time` ASC LIMIT 10", .@pname$, .@rank$);
    	mes("Orcs Memory Rank");
    	for (.@i = 0; .@i < getarraysize(.@rank$); ++.@i)
    		mes("" + .@pname$[.@i] + " - " + .@rank$[.@i] + "");
    	close;
    }

     


  2. Before I start, I need to let you know a few things about my potential solution.

    1. I have never tried this before.
    2. I don't know how initnpctimer() interacts with instance NPCs.
    3. I don't have time to test. This might help you get started / understanding the process.
    // Add this NPC script to the OrcsMemory.txt instance script.
    	2@orcs,1,1,0    script    Orcs_Memory_Timer    FAKE_NPC,{
        end;
    }
    /*************
    * Notes
    **************
    Immediately after the instance is created, add
    this line below it:
    	initnpctimer("Orcs_Memory_Timer");
    
    I don't know how the Orc's Memory instance ends, but
    when it ends (maybe you need to add an event for when
    the mob is killed), add these lines:
    	stopnpctimer("Orcs_Memory_Timer");
    	.@time = getnpctimer("Orcs_Memory_Timer") / 1000;
    	if (.@time < $Orcs_Memory_Record)
    	{
       		// This next bit will display time as 00:00:00 format
            .@hour$ = .@time % (24*60*60) / (60*60) + "";
            .@min$  = .@time % (24*60*60) % (60*60) / (60) + "";
            .@sec$  = .@time % (24*60*60) % (60*60) % (60) + "";
            .@time$ = "" +(getstrlen(.@hour$) == 1 ? "0" : "")+ "" + .@hour$ + ":" +(getstrlen(.@min$) == 1 ? "0" : "")+ "" + .@min$ + ":" +(getstrlen(.@sec$) == 1 ? "0" : "")+ "" + .@sec$ + "";
            announce("The " + getpartyname(CHAR_ID_PARTY) + " party cleared the dungeon in " + .@time$ + ", a new record!", bc_all);
            $Orcs_Memory_Record = .@time;
    	}
    
    You will need to set the $Orcs_Memory_Timer to
    something really high before the first party
    does the instance. This is so the first party
    to clear the dungeon will be the first record.
    I advise going in-game and using the following
    atcommand:
    	@set $Orcs_Memory_Timer 1000000000
    	(that's 1 billion seconds lol)
    *************/
    

  3. Wondering if anybody could update this plugin? Seems it no longer works.

    nohomunc.c: In function ‘clif_parse_LoadEndAck_post’:
    nohomunc.c:62:21: warning: variable ‘hd’ set but not used [-Wunused-but-set-variable]
      struct homun_data *hd;
                         ^
    nohomunc.c: In function ‘homunculus_call_post’:
    nohomunc.c:85:2: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
      if (retVal___ = true) {
      ^
    nohomunc.c:79:21: warning: variable ‘hd’ set but not used [-Wunused-but-set-variable]
      struct homun_data *hd;
                         ^
    nohomunc.c: In function ‘homunculus_create_post’:
    nohomunc.c:104:2: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
      if (retVal___ = true) {
      ^
    nohomunc.c:97:21: warning: variable ‘hd’ set but not used [-Wunused-but-set-variable]
      struct homun_data *hd;
    


  4. I wish you the best of luck. I cannot offer anything but this.

    As Dastgir writes below, this is a dream project for any RO person out there. Not having to rely on client releases would be awesome.


  5. According to npc.c, this is how array values for OnBuyItem/OnSellItem are genereated. Maybe you can work something out from it.

     
    	//npc_buylist for script-controlled shops.
    int npc_buylist_sub(struct map_session_data *sd, struct itemlist *item_list, struct npc_data *nd)
    {
        char npc_ev[EVENT_NAME_LENGTH];
        int i;
        int key_nameid = 0;
        int key_amount = 0;
    	    nullpo_ret(item_list);
        nullpo_ret(nd);
    	    // discard old contents
        script->cleararray_pc(sd, "@bought_nameid", (void*)0);
        script->cleararray_pc(sd, "@bought_quantity", (void*)0);
    	    // save list of bought items
        for (i = 0; i < VECTOR_LENGTH(*item_list); i++) {
            struct itemlist_entry *entry = &VECTOR_INDEX(*item_list, i);
            intptr_t nameid = entry->id;
            intptr_t amount = entry->amount;
            script->setarray_pc(sd, "@bought_nameid", i, (void *)nameid, &key_nameid);
            script->setarray_pc(sd, "@bought_quantity", i, (void *)amount, &key_amount);
        }
    	    // invoke event
        snprintf(npc_ev, ARRAYLENGTH(npc_ev), "%s::OnBuyItem", nd->exname);
        npc->event(sd, npc_ev, 0);
        return 0;
    }
    


  6. I'm trying to use npcshopattach() on a shop in another script. Can this be done? Always returns false.

    if (npcshopattach("My_Shop") == false)
            mes("FALSE");
    else
            mes("TRUE");
    close;
    

    And in another script:

    -    trader    My_Shop    FAKE_NPC,{
    OnInit:
        tradertype(NST_CUSTOM);
        sellitem(Red_Potion, 1);
        end;
    
    OnCountFunds:
        setcurrency(countitem(Orange_Potion));
        end;
    	OnPayFunds:
        if (countitem(Orange_Potion) < @price)
            end;
    	    delitem(Orange_Potion, @price);
        purchaseok();
        end;
    }
    


  7. Hi,

    I want to use the eA Job System to check an 'if' statement, having some trouble.
    I want the statement to check:

    • If user is fully advanced class (e.g. Lord Knight, Paladin) OR user is at the end of the baby line (e.g. Baby Knight, Baby Hunter).
    • User is NOT first class (can the classes above).

    This is my script.

    .@eac = eaclass();
    // if (2-1/2-2 + rebirth OR 2-1/2-2 + baby BUT NOT FIRST CLASS)
    if (.@eac&EAJL_2&(EAJL_UPPER|EAJL_BABY))
    {
         dothis();
    }
    

  8. Ordinal Suffix Function
    File Name: Ordinal Suffix
    File Submitter: Myriad
    File Submitted: 5 June 2017
    File Category: Quests, Shops, Functions & Algorithms Releases

    Ever been constructing a string and wanted to turn 1 into 1st? Or 2 -> 2nd? Well, there is now an answer!
    I call it 'Ordinal Suffix'. It adds a suffix to the end of your number using the callfunc() script command. Example below:

    .@first = 1;
    .@second = 2;
    mes("That's the " + callfunc("Ordinal_Suffix", .@first) + " time you told me that!"); // Will return "That's the 1st time you told me that!"
    mes("That's the " + callfunc("Ordinal_Suffix", .@second) + " time you told me that!"); // Will return "That's the 2nd time you told me that!"
    mes("That's the " + callfunc("Ordinal_Suffix", 11) + " time you told me that!"); // Will return "That's the 11th time you told me that!"
    

    → Special cases such as '11th', '12th' and '13th' are accounted for.
    → Can only be used with integers.
    → Works for all possible numbers (except 0 will return 0th, not sure what that is supposed to be).

    Script can be 'downloaded' at this pastebin link: https://pastebin.com/6Z5k1S70


  9. Bumping this to say I found the solution and wanted to post it for future users.

    In channel.c, find:

    clif->messagecolor_self(sd->fd, COLOR_RED, msg_sd(sd,1455));

    Replace with:

    char output[150];
    sprintf(output, msg_txt(1550), DIFF_TICK(sd->hchsysch_tick + chan->msg_delay*1000, timer->gettick()) / 1000); // "You cannot send a message to this channel for another %d seconds."
    clif->messagecolor_self(sd->fd, COLOR_RED, output);

    In messages.conf, create a new custom message. In the example above, 1550 was used. You should use whatever the next available one is.

    1550: You cannot send a message to this channel for another %d seconds.


  10.  

     

     

    Very nice, haven't updated my herc files in a while, glad to see some awesome changes. Thanks for the summary. 

     

    I concur. Last updated Herc October 2016, seems there's tons of new stuff since then. In the process of getting up to speed.

     

    I suggest stay on your version :) updated one seems very unstable.

     

    Actually there was an issue with item cloning; but this was resolved

     

    Thanks for the advice. I go commit by commit since our server has messy custom code everywhere, so not too much of an issue to review what we are putting in.


  11. I was thinking, how about a disabled_status mapflag or map zone conf?

    How it would work is whenever 'SC_STATUS' is specified in that mapflag (or map zone?), it will automatically end or not allow that status to take place.

     

    Example hypothetical mapflag:

     

    prtg_cas01     mapflag    nostatus    SC_ASSUMPTIO

     

    In this instance, when on the map prtg_cas01, even if a player can use a skill which does this status (i.e. Assumptio, High Priest Skill), the status will not take effect.

    And any new players entering this map will automatically lose SC_ASSUMPTIO.

     

    Or it could work in map_zone_db.conf. This example would do the same as above for Blessing and Assumptio statuses.

     

    disabled_status: {
          SC_ASSUMPTIO: true
          SC_BLESSING: true
    }
    

     

    Erm, just throwing an idea I thought of out there. Let me know what you guys think.

    Even if it's not suitable for official herc, maybe it will inspire someone :P

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.