NPC Code problems
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!
July 20th 2006, 12:18 PM

Ace
oops, ignore the %item parts, I fixed that, but it still does not work right I think...
July 20th 2006, 12:47 PM

Ace
Nevermind on the Sell part and BUy part of the shop, but the spell part, I am, still having problems with...
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();
(&bow_lore = 0) "LVL 5 : Bow Lore - $5000"
(&firespell = 0) "LVL 5 : Fire Spell - $10000"
(&lightspell = 0) "LVL 10 : Light Spell - $100000"
(&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;
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();
(&bow_lore = 0) "LVL 5 : Bow Lore - $5000"
(&firespell = 0) "LVL 5 : Fire Spell - $10000"
(&lightspell = 0) "LVL 10 : Light Spell - $100000"
(&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;
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;
}
Also if that doesnt work try using goto spells; instead of goto restart; i dont know if that will work because there is a spells: defnied but not a restart:
{
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;
}
Also if that doesnt work try using goto spells; instead of goto restart; i dont know if that will work because there is a spells: defnied but not a restart:
July 20th 2006, 01:01 PM

Ace
No, I had fireball and hell fire ball mixed, plus the structure was incorrect. I fixed it, however I am having a problem with bow lore...
When I buy bow lore, it buys, but does not add it properly, and remains in the spells list at the shop.
I have tried these 2 types, and they still do not work:
spells:
int &firespell = count_magic("item-fb");
int &lightspell = count_magic("item-ice");
int &hellspell = count_magic("item-sfb");
choice_start()
title_start();
"Magic Spells"
title_end();
(&bow_lore == 0) "LVL 5 : Bow Lore - $5000"
(&firespell == 0) "LVL 5 : Fire Spell - $10000"
(&lightspell == 0) "LVL 10 : Light Spell - $100000"
(&hellspell == 0) "LVL 20 : Hell Fire Spell - $200000"
"Cancel"
choice_end()
if (&result == 1)
{
if (&gold <= 4999) goto nogold;
if (&level < 5) goto lowlevel2;
&gold -= 5000;
&bow_lore += 1;
}
and this:
spells:
int &firespell = count_magic("item-fb");
int &lightspell = count_magic("item-ice");
int &hellspell = count_magic("item-sfb");
choice_start()
title_start();
"Magic Spells"
title_end();
(&bow_lore == 0) "LVL 5 : Bow Lore - $5000"
(&firespell == 0) "LVL 5 : Fire Spell - $10000"
(&lightspell == 0) "LVL 10 : Light Spell - $100000"
(&hellspell == 0) "LVL 20 : Hell Fire Spell - $200000"
"Cancel"
choice_end()
if (&result == 1)
{
if (&gold <= 4999) goto nogold;
if (&level < 5) goto lowlevel2;
&gold -= 5000;
&bow_lore = 1;
}
Maybe someone can figure this out...
When I buy bow lore, it buys, but does not add it properly, and remains in the spells list at the shop.
I have tried these 2 types, and they still do not work:
spells:
int &firespell = count_magic("item-fb");
int &lightspell = count_magic("item-ice");
int &hellspell = count_magic("item-sfb");
choice_start()
title_start();
"Magic Spells"
title_end();
(&bow_lore == 0) "LVL 5 : Bow Lore - $5000"
(&firespell == 0) "LVL 5 : Fire Spell - $10000"
(&lightspell == 0) "LVL 10 : Light Spell - $100000"
(&hellspell == 0) "LVL 20 : Hell Fire Spell - $200000"
"Cancel"
choice_end()
if (&result == 1)
{
if (&gold <= 4999) goto nogold;
if (&level < 5) goto lowlevel2;
&gold -= 5000;
&bow_lore += 1;
}
and this:
spells:
int &firespell = count_magic("item-fb");
int &lightspell = count_magic("item-ice");
int &hellspell = count_magic("item-sfb");
choice_start()
title_start();
"Magic Spells"
title_end();
(&bow_lore == 0) "LVL 5 : Bow Lore - $5000"
(&firespell == 0) "LVL 5 : Fire Spell - $10000"
(&lightspell == 0) "LVL 10 : Light Spell - $100000"
(&hellspell == 0) "LVL 20 : Hell Fire Spell - $200000"
"Cancel"
choice_end()
if (&result == 1)
{
if (&gold <= 4999) goto nogold;
if (&level < 5) goto lowlevel2;
&gold -= 5000;
&bow_lore = 1;
}
Maybe someone can figure this out...
July 20th 2006, 01:15 PM

Ace
I am sorry for posting, Lol!! I figured all this out myself, this was the problems:
First of all, spells were mixed, fire and super fireball.
Second of all, the following line or lines like this were incorrect:
int &firespell = count_item("item-fb");
It was supposed to be this:
int &firespell = count_magic("item-fb");
Third of all, there was no "if (&result == #)" statements on the previous code I posted.
Last of all, the following:
&bow_lore += 1; or &bow_lore = 1;
it was incorrect, and supposed to be like this:
int &bow_lore = 1;
But, thanks for anyone who has tried to help me!
First of all, spells were mixed, fire and super fireball.
Second of all, the following line or lines like this were incorrect:
int &firespell = count_item("item-fb");
It was supposed to be this:
int &firespell = count_magic("item-fb");
Third of all, there was no "if (&result == #)" statements on the previous code I posted.
Last of all, the following:
&bow_lore += 1; or &bow_lore = 1;
it was incorrect, and supposed to be like this:
int &bow_lore = 1;
But, thanks for anyone who has tried to help me!






