Reply to NPC Code problems
If you don't have an account, just leave the password field blank.
July 20th 2006, 12:15 PM

Ace
I am having a problem checking to see if you have a spell or not, and if you have a certain weapon or item for selling. Here are the script parts. I tried to use someone elses source, it works fine, just not the checking if Dink has things before buying or selling...
spells:
int &firespell = count_item("item-sfb");
int &lightspell = count_item("item-ice");
int &hellspell = count_item("item-fb");
choice_start()
title_start();
"Magic Spells"
title_end();
if (&bow_lore = 0)
"LVL 5 : Bow Lore - $5000"
if (&firespell = 0)
"LVL 5 : Fire Spell - $10000"
if (&lightspell = 0)
"LVL 10 : Light Spell - $100000"
if (&hellspell = 0)
"LVL 20 : Hell Fire Spell - $1000000"
"Cancel"
choice_end()
if (&result == 1)
{
if (&gold <= 4999) goto nogold;
if (&level < 5) goto lowlevel2;
&gold -= 5000;
&bow_lore = 1;
}
if (&result == 2)
{
if (&gold <= 9999) goto nogold;
if (&level < 5) goto lowlevel2;
&gold -= 10000;
add_magic("item-sfb",437, 1);
}
if (&result == 3)
{
if (&gold <= 99999) goto nogold;
if (&level < 10) goto lowlevel2;
&gold -= 100000;
add_magic("item-ice",437, 5);
}
if (&result == 4)
{
if (&gold <= 999999) goto nogold;
if (&level < 20) goto lowlevel2;
&gold -= 1000000;
add_magic("item-fb",437, 2);
}
goto restart;
if (&result == 5)
goto restart;
sell1:
int &tempitem1 = count_item("bomb");
int &tempitem2 = count_item("sword-norm");
int &tempitem3 = count_item("sword-claw");
int &tempitem4 = count_item("sword-light");
int &tempitem5 = count_item("bow-norm");
int &tempitem6 = count_item("bow-mass");
int &tempitem7 = count_item("bow-fire");
int &tempitem8 = count_item("axe");
choice_start()
if (%tempitem1 > 0)
"Bomb - $50"
if (%tempitem2 > 0)
"Small Sword - $250"
if (%tempitem3 > 0)
"Medium Sword - $2500"
if (%tempitem4 > 0)
"Large Sword - $25000"
if (%tempitem5 > 0)
"Short Bow - $500"
if (%tempitem6 > 0)
"Medium Bow - $5000"
if (%tempitem7 > 0)
"Long Bow - $50000"
if (%tempitem8 > 0)
"Throwing Axe - $12500"
"Cancel"
choice_end()
if (&result == 1)
{
&gold += 50;
kill_this_item("bomb");
}
{
&gold += 250;
kill_this_item("sword-norm");
}
{
&gold += 2500;
kill_this_item("sword-claw");
}
{
&gold += 25000;
kill_this_item("sword-light");
}
{
&gold += 500;
kill_this_item("bow-norm");
}
{
&gold += 5000;
kill_this_item("bow-mass");
}
{
&gold += 50000;
kill_this_item("bow-fire");
}
{
&gold += 12500;
kill_this_item("axe");
}
goto restart;
Any Help would be good, and thanks ahead of time for your efforts!
spells:
int &firespell = count_item("item-sfb");
int &lightspell = count_item("item-ice");
int &hellspell = count_item("item-fb");
choice_start()
title_start();
"Magic Spells"
title_end();
if (&bow_lore = 0)
"LVL 5 : Bow Lore - $5000"
if (&firespell = 0)
"LVL 5 : Fire Spell - $10000"
if (&lightspell = 0)
"LVL 10 : Light Spell - $100000"
if (&hellspell = 0)
"LVL 20 : Hell Fire Spell - $1000000"
"Cancel"
choice_end()
if (&result == 1)
{
if (&gold <= 4999) goto nogold;
if (&level < 5) goto lowlevel2;
&gold -= 5000;
&bow_lore = 1;
}
if (&result == 2)
{
if (&gold <= 9999) goto nogold;
if (&level < 5) goto lowlevel2;
&gold -= 10000;
add_magic("item-sfb",437, 1);
}
if (&result == 3)
{
if (&gold <= 99999) goto nogold;
if (&level < 10) goto lowlevel2;
&gold -= 100000;
add_magic("item-ice",437, 5);
}
if (&result == 4)
{
if (&gold <= 999999) goto nogold;
if (&level < 20) goto lowlevel2;
&gold -= 1000000;
add_magic("item-fb",437, 2);
}
goto restart;
if (&result == 5)
goto restart;
sell1:
int &tempitem1 = count_item("bomb");
int &tempitem2 = count_item("sword-norm");
int &tempitem3 = count_item("sword-claw");
int &tempitem4 = count_item("sword-light");
int &tempitem5 = count_item("bow-norm");
int &tempitem6 = count_item("bow-mass");
int &tempitem7 = count_item("bow-fire");
int &tempitem8 = count_item("axe");
choice_start()
if (%tempitem1 > 0)
"Bomb - $50"
if (%tempitem2 > 0)
"Small Sword - $250"
if (%tempitem3 > 0)
"Medium Sword - $2500"
if (%tempitem4 > 0)
"Large Sword - $25000"
if (%tempitem5 > 0)
"Short Bow - $500"
if (%tempitem6 > 0)
"Medium Bow - $5000"
if (%tempitem7 > 0)
"Long Bow - $50000"
if (%tempitem8 > 0)
"Throwing Axe - $12500"
"Cancel"
choice_end()
if (&result == 1)
{
&gold += 50;
kill_this_item("bomb");
}
{
&gold += 250;
kill_this_item("sword-norm");
}
{
&gold += 2500;
kill_this_item("sword-claw");
}
{
&gold += 25000;
kill_this_item("sword-light");
}
{
&gold += 500;
kill_this_item("bow-norm");
}
{
&gold += 5000;
kill_this_item("bow-mass");
}
{
&gold += 50000;
kill_this_item("bow-fire");
}
{
&gold += 12500;
kill_this_item("axe");
}
goto restart;
Any Help would be good, and thanks ahead of time for your efforts!





