User Tag List

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

Thread: Max Item Increase

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

    Question Max Item Increase

    I haven't tried this yet, but just a quick question if anyone knows the answer.

    I've set up a system were there are 4 types of potions, all with separate counters to keep track of amounts. I've been trying to figure out a way to use one item to increase the max counter size for all 4 of them.

    I'm not sure how to go about this since I don't script often enough to "get good" which means every time I go back to my project, I have to do a little bit of reorienting and relearning. I imagine the functions "Max" and "Max Increment" are used somehow.

    Sorry for being such a noob/pain, but am I anywhere close?

    Code:
    const int CR_POTA = 9;
    const int CR_POTB = 10;
    const int CR_POTC = 11;
    const int CR_POTD = 12;
    
    item script counterpickup
    {
         void run(int countermax, int pustring)
         {
              Game->Max[CR_POTA] == countermax;
              Game->Counter[CR_POTA] == countermax;
              Game->Max[CR_POTB] == countermax;
              Game->Counter[CR_POTB] == countermax;
              Game->Max[CR_POTC] == countermax;
              Game->Counter[CR_POTC] == countermax;
              Game->Max[CR_POTD] == countermax;
              Game->Counter[CR_POTD] == countermax;
              Screen->Message(pustring);
         }
    }
    Lost my wings and grew 8 tentacles... I've seen enough Hentai to know where this is going....

  2. #2
    Quest Builder Anarchy_Balsac's Avatar
    Join Date
    Nov 2005
    Posts
    751
    Mentioned
    11 Post(s)
    Tagged
    2 Thread(s)
    vBActivity - Stats
    Points
    2,590
    Level
    16
    vBActivity - Bars
    Lv. Percent
    63.38%
    The Game->Max variables may themselves be constants, and even if they aren't, I don't recommend using them this way. You may not plan to use the things that they correspond to now, but if you decide to later, it'll mess you up badly.

    Instead, I recommend using newly declared integers as your max, and using scripted pick up items that check for the max value before incrementing their respective item.

  3. #3
    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,107
    Level
    11
    vBActivity - Bars
    Lv. Percent
    44.09%
    Quote Originally Posted by Anarchy_Balsac View Post
    The Game->Max variables may themselves be constants, and even if they aren't, I don't recommend using them this way. You may not plan to use the things that they correspond to now, but if you decide to later, it'll mess you up badly.

    Instead, I recommend using newly declared integers as your max, and using scripted pick up items that check for the max value before incrementing their respective item.
    That's seems even more convoluted than how I did things before; which was creating ghost items for the potions, each designated max counter changes, and then using a "real" item with a bundle script to add them on pick up.

  4. #4
    Quest Builder Anarchy_Balsac's Avatar
    Join Date
    Nov 2005
    Posts
    751
    Mentioned
    11 Post(s)
    Tagged
    2 Thread(s)
    vBActivity - Stats
    Points
    2,590
    Level
    16
    vBActivity - Bars
    Lv. Percent
    63.38%
    Quote Originally Posted by Lelouche Vi Britannia View Post
    That's seems even more convoluted than how I did things before; which was creating ghost items for the potions, each designated max counter changes, and then using a "real" item with a bundle script to add them on pick up.
    Video Game Programming is NOT simple. You do not have to like it, but it is the truth. even a simple NES style game takes more lines of code than you will ever remember, and if it is an RPG or anything involving an inventory and a wide array of monsters and power ups, you can easily do 10's of 1000's of lines of code.

    So yeah, you shouldn't be going for simplicity, but for what works.

  5. #5
    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,107
    Level
    11
    vBActivity - Bars
    Lv. Percent
    44.09%
    Quote Originally Posted by Anarchy_Balsac View Post
    Video Game Programming is NOT simple. You do not have to like it, but it is the truth. even a simple NES style game takes more lines of code than you will ever remember, and if it is an RPG or anything involving an inventory and a wide array of monsters and power ups, you can easily do 10's of 1000's of lines of code.

    So yeah, you shouldn't be going for simplicity, but for what works.
    And this is why I'm not a programmer. The simplest solution is always the preferred. That being said, how would you even code what you just suggested?
    Lost my wings and grew 8 tentacles... I've seen enough Hentai to know where this is going....

  6. #6
    The Time-Loop Continues ZC Developer
    Gleeok's Avatar
    Join Date
    Apr 2007
    Posts
    4,815
    Mentioned
    259 Post(s)
    Tagged
    10 Thread(s)
    vBActivity - Stats
    Points
    12,933
    Level
    33
    vBActivity - Bars
    Lv. Percent
    23.44%
    Quote Originally Posted by Lelouche Vi Britannia View Post
    I haven't tried this yet, but just a quick question if anyone knows the answer.

    I've set up a system were there are 4 types of potions, all with separate counters to keep track of amounts. I've been trying to figure out a way to use one item to increase the max counter size for all 4 of them.

    I'm not sure how to go about this since I don't script often enough to "get good" which means every time I go back to my project, I have to do a little bit of reorienting and relearning. I imagine the functions "Max" and "Max Increment" are used somehow.

    Sorry for being such a noob/pain, but am I anywhere close?

    Code:
    const int CR_POTA = 9;
    const int CR_POTB = 10;
    const int CR_POTC = 11;
    const int CR_POTD = 12;
    
    item script counterpickup
    {
         void run(int countermax, int pustring)
         {
              Game->Max[CR_POTA] == countermax;
              Game->Counter[CR_POTA] == countermax;
              Game->Max[CR_POTB] == countermax;
              Game->Counter[CR_POTB] == countermax;
              Game->Max[CR_POTC] == countermax;
              Game->Counter[CR_POTC] == countermax;
              Game->Max[CR_POTD] == countermax;
              Game->Counter[CR_POTD] == countermax;
              Screen->Message(pustring);
         }
    }
    Game->Counter[] looks correct, but I'm not sure what Game->Max[] does here. I think you meant: "Game->MCounter[]" (M = Max).

    Also you want to use"=" instead of "==" there. "=" to set a value, and "==" to test the values for equality (equals).

    That looks like it should get it working. :)
    Last edited by Gleeok; 02-18-2018 at 07:09 AM.
    This post contains the official Gleeok seal of approval. Look for these and other posts in an area near you.

  7. #7
    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,107
    Level
    11
    vBActivity - Bars
    Lv. Percent
    44.09%
    Quote Originally Posted by Gleeok View Post
    Game->Counter[] looks correct, but I'm not sure what Game->Max[] does here. I think you meant: "Game->MCounter[]" (M = Max).

    Also you want to use"=" instead of "==" there. "=" to set a value, and "==" to test the values for equality (equals).

    That looks like it should get it working. :)
    I knew I was close! And here I thought I forgot everything, thanks Gleeok!
    Lost my wings and grew 8 tentacles... I've seen enough Hentai to know where this is going....

  8. #8
    Quest Builder Anarchy_Balsac's Avatar
    Join Date
    Nov 2005
    Posts
    751
    Mentioned
    11 Post(s)
    Tagged
    2 Thread(s)
    vBActivity - Stats
    Points
    2,590
    Level
    16
    vBActivity - Bars
    Lv. Percent
    63.38%
    Quote Originally Posted by Lelouche Vi Britannia View Post
    And this is why I'm not a programmer. The simplest solution is always the preferred. That being said, how would you even code what you just suggested?
    Yes and no, you don't want to over-complicate things, but taking shortcuts can REALLY fuck your game up, literally.

    And it isn't difficult, just declare the new variables then swap them out with MCounter.
    Last edited by Anarchy_Balsac; 02-18-2018 at 09:09 PM.

  9. #9
    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,760
    Level
    21
    vBActivity - Bars
    Lv. Percent
    68.7%
    Quote Originally Posted by Anarchy_Balsac View Post
    Video Game Programming is NOT simple. You do not have to like it, but it is the truth. even a simple NES style game takes more lines of code than you will ever remember, and if it is an RPG or anything involving an inventory and a wide array of monsters and power ups, you can easily do 10's of 1000's of lines of code.

    So yeah, you shouldn't be going for simplicity, but for what works.
    Actually, if you use CC65, you can write a basic NES (NROM) game, and remember all of it.

    CC65 is a NES C compiler. Of course, that is a very simple game, unless you delve into ASM.

    My suggestion on priorities:
    Readability / Cleanliness
    Efficiency
    Minimalism (do the needed task)

  10. #10
    Quest Builder Anarchy_Balsac's Avatar
    Join Date
    Nov 2005
    Posts
    751
    Mentioned
    11 Post(s)
    Tagged
    2 Thread(s)
    vBActivity - Stats
    Points
    2,590
    Level
    16
    vBActivity - Bars
    Lv. Percent
    63.38%
    Well sure, if you write a breakout clone. Then again, if you want to write a GOOD one, you probably WON'T be able to memorize it.

    Curious, does CC65 have canned software like other compilers?

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