User Tag List

Results 1 to 4 of 4

Thread: Nick's Generic Script #1: Inventory Modifier

  1. #1
    Lynel Nick's Avatar
    Join Date
    Oct 2001
    Location
    I don't remember...
    Posts
    1,918
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    2,818
    Level
    17
    vBActivity - Bars
    Lv. Percent
    26.13%

    Nick's Generic Script #1: Inventory Modifier

    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).
    Code:
    // --------------------------------------
    // 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.

  2. #2
    Developer
    ZC Developer
    jman2050's Avatar
    Join Date
    Jun 2001
    Location
    Do you really need to know
    Age
    37
    Posts
    3,883
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    5,709
    Level
    23
    vBActivity - Bars
    Lv. Percent
    46.18%

    Re: Nick's Generic Script #1: Inventory Modifier

    It won't affect hearts or rupees because hearts and rupees won't be checked i the inventory. Their effects are purely as a collected item.
    AGN's Resident Zelda Classic Developer and Sonic the Hedgehog Fanboy

  3. #3
    Lynel Majora's Avatar
    Join Date
    Mar 2006
    Age
    32
    Posts
    1,197
    Mentioned
    24 Post(s)
    Tagged
    7 Thread(s)
    vBActivity - Stats
    Points
    4,388
    Level
    20
    vBActivity - Bars
    Lv. Percent
    93.99%

    Question Re: Nick's Generic Script #1: Inventory Modifier

    So, will this code work just like that? What I mean is, you import it into ZQuest, hit "Compile", go to an empty FFC, attatch this script to it, in that FFC, go to arguments, type in "6" in D0, and "0" in D1 and when you enter that room, you no longer have the white sword? (I am pretty sure that "6" is the white sword)

  4. #4
    Wizrobe C-Dawg's Avatar
    Join Date
    Jan 2002
    Posts
    4,205
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    6,611
    Level
    24
    vBActivity - Bars
    Lv. Percent
    99.9%

    Re: Nick's Generic Script #1: Inventory Modifier

    Yep.

    This is what I keep telling you people - once it's scripted, SCRIPTS ARE EASY TO USE. The only conceivable hard part is actually making the script yourself, and that's only hard if you're scared by an interface that isn't point-and-click.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Armageddon Games is a game development group founded in 1997. We are extremely passionate about our work and our inspirations are mostly drawn from games of the 8-bit and 16-bit era.
Social