PDA

View Full Version : Restrictions on Link->Item[]?



ScaryBinary
02-03-2008, 03:29 PM
I'm experimenting with the Link->Item[] property...it seems I can give Link certain items by setting the appropriate element in the array to true...for instance, to give Link the ladder:

Link->Item[I_LADDER1] = true;

I tried this with a Triforce Fragment (I_TRIFORCE), and nothing happened though. After a little thought, it seems reasonable enough that not all the I_ constants will work (e.g., this doesn't work with Rupees, but they're not really an inventory item, in the sense that a ladder or raft are....), but both the Ladder and the Triforce fragment are marked as "Equipment Item" in the Item Editor, so I thought they'd behave the same way using Link->Item[].

What's the dealio?

Also, the zscript.txt file says to use the "IT_" constants in std.zh, but I couldn't find any "IT_" constants....? :confused:

Joe123
02-03-2008, 04:05 PM
Urm...

To understand this, you have to realise how ZC loads triforce pieces.

The item you pick up is an item per se, but it is not in the subscreen, and I'm assuming so in the system also.

What happens is:
Link picks up the 'triforce piece' item.
The game then check's the DMap's level number, and gives Link the level number of that triforce piece in the subscreen.
This is also how the custom triforce piece subscreen item works; you give them a DMap level number attribute when you place them down.

So it makes sense that setting Link->Item[I_TRIFORCE] to true wouldn't work as you may expect.
However, making the item via the script and placing it onto Link should.

DarkDragon
02-03-2008, 05:12 PM
Link basically has a big list of "Items I Have." Using Link->Item manually checks off an element of the list, which is very straightforward when giving him, say, the hammer or hookshot.

But that's not the whole story. Giving him an item will also carry out whatever was specified to do with counters in the item editor; other special stuff, such as what happens when picking up the Triforce or Kill All Enemies, doesn't happen.

But that's not the whole story. Link->Item does nothing if Link already has that item checked off on his list. So giving him a non-equipment item, such as a rupee or arrow ammo, should always have the expected side effects (if that is not the case, please let me know, as that's very curious/possibly a bug.) But giving him equipment items which also have counter side-effects, like bombs (assuming Link already has picked up a bomb somewhere), won't work, since Link already has bombs checked.

Confused yet? ;)

Link->Item is convoluted because it basically mucks directly with ZC internals, instead of doing something intelligent on a high level. Someday (eg ZC 3.0) everything will be redesigned with scripting in mind from the start; until then, if Link->Item doesnt' do what you want, just spawn the item right on top of Link.

Joe123
02-03-2008, 05:17 PM
Ah, so I was sort of right then ^_^