Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Dynamic Enemies Script help

I've fiddled with this thing for a while now, and searched around these forums, but this script just isn't doing what I want it to do.  Perhaps I have misunderstood it's intended function.

In another thread, I saw Seph suggest inputting the following:

Stats[5] = {}
  Stats[5]['hp'] = [0, 1, 99, 500, 150]
  Stats[5]['sp'] = [0, 1, 99, 200, 75]
  Stats[5]['str'] = [0, 1, 99, 50, 10]
  Stats[5]['dex'] = [0, 1, 99, 50, 10]
  Stats[5]['agi'] = [0, 1, 99, 50, 10]
  Stats[5]['int'] = [0, 1, 99, 50, 10]

To test it out, I've set my character's initial level at 60 and put him in a map where he randomly encounters basilisks, a default enemy in RXMP.  I want the basilisks to match up with my character, but my character is killing them all in one hit while the enemies do a measly 64 damage each time.

Is this script supposed to make enemies scale, or does it only randomize it's base stats within a small range?  Perhaps I've modified Seph's code incorrectly for the basilisks, but even then shouldn't that be covered by default level ranges?

Sorry if this question seems stupid, or posted in the wrong place, or formatted incorrectly.  I'm new to scripting and these boards.
 

khmp

Sponsor

Hey, no problem. Like I said we found some bugs in MACL and I learned a lot in the process of helping you. So thanks to you. I wonder if they still do work on it though.
 
Sorry to bump this again, but I'm having other troubles now.  If I encounter any enemy besides a reptile/basilisk, I get this error:

Script 'MACL Complete' line 7749: NoMethodError occured.

undefined method 'default=' for nil:NilClass

So I suppose I'll have to add to the script every enemy type I want to encounter.  That's fine I guess, but I can't even manage that!  I keep getting syntax errors.

If there's no way to let unspecified troops fall under default settings, then I need to figure out how to code them properly.  If that is the case, could you please show me an example of how to modify the script for both reptiles (2) and flamewolves (4)?  From that I'm sure I could determine how to add the rest of the troops needed.
 

khmp

Sponsor

Alright I'll take another look at. I think it would be a pain to have an entry for every creature just so it doesn't crash. I don't believe SephirothSpawn wrote that script with that kind of intention. I sure hope he visits this thread.

[edit]The default for the Stats hash looks correct. But it never identifies with the fact that if a monster isn't listed to use the default. I'll be honest and say I don't know how to fix this one. If I think of anything or stumble upon the answer I'll just update this reply.
 
I don't mind going to the trouble of making an entry for every creature, as long as it works.  I just need to know the proper syntax of inputting it.  I've tried it several ways:

Code:
Stats = {
      2 => {
      'maxhp' => [0, 1, 99, 500, 150], 
      'maxsp' => [0, 1, 99, 200, 75], 
      'str' => [0, 1, 99, 50, 10],
      'dex' => [0, 1, 99, 50, 10], 
      'agi' => [0, 1, 99, 50, 10], 
      'int' => [0, 1, 99, 50, 10]
      }
      4 => {
      'maxhp' => [0, 1, 99, 500, 150], 
      'maxsp' => [0, 1, 99, 200, 75], 
      'str' => [0, 1, 99, 50, 10],
      'dex' => [0, 1, 99, 50, 10], 
      'agi' => [0, 1, 99, 50, 10], 
      'int' => [0, 1, 99, 50, 10]
      }
      }

Code:
 Stats = {
      2 => {
      'maxhp' => [0, 1, 99, 500, 150], 
      'maxsp' => [0, 1, 99, 200, 75], 
      'str' => [0, 1, 99, 50, 10],
      'dex' => [0, 1, 99, 50, 10], 
      'agi' => [0, 1, 99, 50, 10], 
      'int' => [0, 1, 99, 50, 10]
      }
      }
      Stats = {
      4 => {
      'maxhp' => [0, 1, 99, 500, 150], 
      'maxsp' => [0, 1, 99, 200, 75], 
      'str' => [0, 1, 99, 50, 10],
      'dex' => [0, 1, 99, 50, 10], 
      'agi' => [0, 1, 99, 50, 10], 
      'int' => [0, 1, 99, 50, 10]
      }
      }

Code:
Stats = {
      2, 3, 4 => {
      'maxhp' => [0, 1, 99, 500, 150], 
      'maxsp' => [0, 1, 99, 200, 75], 
      'str' => [0, 1, 99, 50, 10],
      'dex' => [0, 1, 99, 50, 10], 
      'agi' => [0, 1, 99, 50, 10], 
      'int' => [0, 1, 99, 50, 10]
      }
      }

Or just leaving it "blank":

Code:
Stats = {
      }

No luck so far.  :sad:  These all result in syntax or MACL errors.
 

khmp

Sponsor

You almost had it in the first block. You just needed commas between the inside hash objects.

Code:
Stats = {
      2 => {
      'maxhp' => [0, 1, 99, 500, 150], 
      'maxsp' => [0, 1, 99, 200, 75], 
      'str' => [0, 1, 99, 50, 10],
      'dex' => [0, 1, 99, 50, 10], 
      'agi' => [0, 1, 99, 50, 10], 
      'int' => [0, 1, 99, 50, 10]
      },
      4 => {
      'maxhp' => [0, 1, 99, 500, 150], 
      'maxsp' => [0, 1, 99, 200, 75], 
      'str' => [0, 1, 99, 50, 10],
      'dex' => [0, 1, 99, 50, 10], 
      'agi' => [0, 1, 99, 50, 10], 
      'int' => [0, 1, 99, 50, 10]
      }
    }
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top