Jump to content
  • 0

VoteForPoint NPC only show apple


BFPkiller

Question


  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.00
  • Content Count:  111
  • Reputation:   2
  • Joined:  05/09/13
  • Last Seen:  

Hi all !

I have a problem with my VFP npc,
it shows the correct Points i gained from Voting but,
it only shows an apple when i click it ingame.

The items that i want in are supposed to be bought with the Points you get from Voting.

Hope you guys can help me out.

vip_lounge,140,243,4	script	V4P Manager	62,{
function getPoints;

	set .@n$, 			"[VFP Manager]";
	set .@settings, 	1;		// 0 = item, 1 = shop
	set .@itemReward, 	501;	// if settings is set to item
	set .@convertRate, 	2;		// 2 Vote Points for 1 Red Potion
	set .vp, 			getPoints(getcharid(3));
	
	switch (.@settings) {
		case 0:
			mes .@n$;
			mes "Would you like to convert your "+ .vp +" Vote Points?";
			mes "^ff0000The current convert rate is "+ .@convertRate +" Vote Points for 1 "+ getitemname(.@itemReward) +".";
			next;
			menu "Yes", L_Convert, "No", -;
			mes .@n$;
			mes "Bye, then.";
			break;
		case 1:
			mes .@n$;
			mes "You have ^ff0000"+ .vp +"^000000 Vote Points.";
			mes "Would you like to go shopping?";
			next;
			menu "Yes", -, "No", L_Goodbye;
			mes .@n$;
			mes "Have fun shopping!";
			callshop "votepoints_shop",1;
			npcshopattach "votepoints_shop";
			end;
	}
	
	L_Goodbye:
		mes .@n$;
		mes "Goodbye, then.";
		close;
	
	L_Convert:
		if (.vp < .@convertRate)
			goto L_VotePointsTooLow;
		mes .@n$;
		mes "How much Vote Points would you like to convert?";
		next;
		menu "All", L_ConvertAll, "Input Amount", L_ConvertAmount;
	
	L_ConvertAmount:
		input .@convert;
		
		if (.@convert > .vp)
			goto L_VotePointsTooLow;
		
		set .vp, ((.vp - .@convert) + (.@convert % .@convertRate));
		set .@convert, (.@convert / .@convertRate);
		getitem .@itemReward, .@convert;
		query_sql("UPDATE cp_createlog SET votepoints = "+ .vp +" WHERE account_id = "+ getcharid(3));
		
		mes .@n$;
		mes "You have received "+ .@convert +"x "+ getitemname(.@itemReward) +".";
		mes "Your current Vote Points is "+ .vp;
		close;
		
	L_ConvertAll:
		set .@convert, (.vp / .@convertRate);
		set .vp, (.vp % .@convertRate);
		getitem .@itemReward, .@convert;
		query_sql("UPDATE cp_createlog SET votepoints = "+ .vp +" WHERE account_id = "+ getcharid(3));
		
		mes .@n$;
		mes "You have received "+ .@convert +"x "+ getitemname(.@itemReward) +".";
		mes "Your current Vote Points is "+ .vp;
		close;
	
	L_VotePointsTooLow:
		mes .@n$;
		mes "Your Vote Points is too low. Come back when you have the minimum amount of Vote Points.";
		close;
	
	function getPoints {
		set .@account_id, getarg(0);
		
		set .@count, query_sql("SELECT votepoints FROM cp_createlog WHERE account_id = "+ .@account_id, .@votepoints);
		
		return .@count ? .@votepoints : 0;
	}
	
	OnBuyItem:
		set .@cost,0;
		for(set .@i,0; .@i<getarraysize(@bought_nameid); set .@i,.@i+1)
			for(set .@j,0; .@j<getarraysize(.itemShop); set .@j,.@j+2)
				if (@bought_nameid[.@i] == .itemShop[.@j]) {
					set .@cost, .@cost+(.itemShop[.@j+1]*@bought_quantity[.@i]);
					break;
				}
		mes .@n$;
		if (.@cost > .vp) mes "You don't have enough Vote Points.";
		else {
			for(set .@i,0; .@i<getarraysize(@bought_nameid); set .@i,.@i+1) {
				getitem @bought_nameid[.@i], @bought_quantity[.@i];
				dispbottom "Purchased "+@bought_quantity[.@i]+"x "+getitemname(@bought_nameid[.@i])+".";
			}
			set .vp, .vp - .@cost;
			query_sql("UPDATE cp_createlog SET votepoints = votepoints - "+ .@cost +" WHERE account_id = "+ getcharid(3));
			mes .@n$;
			mes "Deal completed.";
			mes "You now have ^ff0000"+ .vp +"^000000 Vote Points.";
			emotion et_money;
		}
		set .@cost,0;
		deletearray @bought_nameid[0], getarraysize(@bought_nameid);
		deletearray @bought_quantity[0], getarraysize(@bought_quantity);
		close;
	
	OnInit:
		setarray .itemShop[0],	501,2,607,5; // <ITEM_ID>,<PRICE>,...
		
		npcshopdelitem "votepoints_shop",512;
		for(set .@i, 0; .@i < getarraysize(.itemShop); set .@i, .@i+2)
			npcshopadditem "votepoints_shop", .itemShop[.@i], .itemShop[.@i+1];
	end;
}

-	shop	votepoints_shop	-1,512:-1

 

Edited by BFPkiller
Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 1

  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  477
  • Reputation:   269
  • Joined:  06/13/17
  • Last Seen:  

You must declare the shop first because on the script. it read the V4P manager first and run the OnInit first..
although its okay if you use @reloadscript to show the items. but its not the case on @reloadnpcfile.

-	shop	votepoints_shop	-1,512:-1
vip_lounge,140,243,4	script	V4P Manager	62,{
function getPoints;

	set .@n$, 			"[VFP Manager]";
	set .@settings, 	1;		// 0 = item, 1 = shop
	set .@itemReward, 	501;	// if settings is set to item
	set .@convertRate, 	2;		// 2 Vote Points for 1 Red Potion
	set .vp, 			getPoints(getcharid(3));
	
	switch (.@settings) {
		case 0:
			mes .@n$;
			mes "Would you like to convert your "+ .vp +" Vote Points?";
			mes "^ff0000The current convert rate is "+ .@convertRate +" Vote Points for 1 "+ getitemname(.@itemReward) +".";
			next;
			menu "Yes", L_Convert, "No", -;
			mes .@n$;
			mes "Bye, then.";
			break;
		case 1:
			mes .@n$;
			mes "You have ^ff0000"+ .vp +"^000000 Vote Points.";
			mes "Would you like to go shopping?";
			next;
			menu "Yes", -, "No", L_Goodbye;
			mes .@n$;
			mes "Have fun shopping!";
			callshop "votepoints_shop",1;
			npcshopattach "votepoints_shop";
			end;
	}
	
	L_Goodbye:
		mes .@n$;
		mes "Goodbye, then.";
		close;
	
	L_Convert:
		if (.vp < .@convertRate)
			goto L_VotePointsTooLow;
		mes .@n$;
		mes "How much Vote Points would you like to convert?";
		next;
		menu "All", L_ConvertAll, "Input Amount", L_ConvertAmount;
	
	L_ConvertAmount:
		input .@convert;
		
		if (.@convert > .vp)
			goto L_VotePointsTooLow;
		
		set .vp, ((.vp - .@convert) + (.@convert % .@convertRate));
		set .@convert, (.@convert / .@convertRate);
		getitem .@itemReward, .@convert;
		query_sql("UPDATE cp_createlog SET votepoints = "+ .vp +" WHERE account_id = "+ getcharid(3));
		
		mes .@n$;
		mes "You have received "+ .@convert +"x "+ getitemname(.@itemReward) +".";
		mes "Your current Vote Points is "+ .vp;
		close;
		
	L_ConvertAll:
		set .@convert, (.vp / .@convertRate);
		set .vp, (.vp % .@convertRate);
		getitem .@itemReward, .@convert;
		query_sql("UPDATE cp_createlog SET votepoints = "+ .vp +" WHERE account_id = "+ getcharid(3));
		
		mes .@n$;
		mes "You have received "+ .@convert +"x "+ getitemname(.@itemReward) +".";
		mes "Your current Vote Points is "+ .vp;
		close;
	
	L_VotePointsTooLow:
		mes .@n$;
		mes "Your Vote Points is too low. Come back when you have the minimum amount of Vote Points.";
		close;
	
	function getPoints {
		set .@account_id, getarg(0);
		
		set .@count, query_sql("SELECT votepoints FROM cp_createlog WHERE account_id = "+ .@account_id, .@votepoints);
		
		return .@count ? .@votepoints : 0;
	}
	
	OnBuyItem:
		set .@cost,0;
		for(set .@i,0; .@i<getarraysize(@bought_nameid); set .@i,.@i+1)
			for(set .@j,0; .@j<getarraysize(.itemShop); set .@j,.@j+2)
				if (@bought_nameid[.@i] == .itemShop[.@j]) {
					set .@cost, .@cost+(.itemShop[.@j+1]*@bought_quantity[.@i]);
					break;
				}
		mes .@n$;
		if (.@cost > .vp) mes "You don't have enough Vote Points.";
		else {
			for(set .@i,0; .@i<getarraysize(@bought_nameid); set .@i,.@i+1) {
				getitem @bought_nameid[.@i], @bought_quantity[.@i];
				dispbottom "Purchased "+@bought_quantity[.@i]+"x "+getitemname(@bought_nameid[.@i])+".";
			}
			set .vp, .vp - .@cost;
			query_sql("UPDATE cp_createlog SET votepoints = votepoints - "+ .@cost +" WHERE account_id = "+ getcharid(3));
			mes .@n$;
			mes "Deal completed.";
			mes "You now have ^ff0000"+ .vp +"^000000 Vote Points.";
			emotion et_money;
		}
		set .@cost,0;
		deletearray @bought_nameid[0], getarraysize(@bought_nameid);
		deletearray @bought_quantity[0], getarraysize(@bought_quantity);
		close;
	
	OnInit:
		setarray .itemShop[0],	501,2,607,5; // <ITEM_ID>,<PRICE>,...
		
		npcshopdelitem "votepoints_shop",512;
		for(set .@i, 0; .@i < getarraysize(.itemShop); set .@i, .@i+2)
			npcshopadditem "votepoints_shop", .itemShop[.@i], .itemShop[.@i+1];
	end;
}
  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.01
  • Content Count:  398
  • Reputation:   246
  • Joined:  07/04/19
  • Last Seen:  

maybe this is your problem

npcshopdelitem "votepoints_shop",512;
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.00
  • Content Count:  111
  • Reputation:   2
  • Joined:  05/09/13
  • Last Seen:  

22 minutes ago, BeWan said:

maybe this is your problem


npcshopdelitem "votepoints_shop",512;

i tried various things on that line, keep getting the apple to show up only

Ex.

npcshopdelitem "votepoints_shop"+.@i,512;

 

Edited by BFPkiller
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.00
  • Content Count:  111
  • Reputation:   2
  • Joined:  05/09/13
  • Last Seen:  

3 hours ago, Haruka Mayumi said:

You must declare the shop first because on the script. it read the V4P manager first and run the OnInit first..
although its okay if you use @reloadscript to show the items. but its not the case on @reloadnpcfile.


-	shop	votepoints_shop	-1,512:-1
vip_lounge,140,243,4	script	V4P Manager	62,{
function getPoints;

	set .@n$, 			"[VFP Manager]";
	set .@settings, 	1;		// 0 = item, 1 = shop
	set .@itemReward, 	501;	// if settings is set to item
	set .@convertRate, 	2;		// 2 Vote Points for 1 Red Potion
	set .vp, 			getPoints(getcharid(3));
	
	switch (.@settings) {
		case 0:
			mes .@n$;
			mes "Would you like to convert your "+ .vp +" Vote Points?";
			mes "^ff0000The current convert rate is "+ .@convertRate +" Vote Points for 1 "+ getitemname(.@itemReward) +".";
			next;
			menu "Yes", L_Convert, "No", -;
			mes .@n$;
			mes "Bye, then.";
			break;
		case 1:
			mes .@n$;
			mes "You have ^ff0000"+ .vp +"^000000 Vote Points.";
			mes "Would you like to go shopping?";
			next;
			menu "Yes", -, "No", L_Goodbye;
			mes .@n$;
			mes "Have fun shopping!";
			callshop "votepoints_shop",1;
			npcshopattach "votepoints_shop";
			end;
	}
	
	L_Goodbye:
		mes .@n$;
		mes "Goodbye, then.";
		close;
	
	L_Convert:
		if (.vp < .@convertRate)
			goto L_VotePointsTooLow;
		mes .@n$;
		mes "How much Vote Points would you like to convert?";
		next;
		menu "All", L_ConvertAll, "Input Amount", L_ConvertAmount;
	
	L_ConvertAmount:
		input .@convert;
		
		if (.@convert > .vp)
			goto L_VotePointsTooLow;
		
		set .vp, ((.vp - .@convert) + (.@convert % .@convertRate));
		set .@convert, (.@convert / .@convertRate);
		getitem .@itemReward, .@convert;
		query_sql("UPDATE cp_createlog SET votepoints = "+ .vp +" WHERE account_id = "+ getcharid(3));
		
		mes .@n$;
		mes "You have received "+ .@convert +"x "+ getitemname(.@itemReward) +".";
		mes "Your current Vote Points is "+ .vp;
		close;
		
	L_ConvertAll:
		set .@convert, (.vp / .@convertRate);
		set .vp, (.vp % .@convertRate);
		getitem .@itemReward, .@convert;
		query_sql("UPDATE cp_createlog SET votepoints = "+ .vp +" WHERE account_id = "+ getcharid(3));
		
		mes .@n$;
		mes "You have received "+ .@convert +"x "+ getitemname(.@itemReward) +".";
		mes "Your current Vote Points is "+ .vp;
		close;
	
	L_VotePointsTooLow:
		mes .@n$;
		mes "Your Vote Points is too low. Come back when you have the minimum amount of Vote Points.";
		close;
	
	function getPoints {
		set .@account_id, getarg(0);
		
		set .@count, query_sql("SELECT votepoints FROM cp_createlog WHERE account_id = "+ .@account_id, .@votepoints);
		
		return .@count ? .@votepoints : 0;
	}
	
	OnBuyItem:
		set .@cost,0;
		for(set .@i,0; .@i<getarraysize(@bought_nameid); set .@i,.@i+1)
			for(set .@j,0; .@j<getarraysize(.itemShop); set .@j,.@j+2)
				if (@bought_nameid[.@i] == .itemShop[.@j]) {
					set .@cost, .@cost+(.itemShop[.@j+1]*@bought_quantity[.@i]);
					break;
				}
		mes .@n$;
		if (.@cost > .vp) mes "You don't have enough Vote Points.";
		else {
			for(set .@i,0; .@i<getarraysize(@bought_nameid); set .@i,.@i+1) {
				getitem @bought_nameid[.@i], @bought_quantity[.@i];
				dispbottom "Purchased "+@bought_quantity[.@i]+"x "+getitemname(@bought_nameid[.@i])+".";
			}
			set .vp, .vp - .@cost;
			query_sql("UPDATE cp_createlog SET votepoints = votepoints - "+ .@cost +" WHERE account_id = "+ getcharid(3));
			mes .@n$;
			mes "Deal completed.";
			mes "You now have ^ff0000"+ .vp +"^000000 Vote Points.";
			emotion et_money;
		}
		set .@cost,0;
		deletearray @bought_nameid[0], getarraysize(@bought_nameid);
		deletearray @bought_quantity[0], getarraysize(@bought_quantity);
		close;
	
	OnInit:
		setarray .itemShop[0],	501,2,607,5; // <ITEM_ID>,<PRICE>,...
		
		npcshopdelitem "votepoints_shop",512;
		for(set .@i, 0; .@i < getarraysize(.itemShop); set .@i, .@i+2)
			npcshopadditem "votepoints_shop", .itemShop[.@i], .itemShop[.@i+1];
	end;
}

This did the trick!!

thank you !!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...