User Tag List

Results 1 to 8 of 8

Thread: Dark Form

  1. #1
    Keese
    ZC Developer

    Join Date
    Jan 2007
    Age
    34
    Posts
    52
    Mentioned
    27 Post(s)
    Tagged
    1 Thread(s)
    vBActivity - Stats
    Points
    781
    Level
    9
    vBActivity - Bars
    Lv. Percent
    80.7%

    Dark Form

    My first script:
    Hit R to switch to a "Dark Link" which gives him the master sword, golden ring, and regenerating hp while constantly losing magic.

    However, when you switch out of it, you are given back a wooden sword. Does anyone know how to read Link's current sword level without having to check for the presence of each individual item? (if has Sword 1, else if has sword 2, etc.)

    EDIT: Changed it around to an item script, with a global script running in the background.
    Now you can have several different forms, as well.


    Code:
    // ===============================================================
    // DarkForm Item:
    //	Must include the global script ability.
    //
    // Use item to toggle between normal Link and a Dark Form, 
    // which gives him the Master Sword and the Gold Ring, 
    // as well as regeneration, all for the price of magic.
    //
    // If Link tries to activate a different form while one is already
    // active, the current form will deactivate, and Link must use the
    // item again to activate the new one.
    //
    // Arguments for ability.toggle_darkform():
    // 1:	Number of frames for Link to lose 1/32 point of magic.
    //	Set to 0 for no loss.
    // 2:	Number of Hearts healed per frame, in sixteenths.
    // 3:	Amount of magic in 32nds that one frame of healing costs.
    // 4:	Item Id of first item to give/take away.
    // 5:	Item Id of second item to give/take away.
    // ===============================================================
    
    // Gives golden ring, master sword, and drains magic
    item script darkform_item {
    
    	void run() {
    		ability.toggle_darkform(12, 0, 0, 61, 36);
    	}
    
    }
    
    // Gives golden ring, mirror shield, and heals.
    item script darkform_item2 {
    
    	void run() {
    		ability.toggle_darkform(0, 1, 1, 61, 37);
    	}
    
    }
    
    global script ability {
    
    	bool darkform_activated = false;
    	int darkform_delaycount = 0;
    	int darkform_magicdelay = 0;
    	int darkform_healamount = 0;
    	int darkform_healcost = 0;
    	int darkform_item1 = 0;
    	int darkform_item2 = 0;
    
    	void run() {
    		while(true) {
    			darkform(darkform_magicdelay, darkform_healamount, darkform_healcost);
    			Waitframe();
    		}
    	}
    
        	void darkform(int magic_delay, int heal_amount, int heal_cost) {
    		if(darkform_activated) {
    			if(Link->HP < Link->MaxHP) {
    				if(Link->MP >= heal_cost) {
    					Link->MP = Link->MP - heal_cost;
    					if(Link->MaxHP - Link->HP > heal_amount) {
    						Link->HP = Link->HP + heal_amount;
    					} else {
    						Link->HP = Link->MaxHP;
    					}
    				}
    			}
    			if(Link->MP == 0 && magic_delay > 0) {
    				set_darkform(false);
    			} else {
    				darkform_delaycount = darkform_delaycount + 1;
    				if(darkform_delaycount == magic_delay) {
    					Link->MP = Link->MP - 1;
    					darkform_delaycount = 0;
    				}
    			}
    		}
    	} // end of void darkform
    
    	void toggle_darkform(int delay, int heal, int cost, int item1, int item2) {
    		if(!darkform_activated && (Link->MP > 0 || delay == 0)) {
    			darkform_magicdelay = delay;
    			darkform_healamount = heal;
    			darkform_healcost = cost;
    			darkform_item1 = item1;
    			darkform_item2 = item2;
    			set_darkform(true);
    		} else {
    			set_darkform(false);
    		}
    	}
    
    	void set_darkform(bool state) {
    		darkform_activated = state;
    		Link->Item[darkform_item1] = state;
    		Link->Item[darkform_item2] = state;		
    		if(!state) {
    			darkform_delaycount = 0;
    		}
    	}
    
    }

  2. #2
    Wizrobe
    Join Date
    Nov 2002
    Posts
    2,819
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    8,462
    Level
    27
    vBActivity - Bars
    Lv. Percent
    77.95%

    Re: Dark Form

    Is this script for an item? If so, i'm still not sure how to attach scripts to an item or compile them or anything. This sounds like it would be useful for an item that grants link "Fierce Diety" status.
    My Zquest Tutorial
    tutorial document

    Working on a quest, I swear i'll finally finish one, one of these days!

    Status:
    --Overworld: 60% done
    --Dungeons: 0% done
    --Misc: 0% done

  3. #3
    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%

    Re: Dark Form

    This is a ffc script. As such, you have to attach it to a ffc and put it on any screens that you desire for this to happen on.

    However, I could see how it'd be useful for an item... but the problem comes with how item scripting currently works: item scripts cannot loop.

    As far as reading for Link's sword level, the only way to check it is to check for the items (as far as I know, anyway).

  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: Dark Form

    You want Link to go back to whatever sword he was using before, right? Then just click the "Link Keeps Old Items" quest rule. Once you take away the new goodies, Link will have the old versions he had before.

    Alternatively, you can set global variables to track what items he had before the change and then re-set his inventory after the change.

  5. #5
    Keese
    ZC Developer

    Join Date
    Jan 2007
    Age
    34
    Posts
    52
    Mentioned
    27 Post(s)
    Tagged
    1 Thread(s)
    vBActivity - Stats
    Points
    781
    Level
    9
    vBActivity - Bars
    Lv. Percent
    80.7%

    Re: Dark Form

    Much thanks for the help with the quest rule.

    I changed it around to an item/global script, with support for several different forms as well. Just run the global script, and attach the item script for a form to whatever item you want to activate it.
    There's still a small problem though, in that whenever I exit the form, my MP is truncated to the nearest integer (1/8th of the meter), and I don't know why.

  6. #6
    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: Dark Form

    The cochles of my heart are warmed by the number of people adding to the scripting library, by the way.

  7. #7
    Cor Blimey! CJC's Avatar
    Join Date
    Dec 2002
    Location
    Fading into the darkness
    Age
    35
    Posts
    1,398
    Mentioned
    150 Post(s)
    Tagged
    6 Thread(s)
    vBActivity - Stats
    Points
    6,621
    Level
    25
    vBActivity - Bars
    Lv. Percent
    1.44%

    Re: Dark Form

    After a little experimenting with your script (And by a little I mean a lot), I was able to create that oh so wonderful feature, Active Link Tile Modifiers.


    This code of yours is amazing, thank you for crafting it.
    I'm an author. If you're interested in checking out my works, you can find them on Amazon.com:


  8. #8
    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: Dark Form

    Okay, this is awesome.
    AGN's Resident Zelda Classic Developer and Sonic the Hedgehog Fanboy

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