Jump to content

Johnson

Members
  • Posts

    23
  • Joined

  • Last visited

Posts posted by Johnson

  1. Hi, will test this once I got back from vacation. Thanks guys!

    22 hours ago, Haruka Mayumi said:
        setarray .C_PetEggs,
        9150, 9151, 9152, 9153, 9154, 9155, 9156, 9157, 9158, 9159, 9198, 9200, 9201, 9203, 9204, 9206, 9210;
    
    	getinventorylist();
    	for(.@i=0;.@i<@inventorylist_count;.@i++){
    		if(inarray(.C_PetEggs,@inventorylist_id[.@i]) < 0) continue; // If the item is not an egg from the array list. continue the loop
    		if(!@inventorylist_attribute[.@i]){ // Check if the egg is not hatched, Attribute 1 if it is hatched, 0 if not.
    			delitemidx @inventorylist_idx[.@i],1; // Delete the item via the index
    			.@delete++;	// Add a counter for deleted eggs
    		}
    		if(.@deleted >= 10) break; // if the deleted eggs is more than 10. exit the loop
    	}
    
    	mes "10 Unhatched eggs are deleted.";

     

     

  2. Tried this hmm seems like when it execute on the block .@roll it returns to this error below.

    Also, fragment and combine is different from exchanger right? Or exchanger not yet applied?

    [Error]: buildin_rand: minimum (1) and maximum (1) are equal. No randomness possible.
    [Warning]: Script command 'rand' returned failure.
    [Debug]: Source (NPC): Pet Combination#1 at payon (95,114)
    [Error]: buildin_rand: minimum (1) and maximum (1) are equal. No randomness possible.
    [Warning]: Script command 'rand' returned failure.
    [Debug]: Source (NPC): Pet Combination#1 at payon (95,114)
    [Debug]: npc_scriptcont: Pet Combination#1 (sd->npc_id=110080596) is not 'Unknown NPC' (id=0).


    Thanks for this pajodex. Would like to see more updates

  3. Could this be possible instead of an item which accumulate inventory count of 1/100 to make it as a permanent variable without the item like bonus, bonus2, bonus3* bonus4*.

    General Idea:
    NPC quest or card deposit.

    if deposited card = 10
    delete x10 cards
    then give some bonus to the attached player.
    Say like bonuses below if all x10 cards are met
          bonus bMdef,3;
          bonus2 bAddRace,RC_Insect,5;
          bonus2 bMagicAddRace,RC_Insect,5;
          bonus2 bSubRace,RC_Insect,5;
          bonus3 bAddMonsterDropItem,518,RC_Insect,2;

  4. Hi,

    For Context: I'm creating an exchange script of Common Eggs to item(not egg).

    Scenario: if player has 10 of Common Eggs it will be deleted and will receive an item. Excluding the hatched egg of current player.

    I have an array list of Pet Eggs and if the player has >= 10 based on .C_PetEggs it will delitem all the captured itemIDs.

    Note* : Pet Eggs is only 1 as default as it is non-stackable

    I'm having trouble as it deletes the hatched egg and will be deleted as well on database and cannot return to egg or feed etc.

      setarray .C_PetEggs,
      9150, 9151, 9152, 9153, 9154, 9155, 9156, 9157, 9158, 9159, 9198, 9200, 9201, 9203, 9204, 9206, 9210; 
    
            
    	getinventorylist;
    	for (set .@i, 0; .@i < @inventorylist_count; set .@i, .@i + 1) {
    			
    		for (set .@j, 0; .@j < getarraysize(.C_PetEggs); set .@j, .@j + 1) {
    			if(@inventorylist_id[.@i] == .C_PetEggs[.@j]){
    				if(countitem(.C_PetEggs[.@j]) > 0){
    					if(.@ctr == 10)
    						end;
    					delitem .C_PetEggs[.@j], 1;
    					.@ctr++;
    				}else end;
    			}
    		}
    	}
     
  5. You can do it with simple script below, then use it on the item you want. Haven't tested it yet.
     

    function    script    testlevel    {
    
    OnDo:
        goto(job_menu);
    
    job_menu:
        switch(select("Assassin Cross","Lord Knight")){
            case 1:
                jobchange 4013;
                set BaseLevel,99;
                set JobLevel,70;
                break;
            case 2:
                jobchange 4008;
                set BaseLevel,99;
                set JobLevel,70;
    	    break;
        }
        end;
    }

     

  6. On 1/23/2024 at 10:56 PM, Emistry said:

    also can try using npc script if you want.

    -	script	getmapmob_main	-1,{
      OnInit:
    	  bindatcmd "getmapmob", strnpcinfo(3) + "::OnAtcommand";
    	  end;
    
    	OnAtcommand:
    		.@map$ = strcharinfo(3);
    		if (.@atcmd_numparameters) {
    			if (getmapusers(.@atcmd_parameters$) == -1) {
    				dispbottom "Invalid map " + .@atcmd_parameters$+".";
    				end;
    			}
    			.@map$ = .@atcmd_parameters$;
    		}
    		.@size = getmapunits(BL_MOB, .@map$);
    		for (.@i = 0; .@i < .@size; .@i++) {
    			getunitdata .@array[.@i], .@array;
    			if (!.@mobcount[.@array[UMOB_CLASS]]) {
    				.@mob_id[.@mob_id_size] = .@array[UMOB_CLASS];
    				.@mob_id_size++;
    			}
    			.@mob[.@array[UMOB_CLASS]]++;
    		}
    		dispbottom "Found "+ .@mob_id_size + " monsters at " + strcharinfo(3);
    		for (.@i = .@mob_id_size - 1; .@i >= 0; .@i--) {
    			if (getmonsterinfo(.@mob_id[.@i], MOB_MVPEXP) > 0)
    				continue;
    			dispbottom sprintf(" %s[%d] : %d", getmonsterinfo(.@mob_id[.@i], MOB_NAME), .@mob_id[.@i], .@mob[.@mob_id[.@i]]);
    			deletearray .@mob_id[.@i], 1;
    			.@mob_id_size--;
    		}
    		dispbottom "Found "+ .@mob_id_size + " normal monsters at " + strcharinfo(3);
    		for (.@i = 0; .@i < .@mob_id_size; .@i++) {
    			dispbottom sprintf(" %s[%d] : %d", getmonsterinfo(.@mob_id[.@i], MOB_NAME), .@mob_id[.@i], .@mob[.@mob_id[.@i]]);
    		}
    		end;
    }

    but this may cause performance issue, use at your own risk.

    Hi Emistry, Thanks for this i have managed to do it in src. Will still test this out tho thanks!

  7. 5 hours ago, Rynbef said:

    The function starts from top of the script when called. I don't know what u want to do with this script but. U need the right syntax und commands. rA Scripts are complete different to classic programming languages and it's more a script language. U can take a look at doc/script_commands.txt and the example scripts to learn it.

    I've changed it and removed unnecessary thinks. But don't understand the usage for the script. What u want to do is not clear for me.

    menuskills.txt 408 B · 0 downloads

     

    Rynbef~

    Hi Rynbef, I have managed to fix double continuation I was messing with my script and managed to fix it. Thx

  8. May I ask help on getting monster to display on mapmoblist command. Somehow, it is not showing any monster data when use on @mapmoblist

    image.png.073347d321703b7a4234ea6b418448ee.png

    atcommand.cpp
     

    static int count_mob(struct block_list *bl, va_list ap) // [FE]
    {
       struct mob_data *md = (struct mob_data*)bl;
       short id = va_arg(ap, short);
       if (md->mob_id == id)
           return 1;
       return 0;
    }
    
    ACMD_FUNC(mapmoblist) // [FE]
    {
       char temp[100];
       bool mob_searched[MAX_MOB_DB];
       bool mob_mvp[MAX_MOB_DB]; // Store mvp data..
       struct s_mapiterator* it;
       unsigned short count = 0, i, mapindex = 0;
       int m = 0;
    
    
       memset(mob_searched, 0, MAX_MOB_DB);
       memset(mob_mvp, 0, MAX_MOB_DB);
    
       if (message && *message) {
           // Player input map name, search mob list for that map
           mapindex = mapindex_name2id(message);
           if (!mapindex) {
               clif_displaymessage(fd, "Map not found");
               return -1;
           }
           m = map_mapindex2mapid(mapindex);
       } else {
           // Player doesn't input map name, search mob list in player current map
           mapindex = sd->mapindex;
           m = sd->bl.m;
       }
    
       clif_displaymessage(fd, "--------Monster List--------");
    
       sprintf(temp, "Mapname: %s", mapindex_id2name(mapindex));
       clif_displaymessage(fd, temp);
    
       clif_displaymessage(fd, "Monsters: ");
    
       //Looping and search for mobs
       it = mapit_geteachmob();
       while (true) {
           TBL_MOB* md = (TBL_MOB*)mapit_next(it);
           uint16 mob_id;
           std::shared_ptr<s_mob_db> mob = mob_db.find(mob_id);
    
           if (md == NULL)
               break;
    
           if (md->bl.m != m || md->status.hp <= 0)
               continue;
           if (mob_searched[md->mob_id] == true)
               continue; // Already found, skip it
           if (md->db->mexp) {
               mob_searched[md->mob_id] = true;
               mob_mvp[md->mob_id] = true; // Save id for later
               continue; // It's MVP!
           }
    
           mob_searched[md->mob_id] = true;
           count = map_foreachinmap(count_mob, m, BL_MOB, md->mob_id);
    
           sprintf(temp, " %s[%d] : %d", mob->jname, md->mob_id, count);
    
           clif_displaymessage(fd, temp);
       }
       mapit_free(it);
    
       clif_displaymessage(fd, "MVP: ");
    
       // Looping again and search for mvp, not sure if this is the best way..
       for (i = 1000; i < MAX_MOB_DB; i++) { //First monster start at 1001 (Scorpion)
           if (mob_mvp[i] == true) {
               TBL_MOB* md = (TBL_MOB*)mapit_next(it);
               count = map_foreachinmap(count_mob, m, BL_MOB, i);
               sprintf(temp, " %s[%d] : %d", md->db->jname, i, count);
               clif_displaymessage(fd, temp);
           }
       }
    
       return 0;
    
    
    
    }
    
    ACMD_DEF(mapmoblist),

    Reference & Credits to FatalError:

     

  9. How do I link the item with enchant options from `<ITEM> <INFO> </INFO></ITEM>`

    I've tried this but just linking the Hat with no random option info

    Quote

    mes "<ITEM>" + getitemname(.@id) + "[" + getitemslots(.@id) + "]<INFO>" + .@id[getrandomoptinfo(.@r_v)]  + "</INFO></ITEM>";

    In this line of script:
    if(.KeepItemData)
     set .@ref, getitem3(.@id,1,1,.@r,0,.@c0,.@c1,.@c2,.@c3,.@r_id,.@r_v,.@null);
     else
     getitem3(.@id,1,1,0,0,0,0,0,0,.@r_id,.@r_v,.@null);
     equip(.@id);
     .@s = getarraysize(getd(".ro_id_" + .@id));
     mes "<ITEM>" + getitemname(.@id) + "[" + getitemslots(.@id) + "]<INFO>" + .@id[getrandomoptinfo(.@r_v)] + "</INFO></ITEM>";
     mes "Done!";

     

  10. Good day! I'm having trouble on this warning and dunno in what part on the script made the error. Appreciate any help. Thanks a lot!

     

    Item_db_usable.yml
    Spoiler
      - Id: 70000
    Script: |
        callfunc("menuskills");


    menuskills.txt

    Spoiler
    function    script  menuskills  {
    OnDo:
            sc_end SC_MENUSKILLS;  
            goto(main_menu);
            end;
    main_menu:
        .@menu$ = "[Skills Menu]";
        mes .@menu$;
       
        .@main_menu = select("Start Skills","Stop Skills","Cancel");
        if( .@main_menu == 1 ){
            menuskills_item;
            message strcharinfo(0),"Skill Active";
        }
        if( .@main_menu == 2 )
            goto(OnDo2);
        close;
    OnDo2:
            sc_end SC_MENUSKILLS;
            message strcharinfo(0),"Skills Deactivated";
            end;
    }
     

    Console log:
    image.png?ex=6593491d&is=6580d41d&hm=9249eac4370fceaeb64052b86dceb9b1fd7c99681c3456039a248392b2f99353&

  11. On 12/17/2023 at 9:09 AM, WhiteEagle said:

    It's not the question, but maybe it helps.

    That's shows the skill-name instead of the ID. 😄

    I've got this already. The problem I encounter was when selecting the skill ID 42 or 153 it does not return the ID i've selected. instead it return basic skill which is skill id = 1

    Edit: Solved

  12. I'm tryna do something with @skilllist_id that returns all skills based on player class(Job).
    However, i get all skills including passives. I created a sample script that lists all skill that is an attack.
    I get the result of 42 < Mammonite, 153 < Cart Revolution for blacksmith.
    when i tried using a for loop and the menu will show up like this.
    image.png.6dc02123cc627d56ff277edf82043a97.png

    After selecting 42, it returns ID: 2 which is not the skill ID that i have selected.
    image.png.ff03f64a78410bb8908eea23a54b8383.png

    Code Snippet:

    getskilllist;
     
        for(set .@i, 0; .@i < @skilllist_count; set .@i, .@i+1){
    if (@skilllist_flag != NoDamage){
    set .@menu$, .@menu$ + ":" + getskillname(@skilllist_id[.@i];
    }

    }

     

    .@skillids = select(.@men$+":Cancel") -1;           
    mes "Skill level to use:";
                mes "[" + getskillstring(0,.@skillids) + "]" + " - Max lv : " + getskilllv(.@skillids);
                input .@attskilllvl;
     
            } while(.@attskilllvl < 0 || .@attskilllvl > getskilllv(.@skillids));
     
            setattack(.@skillids + ";" + .@attskilllvl);

    in the array for @skilllist_id how does it get the skills and how will i remove the skills after setting it in select(.@men$)

     

  13. can this still be implemented on latest rathena git? I'm having trouble applying the patch and diff since it does not contains all the texts. ex:

    @Autopilot.patch

    -line 27600 (stops from there "{")


    @@ -11734,7 +11834,7 @@ if (!((targetmd2->status.def_ele == ELE_HOLY) || (targetmd2->status.def_ele < 4)
                 // *** Note I changed this to make the damage depend on missing HP more and it also costs 5 balls.
                 // Only use when wounded.
                 if (canskill(sd)) if (pc_checkskill(sd, SR_GATEOFHELL) > 0)
    -                    if (sd->spiritball >= 5) if (havepriest && havehealer)
    +                    if (sd->spiritball >= 5)
                             if (sd->battle_status.sp > sd->battle_status.max_sp*0.33)
                                 if (sd->battle_status.hp < sd->battle_status.max_hp*0.3)
                                 {

  14. I'm looking for Compensation code redeemer where features are alike the ff:

    -Compen code (1201MAINTENANCE) generated by admin
    - 1201MAINTENANCE < can consist of multiple items that will be inputted by admin
    - Player1 Redeem 1201MAINTENANCE= get items
    - Checks if 1201MAINTENANCEredeemed already by Player1 (ip/mac)
    - Player2 Redeem 1201MAINTENANCE= get items
    - 1201MAINTENANCEcan be redeemed by all players but is once per ip/mac

    - Create tables and for log

    Sample like below:

    Player inputs 1201MAINTENANCE
    image.png.c8d3412e850d1c28eaf0ea85e1625bd4.png

    image.png.3212ec117c24c6b3fc32b692ec5114a1.png

    = items received from 1201MAINTENACE

    if 1201MAINTENANCE is entered by ip/account
    image.png.91217d62e949f876adc711d63a34ad88.png

×
×
  • Create New...