Aller au contenu

Photo

First Modding attempt


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

#1
Aulis Vaara

Aulis Vaara
  • Members
  • 1 331 messages
I read up on the modding tools for this game and decided to make a small mod to see how it works. I mainly wanted something for my mages to wear that I actually enjoyed looking at.

So I created an item, did all the settings, everything fine up to this point. I proceded with the script, which was a bit of work looking up the right methods, but again, no problem, or so I thought. The script compiles fine, but when I try to run my script from the console, nothing happens, and I haven't the faintest idea why. Please help!

Here is the code:

#include "utility_h"
#include "wrappers_h"
#include "events_h"

void main() {
    int doneBefore = GetLocalInt(OBJECT_SELF, "aulis_mage_dresses_given");
    if(doneBefore != 2) {
        object yeOldeShoppe = GetObjectByTag("den230sr_proprietor");
        CreateItemOnObject(R"aulis_mage_dress_rpr.uti",yeOldeShoppe,1,"Liluri's Dress",TRUE,FALSE);
        UT_AddItemToInventory(R"aulis_mage_dress_rpr.uti",1);
        SetLocalInt(OBJECT_SELF, "aulis_mage_dresses_given", 2);
    }
}

As you can see, I did both a shop and the inventory for easy testing, but again, neither shows up when trying to run the script.


Also, that Excel Processor doesn't seem to work for me. It just crashes, giving the generic W7 crashing screen. I made the batch file I found somewhere on the wiki, but there are no error messages. All I got was "Processing: - Target Output Type: PC" and then just the prompt and the "pause" command.

#2
ponozsticka

ponozsticka
  • Members
  • 453 messages
Do you use Open Office? :) it might be the reason why ExcelProcessor is not working properly

#3
Aulis Vaara

Aulis Vaara
  • Members
  • 1 331 messages
I read that. No, I just used the google docs one. Anyway, the other problem is much more important.

Modifié par Aulis Vaara, 18 avril 2010 - 11:58 .


#4
ponozsticka

ponozsticka
  • Members
  • 453 messages
sorry can´t help you there, I´m lost when it comes to scripting

#5
CID-78

CID-78
  • Members
  • 1 124 messages
I see nothing wrong with the script, check your resource names and tags and that you have exported them. also make sure you have added the local variable to the var_*.2da for the object the script is going to run on.



using "2" and != 2 is a bit weird however. (it won't cause a issue, it just doesn't make sense)

#6
Ymladdych

Ymladdych
  • Members
  • 295 messages

Modifié par Ymladdych, 28 septembre 2011 - 01:30 .


#7
Aulis Vaara

Aulis Vaara
  • Members
  • 1 331 messages
I didn't get a warning or an error about the single quote, and he seemed to accept it just fine, but I'll give it a try.

CID-78 wrote...

I see nothing wrong with the script, check your resource names and tags and that you have exported them. also make sure you have added the local variable to the var_*.2da for the object the script is going to run on.

using "2" and != 2 is a bit weird however. (it won't cause a issue, it just doesn't make sense)


After thinking about this, how can I do this without doing anything wrong. Adding that variable will edit the single player campaign, no? And I'm not supposed to do that. But if I add it to the dress, it will be removed when I destroy the dress, or am I seeing that wrong?

Also, I used 2 because 0 or 1 could be default values or might have special significance. It is a bit an odd value (lol), but any value will do, so it doesn't matter.

Modifié par Aulis Vaara, 19 avril 2010 - 05:02 .


#8
CID-78

CID-78
  • Members
  • 1 124 messages
but you are using OBJECT_SELF which is the object running the script. when it comes to the console that's the module, so any external variable used must be defined in the modules var_*.2da or it will be "0" at all time.ie it won't work.



using the dress isn't good either because you can have plenty of those. the best way is just make a addin with a script that runs once ie on Module_start event. in that case it will run once and once only.



it will do whatever changes you want within the boundary of loaded resources. so the store must be in memory. (ie you can't be in redcliff when running the script if the store is in denerim. (you won't get a valid tag)

#9
Aulis Vaara

Aulis Vaara
  • Members
  • 1 331 messages
Eh, not enough knowledge yet to understand all of that.

Anyway, I wanted to use a PRCSCR file, with this:
ID-------AreaListName---Script
int------string---------string
2493001--den230sr-------aulis_mage_dresses

I'm not sure about the area name, I looked it up, but changed it to 'any' for testing. I assumed that would work and I wouldn't need to do anything more. But with the game not being able to use the script, I can't even get there.

Modifié par Aulis Vaara, 19 avril 2010 - 07:50 .


#10
Aulis Vaara

Aulis Vaara
  • Members
  • 1 331 messages
Alright, update. I managed to solve the 'script not found' problem. So I can execute the script, and it works, but it will not add a dress to the merchant. I double checked the name and it is correct, any idea what it might be?

The game also doesn't accept the 2DA's I managed to create. When I enter the Wonders Of Thedas, nothing gets added to my inventory and it doesn't use the local variable. It just needed to be var_something.gda and nothing specific like var_local.gda, right? Apparently there is an actual tool for this, see below.

Modifié par Aulis Vaara, 20 avril 2010 - 11:58 .


#11
traversc

traversc
  • Members
  • 274 messages
Hello. I did something similar to add runes to Herren's shop:

if(!WR_GetPlotFlag(PLT_HERREN_GM_RUNES, ADDED_RUNES)) {
WR_SetPlotFlag(PLT_HERREN_GM_RUNES, ADDED_RUNES, TRUE);
object herren = GetObjectByTag("store_vgk100cr_herren");
if(IsObjectValid(herren)) {
CreateItemOnObject(R"gen_im_upg_cry_gdm_dwe.uti", herren, 50);

}
}

Instead of local ints, I used a plot flag, but it shouldn't matter. Since you seem to be new to scripting, you really just need to test each thing independently. As you know, there are a million places where you script can fail, and if you try to change things around without knowing where the problem is, you might never find out what's wrong :(

For example: you can try testing your script independently of PRCSCR and independently of local ints. Use the console to do that: runscript scriptname. If it works, then you KNOW that your resource files are properly exported. Then try adding in the local int functions, etc.

Good luck.

#12
Loc'n'lol

Loc'n'lol
  • Members
  • 3 594 messages
If you don't mind, there is a user-created tool that allows you to edit GDAs directly, without going through the excel files.



Also "den230sr" is not an arealist, that would be "den02_al_den_market".

#13
Aulis Vaara

Aulis Vaara
  • Members
  • 1 331 messages
Traversc:: If you read my latest post it should be obvious that the script works, and that I know where the mistakes are. While I am new to Dragon Age scripting, I'm not a newbie to programming. Even then, it's frequently easier for others to see your mistakes than it is for you. That's why I'm posting here and not figuring everything out on my own ^_^

_Loc_N_lol_:: Thanks ! That seems absolutely brilliant !

Oh, and yeah, I looked the area back up, it's supposed to be den230ar_wonders_of_thedas. Sorry about not correcting that.

Using the tool you provided, I've determined that the 2DA's were actually correctly converted, but now I have no idea why they are not recognized. They don't need any special naming other than PRCSCR_ and var_, right? Or do they need to be named after your module?

Or maybe I am missing something I really need, though I rather doubt it, since the game recognizes the package and allows me to execute the script.

Maybe it's the placing of the files. I've read the 2DA's and the script need to be in the mod's folders under module/override, that is correct?

In any case, many thanks for the help already provided.

Modifié par Aulis Vaara, 20 avril 2010 - 01:16 .


#14
CID-78

CID-78
  • Members
  • 1 124 messages
the var_.2da must be in the modules properties or in the object that is going to run the scripts properties to be more generic. So make sure you have it setup. a loose .2da will not be used.

#15
Aulis Vaara

Aulis Vaara
  • Members
  • 1 331 messages
Yeah, I already figured that out, however, it doesn't change a thing. I even tried calling the module object with GetModule() for certainty, but again, it doesn't work. And the PRCSCR_aulis_mage_dresses.gda still doesn't do anything either.

Alright, the shop is now working, as is the PRCSCR, which means I'm down to one problem. The Local Variable which is not working.

Modifié par Aulis Vaara, 20 avril 2010 - 05:08 .


#16
CID-78

CID-78
  • Members
  • 1 124 messages
the files can be in several places and still work. I have my .gda in the core data folder for my module.

#17
Aulis Vaara

Aulis Vaara
  • Members
  • 1 331 messages
I turned to plotflags as Traversc suggested, since I couldn't get the 2da to work. The plotflags worked from the start, a bit stupid of myself not to turn to it immediately. Still curious why it didn't work though.



In any case, thanks for all the help everyone.