Hello, guys. I'm in need of help with the command setd/getd.
Short explanation what I wanna talk about.
Currently I'm scripting an PvP/GvG/MvP Arena with Ranking and Bounty feature (+Shops).
Before I added the bounty feature it kinda worked fine, to say that before hand :I.
Anyway also I'm working on my Global NPC Handler, which uses setd/getd partly.
Then I thought about saving some space and make an improvement.
So I'm tried to add the set/getd in the extra Conf NPC (need explanation? view my script)
This is what I exactly mean - a main problem of it...
- script <NPC_Name>_Conf -1,{
end;
OnInit:
// Exchange the NPC 1, etc, with the NPC Name you want to disable
setarray .npc$[0],"NPC 1","NPC 2","NPC 3"; // etc, but don't put this npc
set .conf_npc$,strnpcinfo(1); // Here comes this NPC, will be unloaded only.
end;
}
Now the newer one:
setarray .npc$[0],"PvPGvGMain","Arena Master","Arena_ShopB","Arena_ShopC","Arena_ShopZ"; // etc, but don't put this npc
set .ext$,"main"; // In which variable is it saved? $@npc_main$ > "main" ... as example
set .conf_npc$,strnpcinfo(1); // Here comes this NPC, will be unloaded only.
OnNPCConf:
if(playerattached() == 1) dispbottom "Extension: "+.ext$;
for( set .@i,0; .@i < getarraysize(getd("$@npc_"+.ext$+"_alias$")); set .i,.i + 1) {
if(.conf_npc$ == getd("$@npc_"+.ext$+"_alias$["+.@i+"]")) {
setd("$@npc_"+.ext$+"_a["+.@i+"]"),getarraysize(.npc$);
setd("$@npc_"+.ext$+"_lo["+.@i+"]"),1;
setd("$@npc_"+.ext$+"_ab["+.@i+"]"),1;
}
}
end;
(Don't mind the "OnNPCConf" - is used for bug fixxing atm.)
Here comes the problem - to get a hang of the problem I added this:
After the Map Server start, the "set/getd" shows "0", after I chose "OnNPCConf" and rewhisper him again, it shows the wanted result.
Here are some images:
So does this mean "setd/getd" requires an rid attached?
Something similiar happenes to my Bounty Shops - about attached rid I mean q.q:
// Shop Items: PvP useful stuff D:, like Elements, Boxes and Food
// These will be used for all shops, but the prices depends on the Bounty Type you have set.
setarray .arena_sh[0],12020,12028,12029,12030,12031,12032,12033,12034,12108,12215,12216,12217,12218,12219,12075,12080,12085,12090,12095,12100,12114,12115,12116,12117,12118,12119,12120,12121,13543,13544,13545,13546,13547,14593;
if($@bty_type == 1) {
npcshopdelitem "Arena_ShopZ",512;
// Prices:
// Default is a formula: ($@bty_z+(.@s*($@bty_z/10)))/2
// Base Price = $@bty_z, "Multiplier" = + (Index ID* ($@bty_z/10))/2
// Example: 5000 + (4(=Index of 12031)*(5000/10=500) > 7000/2 = 3500 Zeny for 12031
// Note: If the formula results in a decimal number it will be degraded.
// If you wanna use your own prices, comment the line with the formula and uncommented the line with the array below.
// But remember to put the prices for all items.
// setarray .arena_pr[0],100,100,0; // Etc
// For the Shop itself, how the costs are set:
set .arena_pay,1; // 1 = Formula, 2 = Per Array
for ( set .@s,0; .@s < getarraysize(.arena_sh); set .@s,.@s + 1) {
if(.arena_pay == 2) npcshopadditem "Arena_ShopZ",.arena_sh[.@s],.arena_pr[.@s];
else {
set .@arena_pr,($@bty_z+(.@s*($@bty_z/10)))/2; // Formula
npcshopadditem "Arena_ShopZ",.arena_sh[.@s],.@arena_pr;
}
}
} else if($@bty_type == 2) {
npcshopdelitem "Arena_ShopC",512;
// Prices:
// Default is a formula: ($@bty_c+.@s)/2
// Base Price = $@bty_c, "Multiplier" = + Index ID/2
// Example: 2 + 4(=Index of 12031) > 6/2 = 3 Cash Points for 12031
// Note: If the formula results in a decimal number it will be degraded.
// If you wanna use your own prices, comment the line with the formula and uncommented the line with the array below.
// But remember to put the prices for all items.
// setarray .arena_pr[0],100,100,0; // Etc
// For the Shop itself, define the way how the costs are set:
set .arena_pay,1; // 1 = Formula, 2 = Per Array
for ( set .@s,0; .@s < getarraysize(.arena_sh); set .@s,.@s + 1) {
if(.arena_pay == 2) npcshopadditem "Arena_ShopC",.arena_sh[.@s],.arena_pr[.@s];
else {
set .@arena_pr,($@bty_c+.@s)/2; // Formula
npcshopadditem "Arena_ShopC",.arena_sh[.@s],.@arena_pr;
}
}
} else if($@bty_type == 3) {
npcshopdelitem "Arena_ShopB",512;
// Prices:
// Default is a formula: ($@bty_b+(.@s*10))/2
// Base Price = $@bty_b, "Multiplier" = + (Index ID* 10)/2
// Example: 5 + (4(=Index of 12031)*10) > 45/2 = 22 Bounty Points for 12031
// Note: If the formula results in a decimal number it will be degraded.
// If you wanna use your own prices, comment the line with the formula and uncommented the line with the array below.
// But remember to put the prices for all items.
// setarray .arena_pr[0],100,100,0; // Etc
// For the Shop itself, how the costs are set:
set .arena_pay,1; // 1 = Formula, 2 = Per Array
for ( set .@s,0; .@s < getarraysize(.arena_sh); set .@s,.@s + 1)
if(.arena_pay == 2) npcshopadditem "Arena_ShopB",.arena_sh[.@s],.arena_pr[.@s];
else {
set .@arena_pr,($@bty_b+(.@s*10))/2; // Formula
npcshopadditem "Arena_ShopB",.arena_sh[.@s],.@arena_pr;
}
}
if($@debug) announce "Arena Shop loaded.",bc_self;
if(!.@re_in) end;
Previously I had it execute "OnInit" but opening the shop, shows it doesnt work.
So I added also the "OnWhisperGlobal" to see what happened.
When I initate it via whisper the shops (item/prices) are being added like I wanted.
First I thought that the loading order would be the problem, but it wasn't (well I believed that, but to be sure)
so I exchanged/added an extra label to it and used "doevent" after I had loaded the required variables.
But didn't help either so far.
So can anybody help me with this? o.o
Regards,
Chris
Note: I'm using eAthena SVN 14434 SQL Trunk for my Test server, could that be the problem?
Question
llchrisll
Hello, guys. I'm in need of help with the command setd/getd.
Short explanation what I wanna talk about.
Currently I'm scripting an PvP/GvG/MvP Arena with Ranking and Bounty feature (+Shops).
Before I added the bounty feature it kinda worked fine, to say that before hand :I.
Anyway also I'm working on my Global NPC Handler, which uses setd/getd partly.
Then I thought about saving some space and make an improvement.
So I'm tried to add the set/getd in the extra Conf NPC (need explanation? view my script)
This is what I exactly mean - a main problem of it...
Now the newer one:
(Don't mind the "OnNPCConf" - is used for bug fixxing atm.)
Here comes the problem - to get a hang of the problem I added this:
After the Map Server start, the "set/getd" shows "0", after I chose "OnNPCConf" and rewhisper him again, it shows the wanted result.
Here are some images:
So does this mean "setd/getd" requires an rid attached?
Something similiar happenes to my Bounty Shops - about attached rid I mean q.q:
Previously I had it execute "OnInit" but opening the shop, shows it doesnt work.
So I added also the "OnWhisperGlobal" to see what happened.
When I initate it via whisper the shops (item/prices) are being added like I wanted.
First I thought that the loading order would be the problem, but it wasn't (well I believed that, but to be sure)
so I exchanged/added an extra label to it and used "doevent" after I had loaded the required variables.
But didn't help either so far.
So can anybody help me with this? o.o
Regards,
Chris
Note: I'm using eAthena SVN 14434 SQL Trunk for my Test server, could that be the problem?
Edited by llchrisllLink to comment
Share on other sites
2 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.