PDA

View Full Version : Possible Epiphany!



Lelouche Vi Britannia
03-14-2016, 10:53 PM
Ok, so I think I finally figured out how the whole counters thing works. Someone stop me if I'm wrong...

While surfing PZC for interesting item and ffc scripts I came across an older weapon script called "Grenades" finding it at least a little interesting I took a closer look at it since it boasted of not needed a global function in order to do its job. Then I noted the counter comment... "By default, the grenade will use up bombs, but you can edit the CR_GRENADES constant to make it use another counter instead."

So I looked at the code. Low and behold, I see the line...


const int CR_GRENADES = 2;


Making a few assumptions I checked the order of the counters listed in ZQuest and saw the order of the first three being Life, Rupees, and Bombs respectively. Based on what I read, if I'm following this correctly... Counters follow as 0 = Life, 1 = Rupees, and 2 = Bombs... therefore 3 = Arrows, 4 = Magic, 5 = Keys, and 6 = Super Bombs. So counters 7+ then refer to scripts 1 through 25 (7 = S1, 8 = S2, etc up to 31 = S25).

So my new assumption is now that if I use the line...


const int CR_POTIONA = 7;

then I can create a unique counter reference for the item and it should in theory work like normal (counting up by the indicated amount in the item editor when an item is picked up, and reduced by 1 whenever the item is used).

Are my assumptions correct? Is there anything I'm missing?

Gleeok
03-15-2016, 06:18 AM
Yep. Mostly. If I'm understanding you correctly.

Game Counters starting at CR_SCRIPT1 just means that they aren't used internally for anything important and scripts are free to do whatever they want with them.

Lelouche Vi Britannia
05-08-2016, 07:25 PM
It worked but as they are bare bones, I had to tell it how to use itself in the code for the item. I 've made a few custom counters since this thread opened. Still not an expert but definitely wiser now.