• Welcome to Freedom Reborn Archive.
 

loadData() Useage

Started by GogglesPizanno, December 02, 2007, 11:45:34 AM

Previous topic - Next topic

GogglesPizanno

So i got my script basically working and I'm doing something similar to the example in the FFX documentation about writing to the character DAT file to give a character a new set of powers. The info gets written just fine. The problem is using the loadData() command. It appears to fire correctly, there are no errors generated in the log, but in-game, when I recruit that character, the character still has the powers that he defaulted to in FFedit.

So what Im doing is this:

The mission is a cutscene.
- At the end of the cutscene, it picks the new random powers, and writes them to the character dat (I have confirmed this by jumping to FFEdit and looking in the characters tab)

- I then call  loadData() in OnMissionWon()

- On the Base Mission of the next level I recruit the character I altered (which had previously never been used or recruited)

- When he shows up in game, his powers are what they were prior to the writing of the new dat.

So am I using the loadData() function at the wrong time or in the wrong way?
I'm calling it in the mission previous to when I actually am recruiting the character as per the documentation.
I'm calling it after the new data has been written to the DAT file.

The only thing I can figure is that the original data is being stored in one of the games autosaves and loaded in at the base screen.
Thats about the only temp file I can find that references characters and their powers.


stumpy

The problem, basically, is that loadData() doesn't work. At least, it doesn't do something analogous to what loadPowers() does and force the game to reload and use the current DAT data. It's too bad, because when we started playing with loadPowers(), we were seeing some cool possibilities for loadData().

If the player never leaves the campaign, I don't know that the game reloads from its autosaves. I think it keeps the data internally from mission to mission.

I don't know of a clean way around this. Depending on what you are after, you could try rewriting the autosaved game and then flash some Mission_StatusText() for the player to load that game once he gets to the base...

Epimethee

Alternatively, you could give the character dummy zero-cost powers and rewrite the powers and strings databases once the random powers are picked up. However, this won't work with custom heroes, only with built-ins. 

(As an aside, IIRC, loadData() seemed to kind of work in certain conditions, even in campaign mode, but I'm none too sure it can be made useful in any real way.)

GogglesPizanno

QuoteThe problem, basically, is that loadData() doesn't work.

So that would be a feature  :P

stumpy

Ha. Yeah. There are a few functions in the game API that either do nothing or don't do anything reliably useful. Shades of Campaign_Save() and Object_DumpAttr().  <_<

Épiméthée is right, though. The function (like loadPowers()) was there to help the IG folks develop the campaign without having to restart it whenever they changed something about a character. It was useful to them somehow and they left it there for us in case we could use it, too (or they just didn't bother removing it...). It just isn't reliable enough for most of the scripting applications we might have for it.