User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11

Thread: items.zh

  1. #1
    Username Kaiser SUCCESSOR's Avatar
    Join Date
    Jul 2000
    Location
    Winning.
    Age
    31
    Posts
    4,431
    Mentioned
    152 Post(s)
    Tagged
    7 Thread(s)
    vBActivity - Stats
    Points
    10,322
    Level
    30
    vBActivity - Bars
    Lv. Percent
    22.63%
    Daily Activity
    0%
    Weekly Activity
    20%
    Monthly Activity
    27.09%

    items.zh

    https://dl.dropboxusercontent.com/u/...ripts/items.zh

    Updated link: https://1drv.ms/u/s!Anx-XGRXU_d2gsxpd1bZWFoFLq6x_Q

    Update 3/26/14
    -some function name fixes
    -added GetActiveEquipmentOfFamily()
    -added demo script EquipmentSlotX

    A header for managing and using Equipment as well as other item related functions.
    This is a header I have been working on for a while. It started out as just some functions I made for my quest but when interest in those functions grew(and the quest died) I decided to make it into a header. It is still a WIP. Also even though I am pretty sure there is no items.zh already the name could change if needed.

    The biggest part of this header is the ability to use Equipment on Inputs other than A and B. I wanted to make that very simple to do. I really want this to get plenty of testing so if you try it out please post some feedback. I am also sorry for it's state. Some organization, commenting, refining, and possibly renaming of some functions are still in order. I am also working on some example scripts to help people who are not scripters get some use out of this.

    This script allows you to use

    Use hardcoded equipment on all extra buttons: Show

    All Extra inputs including L & R have been hardcoded to use an item if acquired
    Code:
    import "items.zh"
    import "std.zh"
    
    global script UseEquipmentOnExInput{
        void run(){
            while(true){
                //UseEquipmentOnExInput(Ex1, Ex2, Ex3, Ex4, L, R);
                UseEquipmentOnExInput(I_CANDLE2, I_BRANG1, I_WAND, I_HOOKSHOT1, I_ARROW1, I_BOMB);
                Waitframe();
            }
        }
    }

    Use hardcode equipment on one button: Show

    Pressing Ex1 will use the Roc's Feather making Link Jump
    Code:
    import "items.zh"
    import "std.zh"
    
    global script UseEquipment{
    	void run(){
    		while(true){
    			ResetEquipment();
    			UseEquipmentOnInput(I_ROCSFEATHER, EQP_INPUT_EX1);
    			Waitframe();
    		}
    	}
    }


    Script that creates an Ex1 Equipment slot that functions like A and B
    This one is a little more involve. You will need to make a new equipment slot
    on you subscreen and then figure out the coordinates for Zscript and put it in the constants.
    To select equipment for Ex1 press L and R. Demo file
    Equipment Slot X: Show

    Code:
    import "items.zh"
    import "std.zh"
    
    const int XSLOT_X = 100;
    const int XSLOT_Y = -24;
    
    //Equipment Slot Ex1
    int EquipmentX[4];
    	const int EX1_ID 	= 0;
    	const int EX1_OLDID = 1;
    	const int EX1_TILE 	= 2;
    	const int EX1_CSET 	= 3;
    	
    
    global script EquipmentSlotX{
    	void run(){
    		
    		while(true){
    			ResetEquipment();
    			EquipmentX();
    			
    			Waitframe();
    		}
    	}
    	bool EquipmentXIsValid(){
    		return (EquipmentX[EX1_ID] > 0 && EquipmentX[EX1_ID] < 256);
    	}
    	void ShiftEquipmentX(int dir){
    		if(EquipmentXIsValid()){
    			int storeB = EquipmentB();				//save EquipmentB value
    			SwapEquipmentB(EquipmentX[EX1_ID]);		//Change EquipmentB to EquipmentX[EX1_ID]
    			Link->SelectBWeapon(dir);				//Adjust EquipmentB as directed
    			if(EquipmentB() == storeB)Link->SelectBWeapon(dir); //make sure we don't set X to B
    			EquipmentX[EX1_ID] = EquipmentB();		//set X
    			SwapEquipmentB(storeB);					//reset B
    		}
    	}
    	void UpdateEqupimentX(){
    		//Makes sure the value of EquipmentX is in inventory or another item of the same family is in inventory
    		if(EquipmentXIsValid()){
    			int get = GetActiveEquipment(EquipmentX[EX1_ID]); 			//Confirm EquipmentX or Equipment in the same family is in inventory
    			if(get == -1) get = GetActiveEquipmentOfFamily(EquipmentX[EX1_ID]); //Link does not have that Equipment try Equipment of Family
    			if(get == -1) EquipmentX[EX1_ID] = 0;						//Link does not have that Equipment 
    			else if(get != EquipmentX[EX1_ID]) EquipmentX[EX1_ID] = get; //Equipment found set it to X
    		}
    		
    		//If EquipmentX has no value
    		else if(CountActiveEquipment() > 2) {
    			EquipmentX[EX1_ID] = EquipmentB();
    		}
    		//change EquipmentX if it it already on A or B and we are not using EquipmentX
    		if( (EquipmentX[EX1_ID] == EquipmentB() || EquipmentX[EX1_ID] == EquipmentA())  && !Link->Misc[EQP_LINK_MISC]){
    			ShiftEquipmentX(DIR_RIGHT);			
    		}
    		//if EquipmentX has changed update draw variables
    		if(EquipmentX[EX1_ID] != EquipmentX[EX1_OLDID]){
    			GetItemTileAndCSet(EquipmentX[EX1_ID]);
    			EquipmentX[EX1_OLDID] = EquipmentX[EX1_ID];
    		}
    	}
    	//get tile and cset of our equipment to draw
    	void GetItemTileAndCSet(int it){
    		item get = Screen->CreateItem(it);
    		EquipmentX[EX1_CSET] = get->CSet;
    		EquipmentX[EX1_TILE] = get->Tile;
    		Remove(get);
    	}
    	void EquipmentX(){
    		//makes sure we have a good equipment ID and it's not a duplicate
    		UpdateEqupimentX();
    		//Press L or R to change EquipmentX
    		if(Link->PressL  && CanUseEquipment()) ShiftEquipmentX(DIR_LEFT);
    		else if(Link->PressR  && CanUseEquipment()) ShiftEquipmentX(DIR_RIGHT);
    		
    		
    		if(EquipmentXIsValid()){
    			//draw item tile to subscreen
    			Screen->FastTile(7, XSLOT_X, XSLOT_Y, EquipmentX[EX1_TILE], EquipmentX[EX1_CSET], 128);
    			//Use our equipment with with the right input
    			UseEquipmentOnInput(EquipmentX[EX1_ID], EQP_INPUT_EX1);
    		}
    	}
    }
    Last edited by SUCCESSOR; 10-09-2017 at 05:03 PM.

  2. #2
    Username Kaiser SUCCESSOR's Avatar
    Join Date
    Jul 2000
    Location
    Winning.
    Age
    31
    Posts
    4,431
    Mentioned
    152 Post(s)
    Tagged
    7 Thread(s)
    vBActivity - Stats
    Points
    10,322
    Level
    30
    vBActivity - Bars
    Lv. Percent
    22.63%
    Daily Activity
    0%
    Weekly Activity
    20%
    Monthly Activity
    27.09%
    A few small updates to the header. Nothing to get all worked up about.

    I completed the example script for creating a new item slot. It of course requires you to have a space for it to draw on the subscreen. You adjust where it goes with the constants XSLOT_X and XSLOT_Y. Unfortunately it seems the coordinates for Y in the subscreen editor are a little different than Zscript so a little guesswork and trial and error goes into that. I made a little demo quest for this one. Use L and R to change the equipment in the X Slot.

    The demo file
    The script file

  3. #3
    The Timelord ZC Developer ZoriaRPG's Avatar
    Join Date
    Oct 2006
    Location
    Prydon Academy
    Posts
    1,039
    Mentioned
    95 Post(s)
    Tagged
    1 Thread(s)
    vBActivity - Stats
    Points
    3,606
    Level
    19
    vBActivity - Bars
    Lv. Percent
    22.26%
    Daily Activity
    0%
    Weekly Activity
    20%
    Monthly Activity
    207.67%
    @SUCCESSOR
    Have you updated this recently, to a more 'final' version? I've been waiting for news on it, so that I can update scripts to depend on it, rather than what I've been using, but I never heard back from you (PM'd about six months back).


    Featured Scripts & Headers: RPG.zh ( v. a0.97.1 ) ( RPG.zh Thread ) | Zelda 3 Thief's Town Treasure Chest Minigame (ffc) | Bobomb (enemy)
    ZScript & ZC-Related Pastebin | Quests and ZScript Repository | ZC Dev & Betas | Latest ZC 2.54 Beta | YouTube Channel
    All of the code that I create and publish here is free for use, modification and distribution under the GPL v2.0, or v3.0 where applicable..

  4. #4
    Octorok Lelouche Vi Britannia's Avatar
    Join Date
    Oct 2015
    Location
    Britannia - Area 11
    Posts
    155
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    840
    Level
    10
    vBActivity - Bars
    Lv. Percent
    13.37%
    Daily Activity
    0%
    Weekly Activity
    20%
    Monthly Activity
    27.09%
    Any updates? Having more equipment buttons is a nice thing.
    Lost my wings and grew 8 tentacles... I've seen enough Hentai to know where this is going....

  5. #5
    Gel Just registered Lunaria's Avatar
    Join Date
    Jun 2017
    Posts
    11
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    58
    Level
    2
    vBActivity - Bars
    Lv. Percent
    63.5%
    Daily Activity
    0%
    Weekly Activity
    20%
    Monthly Activity
    162.53%
    Does anyone have a mirror of this library? The download links are all dead, most likely due to dropbox killing public folders.
    If you want to reach me I recommend elsewhere, I'm not really active here.

  6. #6
    The Timelord ZC Developer ZoriaRPG's Avatar
    Join Date
    Oct 2006
    Location
    Prydon Academy
    Posts
    1,039
    Mentioned
    95 Post(s)
    Tagged
    1 Thread(s)
    vBActivity - Stats
    Points
    3,606
    Level
    19
    vBActivity - Bars
    Lv. Percent
    22.26%
    Daily Activity
    0%
    Weekly Activity
    20%
    Monthly Activity
    207.67%
    Quote Originally Posted by Lunaria View Post
    Does anyone have a mirror of this library? The download links are all dead, most likely due to dropbox killing public folders.
    I have some of his functions cloned in my old ItemHandling.zh header. I may have the newer one, on a server somewhere.

    Is there a specific function, or set of utilities that you needed from it, failing that?

    THis old, ugly weapon script uses some of them, but it does not have L/R Ex item buttons in it. The general premise for that, is this:

    Store an item ID to a button somehow.
    When the button is pressed, read the item stored to it.
    Set that item to A or B.
    Fake a press of A or B (respectively).

    Not pretty, and the one frame graphical glitch will probably irritate you; which means scripting a visual fix for it.

    Future ZC Notes and Notions
    Spoiler: show

    I'm leaning toward adding something along the lie of Game->RunItemScript() to ZScript in the future to allow using a scripted item from any button, and possibly Link->UseItem() if i want to lose more sleep, and more sanity. I've considered adding buttons mapped to all of the eight non-directional buttons for 2.60. That'll be joyful, and merit a other case of whiskey.
    Last edited by ZoriaRPG; 10-08-2017 at 07:41 PM.


    Featured Scripts & Headers: RPG.zh ( v. a0.97.1 ) ( RPG.zh Thread ) | Zelda 3 Thief's Town Treasure Chest Minigame (ffc) | Bobomb (enemy)
    ZScript & ZC-Related Pastebin | Quests and ZScript Repository | ZC Dev & Betas | Latest ZC 2.54 Beta | YouTube Channel
    All of the code that I create and publish here is free for use, modification and distribution under the GPL v2.0, or v3.0 where applicable..

  7. #7
    Gel Just registered Lunaria's Avatar
    Join Date
    Jun 2017
    Posts
    11
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    58
    Level
    2
    vBActivity - Bars
    Lv. Percent
    63.5%
    Daily Activity
    0%
    Weekly Activity
    20%
    Monthly Activity
    162.53%
    Well I was both wanting to look into how it handled things in code as well as maybe implementing it depending on how it worked, I'm not yet certain exactly what kind of solution I want so I really can't see exactly what I need from it. If you do find it that would be appreciated.

    Also paging @SUCCESSOR in case you're still around and have it.
    If you want to reach me I recommend elsewhere, I'm not really active here.

  8. #8
    Username Kaiser SUCCESSOR's Avatar
    Join Date
    Jul 2000
    Location
    Winning.
    Age
    31
    Posts
    4,431
    Mentioned
    152 Post(s)
    Tagged
    7 Thread(s)
    vBActivity - Stats
    Points
    10,322
    Level
    30
    vBActivity - Bars
    Lv. Percent
    22.63%
    Daily Activity
    0%
    Weekly Activity
    20%
    Monthly Activity
    27.09%
    Quote Originally Posted by Lunaria View Post
    Well I was both wanting to look into how it handled things in code as well as maybe implementing it depending on how it worked, I'm not yet certain exactly what kind of solution I want so I really can't see exactly what I need from it. If you do find it that would be appreciated.

    Also paging @SUCCESSOR in case you're still around and have it.
    Sorry for the late reply. I have updated the OP with a new link on my onedrive. I don't really know what is happening with dropbox. I'll try getting that one fixed as well.


    Quote Originally Posted by Lelouche Vi Britannia View Post
    Any updates? Having more equipment buttons is a nice thing.
    Sorry, I have not really updated this. Lost touch with ZC and ZScript. If there is anything lacking, faulty, or other such let me know! I realize this reply is coming a year late, but it goes to anyone else who might have a similar question.
    Last edited by SUCCESSOR; 10-09-2017 at 05:18 PM.

  9. #9
    The Timelord ZC Developer ZoriaRPG's Avatar
    Join Date
    Oct 2006
    Location
    Prydon Academy
    Posts
    1,039
    Mentioned
    95 Post(s)
    Tagged
    1 Thread(s)
    vBActivity - Stats
    Points
    3,606
    Level
    19
    vBActivity - Bars
    Lv. Percent
    22.26%
    Daily Activity
    0%
    Weekly Activity
    20%
    Monthly Activity
    207.67%
    Quote Originally Posted by SUCCESSOR View Post
    Sorry for the late reply. I have updated the OP with a new link on my onedrive. I don't really know what is happening with dropbox. I'll try getting that one fixed as well.

    Sorry, I have not really updated this. Lost touch with ZC and ZScript. If there is anything lacking, faulty, or other such let me know! I realize this reply is coming a year late, but it goes to anyone else who might have a similar question.
    @SUCCESSOR : You may want to consider adding it to the databases on zeldaclassic.ocm and pureze.com.

    One nice thing that I added to 2.54 and above, thatwill benefit this, and to which you may want to update it (once released), is:


    int SetItemSlot(int itm_id, int slot, int force);

    /**
    * This allows you to set Link's button items without binary operations, and to decide whether to
    * obey quest rules, or inventory.
    *
    * When using this, 'itm_id' is the ID number of the item.
    * Set 'slot' to one of the following: 0 == Slot B, 1 == Slot A
    * Other buttons may be added in the future, and other values for 'slot' are thus, reserved.
    * Set the flags on 'force' as follows:
    * const int ITM_REQUIRE_NONE = 0
    * const int ITM_REQUIRE_INVENTORY = 1
    * const int ITM_REQUIRE_A_SLOT_RULE = 2
    * Thus, require both inventory, and following quest slot rules, force == 3.



    Thus, needing to set up a subscreen, or using idiotic functions to page through items, is a duck.

    I want to add either, or both, RunitemScript(int script) and Useitem(int item_id) at some point--I may have mentioned this in the thread earlier, but I've forgotten--and I want to add bitem slots for the extra buttons, plus L and R; hence the configuration for SetItemSlot(), which can be expanded to cover additional slots, if we add more.

    The real issue, is the suibscreen: I could add item slots for more buttons, but making the subscreen show them would be hellish.

    Quote Originally Posted by Lunaria
    Well I was both wanting to look into how it handled things in code as well as maybe implementing it depending on how it worked, I'm not yet certain exactly what kind of solution I want so I really can't see exactly what I need from it. If you do find it that would be appreciated.
    One of the things that I did, to suppress the graphical inconsistency, was this:

    Set the tile positions for A and B item slots (the subscreen icons) as constants:
    const int SUBSC_PSV_ITEM_A_X = n;
    const int SUBSC_PSV_ITEM_A_Y = n;
    const int SUBSC_PSV_ITEM_B_X = n;
    const int SUBSC_PSV_ITEM_B_Y = n;

    Draw a solid black tile over the item that I am substituting.
    Draw the item tile for the item the item that is truly held in that slot (the one that I am temporarily shifting out) over the black tile.

    This overrides the graphics of the item that I am using for a frame, so that the graphical glitch is less obvious.

    I was more clever with 2.54, and in that version, I do:

    Code:
    //global
    
    const int TEMP_ITM_B_ID = 0;
    const int TEMP_ITM_B_TILE = 1;
    const int TEMP_ITM_A_ID = 2;
    const int TEMP_ITM_A_TILE = 3;
    const int TEMP_ITM_L_ID = 4;
    const int TEMP_ITM_L_TILE = 5;
    
    int tempitem[8]; //holds the item that should be in the slot, and its tile. 
    // Item that should be there: item id (B), tile (B), item id (A), tile (A) 
    //item that we are using this frame tempidtem_id, tempitem_tile
    
    
    void UseItemOnL(int itm_id)
    {
    	itemdata temp = Game->LoadItemData(GetItemSlot(SLOT_B)); 
    	itemdata itmL = Game->LoadItemData(itm_id);
    	//store the original item information for the slot
    	tempitem[TEMP_ITM_B_ID] = temp->ID; //what was in the slot.
    	tempitem[TEMP_ITM_B_TILE] = temp->Tile; //..
    	tempitem[TEMP_ITM_L_ID] = itm_id;
    	tempitem[TEMP_ITM_L_TILE] = temp->Tile; //the original tile for the temporary item
    	itmL->Tile = tempitem[1];
    	Link->SetItemSlot(itm_id, SLOT_B, 0);
    	Link->PressB = true;
    	Waitframe();
    }
    
    void RestoreItemB()
    {
    	itemdata temp = Game->LoadItemData(tempitem[TEMP_ITM_L_ID]);
    	itemdata real = Game->LoadItemData(tempitem[TEMP_ITM_B_ID]);
    	Link->SetItemSlot(tempitem[TEMP_ITM_B_ID], SLOT_B, 0); //restore the true item
    	temp->Tile = tempitem[TEMP_ITM_L_TILE]; //restore the original tile. 
    }
    Last edited by ZoriaRPG; 10-10-2017 at 12:11 PM.


    Featured Scripts & Headers: RPG.zh ( v. a0.97.1 ) ( RPG.zh Thread ) | Zelda 3 Thief's Town Treasure Chest Minigame (ffc) | Bobomb (enemy)
    ZScript & ZC-Related Pastebin | Quests and ZScript Repository | ZC Dev & Betas | Latest ZC 2.54 Beta | YouTube Channel
    All of the code that I create and publish here is free for use, modification and distribution under the GPL v2.0, or v3.0 where applicable..

  10. #10
    Username Kaiser SUCCESSOR's Avatar
    Join Date
    Jul 2000
    Location
    Winning.
    Age
    31
    Posts
    4,431
    Mentioned
    152 Post(s)
    Tagged
    7 Thread(s)
    vBActivity - Stats
    Points
    10,322
    Level
    30
    vBActivity - Bars
    Lv. Percent
    22.63%
    Daily Activity
    0%
    Weekly Activity
    20%
    Monthly Activity
    27.09%
    Quote Originally Posted by ZoriaRPG View Post
    @SUCCESSOR : You may want to consider adding it to the databases on zeldaclassic.ocm and pureze.com.
    Maybe, if I get around to it.

    Quote Originally Posted by ZoriaRPG View Post
    Thus, needing to set up a subscreen, or using idiotic functions to page through items, is a duck.
    You don't need to set up a subscreen for this. subscreens by default let you toggle linearly through all items. It's custom subscreens that can be a problem for this header. Other than that cycling through items isn't really so much of an issue so far as I can tell. And seems to rarely be visible. If people actually start using it in quests we might get a better idea though. Most people generally just want to have an extra button for a single constant item, from what I've seen.

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