Dynamic Shop with Selection

TrndsttR

New member
Messages
34
Points
0
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

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

Code:
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;
}
 
Last edited by a moderator:
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

 
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.

Code:
-    script     HeadgearPods     FAKE_NPC,{
 
OnInit:
tradertype(NST_CUSTOM);
sellitem 501,1,1;        // Sells 1 Red Potion for 1 Currency (Pods)
end;
}
 
Last edited by a moderator:
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

 
Back
Top