Aller au contenu

Photo

Persistent Variables ?


  • Veuillez vous connecter pour répondre
9 réponses à ce sujet

#1
Sitrius

Sitrius
  • Members
  • 9 messages
Hey again..

Got another question.. Say I want to make sure an specific variable state gets saved into my save game, what function should I use (or is there a special object I can set it on ?)

Currently I've tried using SetLocal* to set it on the Hero Player object, but that doesn't seem to get saved into my save game (I checked the save game afterwards and saw no mention of my variable, and the code also reran next time, even after resaving it)

I haven't tried saving local variables onto the Module, but that is what I'm gonna try next. ;)

Any insights would be lovely..

Thanks

EDIT: Using SetLocal* on the object returned from GetModule() doesn't persist either.

Modifié par Sitrius, 09 novembre 2009 - 05:41 .


#2
FollowTheGourd

FollowTheGourd
  • Members
  • 572 messages
Are the variables defined in the 2DA for that object?

The wiki here has some tips and pitfalls: http://social.biowar.../Local_variable

Modifié par FollowTheGourd, 09 novembre 2009 - 05:46 .


#3
Sitrius

Sitrius
  • Members
  • 9 messages

FollowTheGourd wrote...

Are the variables defined in the 2DA for that object?

The wiki here has some tips and pitfalls: http://social.biowar.../Local_variable


Ahh darn, no they aren't defined in the 2da for that object. *chuckles* 

Thanks for the link, but alas I cannot seem to get into the toolset wiki at all, it wants me to login, though I've tried all the usernames/email addies I've tried, without luck..

So I cannot really look at that link, even though I wish I could.

#4
FollowTheGourd

FollowTheGourd
  • Members
  • 572 messages
I guess they wouldn't mind a full-page quote... formatting is a bit off, but not much I can do there really.
Also, did you try logging out and clearing your browser's cookies before trying to access the wiki again?


Local variable

From DA Builder Wiki

Jump to: navigation, search
Local
variables are persistent variables that are associated with in-game
objects. They are not the same as the temporary variables you can
create in a script; local variables retain their values even when no
scripts are using them, and are shared across any scripts that choose
to access them.
Local variables are set using the SetLocal* functions and read
using the GetLocal* functions. There are a number of SetLocal*
functions in the game engine. The five that are of use to you (that
Programming fully supports) are:

  • SetLocalInt
  • SetLocalFloat
  • SetLocalObject
  • SetLocalString
  • SetLocalResource
These functions work and have been through the fire of QA for many months. They are solid and work well.
There are a number of other functions that happen to exist such as:

  • SetLocalPlayer
  • SetLocalEffect
  • SetLocalEvent
  • SetLocalCommand
  • SetLocalItemProperty
  • SetLocalLocation
These functions do *NOT* work the way that the first five do. The
major issue with this second set of functions is that they are not
saved/loaded via the save system. So, if a community member or designer
wants to save information like this for use later, and someone
saves/loads the game, that information is lost forever. Thus, using
them outside of situations where you can guarantee no save/load occurs
(i.e. during combat) is pretty much guaranteed to fail for some
enduser. Furthermore, if you use these variable types in the var_ 2DAs,
it will fail gloriously.
Don’t use these functions. They will in all likelihood be removed in a future patch.

edit] Variable 2DAs
Local variables must be pre-defined in a variable 2DA before they
can be read or set using these functions. The structure of a variable
2DA is as follows:


var_*


Column name Type Description


ID
int
an integer row ID number that is unique to that row across
all files (unless creating an M2DA override). Row IDs will be listed
from smallest to highest within the same file and do not need to be
consecutive.


Label
string
The name of the variable.


Type
string
The type of the variable.


Default
string
The default value of the variable. Resources can have the string "NONE" to indicate an empty default.


IsPlot
int
Set this to 1 to indicate that a string variable is meant to contain the name of a plot resource. 0 otherwise.

Each different type of resource has a standard default variable 2DA,
whose entries are described in the variable tables associated with
their respective articles. You can create your own variable tables or
extend existing ones with M2DAs if you need additional local variables
for specific objects.
Dragon Age doesn't support the dynamic in-game allocation of new local variables[/code]

Modifié par FollowTheGourd, 09 novembre 2009 - 05:57 .


#5
Sitrius

Sitrius
  • Members
  • 9 messages
Okay, thanks for the quote that really cleared up a few things.. Now I just need to find where the current variable tables are, so I can amend those..

EDIT: Well, duh.. They are, of course, in 2da.erf. *grins*

Thanks again for the help

Modifié par Sitrius, 09 novembre 2009 - 05:58 .


#6
Sitrius

Sitrius
  • Members
  • 9 messages
Next task: How do I get the toolset to regonize my new 2da file. *chuckles*

#7
FollowTheGourd

FollowTheGourd
  • Members
  • 572 messages
No problem. Also, as I edited in above, have you tried logging out and clearing your cookies? I couldn't access the wiki at first either until I did that. Or if that fails, maybe try a different browser and see what happens.


#8
Sitrius

Sitrius
  • Members
  • 9 messages

FollowTheGourd wrote...

No problem. Also, as I edited in above, have you tried logging out and clearing your cookies? I couldn't access the wiki at first either until I did that. Or if that fails, maybe try a different browser and see what happens.


I'll try that..

EDIT: Thank you sooo much, after a logout and an re-login, I can now access the Wiki. *chuckles*

Modifié par Sitrius, 09 novembre 2009 - 06:18 .


#9
FollowTheGourd

FollowTheGourd
  • Members
  • 572 messages

Sitrius wrote...

Next task: How do I get the toolset to regonize my new 2da file. *chuckles*


You to convert them to GDA files first as far as I know. If you ever get access to the wiki, I think you can ignore any reference to
2daExporter.xls.
Somewhere on the forum a dev pretty much said that isn't included, and was sort of easy to break anyway (paths with spaces IIRC).

Here's what I think is a relevant quote from the wiki: http://social.biowar...t/index.php/2DA

EDIT: Since you can access the wiki now, I'll just post the direct link instead of the text:
http://social.biowar...P_file_explorer

Modifié par FollowTheGourd, 09 novembre 2009 - 06:24 .


#10
Sitrius

Sitrius
  • Members
  • 9 messages
Yea, I figured that one out from reading the Wiki, though I ran into a problem, with the generated .gda files that ExcelProcessor.exe spits out..



The Toolset says that there are no variables in said .gda files, but I checked the .gda file structure in the toolset itself and they are identical from what I can see, to the one I made from copy pasting. *chuckles*



Very weird..



Thanks again for the help