Aller au contenu

Photo

Add Custom Item Scripting ... Slightly More Advanced


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

#1
Ebon Dark

Ebon Dark
  • Members
  • 51 messages
So I started playing with adding my own custom items (mainly ways to try and get rid of helmets).  Like many of you I started with the great tutorial John Vanderbeek.  I decided to try a slightly more advanced version so I can add mutiple items by iterating over an array so as I added items I simply had to add the resource name to the array.

It appears to work like a charm for me so I thought I would share it (next version I do of this I think I'll vary items by class or something).

Let me know any comments or ways to improve it (or if it blows goat chunks let me know too ;) ):

SCRIPT_FILE

Modifié par Ebon Dark, 27 novembre 2009 - 07:15 .


#2
Sunjammer

Sunjammer
  • Members
  • 925 messages
One question: did you test it?

Note this is a trick question because I know you didn't. The script won't compile because the way you are trying to populate the array isn't valid in dascript.

Modifié par Sunjammer, 27 novembre 2009 - 08:24 .


#3
Ebon Dark

Ebon Dark
  • Members
  • 51 messages
Actually I did test it but the problem I'm running into is that I can't tell if the export that I was using was failing to override a previous export or not.  Basically a new save game file was getting the items but I couldn't tell from the toolset logs if it was overriding the old version.

EDIT: Yep ... looks like you can't initialize an array.  So my original file version was still running not this one and I couldn't seperate the two ... man scripting in DA is harder then NWN ... grrr.

Modifié par Ebon Dark, 27 novembre 2009 - 09:03 .


#4
Sunjammer

Sunjammer
  • Members
  • 925 messages

Ebon Dark wrote...

EDIT: Yep ... looks like you can't initialize an array.  So my original file version was still running not this one and I couldn't seperate the two ... man scripting in DA is harder then NWN ... grrr.

It is a bit more involved but we'll get there in the end!  Just keep an eye on your log window when compiling.

:)

Modifié par Sunjammer, 27 novembre 2009 - 09:09 .


#5
Ebon Dark

Ebon Dark
  • Members
  • 51 messages
Alright script fixed.

#6
Georg Zoeller

Georg Zoeller
  • Members
  • 188 messages
The use of global variables is strongly discouraged.

You will find no instances of global variables in the entire 300.000 lines of Dragon Age scripting code :)




#7
Ebon Dark

Ebon Dark
  • Members
  • 51 messages
I'll be moving it to instance variables. I'm trying to get used to some of the nuances of the scripting language. Relatively easy refactor to move that though.

EDIT: Refactor complete ... and thanks for the feedback.  Turkey day make me lazy :)

Modifié par Ebon Dark, 28 novembre 2009 - 03:12 .


#8
Sunjammer

Sunjammer
  • Members
  • 925 messages
One final point: you are using a local variable so you might want to highlight that users will need to include that in the variables 2da. Alternatively you can convert it to a plot variable and use that but that would mean setting up you script as a B2B package.