Jump to content
  • 0
Sign in to follow this  
TrndsttR

Dynamic Shop with Selection

Question

Hello, I saw the quest script already on the folder of custom/quests/

Now i am thinking about tweaking a good Pod NPC For it which has Selection

Before talking to the npc there will be a donation info/rates and then after you proceed there will be a next window that shows the options what do you want to purchase

Example:

There will be 5 Selections on this NPC (Currency is Pods) which lets you choose a option of Headgear, Armor, Shield, Shoes, Weapons

Share this post


Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0

I'll give this a go. Quick scratch together, hope it helps.

 

 

prontera,150,150,3     script     Pods Exchanger     4_F_NPC,{
 
.@name$ = Pods Exchanger;
 
mes .@name$;
mes "I can exchange pods for stuff.";
next;
.@menu = select("Headgear:Armor:Shield:Shoes:Weapons");
switch(.@menu) {
 
case 1:
mes .@name$;
mes "Headgears cost pods and something something";
openshop("HeadgearPods");
close;
break;
 
// do the same for case 1 to below
case 2:
openshop("ArmorPods");
close;
break;
 
case 3:
openshop("ShieldPods");
close;
break;
 
case 4:
openshop("ShoesPods");
close;
break;

case 5:
openshop("WeaponsPods");
close;
break;
}
}
 
// Enter your headgears here
// Repeat script for ArmorPods, ShoesPods, etc.
-    script     HeadgearPods     FAKE_NPC,{
 
OnInit:
tradertype(NST_CUSTOM);
sellitem 501,1,1;        // Sells 1 Red Potion for 1 Currency (Pods)
end;
 
// Sets Pods as the store currency
OnCountFunds:
setcurrency(countitem(PODS ID HERE));
end;
 
// I don't know about this I just copied it from the trader sample.
// The 's'/'have'/'has' is about getting the correct grammar/plural
OnPayFunds:
    dispbottom ""+price+" Pod" + (@price == 1?"":"s") + " " + (@price == 1?"has":"have") + " been deducted from your inventory."; // put @ before '+price+' so it is '+@price+'
    if( countitem(pods) < @points || countitem(PODS ID HERE) < price-points) // put @ before each one, forum is censoring them
        end;
    delitem PODS ID HERE,@points;
    delitem PODS ID HERE,@price-@points;
    purchaseok();
    end;
}
Edited by True Zeal

Share this post


Link to post
Share on other sites
  • 0

 

I'll give this a go. Quick scratch together, hope it helps.

 

 

prontera,150,150,3     script     Pods Exchanger     4_F_NPC,{
 
.@name$ = Pods Exchanger;
 
mes .@name$;
mes "I can exchange pods for stuff.";
next;
.@menu = select("Headgear:Armor:Shield:Shoes:Weapons");
switch(.@menu) {
 
case 1:
mes .@name$;
mes "Headgears cost pods and something something";
openshop("HeadgearPods");
close;
break;
 
// do the same for case 1 to below
case 2:
openshop("ArmorPods");
close;
break;
 
case 3:
openshop("ShieldPods");
close;
break;
 
case 4:
openshop("ShoesPods");
close;
break;

case 5:
openshop("WeaponsPods");
close;
break;
}
}
 
// Enter your headgears here
// Repeat script for ArmorPods, ShoesPods, etc.
-    script     HeadgearPods     FAKE_NPC,{
 
OnInit:
tradertype(NST_CUSTOM);
sellitem 501,1,1;        // Sells 1 Red Potion for 1 Currency (Pods)
end;
 
// Sets Pods as the store currency
OnCountFunds:
setcurrency(countitem(PODS ID HERE));
end;
 
// I don't know about this I just copied it from the trader sample.
// The 's'/'have'/'has' is about getting the correct grammar/plural
OnPayFunds:
    dispbottom ""+price+" Pod" + (@price == 1?"":"s") + " " + (@price == 1?"has":"have") + " been deducted from your inventory."; // put @ before '+price+' so it is '+@price+'
    if( countitem(pods) < @points || countitem(PODS ID HERE) < price-points) // put @ before each one, forum is censoring them
        end;
    delitem PODS ID HERE,@points;
    delitem PODS ID HERE,@price-@points;
    purchaseok();
    end;
}

 

Bug upon clicking cancel the button when buying and after talking to npc. 

 

Here is the script that i have added http://pastebin.com/QyitjDgP

Share this post


Link to post
Share on other sites
  • 0

You have to close your script. Forgot your curly at the end of these.

Also you have do OnCountFunds: and OnPayFunds: for each shop. Each shop is a new script (enclosed by { }).

So you have to do this five times, changing few things around in each.

That part has to be apart of below. Goes inside that script, after OnInit: section.

 

-    script     HeadgearPods     FAKE_NPC,{
 
OnInit:
tradertype(NST_CUSTOM);
sellitem 501,1,1;        // Sells 1 Red Potion for 1 Currency (Pods)
end;
}
Edited by True Zeal

Share this post


Link to post
Share on other sites
  • 0

 

You have to close your script. Forgot your curly at the end of these.

Also you have do OnCountFunds: and OnPayFunds: for each shop. Each shop is a new script (enclosed by { }).

So you have to do this five times, changing few things around in each.

That part has to be apart of below. Goes inside that script, after OnInit: section.

 

-    script     HeadgearPods     FAKE_NPC,{
 
OnInit:
tradertype(NST_CUSTOM);
sellitem 501,1,1;        // Sells 1 Red Potion for 1 Currency (Pods)
end;
}

 

Doesn't Work. It doesn't trigger the Shops

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

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