Originally Posted by
Spacepoet
@
SUCCESSOR
that sounds about perfect! also, i think i found a simple way to do what im looking at as well. have a variable that keeps track of links form number, and set R to run a function depending on the current form that removes and adds items to link, grabbing the data from an array stating which items are obtained, and then changes his form number. stick pickup scripts onto all your items that changes their value in the array to 'obtained', then checks his form number. if it is incorrect, it removes the item, and if its right, he equips it to his open slot. when you cycle around to the correct form, the R script should pull the items data from the array and put it back on the right button?
The variable and pickup scripts would be superfluous. Though since you pickup items in sets I guess it wouldn't be that many, but still superfluous. The array example I showed you uses the first index of the array exactly as you are intending to use a variable. It is a global array so any script can check what set is active by doing itemSets[0] or more readibly: itemSets[ITEM_SET_POSITION]. Your script can easily tell if the player picked up an item set by looking for changes in Link->Items[]. Since it only has to check for items that are in part of a set and not all the items in the game there is no problem in running that check every frame.
An example look:
//NUM_ITEMS_IN_SETS = 2;
itemSets[1,5.1,23.1,15.1,31.1,52,3,...]
We can see here that the current set in use is Set1 so Link has Bow(15) and the Whistle(31) equipped and we can also see that he has the items of Set0, Sword(5) and Boomerang(23) but not the items of Set3 Hookshot(52) and Bombs(3). If we use the convention that A comes first then B we know that the Bow should be assigned to A and the Whistle should be assigned to B.
itemSets[0,5.1,23.1,15,31,52,3,...]
Now Set0 is active and Link has the Sword and BRang and no other sets to use.
(all these names and items are examples of course. What you name your constants and arrays is obviously up to you.)
To mark as obtained:
Code:
for(int i = 1,i<100,i++)//start at 1 because the 0 index is used to mark the current item set; the 100 is irrelevant it just has to be bigger than the amount of items
{ if(!itemSets[i]) break;//we reached an index with a zero value so we end the loop.
if(Link->Item[floor(itemSets[i])] && !(itemSets[i] - floor(itemSets[i]) ) )//if Link has the item but it hasn't been marked as obtain in the array
itemSets[i] = itemSets[i] + .1; //mark it as obtained in the array
}
(once again: just how I would go about it)