So I've started working on enemy AI, and I've come upon the problem of trying to randomly select a movement or attack to perform. My NPC's are set up with private variables like so.
+NPC
--STATUS = WHAT NPC IS DOING
--NUMERIC = TEMPORARY NUMERIC VARIABLE HOLDER
--STRING = TEMPORARY STRING VARIABLE HOLDER
--MOVEMENTS = 2
--MOVEMENT1 = WALK TOWARDS
--MOVEMENT2 = HOP TOWARDS
Now I've already coded the walking towards and hopping towards movements, and can make the NPC's move as wanted, but I cannot select one to do randomly.
As it is my code is going.
SET NPC('NUMERIC'): random(NPC('MOVEMENTS'))
SET NPC('STRING'): "MOVEMENT" & NPC('NUMERIC')
SET NPC('STATUS'): NPC.Value(NPC.Value('STRING'))
This results in my NPC private variable of STRING equal MOVEMENT1 or MOVEMENT 2, so far things are working perfectly. Now I attempt to read the value of the the MOVEMENT1 or MOVEMENT2 stored in NPC('STRING') and set it to NPC('STATUS').
However instead of having NPC('STATUS') have a value corresponding to MOVEMENT1 or MOVEMENT2, or even the strings MOVEMENT1 or MOVEMENT2, I end up with a string of numbers, "577045393604775701".
I'm sure there are other ways to go about this, however I like the idea of each object containing it's own information for moving and attacking, and the engine interpreting them.
I'm using the most recent STABLE version of Construct 0.98.9, so I don't know if this is a bug that has been fixed in the UNSTABLE releases. I would have switched over, but I have a bit of a deadline for this project and I don't wish to switch over to an UNSTABLE build and risk losing all progress.