Aller au contenu

Photo

How do i place an item i made in the toolset appear in my character's inventory in-game, in the main campaign?


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

#1
Michaeldayam

Michaeldayam
  • Members
  • 1 messages
How do i place an item i made in the toolset appear in my character's inventory in-game, in the main campaign?

please help me...

#2
sillyrobot

sillyrobot
  • Members
  • 171 messages
There are a couple of options:  create a module script to insert the object (see example below) or use an addin that offers such a feature, like A Mysterious Bag.

Here is a simple code sample. 

void main()
{
    event ev = GetCurrentEvent();
    int nEventType = GetEventType(ev);
    switch ( nEventType )
    {
        case EVENT_TYPE_MODULE_LOAD:
        { 
            object oObjToGive = GetItemPossessedBy( GetHero(), "TagOfObject" ); // see if he already has it
            if ( !IsObjectValid( oObjToGive ))
            {
                CreateItemOnObject( R"ObjectToGive.uti", GetHero(), 1 );           
             }
            break;
        }
}

#3
TheGreenLion

TheGreenLion
  • Members
  • 513 messages
http://dragonagemodd...player-an-item/

Be sure you check out his follow ups, and there's also a lot of comments to check out, especially if you seem to be having problems. You must follow the steps carefully, any small problem is just about as good as a big one.

Here's a larger script for multiple items, Lethal_Brahms is the uber and it's more effecient than the older script in the above link.. You may need to replace the quotations as sometimes they don't register as quotations when copy/pasted. I included two sets of armor in the script to show that you need to rename them for it to register in-game (oArmor versus oArmor1). Happy modding.

Oh, do remember to use a different id for your items, if I ever release mods I'll be using my eeg_ prefix. Posted Image

    // All module events
#include "utility_h"
#include "wrappers_h"
#include "events_h"
void main()
{
event ev = GetCurrentEvent();
int nEvent = GetEventType(ev);
Log_Events("", ev);
switch (nEvent)
{
case EVENT_TYPE_MODULE_LOAD:
{
// get the object which contains the player
object oPlayer = GetHero();

object oArmor = GetObjectByTag("eeg_massivearmor");
object oBoots = GetObjectByTag("eeg_massiveboots");
object oGloves = GetObjectByTag("eeg_massivegloves");
object oHelm = GetObjectByTag("eeg_massivehelmet");
object oArmor1 = GetObjectByTag("eeg_mediumarmor");
object oBoots1 = GetObjectByTag("eeg_mediumboots");
object oGloves1 = GetObjectByTag("eeg_mediumgloves");
object oHelm1 = GetObjectByTag("eeg_heavyhelmet");
object oShield = GetObjectByTag("eeg_shield");

if (!IsObjectValid(oArmor))
UT_AddItemToInventory(R"eeg_massivearmor.uti",1);
if (!IsObjectValid(oBoots))
UT_AddItemToInventory(R"eeg_massiveboots.uti",1);
if (!IsObjectValid(oGloves))
UT_AddItemToInventory(R"eeg_massivegloves.uti",1);
if (!IsObjectValid(oHelm))
UT_AddItemToInventory(R"eeg_massivehelmet.uti",1);
if (!IsObjectValid(oArmor1))
UT_AddItemToInventory(R"eeg_mediumarmor.uti",1);
if (!IsObjectValid(oBoots1))
UT_AddItemToInventory(R"eeg_mediumboots.uti",1);
if (!IsObjectValid(oGloves1))
UT_AddItemToInventory(R"eeg_mediumgloves.uti",1);
if (!IsObjectValid(oHelm1))
UT_AddItemToInventory(R"eeg_heavyhelmet.uti",1);
if (!IsObjectValid(oShield))
UT_AddItemToInventory(R"eeg_shield.uti",1);
break;
}
default:
{
break;
}
}
}

Modifié par TheGreenLion, 29 novembre 2009 - 05:37 .


#4
A2Buddha

A2Buddha
  • Members
  • 19 messages
I wholeheartedly endorse weriKK's blog entry. I just used it today, and it was flawless. It even covers assigning a flag so that your item doesn't duplicate every time you load a game:



Custom Player Items In Single Player

#5
tazpn

tazpn
  • Members
  • 70 messages
I suspect weriKK's approach is slightly better than sillyrobot and TheGreenLions because the flag prevents it being inserted repeatedly. And is well done and has been proved to work for many people.



I think sillyrobot's and TheGreenLion's approaches will insert the item into inventory every time you load the module if is not in inventory any more (like on a character). I could be wrong but does wouldn't this happen every time the save is loaded?

#6
sillyrobot

sillyrobot
  • Members
  • 171 messages

tazpn wrote...

I suspect weriKK's approach is slightly better than sillyrobot and TheGreenLions because the flag prevents it being inserted repeatedly. And is well done and has been proved to work for many people.

I think sillyrobot's and TheGreenLion's approaches will insert the item into inventory every time you load the module if is not in inventory any more (like on a character). I could be wrong but does wouldn't this happen every time the save is loaded?


Yes.  Mine will insert any time the hero doesn't possess the item either equipped or in inventory.  TheGreenLion's will insert anytime the items aren't in the same area.

If I only want the item inserted once, I use a plot flag check instead of the function call.  GetItemPossessedBy() is valuable in that the player gets to control how many items he receives.  If the item would be of value to different characters he can distribute and receive new copies.

#7
TheGreenLion

TheGreenLion
  • Members
  • 513 messages
Oooo good to know about the plot flag, I followed the one fellows advice not to mess with plot shtuff but apparently there's nothing wonky with it eh?

#8
tazpn

tazpn
  • Members
  • 70 messages
Whats wrong with the plot flag? Does it break other modules?

#9
TheGreenLion

TheGreenLion
  • Members
  • 513 messages
Well I never rightly tested it, there was an after comment in the guys tutorial about not messing with plot flags and such because he wasn't sure if it was a buggy area of the Toolset, but so far I see no evidence of conflicts between other modules and use of plot flags.