Jump to content

Emistry

Forum Moderator
  • Posts

    10015
  • Joined

  • Days Won

    405

Posts posted by Emistry

  1. function	script	F_CASH_SHOP_RANDOM	{
    	.@item_id = getarg(0);
    	.@amount = getarg(1);
    	
    	setarray .@OptID[0],RDMOPT_WEAPON_ATTR_TELEKINESIS, RDMOPT_VAR_MAXHPAMOUNT;
    	setarray .@OptVal[0],10,10;
    	setarray .@OptParam[0],0,0;
    	
    	.@item_type = getiteminfo(.@item_id, ITEMINFO_TYPE);
    	if (.@item_type == IT_ARMOR || .@item_type == IT_WEAPON)
    		getitem3 .@item_id,.@amount,1,0,0,0,0,0,0,.@OptID,.@OptVal,.@OptParam;
    	else
    		getitem .@item_id,.@amount;
    	return;
    }
    function	script	Costumes_R	{
    
    	set .@Total,14;
    	//<%>,<ItemID>,<Amount>	
    	setarray .@P1[0],10,20764,1; //Fallen Angel Wing
    	setarray .@P2[0],20,45008,1; //Flapping Angel Wing
    	setarray .@P3[0],30,969,1; 	 //Gold
    	setarray .@P4[0],30,7620,2;  //Enriched Oridecon
    	setarray .@P5[0],30,7620,2;  //Enriched Elunium	
    	setarray .@P6[0],70,7179,10; //Pods
    	setarray .@P7[0],70,12259,2; //Miracle Medecine
    	setarray .@P8[0],70,12684,10; //Speed Potion
    	setarray .@P9[0],70,14586,5; //Spark Candy	
    	setarray .@P10[0],70,16682,1; //Halter Box
    	 
    	setarray .@P11[0],90,12906,1; //Hwergelmir's Tonic
    	setarray .@P12[0],90,12904,1; //Steamed Scorpion
    	setarray .@P13[0],90,12903,1; //Steamed Tongue
    	setarray .@P14[0],90,12908,1; //Immortal Stew
    	
    	setarray .@Default[0],45101,1; //Token Scrolls
    	set .@i, rand(1,.@Total);
    	if (rand(1,100) > getd(".@P"+.@i+"[0]"))
    	{
    		for(set .@j,0; .@j<getarraysize(.@Default); set .@j,.@j+2)
    		{
    			// getitem .@Default[.@j], .@Default[.@j+1];
    			callfunc("F_CASH_SHOP_RANDOM", .@Default[.@j], .@Default[.@j+1]);
    			if(!.@k[0])
    				setarray .@k[0], .@Default[.@j], .@Default[.@j+1];
    		}
    	}
    	else{
    		for(set .@j,1; .@j<getarraysize(getd(".@P"+.@i)); set .@j,.@j+2)
    		{
    			// getitem getd(".@P"+.@i+"["+.@j+"]"), getd(".@P"+.@i+"["+(.@j+1)+"]");
    			callfunc("F_CASH_SHOP_RANDOM", getd(".@P"+.@i+"["+.@j+"]"), getd(".@P"+.@i+"["+(.@j+1)+"]"));
    			if (!.@k[0])
    			{
    				set .@gz,.@i;
    				setarray .@k[0], getd(".@P"+.@i+"["+.@j+"]"), getd(".@P"+.@i+"["+(.@j+1)+"]");
    				break;
    			}
    		}
    	}
    	
    	if(1<=.@gz&&.@gz<=9)
    		announce ""+strcharinfo(0)+" has opened [Devil Scroll] and reward ["+getitemname(.@k[0])+" x "+.@k[1]+"]!",0;
    	specialeffect2 251;
    	end;
    }

     

    • MVP 1
  2. it was added to ensure character will auto disconnect after it reached the time limit.

    if you dont need it, might as well just remove the whole block of codes.

        if( battle_config.at_timeout ) {
            int timeout = atoi(message);
            status_change_start(NULL,&sd->bl, SC_AUTOTRADE, 10000, 0, 0, 0, 0, ((timeout > 0) ? min(timeout,battle_config.at_timeout) : battle_config.at_timeout) * 60000, 0);
        }

    or just disable the at_timeout settings as mentioned previously.

  3. -	script	Sample	-1,{
    	OnTalk:
    		mes "Enter Mob ID";
    		input .@mob_id;
    		getmobdrops(.@mob_id);
    		.@count = $@MobDrop_count;
    		copyarray .@mob_drop_item, $@MobDrop_item, .@count;
    		for (.@i = 0; .@i < .@count; .@i++) {
    			mes getitemname(.@mob_drop_item[.@i]);
    			.@menu$ = .@menu$ + getitemname(.@mob_drop_item[.@i]) + ":";
    		}
    		.@i = select(.@menu$) - 1;
    		MOB_DROP_MOB_ID = .@mob_id;
    		MOB_DROP_ITEMID = .@mob_drop_item[.@i];
    		MOB_DROP_KILL = 0;
    		close;
    		
    	OnNPCKillEvent:
    		if (killedrid == MOB_DROP_MOB_ID) {
    			MOB_DROP_KILL++;
    			if (MOB_DROP_KILL && MOB_DROP_KILL % 100 == 0)
    				getitem MOB_DROP_ITEMID, 1;
    		}
    		end;
    }
    
    prontera,155,181,5	script	NPC	757,{
    	doevent "Sample::OnTalk";
    }

    try this

  4. 
    *npcshopadditem "<name>",<item id>,<price>{,<item id>,<price>{,<item id>,<price>{,...}}};
    *npcshopadditem "<name>",<item id>,<price>,<stock>{,<item id>,<price>,<stock>{,<item id>,<price>,<stock>{,...}}};
    
    This command will add more items at the end of the selling list for the
    specified NPC shop or cashshop. If you specify an item already for sell, that item will
    appear twice on the sell list.
    
    The function returns 1 if shop was updated successfully, or 0 if not found.
    
    NOTES:
     - That you cannot use -1 to specify default selling price!
     - If attached shop type is market shop, need an extra param after price, it's <stock>
       and make sure don't add duplication item! For unlimited stock use -1.
    OnHour00:
    	// reset the shop item list
    	npcshopitem "shop_name", 909, 1;
    	npcshopdelitem "shop_name", 909;
    	
    	// add item with random price
    	npcshopadditem "shop_name", 756, rand(500, 1000);
    	npcshopadditem "shop_name", 1260, rand(1000000, 2500000);
    	npcshopadditem "shop_name", 2609, rand(1000, 1500);
    	npcshopadditem "shop_name", 4110, rand(2000000, 2300000);
    	npcshopadditem "shop_name", 13404, rand(3000000, 3200000);
    	npcshopadditem "shop_name", 4435, rand(5000000, 7000000);
    	end;
    	

     

    • Upvote 1
  5. *guardian "<map name>",<x>,<y>,"<name to show>",<mob id>{,"<event label>"{,<guardian index>}};
    
    This command is roughly equivalent to 'monster', but is meant to be used with
    castle guardian monsters and will only work with them. It will set the guardian
    characteristics up according to the castle's investment values and otherwise
    set the things up that only castle guardians need.
    
    Since trunk r12524:
    Returns the id of the mob or 0 if an error occurred.
    When 'guardian index' isn't supplied it produces a temporary guardian.
    Temporary guardians are not saved with the castle and can't be accessed by guardianinfo.

    just execute this script command as many times as you want to create the guardian you need for each castles.

  6. perhaps try alter the condition checking here ?

      if( itemdb_isenchant(sd->inventory.u.items_inventory[idx_card].nameid) && item_eq->slots > 3 )
            return 0; // Reserved slot for Enchant is a normal slot

    into

      if(!itemdb_isenchant(sd->inventory.u.items_inventory[idx_card].nameid) && idx_card == (item_eq->slots - 1))
            return 0; // Reserved slot for Enchant is a normal slot

    or

      if(itemdb_isenchant(sd->inventory.u.items_inventory[idx_card].nameid) && idx_card != (item_eq->slots - 1))
            return 0; // Reserved slot for Enchant is a normal slot

     

  7. @b = callsub(L_RefinePart, EQI_HAND_R, EQI_HAND_L);
    // @b = callsub(L_RefinePart, EQI_HEAD_TOP, EQI_ARMOR, EQI_GARMENT, EQI_SHOES, EQI_HAND_L);
    _check(@b);
    ...
    ...
    ...
    L_RefinePart:
    	.@getargcount = getargcount();
    	
    	.@menu$ = "";
    	for (.@i = 0; .@i < .@getargcount; .@i++) {
    		.@part = getarg(.@i, 0);
    		.@item_id = getequipid(.@part);
    		if (.@item_id != -1) {
    			.@menu$ = .@menu$ + getitemname(.@item_id);
    		}
    		.@menu$ = .@menu$ + ":";
    	}
    	.@part = select(.@menu$) - 1;
    	return getarg(.@part);

    with so limited info, I guess you are just trying to fix the value stored in the @b variable.

    either you are using old emulator or old npc script, you should fix that.

  8. On 12/28/2022 at 4:34 AM, gleynn said:

    how can i make the dispbottom to reflect the first 3 rows of result?

    input .@item_id;
    .@size = query_sql("SELECT char_id, nameid, amount FROM `inventory` HAVING nameid = "+.@item_id+" ORDER BY amount DESC LIMIT 3",.@charid,.@nameid,.@amnt);
    for (.@i = 0; .@i < .@size; .@i++)
    	dispbottom .@charid[.@i]+" : "+getitemname(.@nameid[.@i])+" "+.@amnt[.@i]+"pcs";
    end;

     

×
×
  • Create New...