User Tag List

Results 1 to 6 of 6

Thread: Max HP

  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,129
    Level
    11
    vBActivity - Bars
    Lv. Percent
    54%

    Max HP

    Simple question. I've seen it done on a custom quest so I know it can be done; how do I display max hp numerically on the passive and active subscreens? I'm guessing it's a scripting function which is why I'm asking here.

    Edit:
    Had a thought. I might be able to do it by using a counter (supported on sunscreens already) to copy the value of the max value of the counter in question. I hate the thought that I might have to eat more counters just to do it this way. If you can think of a different method....
    Last edited by Lelouche Vi Britannia; 09-21-2017 at 01:45 PM. Reason: Further thoughts

  2. #2
    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,129
    Level
    11
    vBActivity - Bars
    Lv. Percent
    54%
    Woot! I figured it out on my own! Sadly, I do have to take up 4 counters with this nonsense but hey, 24 counters is a lot of extra counters to work with so might as well put them to good use eh?

    Spoiler: show

    const int CR_LIFECUR = 7;//set current life mirror to script 1, can be modified if needed
    const int CR_LIFEMIRMAX = 8;//Set max life mirror counter to script 2, can be modified if needed
    const int CR_MAGICCUR = 9;//set current magic mirror to script 3, can be modified if needed
    const int CR_MAGICMIRMAX = 10;//set current magic max mirror counter to script 4, can be modified if needed

    //create 4 counters on passive subscreen using script 1, 2, 3, and 4 (or chosen slots) where desired

    global script Active
    {
    void run()
    {
    while(true)
    {
    Game->Counter[CR_LIFECUR]=Link->HP;
    Game->Counter[CR_LIFEMIRMAX]=Link->MaxHP;
    Game->Counter[CR_MAGICCUR]=Link->MP;
    Game->Counter[CR_MAGICMIRMAX]=Link->MaxMP;
    //section may also contain other global script stuff as normal
    Waitframe();
    }
    }
    }


    I'll probably go ahead and post it on PureZC just because
    Lost my wings and grew 8 tentacles... I've seen enough Hentai to know where this is going....

  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,781
    Level
    21
    vBActivity - Bars
    Lv. Percent
    73.06%
    Quote Originally Posted by Lelouche Vi Britannia View Post
    Woot! I figured it out on my own! Sadly, I do have to take up 4 counters with this nonsense but hey, 24 counters is a lot of extra counters to work with so might as well put them to good use eh?

    Spoiler: show

    const int CR_LIFECUR = 7;//set current life mirror to script 1, can be modified if needed
    const int CR_LIFEMIRMAX = 8;//Set max life mirror counter to script 2, can be modified if needed
    const int CR_MAGICCUR = 9;//set current magic mirror to script 3, can be modified if needed
    const int CR_MAGICMIRMAX = 10;//set current magic max mirror counter to script 4, can be modified if needed

    //create 4 counters on passive subscreen using script 1, 2, 3, and 4 (or chosen slots) where desired

    global script Active
    {
    void run()
    {
    while(true)
    {
    Game->Counter[CR_LIFECUR]=Link->HP;
    Game->Counter[CR_LIFEMIRMAX]=Link->MaxHP;
    Game->Counter[CR_MAGICCUR]=Link->MP;
    Game->Counter[CR_MAGICMIRMAX]=Link->MaxMP;
    //section may also contain other global script stuff as normal
    Waitframe();
    }
    }
    }


    I'll probably go ahead and post it on PureZC just because
    This is to do what? Display HP and MP Current/Max as numbers on the subscreen? if so, then aye, this is one of two options that you have available. The other, is to use draw instructions to draw the values. I essentially do what you did here, in several quests, and since then, I have become more focused on scripted draws for the subscreen elements. Either work perfectly well.

    You do have one issue in this script: You want a Waitdraw() instruction, so that these update at the correct time:

    Code:
    const int CR_LIFECUR = 7;//set current life mirror to script 1, can be modified if needed
    const int CR_LIFEMIRMAX = 8;//Set max life mirror counter to script 2, can be modified if needed
    const int CR_MAGICCUR = 9;//set current magic mirror to script 3, can be modified if needed
    const int CR_MAGICMIRMAX = 10;//set current magic max mirror counter to script 4, can be modified if needed
    
    //create 4 counters on passive subscreen using script 1, 2, 3, and 4 (or chosen slots) where desired
    
    global script Active
    {
    	void run()
    	{
    		while(true)
    		{
    			//These should occur before Waitdraw. -Z
    			Game->Counter[CR_LIFECUR]=Link->HP;
    			Game->Counter[CR_LIFEMIRMAX]=Link->MaxHP;
    			Game->Counter[CR_MAGICCUR]=Link->MP;
    			Game->Counter[CR_MAGICMIRMAX]=Link->MaxMP;
    			//section may also contain other global script stuff as normal
    			
    			Waitdraw();
    			//Stuff that should happen *after* Waitdraw(), goes here. -Z
    			
    			Waitframe();
    		}
    	}
    }
    This is a function inside the global active script in most of my older RPG-esque quest projects:

    Code:
    //Call before Waitdraw()
    void UpdateDisplayCounters(){
        Game->Counter[CR_MAX_MP_DISPLAY] = Link->MaxMP;
        Game->Counter[CR_MAX_HP_DISPLAY] = Link->MaxHP;
        Game->Counter[CR_MP_DISPLAY] = Link->MP;
        Game->Counter[CR_HP_DISPLAY] = Link->HP;
    }
    It might be a tiny bit cleaner to do it that way, and then to call a function prior to Waitdraw().


    Also: You also want to use code and /code for your tags for this, not spoiler and /spoiler. You do not need (or want) indent tags. Just paste the code inside code tags, and your indentation is preserved.

    As-is, when you copy/paste the code into a text file from the browser, all of your tabbing goes poof. Click the quote button on this post, to see the difference.

  4. #4
    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,129
    Level
    11
    vBActivity - Bars
    Lv. Percent
    54%
    Also: You also want to use code and /code for your tags for this, not spoiler and /spoiler. You do not need (or want) indent tags. Just paste the code inside code tags, and your indentation is preserved.

    As-is, when you copy/paste the code into a text file from the browser, all of your tabbing goes poof. Click the quote button on this post, to see the difference.
    Thanks, I forgot what the actual command was to set that up.

    So basically to call the function as you have it written I just have to add the line "UpdateDisplayCounters();" just before the "Waitdraw();" then put the actual function in (obvious) as you set it.

    I wished I remembered that this was a thing. Its been a while since I played with the editor, and I'm still not all that good at scripting.
    Lost my wings and grew 8 tentacles... I've seen enough Hentai to know where this is going....

  5. #5
    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,781
    Level
    21
    vBActivity - Bars
    Lv. Percent
    73.06%
    Quote Originally Posted by Lelouche Vi Britannia View Post
    Thanks, I forgot what the actual command was to set that up.

    So basically to call the function as you have it written I just have to add the line "UpdateDisplayCounters();" just before the "Waitdraw();" then put the actual function in (obvious) as you set it.

    I wished I remembered that this was a thing. Its been a while since I played with the editor, and I'm still not all that good at scripting.

    By command, you mean [ code ] and [ /code ] ...right?

    The function hat I posted is custom, not from any common header. All you would need to do is change the counter IDs to whatever you are using, and call it before Waitdraw(). This is a personal style choice, but I hate to see raw instructions in global active scripts. It is far cleaner to encapsulate them all in functions.

  6. #6
    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,129
    Level
    11
    vBActivity - Bars
    Lv. Percent
    54%
    Quote Originally Posted by ZoriaRPG View Post
    By command, you mean [ code ] and [ /code ] ...right?

    The function hat I posted is custom, not from any common header. All you would need to do is change the counter IDs to whatever you are using, and call it before Waitdraw(). This is a personal style choice, but I hate to see raw instructions in global active scripts. It is far cleaner to encapsulate them all in functions.
    I agree. I also liked the identifiers you used, better than the ones I made.

    Tried it last night and it worked like a charm. Code is cleaner. And now I understand the concept of functions and how they are implemented, so thanks for that!

    And yes, I was referring to the "/code" command.

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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