User Tag List

Results 1 to 10 of 37

Thread: ZC [2.future] Feature Requests

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Octorok Lelouche Vi Britannia's Avatar
    Join Date
    Oct 2015
    Location
    Britannia - Area 11
    Posts
    173
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    1,112
    Level
    11
    vBActivity - Bars
    Lv. Percent
    46.5%
    Quote Originally Posted by ZoriaRPG View Post
    Do you happen to have a reference for that comment? I'm not sure what you mean by a 'proper counter'; nor do I know if this is intended to imply that it is difficult to accomplish this in ZScript, or difficult to modify the source to expand the number of available counters; else something entirely different.

    If you are scripting things, and need many counters, you can just store the values in an array, or variable. I suppose we can add more, but I don't know how much of a pain that would be. I don't think it would be too difficult, but I've no idea yet; and depending on how the values are stored, it could either be easy-peasy, or a true nightmare.

    I want to change the way counters work, in general, to use signed longs, instead of (supposedly unsigned) ints. I say 'supposedly' there, because they roll over at a signed int value, but Tamamo claimed they were unsigned. Negative counters do have practical applications, and should be a thing in the future.
    http://armageddongames.net/showthrea...he-Item-Editor

    I may have misinterpreted what was here but I don't think so. It made it sound like customized counters were simply not possible. If you know how to script this out, I would love to know how. I researched it but I guess the math functions required are over my head right now. I'm still getting used to tweeking scripts already made to do what I want them to do (which has become pretty easy now). But other than some really basic stuff, I'm not a guru yet.
    Lost my wings and grew 8 tentacles... I've seen enough Hentai to know where this is going....

  2. #2
    The Timelord
    QDB Manager
    ZC Developer

    Join Date
    Oct 2006
    Location
    Prydon Academy
    Posts
    1,396
    Mentioned
    112 Post(s)
    Tagged
    1 Thread(s)
    vBActivity - Stats
    Points
    4,765
    Level
    21
    vBActivity - Bars
    Lv. Percent
    69.76%
    Quote Originally Posted by Lelouche Vi Britannia View Post
    http://armageddongames.net/showthrea...he-Item-Editor

    I may have misinterpreted what was here but I don't think so. It made it sound like customized counters were simply not possible. If you know how to script this out, I would love to know how. I researched it but I guess the math functions required are over my head right now. I'm still getting used to tweeking scripts already made to do what I want them to do (which has become pretty easy now). But other than some really basic stuff, I'm not a guru yet.

    Here is an example:

    Spoiler: show
    Code:
    ///////////////////////////////
    /// Custom Counters Example ///
    ///////////////////////////////
    
    //Counters array.
    int Counters[214747];
    
    //Counter Array Indices
    const int CTR_ARROW_4 = 1001;
    const int CTR_MAX_ARROW_4 = 1002;
        
    //Item vconstants
    const int IT_ARROW_4 = 200;
    
    //Drawing Arrow 4 COunters Settings:
    const int DRAW_ARROW_4_X = -30;
    const int DRAW_ARROW_4_Y = 100;
    const int DRAW_ARROW_4_FONT = 16;
    const int DRAW_ARROW_4_WIDTH = 8;
    const itn DRAW_ARROW_4_HEIGHT = 8;
    const int DRAW_ARROW_4_COLOUR = 1;
    
    //Initial Set-Up Values
    const int INIT_ARROW_4_MAX = 20;
    
    //Script for 'Arrow 4' quiver.
    item script Arrow_4_Quiver{
        void run(int increase, int set_exact){
            if ( increase && !set_exact ) IncreaseCounterMax(CTR_MAX_ARROW_4, increase);
            if ( !increase && set_exact ) SetCounterMax(CTR_MAX_ARROW_4, set_exact);
        }
    }
    
    //Script for Arrow 4 ammo.
    item script PickupCustomArrowAmmo4{
        void run(int amount, int sound){
            Game->PlaySound(sound);
            if ( Counters[CTR_ARROW_4] - amount < Counters[CTR_MAX_ARROW_4] ) Counters[CTR_ARROW_4]+=amount;
            if ( Counters[CTR_ARROW_4] - amount > Counters[CTR_MAX_ARROW_4] ) Counters[CTR_ARROW_4] = Counters[CTR_MAX_ARROW_4];
        }
    }
            
    //Example bow item that uses 'IT_ARROW_4' and a custom counter.
    //Assign to an item, with the item class 'Custom itemclass', or one of the 'zz###' item classes
    //as the 'Action; script.
    
    //Arguments:
    //Arguments:
    // D0: The sound to play for firing an arrow.. 
    // D1: The number of ammo to use.
    // D2: The sound effect to play for an error, including too many arrows on screen, or out of arrows in the counter.
    // D3: The maximum number of arrows that the player may have on-screen at any one time. 
    // --> You want to set this argument, as not setting it, will allow the player to fire up to 255 arrows, providing 
    // --> that they have sufficient ammunition. Normal values are between '1' and '4'. 
    // D4: Set to a value of '1' to allow Link to fire arrows while jumping. 
    // D5: The ID of the arrow type to generate.
    // D6: The sprite of the arrow when fired.
    // D7: The distance from Link to place it. 
    
    item script Arrow_CustomCounter{
    	void run(int sound, int errorSFX, int maxOnscreen, int allowLinkZ, int arrowID, int sprite, int dist){
    		int numArrows;
    		if ( Floor(Link->Z) !=0 && !allowLinkZ ) Quit();
    
    			if ( Counters[CTR_ARROW_4] && !maxOnscreen ){
    				( if cost > 1 ) {
                        if ( cost > Counters[CTR_ARROW_4] ) {
                            Game->PlaySound(SFX_ERROR);
                            Quit();
                        }
                        else Counters[CTR_ARROW_4]-=cost;
                    }
                    if ( !cost ) Counters[CTR_ARROW_4]--;
    				if ( sound ) Game->PlaySound(sound);
    				lweapon arrow = NextToLink(LW_ARROW, dist);
    				itemdata normalArrow = Game->LoadItemData(arrowID);
    				arrow->UseSprite(sprite);
    				this->Power = normalArrow->Power;
    			}
    			else if ( Counters[CTR_ARROW_4] && maxOnscreen ){
    				for ( int q = 1; q <= Screen->NumLWeapons(); q++ ) {
    					lweapon l = Screen->LoadLWeapon(q);
    					if ( l->ID == LW_ARROW ) numArrows++;
    				}
    				if ( numArrows < maxOnscreen ) {
                        if ( cost > 1 ) {
                            if ( cost > Counters[CTR_ARROW_4] ) {
                                Game->PlaySound(SFX_ERROR);
                                Quit();
                            else Counters[CTR_ARROW_4]--;
                        }
    					if ( !cost ) Counters[CTR_ARROW_4]--;
    					if ( sound ) Game->PlaySound(sound);
    					lweapon arrow = NextToLink(LW_ARROW, dist);
    					itemdata normalArrow = Game->LoadItemData(arrowOD);
    					arrow->UseSprite(sprite);
    					this->Power = normalArrow->Power;
    				}
    				else Game->PlaySound(errorSFX);
    			}
    			if ( !Counters[CTR_ARROW_4] ) Game->PlaySound(errorSFX);
    		
    	}
    }
    
    //Example Global Scripts
    
    //Active
    global script DrawCounters{
        void run(){
            while(true){
                DrawArrow_4_Counter(true);
                WaitDraw();
                Waitframe();
            }
        }
    }
        
    global script Init{
        void run(){
            Counters[COUNTER_MAX_ARROW_4] = INIT_ARROW_4_MAX;
        }
    }
    
    //Global functions
    
    //Draws custom counter from array[index] using settings passed to the remainder of the params.
    void DrawCounter(int arr, int index, int x, int y, int font, int width, int height, int colour){
        Screen->Drawinteger(7,x,y,colour,0,sizeX,arr[index],0,128);
    }
    
    //Draws the counter for 'Arrow 4'. Set 'only_equipped 'true' if you wish ti display only if equipped.
    void DrawArrow_4_Counter(bool only_equipped){
        if ( only_equipped && ( GetEquipmentA() == IT_ARROW_4 || GetEquipmentB() == IT_ARROW_4 ) )
                    DrawCounter(Counters, CTR_ARROW_4, DRAW_ARROW_4_X, DRAW_ARROW_4_Y, DRAW_ARROW_4_FONT, DRAW_ARROW_4_WIDTH, DRAW_ARROW_4_HEIGHT, DRAW_ARROW_4_COLOUR)'
        if ( !only_equipped ) DrawCounter(Counters, CTR_ARROW_4, DRAW_ARROW_4_X, DRAW_ARROW_4_Y, DRAW_ARROW_4_FONT, DRAW_ARROW_4_WIDTH, DRAW_ARROW_4_HEIGHT, DRAW_ARROW_4_COLOUR)'
    }
    
    //Increases a custom counter max to a specified amount.
    void SetCounterMax(int counter, int amount){
        Counters[counter] = amount;
    }
    
    //Increases a ccustom ounter max by a specified amount.
    void IncreaseCounterMax(int counter, int amount){
        Counters[counter] += amount;
    }


    I made this purely out of me head, in about ten minutes at most. As can see, it's not terribly difficult to do this, and it allows you to display the counter on the screen, wherever you bloody well please. I hope this it sans-error...

    If you want to know how to store, and modify an internal Game->Counter[ctr] by shifting weapons,I can give you an example of that, too. Doing this involves little more than storing one state, (CTR_ARCHIVED_*), and if the weapon is selected, store the previous ammo into a backup array index, read a backup array index for the ammo to load, and transpose their values if the condition test evaluates for the specified state.

  3. #3
    The Timelord
    QDB Manager
    ZC Developer

    Join Date
    Oct 2006
    Location
    Prydon Academy
    Posts
    1,396
    Mentioned
    112 Post(s)
    Tagged
    1 Thread(s)
    vBActivity - Stats
    Points
    4,765
    Level
    21
    vBActivity - Bars
    Lv. Percent
    69.76%
    [ unintentional double post ]

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