Author Topic: Multiple battles on one map  (Read 1685 times)

Fauntleroy

  • Architect of Kajar
  • Guardian (+100)
  • *
  • Posts: 184
  • Inclinata resurgit
    • View Profile
Multiple battles on one map
« on: January 24, 2018, 09:33:26 pm »
So, is there something that needs to be set or cleared between battles?

I've created a new area and put multiple battles in it which you can fight in any order.

Whichever battle I do first runs perfectly, but any subsequent battles crash after the party members move into place. (Specifically, all enemies disappear and then the game locks up.)

I've checked to make sure that I didn't reuse any enemy slots and am not calling the wrong functions.

Any ideas what to look at next?  I've been staring at this for hours and can't look at it anymore!
« Last Edit: January 24, 2018, 09:35:05 pm by Fauntleroy »

Mauron

  • Guru of Reason Emeritus
  • Errare Explorer (+1500)
  • *
  • Posts: 1763
  • Nu-chan
    • View Profile
    • Maurtopia
Re: Multiple battles on one map
« Reply #1 on: January 24, 2018, 09:47:44 pm »
I haven't seen this particular problem before.

Are there any defeated enemies that could be on screen for the new battle? What do your enemy objects look like?

Fauntleroy

  • Architect of Kajar
  • Guardian (+100)
  • *
  • Posts: 184
  • Inclinata resurgit
    • View Profile
Re: Multiple battles on one map
« Reply #2 on: January 25, 2018, 07:06:19 pm »
Although the battles are on one map, they are far enough apart that enemies from one battle cannot bleed over into another.  (They're about as far away as the battles in that long hallway in Magus's Castle.)

Each battle is against two Bashers. The Bashers can't move anywhere until the battle starts.

Each enemy looks like this:
Startup / Idle
* LoadEnemy({F5}Basher, (slot number), Normal)
* Animation(Normal, 01, 00)
* Return
* End
Activate
* CallObjFunc(Obj(slot number), Arbitrary0, 00, cont)
* Return
* End
Touch
* CallObjFunc(Obj(slot number), Arbitrary0, 00, cont)
* Return
* End

There are three Object Functions that get called, one for each battle. Each called function is the Arbitrary0 of the first Basher in the battle.

The functions being called all look like this:

Arbitrary0
* ExploreMode Off
* Textbox(Auto, "It's the rebels!{null}")
* MoveParty(different for each battle; this command appears to execute properly)
* Battle(00, 40)
* DrawStatus(Remove Obj(first enemy's slot)
* DrawStatus(Remove Obj(second enemy's slot)
* ExploreMode On
* Return

And then for the battle setup, every variable is set to False except for Map Music.

This has got to be an error on my part, I'm just not seeing it.

Mauron

  • Guru of Reason Emeritus
  • Errare Explorer (+1500)
  • *
  • Posts: 1763
  • Nu-chan
    • View Profile
    • Maurtopia
Re: Multiple battles on one map
« Reply #3 on: January 25, 2018, 07:46:26 pm »
Try removing the End commands from your activate and touch sections.

Fauntleroy

  • Architect of Kajar
  • Guardian (+100)
  • *
  • Posts: 184
  • Inclinata resurgit
    • View Profile
Re: Multiple battles on one map
« Reply #4 on: January 25, 2018, 09:26:11 pm »
Removing them probably wasn't a bad thing since they appear to be redundant, but it did not repair the issue.

Mauron

  • Guru of Reason Emeritus
  • Errare Explorer (+1500)
  • *
  • Posts: 1763
  • Nu-chan
    • View Profile
    • Maurtopia
Re: Multiple battles on one map
« Reply #5 on: January 25, 2018, 09:46:49 pm »
They serve a different purpose than Returns, but I usually see them in Startup/Idle, not other commands.

What about changing the CallObjectFunction priority to 3 and wait status to halt?

Fauntleroy

  • Architect of Kajar
  • Guardian (+100)
  • *
  • Posts: 184
  • Inclinata resurgit
    • View Profile
Re: Multiple battles on one map
« Reply #6 on: January 25, 2018, 09:58:10 pm »
Nada. :/

Mauron

  • Guru of Reason Emeritus
  • Errare Explorer (+1500)
  • *
  • Posts: 1763
  • Nu-chan
    • View Profile
    • Maurtopia
Re: Multiple battles on one map
« Reply #7 on: January 25, 2018, 10:06:08 pm »
A lot of the events I've checked set a RAM address in the 7F02xx range, and start the battle from object 00 or special object 1. Maybe that makes a difference? I'm not 100% sure here.

Fauntleroy

  • Architect of Kajar
  • Guardian (+100)
  • *
  • Posts: 184
  • Inclinata resurgit
    • View Profile
Re: Multiple battles on one map
« Reply #8 on: January 26, 2018, 12:03:27 am »
Hey, thanks, I'll try some experimenting with that this weekend!

EDITED TO ADD: Happy to report that moving the battle sequences from Object 0F and Object 11 to Object 0 was all it took to repair the problem.

Thanks again, Mauron, you got me working down the right track!
:)
« Last Edit: January 26, 2018, 09:52:34 pm by Fauntleroy »

Mauron

  • Guru of Reason Emeritus
  • Errare Explorer (+1500)
  • *
  • Posts: 1763
  • Nu-chan
    • View Profile
    • Maurtopia
Re: Multiple battles on one map
« Reply #9 on: January 27, 2018, 09:35:07 pm »
Excellent! So that one wasn't just a style choice, it was required design.