New item problem.
Hello folks. I am working on some new items for an old project of mine. However i've run to a problem. Check this out:
My problem is, the vendor simply takes the gold, but no sword is given. The sword code is a copy of the clawsword code with very little changes that do not mess up the script in any way.
What am i doing wrong, C gurus?
void buysw2( void) { int &junk = free_items(); if (&junk < 1) { choice_start() set_y 240 title_start(); You are carrying too much. title_end(); "Ok" choice_end() return; } if (&gold < 2000) { choice_start() set_y 240 set_title_color 6 title_start(); Not enough to buy! title_end(); "Ok" choice_end() return; } &gold -= 2000; add_item("item-sw2",521, 25); }
load_sequence graphics\newitems\item-w 521 NOTANIM
My problem is, the vendor simply takes the gold, but no sword is given. The sword code is a copy of the clawsword code with very little changes that do not mess up the script in any way.
What am i doing wrong, C gurus?
Is free_items(); an actual command?
Not sure why the sword isn't being added though.
Edit:
I mean if you're losing the 2000 gold it doesn't really make sense that the add_item() line right below it doesn't do anything. The sword should be there in your inventory. Even if the script "item-sw2" doesn't exist, the seq, frame you called should still load a graphic into the inventory.
Not sure why the sword isn't being added though.
Edit:
I mean if you're losing the 2000 gold it doesn't really make sense that the add_item() line right below it doesn't do anything. The sword should be there in your inventory. Even if the script "item-sw2" doesn't exist, the seq, frame you called should still load a graphic into the inventory.
free_items(); is an actual command yes. It is also used by Seth on some scripts if you check the source code.

You should check the value of free_items(); before and after adding the sword and see if it changes. That should help narrow down where the problem lies.
Looks fine to me. Do the item-w graphics show up in the editor? All slots until the 25th frame have to exist, you can't have empty slots in the middle. Also, with the way you've written it in the dink.ini, those graphics should be called "item-w01.bmp", "item-w02.bmp", etc. (instead of item-w-01.bmp, like graphics in the original game are written)
^That is the only thing I can think of.
I ran it with it using the standard item graphics and it worked fine. I also tried deliberate errors in the item script and it still loaded correctly.
I ran it with it using the standard item graphics and it worked fine. I also tried deliberate errors in the item script and it still loaded correctly.
I found the problem. Turns out the dir.ff i had packed my graphics in was corrupt and it was reading it but not actually loading it. Either way folks thanks for the help! Who would believe the Dink Smallwood community would be active after all these years!