Aller au contenu

Photo

Help with creating items into inventory


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

#1
sand beagle

sand beagle
  • Members
  • 22 messages
I am having trouble creating items into my inventory. I have followed the tutorials on how to do it, but when i try to compile my script it always gives: my_event_handler_fixed_1.nss - Unable to get the resource information for "utility_h" of type "nss", in the log window, and then it fails to export when i try to compile my mod. here is the 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_armor_bow.uti", 1);
            UT_AddItemToInventory(R"my_armor_.uti", 1);
            UT_AddItemToInventory(R"my_armor_boots.uti", 1);
            UT_AddItemToInventory(R"my_armor_gloves.uti", 1);
            UT_AddItemToInventory(R"my_armor_ring", 1);
            UT_AddItemToInventory(R"my_armor_tunic.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 ----

Modifié par sand beagle, 21 novembre 2009 - 04:12 .


#2
Sunstar

Sunstar
  • Members
  • 25 messages
I found this tutorial on how to do it - it works

http://dragonagemodd...player-an-item/

I found i could add multiple items by adding a few lines and numbering the variables.

if you wrote the srcript you posted -  i'd say you won't have any trouble

Modifié par Sunstar, 21 novembre 2009 - 04:30 .


#3
sand beagle

sand beagle
  • Members
  • 22 messages
yeah, i'm not sure why, but it says it cant find utility_h, and i cant figure out where i can even find utility_h to see if i even have it :<. Thanks though, i'll check out that script, hopefully it will work.

#4
sand beagle

sand beagle
  • Members
  • 22 messages
hmm, nope :(. I tried it using that script template and i still get the following error:

E: 23:43:32 - my_event_handler_fixed_1.nss - Exporter FAILED for resource: my_event_handler_fixed_1.nss
E: 23:43:32 - my_event_handler_fixed_1.nss - Unable to get the resource information for "utility_h" of type "nss"

**edit
Hey, also i found on that website you sent me, this guy had the exact same problem I did and he said this:
"Wow, so sorry for wasting your time, i figured out what the problem
was. I was typing the script into the Client Scripts, not “Scripts” and
now it has no problem saving or exporting."
Can you tell me what he means by typing the script into the Client Scripts and not "Scripts"?

** also when i look in the core scripts folder thats above my created folder, i only see about 7 scripts, like area_core, creature_core, merchant_core etc. Is that normal?

Modifié par sand beagle, 21 novembre 2009 - 04:59 .


#5
Sunstar

Sunstar
  • Members
  • 25 messages
if you look at the toolset - top right hand corner... there is a "palette window" lots of icons - the script icon and the client script icon are right next to each other...

the script icon is the bottom row third from the left and client scripts is next to it 4th from the left. so it sounds like you're putting them into the client script compiler not the script compiler.

I followed the tutorial very closely and I'm finding the only problem I have is that the game will add the item every time i load a game unless it's in the inventory.

when it comes to the number of scripts - if i look at core scripts in the script area i have 4 scripts in it.

sorry it took me so long to reply - had to go to work. might not be on for 18+ hours but be happy to help out if i can - but i'm far from an expert - i'm just going to follow the tutorial on the same site as above on how to add a merchant to the camp area  :wizard:

Modifié par Sunstar, 21 novembre 2009 - 03:21 .


#6
weriKK

weriKK
  • Members
  • 106 messages
If you create the module script file on the Module Management screen BEFORE you opened the module at least once, the Toolset will place the file into your previously opened (and at that point still open) project.



This can cause compilation issues because the file is simply not part of your module.



Check your module script file. Does it point at your custom script or a database entry?

You might have to recreate the script file in case it does.

#7
Sunstar

Sunstar
  • Members
  • 25 messages
Thanks for the tip werikk - what i really need is a lilac soul script writter for DA as i could always use those as a base for my scripts in nwn,



DA building areas seems to have a lot more power and simplicity to it than nwn 2 though, so at least on that score i'm happy.


#8
sand beagle

sand beagle
  • Members
  • 22 messages
hmm, nope its in "scripts", but i dont know anymore, maybe i just dont have wrappers_h, or utility_h or something, cause no matter what i try it just keeps giving that same error :(

**edit
i tried what you said, i made scripts in the module management screen, and by themselves, but both times they still just give the utility_h/wrapper_h error. its like i dont have the files or something

** oh, yes when  i open the module manager under the scripts section it does point to my script, i still get this error though: E: 17:36:45 - my_event_handler_fixed_1.nss - Unable to get the resource information for "wrappers_h" of type "nss"

it really makes me think that i just dont have the files, cause if i delete wrappers_h it will just complain about utility_h and im guessing any other xxxxxx_h it will have problems with too

Modifié par sand beagle, 21 novembre 2009 - 10:39 .


#9
Craig Graff

Craig Graff
  • Members
  • 608 messages
If I recall correctly, this error can sometimes be caused by scripts in override - try clearing packages/core/override and recompiling.

#10
sand beagle

sand beagle
  • Members
  • 22 messages
hmm, no luck, i deleted all items in override folder, and it still gives:
my_event_handler.nss - Unable to get the resource information for "wrappers_h" of type "nss"

** if it helps, i am using windows 7 64 bit and i had to custom setup the toolset using SQL server managment studio express to bypass the "could not connect to database error".

Modifié par sand beagle, 22 novembre 2009 - 09:35 .


#11
blaalindorm

blaalindorm
  • Members
  • 234 messages
I followed the instructions to add a script to add an item to the inventory.



The toolset just throws up unknown error (36) when I assume it tries to compile(?) the C++ code.



This is on Vista x64.

#12
Sunstar

Sunstar
  • Members
  • 25 messages
Does the over ride exist in program files and my documents... other than that you could try a re install. if you've tried to work on anything in the official single player mod in the toolset i hear it can create problems... i think re installing would help if that was the answer. other than that i'm at a complete loss...

#13
Chaos5061

Chaos5061
  • Members
  • 26 messages
I recognised the script from this link:
http://social.biowar.../5339/blog/576/
make sure to delete all the items from the C:\\MyDocuments\\Bioware\\DragonAge\\packages\\core\\override\\toolsexport\\
Also the line in the script of
UT_AddItemToInventory(R"my_armor_ring", 1);
does not have .uti in it. It should be this below:
UT_AddItemToInventory(R"my_armor_ring.uti", 1);
If this does not fix it I did do one other thing but i don't know for sure if this helped me or not what you do is go to this:
Go to "My Documents/Bioware/Dragon Age/Modules" and rename the "Single Player" folder there to something like Single Player.bk
Hope this helps you.

#14
blaalindorm

blaalindorm
  • Members
  • 234 messages
Any ideas about the unknown error 36?

#15
blaalindorm

blaalindorm
  • Members
  • 234 messages
Any help on how to debug this unknown error 36?

#16
Sunstar

Sunstar
  • Members
  • 25 messages
just a quick thought - did you try the section in the tutorial...



The first thing you should do, is in the toolset go to TOOLS -> EXPORT -> EMPTY EXPORT DIRECTORIES. This will wipe out any modifications you’ve made. It will reset all overrides on Single Player but its important to keep the campaign running properly. After you’ve done that, never ever open the Single Player module again :) .

#17
Craig Graff

Craig Graff
  • Members
  • 608 messages
Sometimes an unknown error indicates that you left off the .uti (or whatever extension is appropriate) in your resource string.

Modifié par Craig Graff, 25 novembre 2009 - 09:51 .


#18
blaalindorm

blaalindorm
  • Members
  • 234 messages
Thanks for the reply. I did make sure all the override directories were empty, I'm pretty sure that I had the .uti extension on the string, but I will double check tonight.

#19
Dansharp1

Dansharp1
  • Members
  • 103 messages
I also need help, i can't find a script which works. Can someone tell me one?



Also my module doesn't work in DA:O, when i go to loadf it up in other Campaigns, it says Unable to load. Can someone please tell me why?

#20
Proleric

Proleric
  • Members
  • 2 343 messages
Hopefully answered in your other thread.