User Tag List

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

Thread: [Request] Custom potions

  1. #1
    Lynel
    Join Date
    Jul 2005
    Posts
    1,726
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    4,602
    Level
    21
    vBActivity - Bars
    Lv. Percent
    37.28%

    [Request] Custom potions

    I'm posting this here because I'm pretty sure this can't be done without scripting.

    I want to have seperate potions for HP and MP. I know I can edit the normal potions to refill HP only, but can I make a custom item to refill MP?

  2. #2
    Wizrobe
    Join Date
    Dec 2006
    Age
    29
    Posts
    3,692
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    8,931
    Level
    28
    vBActivity - Bars
    Lv. Percent
    42.31%

    Re: [Request] Custom potions

    Sure you can. It would be a very simple script. I might try to right it. I'll see if I can.

    Edit:

    Code:
    import "std.zh"
    
    //This script, when attached to an item, works as a magic potion.  
    //It refills Link's magic, but disappears after one use.
    //A simple script, but useful.
    //Set D0 to be the ID of the item.
    
    item script MagicPotion{
    
    	void run (int id){
    		
    		Link->MP=Link->MaxMP;
    		Link->Item[id] = false;
    
    		}
    
    }
    I haven't tested it, but it compiles fine.
    Play The Darkness Within, my newest ZC Quest! Download here:
    http://www.purezc.net/index.php?page=quests&id=374

    Quote Originally Posted by rock_nog View Post
    Well of course eveything's closed for Easter - don't you know of the great Easter tradition of people barricading themselves up to protect themselves from the return of Zombie Christ?


  3. #3
    Lynel
    Join Date
    Jul 2005
    Posts
    1,726
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    4,602
    Level
    21
    vBActivity - Bars
    Lv. Percent
    37.28%

    Re: [Request] Custom potions

    It works~

    Though… I forgot to specify that I only want it to refill 128MP, not 100%.

    EDIT: Blerrblerrblehgh.

  4. #4
    &&
    ZC Developer
    Joe123's Avatar
    Join Date
    Sep 2006
    Age
    32
    Posts
    3,061
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    7,301
    Level
    26
    vBActivity - Bars
    Lv. Percent
    8.31%

    Re: [Request] Custom potions

    Urm....

    When you pick up a magic jar item, does your HP increase steadily or instantly?
    If it's steadily, then this script wouldn't be very hard to do.

    If it's instantly then you'd have to add a section to the global script which is a bit of a pain really.

  5. #5
    Lynel
    Join Date
    Jul 2005
    Posts
    1,726
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    4,602
    Level
    21
    vBActivity - Bars
    Lv. Percent
    37.28%

    Re: [Request] Custom potions

    Ya' know, that part's not important. Forget the gradual refill. What I really need if for the potion to fill 128 MP instead of the maximum. Also, how would I change this to work for HP, so I can make custom health potions as well?

  6. #6
    &&
    ZC Developer
    Joe123's Avatar
    Join Date
    Sep 2006
    Age
    32
    Posts
    3,061
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    7,301
    Level
    26
    vBActivity - Bars
    Lv. Percent
    8.31%

    Re: [Request] Custom potions

    Code:
    item script CustomPotion{
    	void run(int refil,int counter){
    		if(counter == 0){
    			Link->MP += refil;
    			if(Link->MP > Link->MaxMP) Link->MP = Link->MaxMP;
    		}else{
    			Link->HP += refil;
    			if(Link->HP > Link->MaxHP) Link->HP = Link->MaxHP;
    		}
    	}
    }
    D1: Amount to refil
    D2: 1 to refil hearts, 0 to refil magic

    To take the item away after useage, there's a little checkbox somewhere in the item editor.

  7. #7
    The Time-Loop Continues ZC Developer
    Gleeok's Avatar
    Join Date
    Apr 2007
    Posts
    4,817
    Mentioned
    259 Post(s)
    Tagged
    10 Thread(s)
    vBActivity - Stats
    Points
    12,940
    Level
    33
    vBActivity - Bars
    Lv. Percent
    24.2%

    Re: [Request] Custom potions

    No, it's actually quite easy to do.


    Code:
    void Refill(){
    	int hp = Link->MaxHP-Link->HP;
    	for(int i;i<mp;i++){
    		Link->HP++;
    		Game->PlaySound(SFX_REFILL);
    		Waitframe();
    	}
    }
    
    void RefillMagic(){
    	int mp = Link->MaxMP-Link->MP;
    	for(int i;i<hp;i++){
    		Link->MP++;
    		if(Link->MP < Link->MaxMP){
    			Link->MP++;i++;
    		}
    		Game->PlaySound(SFX_REFILL);
    		Waitframe();
    	}
    }
    This post contains the official Gleeok seal of approval. Look for these and other posts in an area near you.

  8. #8
    Lynel
    Join Date
    Jul 2005
    Posts
    1,726
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    4,602
    Level
    21
    vBActivity - Bars
    Lv. Percent
    37.28%

    Re: [Request] Custom potions

    Quote Originally Posted by Joe123 View Post
    Code:
    item script CustomPotion{
    	void run(int refil,int counter){
    		if(counter == 0){
    			Link->MP += refil;
    			if(Link->MP > Link->MaxMP) Link->MP = Link->MaxMP;
    		}else{
    			Link->HP += refil;
    			if(Link->HP > Link->MaxHP) Link->HP = Link->MaxHP;
    		}
    	}
    }
    D1: Amount to refil
    D2: 0 to refil hearts, 1 to refil magic

    To take the item away after useage, there's a little checkbox somewhere in the item editor.
    Schweet~ Everything works. Except you said the D2 thing backwards; 0 is magic and 1 is hearts.

  9. #9
    &&
    ZC Developer
    Joe123's Avatar
    Join Date
    Sep 2006
    Age
    32
    Posts
    3,061
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    7,301
    Level
    26
    vBActivity - Bars
    Lv. Percent
    8.31%

    Re: [Request] Custom potions

    Oops. Nevermind.

    Quote Originally Posted by Gleeok View Post
    No, it's actually quite easy to do.
    If you want to A: add a section to the global script and B: stop all other functions in the global script for 128 frames or something then yeah sure...

  10. #10
    Lynel
    Join Date
    Jul 2005
    Posts
    1,726
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    4,602
    Level
    21
    vBActivity - Bars
    Lv. Percent
    37.28%

    Re: [Request] Custom potions

    Yeah, I'm not worried about the gradual refill. I just wanted the custom MP potion to match the behavior of the normal potion, but I'm just using a custom HP potion instead so the both refill instantly.

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