Jump to content

Scripting Help


Danieladius

Recommended Posts

Hey all. I am trying to get into modding Dragon Age, and I am completely ignorant about scripting. Could someone please tell me what is wrong with this script :

 

 

// ---- SCRIPT STARTS HERE ----

 

// Later on in this script, we will use the UT_AddItemToInventory()

// function to add an item to the player's inventory.

// But before we could use it, we have to tell the toolset where

// to look for it. The function is in the "utility_h" script file

// under _Core Includes, we will include this file at the top of

// our script file, above the main function.

 

#include "utility_h"

#include "plt_my_custom_plot"

 

void main()

{

// If our plot flag is set to TRUE, that means we have already

// given the items to the player, there is no need to continue

// running this script.

if ( WR_GetPlotFlag( PLT_MY_CUSTOM_PLOT, MY_ITEM_CHECK_FLAG ) == TRUE )

return;

 

event ev = GetCurrentEvent();

int nEventType = GetEventType(ev);

 

// We will watch for every event type and if the one we need

// appears we will handle it as a special case. We will ignore the rest

// of the events

switch ( nEventType )

{

// This event happenes every time the module loads

// This usually happenes when creating a new game

// or loading a savegame

case EVENT_TYPE_MODULE_LOAD:

{

// The UT_AddItemToInventory function adds various resources to a

// creature's inventory. Here we add one weapon and one shield.

UT_AddItemToInventory(R"my_custom_weapon.uti", 1);

UT_AddItemToInventory(R"my_custom_shield.uti", 1);

 

// Set our plot flag to TRUE, so the next time this script tries

// to run it will not add extra items to the player's inventory

WR_SetPlotFlag( PLT_MY_CUSTOM_PLOT, MY_ITEM_CHECK_FLAG, TRUE );

 

// We have dealt with the event we were waiting for.

// At this point we can stop looking for other events

break;

}

default:

break;

}

}

// ---- SCRIPT ENDS HERE ----

 

 

I have followed Werrik's tutorial over on Bioware step by step, except for changing the item names. I ensured that the items had ".uti" after them, if that helps. They turned blue. Anyways; I am at my wits end. Any help is greatly appreciated.

Link to comment
Share on other sites

The werriKK script doesn't use the console > runscript xxxx delivery system; rather, it runs in the background, checks a plot flag to see if the specified items have been given, adds them if they haven't been given, and then sets the aforementioned flag so they won't be given again... using it as a console runscript will have exactly the result you've reported: a success message, no items.

 

To add items to inventory via the console, most modders use one of these scripts:

 

// ---- SCRIPT STARTS HERE ----

 

void main()
{
object oPC = GetHero();
CreateItemOnObject (R"your_item.uti",oPC);
}

 

// ---- SCRIPT ENDS HERE ----

 

or (from the toolset wiki)

 

// ---- SCRIPT STARTS HERE ----

 

void main()
{
CreateItemOnObject(R"your_item.uti", OBJECT_SELF, 1, "", TRUE);
}

// ---- SCRIPT ENDS HERE ----

 

or the fancy version with some floaty text:

 

// ---- SCRIPT STARTS HERE ----

 

void main ()
{
object oPlayer = GetHero();

CreateItemOnObject(R"your_item.uti", OBJECT_SELF, 1, "", TRUE);

DisplayFloatyMessage (oPlayer, "Item Recieved: Your Item",FLOATY_MESSAGE,0xff0000,3.0f);
}

// ---- SCRIPT ENDS HERE ----

Edited by theskymoves
Link to comment
Share on other sites

Thank you so very much. I wound up using the "Add Custom Items To A Custom Module" toolset wiki tutorial. Pardon my ignorance; but for my own personal purposes, just adding a few duplicated items; would that work, or is there a better/simpler/more efficient way to do so ?

 

I think that's the wiki tutorial with the second script I mentioned, so it sounds like you are good to go. :thumbsup:

 

If you are already in the toolset, the script to add items really only takes a few seconds, but if you'd rather avoid that step, another option for custom items is to use the item scanner in Add Item Visual Deluxe.... apples vs oranges and it's all fruit

 

And congratulations on your first mod! :dance:

Link to comment
Share on other sites

Thanks. I have a request that is above my head (way above my head). A single weapon talent tree. I would make it myself; but I kind of got lost right after the tutorial started editing 2DA's and such. One could refer to my thread on the request in Mod Requests. Thank you all for all the help. The feeling of making my first DA:O mod is good. I am overjoyed.

 

Edit: maybe someone would be willing to show me how ? Walk me through the process of such ? A "learn by doing" situation ?

Edited by Danieladius
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...