Aller au contenu

Photo

Variables/Objects that can be accessed from two scripts?


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

#1
JackFuzz

JackFuzz
  • Members
  • 408 messages
Anyone know if this is possible?

I need to remember what the player was originally wearing in their chest piece so I can put it back on in another script.

I believe armor has a "tag".  If I could just store this tag in a global variable so I can access it from multiple scripts.

Modifié par JackFuzz, 09 janvier 2010 - 09:10 .


#2
JackFuzz

JackFuzz
  • Members
  • 408 messages

JackFuzz wrote...

Anyone know if this is possible?

I need to remember what the player was originally wearing in their chest piece so I can put it back on in another script.

I believe armor has a "tag".  If I could just store this tag in a global variable so I can access it from multiple scripts.


Script 1

//Let's store the tag of the armor the user was originally wearing.

    object oArea = GetObjectByTag("bp_area"); // Get object that holds the variables
    SetLocalString(oArea, CODEX_PLOT_NAME_1, GetTag(oItemChest)); 

Script 2

//Let's get the tag out of the global variable we set so we can reequip the original armor the player was wearing
    object oArea = GetObjectByTag("bp_area"); // Get object that holds the variables
    string oItem = GetLocalString(oArea, CODEX_PLOT_NAME_1);




THIS DOESN"T WORK unfortunately.  Any ideas?

#3
Proleric

Proleric
  • Members
  • 2 354 messages
Is the local string declared correctly in the 2da for the area's variables?

#4
JackFuzz

JackFuzz
  • Members
  • 408 messages

Proleric1 wrote...

Is the local string declared correctly in the 2da for the area's variables?


I just realized I have to make that.

I made an XLS file:

ID        Label
int        string
0          bp_string1
1          bp_string2
2          bp_string3

I converted it with the excelprocessor: var_bp_area.gda

But now it says my 2DA is invalid (when i added it to variable 2da in my area bp_area.are).

Modifié par JackFuzz, 09 janvier 2010 - 12:01 .


#5
JackFuzz

JackFuzz
  • Members
  • 408 messages
Does it even have to be an area?

There has to be an easier way to do this.

The kind of information i'm storing is very very temporary.

I just need a place where I can store global variables. Why does it have to be an area? Why can't it just be something simple like a file or just a global variable in memory.

Oh man i'm so tired... I'm going to go to sleep..

I hope you have time to respond! I'm very close. THis is the last thing I need to fix.

Modifié par JackFuzz, 09 janvier 2010 - 12:20 .


#6
elys

elys
  • Members
  • 458 messages
You can declare your own variables for your module and then access these variables from any of your scripts(using GetModule() to get the object which contains the variables)

You just have to create var_mymodule.gda and select it  in the module properties

Modifié par elys, 09 janvier 2010 - 12:34 .


#7
elys

elys
  • Members
  • 458 messages
Sorry, Double post

Modifié par elys, 09 janvier 2010 - 12:35 .


#8
elys

elys
  • Members
  • 458 messages
Waah triple post.. something is $#@" up with my edit button which makes a reply instead.....

Well I might as well use it to give some more details, you var_*.gda should be made like this:

ID Label Type default IsPlot
int string string string int
0 bp_string1 string 0 0
1 bp_string2 string 0 0
2 bp_string3 string 0 0

You can also store OBJECT the variable and not only STRING if you want.

Modifié par elys, 09 janvier 2010 - 12:49 .


#9
JackFuzz

JackFuzz
  • Members
  • 408 messages

elys wrote...

You can declare your own variables for your module and then access these variables from any of your scripts(using GetModule() to get the object which contains the variables)

You just have to create var_mymodule.gda and select it  in the module properties


Hmmm but I'm not working with my own module. 

Under manage modules i've switched to the single player campaign.

I made a new excel file like this, like you said: 

ID Label Type default IsPlot
int string string string int
0 bp_string1 string 0 0
1 bp_string2 string 0 0
2 bp_string3 string 0 0

I've compiled it into a GDA.

1. I've made a new area called bp_area
2. It asked me to add an area layout so I just added a random one in the list.
3. I added the new gda var_bp_area.gda
4. I saved and it exported properly.

My code still doesn't work!!! wtf...

I don't know if this has anything to do with it.  But i'm modifying the single player campaign. My PC is in redcliffe.  Does that matter at all?

I don't even understand why I have to store a global variable in an area.

And if I make my own module, the problem arises where I'm modiying the single player game ? ... I don't understand why they made this so incredibly difficult. I never wanted to go this far in the toolset just to do something so simple as have the PC simply wear something new in a cutscene that they didn't own in their inventory. *sigh*

Modifié par JackFuzz, 09 janvier 2010 - 11:11 .


#10
elys

elys
  • Members
  • 458 messages
By modifying the Single Player campaign, I hope you mean it by creating a module that will modify the Single Player campaign when enabled, and not that you directly modify the Single Player module in the toolset, which is not the proper way to do.
 
?.?

Modifié par elys, 10 janvier 2010 - 03:32 .


#11
JackFuzz

JackFuzz
  • Members
  • 408 messages

elys wrote...

By modifying the Single Player campaign, I hope you mean creating a module that will modify the Single Player campaign when enabled, and not that you directly modify the Single Player module in the toolset, which is not the proper way to do.
 
?.?


I didn't know that. All this time I've had the single player campaign module open and have been modifying that way. 

The good news is I've kept a record of what I've changed. Also the "resouce history" allows me to revert back to the original.

However it makes sense that the methodology is to create a module and extend it by adding the single player campaign correct?

I've done that and made a new post hoping someone could help me understand what it means to have a module that is extended.

http://social.biowar.../8/index/581663

1. Should I have my module open that is extended into the single player campaign? I tried compiling a script and a warning came up in the log window saying I don't have a starting point set.  But then the wiki says not to set a starting point if your module is an extension.

2. How will GetModule() and GetLocalstring work?  How does it know to access the var_module in MY module and not the var_module in the Single player campaign?

I'm just confused lol.

#12
elys

elys
  • Members
  • 458 messages
There was no need to create another topic I think :P



So it seems you have managed to make extended module.
By the way, this new module will be where you will do all your stuff, including areas and alike, it's not just to use it as "variable depository" like I think you mean in your new topic.

So now go in the module properties, and the end of the tab, you are able to specify a custom var*.gda, the one you have created earlier.

Then in the your module scripts you need to use the variable, you can just do:


object oModule = GetModule();  GetModule returns the module from which the script is from.
string sString;

SetLocalString(oModule,"STRING_NAME", sString") to set the module STRING_NAME variable to sString value.

sString = GetLocalString(oModule,"STRING_NAME") to read the module STRING_NAME variable into sString

You can also use similar approach by using another object than the module. But that example should get you started.

Modifié par elys, 10 janvier 2010 - 03:54 .


#13
JackFuzz

JackFuzz
  • Members
  • 408 messages
I really appreciate this :)

I will change that gda to the new custom one I made.

I just have one last question and I'm totally set!

elys wrote...
object oModule = GetModule();  GetModule returns the module from which the script is from.
string sString;


I'm currently working with my new module.  I have it extended so I can see all the single player campaign files.

I originally made my script files under the single player campaign module.  Is that going to cause a problem?

I think I figured it out.  I guess you change the ownership of it right?

http://img20.imagesh...2797/testks.jpg

Modifié par JackFuzz, 10 janvier 2010 - 04:07 .


#14
elys

elys
  • Members
  • 458 messages
Well you can see all the single player campaign files because the new database included with the new version of the toolset is containing the single player datas, else extended or not you would just see the core datas.

You should better go back to a clean vanilla version of the Single Player module, eventually exporting the scripts (or saving the text and recreate the scripts in new module copy-paste power) and stuff you have already created, to import them back into your new extended module.

Scripts and other objects properties can be modified after creation even their "owner" field.

Modifié par elys, 10 janvier 2010 - 04:14 .


#15
JackFuzz

JackFuzz
  • Members
  • 408 messages

elys wrote...

Well you can see all the single player campaign files because the new database included with the new version of the toolset is containing the single player datas, else extended or not you would just see the core datas.

You should better go back to a clean vanilla version of the Single Player module, eventually exporting the scripts and stuff you have already created, to import them back into your new extended module.


Do you mean literally import them via some way in toolset method?

Or do you mean change ownership via properties?

#16
elys

elys
  • Members
  • 458 messages
If it is just few scripts, just copy-paste the text into notedpad or whatever, recreate the scripts into you extended module.



If you have lot of stuff to export, however, you can just use the Builder to Builder package, choose resource u need to export, then import back into your extended module.



Don't forget to change ownership eventually after.

#17
JackFuzz

JackFuzz
  • Members
  • 408 messages

elys wrote...

If it is just few scripts, just copy-paste the text into notedpad or whatever, recreate the scripts into you extended module.

If you have lot of stuff to export, however, you can just use the Builder to Builder package, choose resource u need to export, then import back into your extended module.

Don't forget to change ownership eventually after.


I've modified a lot of conversations, scripts and make new cutscenes in single player campaign.

I will do what you just said though :)

...

I just checked out "builder to builder" It seems that it wants to export EVERYTHING.

I have to import all that into my module? Really?

Were we not supposed to modify the single player campaign files but instead make a copy of them into our own module? Not even extending?

Modifié par JackFuzz, 10 janvier 2010 - 04:23 .


#18
elys

elys
  • Members
  • 458 messages
You should make a backup of your existing database before going into big moves.
Better safe than sorry if something goes wrong.

Procedure to do so is detailed in Program Files\\\\Dragon Age\\\\Tools\\\\ReadMe.txt
A little work that can save from going mad when something  goes very wrong Image IPB

Modifié par elys, 10 janvier 2010 - 04:23 .


#19
JackFuzz

JackFuzz
  • Members
  • 408 messages

elys wrote...

You should make a backup of your existing database before going into big moves.
Better safe than sorry if something goes wrong.

Procedure to do so is detailed in Program Files\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\Dragon Age\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\Tools\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ReadMe.txt
A little work that can save from going mad when something  goes very wrong Image IPB


I know you are very knowledgeable.

But this doesn't sound right.

What belongs to the single player campaign module should belong to it.  Even though I've modified conversations and scripts, they technically belong to the single player campaign module.

What belongs to me (new things i've created) should stay in my module correct?  New scripts, new cutscenes for example belong in my extended module.

Then when I go to give this to another player.  I give it to them as an "addin" so it won't conflict with other addins correct?

Modifié par JackFuzz, 10 janvier 2010 - 04:27 .


#20
elys

elys
  • Members
  • 458 messages
No I'm not very knowledgable (but thx for the thought Image IPB) I just talk about what I've played so far with the toolset.

And Yes to answer your question, (when I replied before you did not specify what stuff you had modified).

If you have modified existing vanilla dialogues or scripts, you do not need to export or import them, they are already modified inside the database, but you will have to remember to export them when creating the player package.

Also if you plan to release your modification, it's nice if you can join the list of vanilla files you have modified because that's help to solve potential conflicts with other addins who modify original resources Image IPB

Modifié par elys, 10 janvier 2010 - 04:34 .


#21
JackFuzz

JackFuzz
  • Members
  • 408 messages

elys wrote...

Yes, (when I replied before you did not specify what you had modified).

If you have modified existing dialogues or scripts, you do not need to export or import, they are already modified inside the database, but you will have to remember to export them when creating the player packaged.



Aaah yes I have all that under control :) I've stayed pretty organized.

Elys... Thank you so much for your help!

I hope this thread helps other people as well when they use the search feature :)