Jump to content

astralprojection

Members
  • Content Count

    333
  • Joined

  • Last visited

  • Days Won

    8

Posts posted by astralprojection


  1. prontera,125,93,5	script	test_girl	1_F_MARIA,{
    	mes "[List Card]";
    	mes "Please select from "+getarraysize(.cards)+" cards";
    	.@s = select(.menu$) -1;
    	mes "You selected: "+getitemname(.cards[.@s]);
    	close;
    OnInit:
    	setarray .cards, 4244,4253,4252,4245,4032,4062,4248,4249,4043,4013,4018,4234,4344,4160,4243,4138,4242,4094,4240,4114,4075,4347,4246,4247,4233,4129,4119,4356,4074,4215,4327,4320,4214,4212,4213,4229,4063,4288,4290,4289,4284,4285,4009,4202,4299,4041,4015,4293,4235,4061,4153,4296,4040,4298,4297,4272,4170,4171,4133,4279,4173,4023,4082,4125,4122,4182,4181,4098,4178,4069,4180,4004,4177,4176,4056,4070,4251,4052,4360,4349,4262,4141,4267,4002,4316,4020,4080,4158,4319,4088,4312,4151,4152,4149,4323,4280,4110,4271,4270,4278,4087,4165,4150,4157,4060,4155,4072,4161,4283,4355,4162,4164,4325,4362,4331,4322,4345,4081,4045,4019,4103,4115,4035,4328,4321,4231,4269,4268,4239,4116,4109,4139,4065,4287,4286,4366,4351,4136,4301,4307,4140,4292,4091,4291,4295,4027,4184,4195,4188,4265,4217,4191,4193,4006,4364,4076,4201,4030,4079,4105,4112,4196,4055,4084,4113,4095,4046,4097,4124,4200,4067,4199,4341,4057,4205,4339,4204,4126,4208,4317,4343,4036,4106,4090,4108,4206,4167,4127,4166,4159,4334,4093,4338,4256,4255,4085,4066,4071,4237,4310,4309,4099,4031,4007,4314,4311,4315,4120,4118,4077,4329,4011,4008,4073,4335,4024,4048,4175,4033,4337,4005,4001,4313,4003,4294,4083,4186,4350,4187,4353,4104,4154,4185,4021,4014,4192,4194,4219,4101,4216,4017,4078,4068,4326,4358,4368,4273,4230,4117,4222,4092,4025,4221,4228,4044,4037,4100,4059,4086,4220,4022,4227,4039,4223,4156,4042,4224,4226,4225,4111,4218,4089,4304,4028,4340,4282,4058,4172,4016,4012,4026,4050,4308,4336,4049,4333,4107,4209,4053,4211,4210,4332,4348,4303,4102,4258,4232,4257,4010,4264,4029,4259,4261,4260,4034,4190,4189,4346,4051,4096,4064,4277,4281,4038,4274,4275;
    	for (.@i = 0; .@i < getarraysize(.cards); ++.@i)
    		.menu$ += "^FF0000[ "+( .@i+1 )+". ]^0000FF "+getitemname(.cards[.@i]) +":";
    	end;
    }

    Is it possible to make pagination on these menu? as you can see I have more than 300 entries and wanted to add those to menu.
     


  2. On 4/21/2022 at 5:45 PM, IndieRO said:

    as you can see on the function 
    megaphone can't use by job Novice

    Yes its true but it should return the dispbottom message if used by novice.
    The problem after  2nd try (still novice)  it display  .... Any work in progress (NPC dialog.... and need to relog to use again.


  3. {
    	Id: 12221
    	AegisName: "Megaphone_"
    	Name: "Megaphone"
    	Type: "IT_DELAYCONSUME"
    	Buy: 2
    	Weight: 10
    	Trade: {
    		nodrop: true
    		notrade: true
    		noselltonpc: true
    		nocart: true
    		nogstorage: true
    		nomail: true
    		noauction: true
    	}
    	Script: <" callfunc "F_Megaphone"; ">
    },

     

    function	script	F_Megaphone	{
    	if (Class == 0) {
    		dispbottom "Sorry, you can't use the channel while still a Novice";
    		end;
    	}
    	if (strcharinfo(PC_MAP) == "sec_pri" ) {
    		dispbottom "Sorry, you can't use the channel in jail.";
    		end;
    	}
    	input @megaphone$;
    	loudhailer(@megaphone$);
    	end;
    }

    1. Using novice use megaphone = "Sorry, you can't use the channel while still a Novice
    2 try again = Any work in progress (NPC dialog....

    any idea where i messed it up? 


  4.  

    I was trying to make my slave monster to not attack and make skills. It should just follow me.  Any help on my existing script? Thanks guys for the help.

    			@monster = monster(strnpcinfo(NPC_MAP), 0, 0, "Happy "+getmonsterinfo( getd("."+getarg(0)+"[3]"),MOB_NAME), getd("."+getarg(0)+"[3]"), 1);
    			.@masterID = getcharid(CHAR_ID_ACCOUNT);
    			setunitdata(@monster, UDT_MASTERAID, .@masterID);
    			setunitdata(@monster, UDT_MODE,getunitdata(@monster,UDT_MODE) &~ (128|8|4|2) ); 

     


  5. it looks like multiple login server is running.
    1. stop everything. ./athena-start stop
    2. list running process to verify using
    ps -e
    find login-server, map-server, char-server if still exist in the process

    then kill the  process.
    3. run again the server.


  6. 4 minutes ago, 4144 said:

    read in docs and see samples with NST_CUSTOM. see in doc folder

    /* custom npc trader */
    prontera,153,152,1	trader	TestCustom2	4_F_EDEN_OFFICER,{
    	OnInit:
    	tradertype(NST_CUSTOM);
    	sellitem Red_Potion,2;
    	end;
    
    /* allows currency to be item 501 and 502 */
    OnCountFunds:
    	setcurrency(countitem(Red_Potion),countitem(Orange_Potion));
    	end;
    
    /* receives @price (total cost) and @points (the secondary input field for cash windows) */
    OnPayFunds:
    	dispbottom "Hi: price="+@price+" and points="+@points;
        /*
        	check if how many item is sold already
           if max
    		   but sorry, we reach max purchase of item 
    			 end;
           else
             ok you can still buy
        */
    	if( countitem(Orange_Potion) < @points || countitem(Red_Potion) < @price-@points )
    		end;
    	delitem Orange_Potion,@points;
    	delitem Red_Potion,@price-@points;
    	purchaseok();
    	end;
    }

    that is why i want to  use that NTS_MARKET instead, no confusion.


  7. Just now, 4144 said:

    you not understand. don't change market c code.

    use shop type NST_CUSTOM in npc shop script.

     

    i understand master , it the official setup. but what i was trying to customize or achieve here that "qty limit" of item sold. It can't be done using NST_CUSTOM i believe. Correct me if im wrong. 


  8. 58 minutes ago, 4144 said:

    see in docs for NST_CUSTOM

    yes master but i wanted to use that LIMITED QTY feature but uses #CASHPOINTS instead of Zeny
    i tried already
     

    /**
     * Processes incoming npc market purchase list
     **/
    static enum market_buy_result npc_market_buylist(struct map_session_data *sd, struct itemlist *item_list)
    {
    	struct npc_data* nd;
    	struct npc_item_list *shop = NULL;
    	int64 z;
    	int i,j,w,new_;
    	unsigned short shop_size = 0;
    
    	nullpo_retr(1, sd);
    	nullpo_retr(1, item_list);
    
    	nd = npc->checknear(sd,map->id2bl(sd->npc_shopid));
    
    	if (nd == NULL || nd->subtype != SCRIPT || VECTOR_LENGTH(*item_list) == 0 || !nd->u.scr.shop || nd->u.scr.shop->type != NST_MARKET)
    		return MARKET_BUY_RESULT_ERROR;
    
    	shop = nd->u.scr.shop->item;
    	shop_size = nd->u.scr.shop->items;
    
    	z = 0;
    	w = 0;
    	new_ = 0;
    
    	// process entries in buy list, one by one
    	for (i = 0; i < VECTOR_LENGTH(*item_list); ++i) {
    		int value;
    		struct itemlist_entry *entry = &VECTOR_INDEX(*item_list, i);
    
    		// find this entry in the shop's sell list
    		ARR_FIND( 0, shop_size, j,
    				 entry->id == shop[j].nameid || //Normal items
    				 entry->id == itemdb_viewid(shop[j].nameid) //item_avail replacement
    				 );
    		if (j == shop_size) /* TODO find official response for this */
    			return MARKET_BUY_RESULT_ERROR; // no such item in shop
    
    		entry->id = shop[j].nameid; //item_avail replacement
    
    		if (entry->amount > (int)shop[j].qty)
    			return MARKET_BUY_RESULT_AMOUNT_TOO_BIG;
    
    		value = shop[j].value;
    		npc_market_qty[i] = j;
    
    		if (!itemdb->exists(entry->id)) /* TODO find official response for this */
    			return MARKET_BUY_RESULT_ERROR; // item no longer in itemdb
    
    		if (!itemdb->isstackable(entry->id) && entry->amount > 1) {
    			//Exploit? You can't buy more than 1 of equipment types o.O
    			ShowWarning("Player %s (%d:%d) sent a hexed packet trying to buy %d of non-stackable item %d!\n",
    						sd->status.name, sd->status.account_id, sd->status.char_id, entry->amount, entry->id);
    			entry->amount = 1;
    		}
    
    		switch (pc->checkadditem(sd, entry->id, entry->amount)) {
    			case ADDITEM_EXIST:
    				break;
    			case ADDITEM_NEW:
    				new_++;
    				break;
    			case ADDITEM_OVERAMOUNT: /* TODO find official response for this */
    				return 1;
    		}
    
    		z += (int64)value * entry->amount;
    		w += itemdb_weight(entry->id) * entry->amount;
    	}
    
    	if (z > sd->cashPoints) /* TODO find official response for this */
    		return MARKET_BUY_RESULT_NO_ZENY; // Not enough Zeny
    
    	if( w + sd->weight > sd->max_weight ) /* TODO find official response for this */
    		return MARKET_BUY_RESULT_OVER_WEIGHT; // Too heavy
    
    	if( pc->inventoryblank(sd) < new_ ) /* TODO find official response for this */
    		return MARKET_BUY_RESULT_OUT_OF_SPACE; // Not enough space to store items
    
    	pc->paycash(sd,(int)z,0);
    
    	for (i = 0; i < VECTOR_LENGTH(*item_list); ++i) {
    		struct itemlist_entry *entry = &VECTOR_INDEX(*item_list, i);
    
    		j = npc_market_qty[i];
    
    		if (entry->amount > (int)shop[j].qty) /* wohoo someone tampered with the packet. */
    			return MARKET_BUY_RESULT_AMOUNT_TOO_BIG;
    
    		shop[j].qty -= entry->amount;
    
    		npc->market_tosql(nd,j);
    
    		if (itemdb_type(entry->id) == IT_PETEGG) {
    			pet->create_egg(sd, entry->id);
    		} else {
    			struct item item_tmp;
    			memset(&item_tmp,0,sizeof(item_tmp));
    			item_tmp.nameid = entry->id;
    			item_tmp.identify = 1;
    
    			pc->additem(sd, &item_tmp, entry->amount, LOG_TYPE_NPC);
    		}
    	}
    
    	return MARKET_BUY_RESULT_SUCCESS;
    }

        if (z > sd->cashPoints) /* TODO find official response for this */

    It's working ok by deducting CP. It still check zeny when you drag item to buy.

×
×
  • Create New...

Important Information

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