Nick
12-29-2006, 12:48 AM
This is far from a "cool" script (it is essentially one line of code that isn't validation), but one of the things that is scaring people with no knowledge of scripting off from using it is the lack of simplistic scripts.
Granted ZQuest now has the ability to disable items per dmap, this isn't quite the same as simply stripping the player of the items forever (I think?). Ignoring this fact, it would be a hassle to make new dmaps just to do this. This script helps solve this problem a bit. It's essentially my first script, so I might have put too much effort into the validation (I dunno how ZC reacts to stupid input for things like arrays or boolean conversion).
To use this script, simply attach it to a FFC then modify the D# values. D0 is the number of the item (look it up under "Item IDs" in std.zh). D1 specifies whether to remove or add the item to the inventory. 0 (the default) will remove the item. 1 will add the item. This script will run once every time the FFC appears (once every time you enter the room).
// --------------------------------------
// SCRIPT: Inventory Modifier
// Created by Nick
// --------------------------------------
// --------------------------------------
// DESCRIPTION
// This script modifies the player's inventory upon execution.
// It's a very simplistic script, as the action is executed
// in one line. Everything else is validation... I have no clue
// how ZC reacts to some things at the moment.
//
// NOTE: If you don't want this script to run EVERYTIME
// you enter a screen, the FFC will need to be removed or
// it will need to be on a duplicate screen.
// --------------------------------------
// --------------------------------------
// USER ARGUMENTS
// D0 (item_number)
// The number of the item you wish to modify.
// Refer to std.zh under item #'s (not item class)
// D1 (item_state)
// The state of the item. 0 = Take 1 = Give
// --------------------------------------
// #####This is the main code that ZQuest will execute#####
ffc script inventory_mod {
void run(int item_number, int item_state) { // Begin execution of running code
if (item_number > 0 && item_number < 255) // item_number validation
{
if (item_state == 0 || item_state == 1) // item_state validation
{
Link->Item[item_number] = item_state; // Item "item_number" is taken or given, depending on "item_state".
}//!End of item_state validation
}//!End of item_number validation
}//! End of run function
}//! End of main running code. Essentially the end of the script.
On the note of validation, did I get the number of items in ZQuest correct? I've not really checked. If I didn't, I'll fix that.
If there are any other problems, let me know. This is my first script, so it's probably not perfect. Actually... I know it isn't. I was wanting to add the ability to make this execute just once for the entire game (by option), but I'll work on that later.
Edit: I should probably note I haven't tested this very thoroughly. I only tested this on items that are actually kept in the inventory. I have no idea what this does with stuff like hearts or rupees.
Granted ZQuest now has the ability to disable items per dmap, this isn't quite the same as simply stripping the player of the items forever (I think?). Ignoring this fact, it would be a hassle to make new dmaps just to do this. This script helps solve this problem a bit. It's essentially my first script, so I might have put too much effort into the validation (I dunno how ZC reacts to stupid input for things like arrays or boolean conversion).
To use this script, simply attach it to a FFC then modify the D# values. D0 is the number of the item (look it up under "Item IDs" in std.zh). D1 specifies whether to remove or add the item to the inventory. 0 (the default) will remove the item. 1 will add the item. This script will run once every time the FFC appears (once every time you enter the room).
// --------------------------------------
// SCRIPT: Inventory Modifier
// Created by Nick
// --------------------------------------
// --------------------------------------
// DESCRIPTION
// This script modifies the player's inventory upon execution.
// It's a very simplistic script, as the action is executed
// in one line. Everything else is validation... I have no clue
// how ZC reacts to some things at the moment.
//
// NOTE: If you don't want this script to run EVERYTIME
// you enter a screen, the FFC will need to be removed or
// it will need to be on a duplicate screen.
// --------------------------------------
// --------------------------------------
// USER ARGUMENTS
// D0 (item_number)
// The number of the item you wish to modify.
// Refer to std.zh under item #'s (not item class)
// D1 (item_state)
// The state of the item. 0 = Take 1 = Give
// --------------------------------------
// #####This is the main code that ZQuest will execute#####
ffc script inventory_mod {
void run(int item_number, int item_state) { // Begin execution of running code
if (item_number > 0 && item_number < 255) // item_number validation
{
if (item_state == 0 || item_state == 1) // item_state validation
{
Link->Item[item_number] = item_state; // Item "item_number" is taken or given, depending on "item_state".
}//!End of item_state validation
}//!End of item_number validation
}//! End of run function
}//! End of main running code. Essentially the end of the script.
On the note of validation, did I get the number of items in ZQuest correct? I've not really checked. If I didn't, I'll fix that.
If there are any other problems, let me know. This is my first script, so it's probably not perfect. Actually... I know it isn't. I was wanting to add the ability to make this execute just once for the entire game (by option), but I'll work on that later.
Edit: I should probably note I haven't tested this very thoroughly. I only tested this on items that are actually kept in the inventory. I have no idea what this does with stuff like hearts or rupees.