chronoboy Into the past with a splash

Joined: 04 Jun 2010 Posts: 162 Location: Canada
|
Posted: Wed Oct 13, 2010 2:25 pm Post subject: [SOLVED] Access to recently set global in after battle |
|
|
Not sure if this is a bug or not, or how it's just suppose to work:
Code: |
global variable (1,battle ref)
plotscript, formation fight,arg,npcref begin
battle ref := npcref
fight formation (1)
end
plotscript, after battle, begin
if (battle ref >> 0) then (do something with npcref)
Code to fade music back in...
end |
Okay, so for some reason, battle ref seems to always be 0 in my after battle script, even though I set it before I fight the formation.
I previously had my code to do something with my npcref right after my fight formation, but due to my new fade music in code, it seems to be delaying that code now. Since the after battle runs before it continues my other script, I thought I'd just add this code directly in the after battle script, as I'd be using it alot anyways when calling formations.
My workaround is going to be using a timer set to 0, but if the global variable is not working, then this may not work either as planned.
UPDATE: My proposed workaround is not working, the global variable is still not set. Unless an NPC reference is indeed under 0.
UPDATE 2: After using show value in the after battle script, it does appear that NPC references are indeed under 0. Odd, who would have thought! _________________ Current project: Chronoboy Adventures
Website: http://www.chronoboy.com/ |
|
Bob the Hamster OHRRPGCE Developer

Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Wed Oct 13, 2010 2:56 pm Post subject: |
|
|
Yep. NPC references are always negative numbers.
That was my old hack to work around the fact that plotscripting doesn't support any kind of data typing. If I had made references positive, it would have been impossible to accurately tell the difference between an NPC ID and an NPC ref. |
|