playMaker

Author Topic: Problem with Global Variable String Array  (Read 522 times)

jonnyk

  • Playmaker Newbie
  • *
  • Posts: 2
Problem with Global Variable String Array
« on: October 17, 2021, 09:54:01 AM »
Hi all,

So I have some AI controlled ships in my game for different players, and these ships reference a global string array. The array for each player is 10 strings, just stating 'hostile' or 'neutral' at an index for each player. An fsm will check a ships owner, then check this global array for the owning player, to see how they should behave.

In editor mode, this works exactly as expected. I can 'declare war' on another player, and it immediately updates the reference to 'hostile', and the ships start attacking. I can 'make peace' to update again back to 'neutral', and they will stop firing. All is well.

However, when I build the game, this is not working correctly. The first time it is changed to war, it will work fine, but from then on any changes back or forth in status do not work properly, or at all. Ships that are enemies won't fire on each other, even though the array has been changed. It is very frustrating, because I can't see or think of any reason why this works perfectly in editor, but not the build.

Can anyone think of a reason that changing these global array values at run time in a build, are treated differently than in run time in editor mode? Failing that, any suggestions at all would be great. There are no errors in the build or playmaker, and everything else works fine in the build.

Thanks for reading.

jonnyk

  • Playmaker Newbie
  • *
  • Posts: 2
Re: Problem with Global Variable String Array
« Reply #1 on: October 17, 2021, 02:12:50 PM »
Never mind. While I have not solved the problem, it doesn't seem to be the array at fault. I've set up some UI text elements to display the value each ship was retrieving, and they are getting them in the build, just not behaving correctly once they have it.