Aller au contenu

Photo

Need help getting my custom items to respawn after deactivating the mod.


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

#1
AdamTaylor

AdamTaylor
  • Members
  • 461 messages
Okay, so I had that stat glitch, where every point is worth two stat points.
I was talked through how to fix it. Part of that being to disable all mods.

I reactivated them, and everything's working now, except that I made a mod that has a pair of swords in it.
I got all the mod items back in my game, except for my swords.
And I don't know how to fix that. I want to have them re-added, like everything else.

Here's the script I used (taken from weriKK's blog):

// ---- 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_uberweapon_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_UBERWEAPON_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"uber_weapon_heaven.uti", 1);
            UT_AddItemToInventory(R"uber_weapon_hell.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_UBERWEAPON_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 ----



Now, I'm mostly brainless about using the toolset. But I figure it has something to do with the plot bit. The script had run once, and that was saved. So now the game's not running it again? Is that it?
How do I get my items back?

#2
eiham

eiham
  • Members
  • 38 messages
create a new script, call it dbg_remove_uberweapon_plot and put the following in it



#include "plt_uberweapon_plot"



void main()

{

// Set our plot flag to FALSE

WR_SetPlotFlag( PLT_UBERWEAPON_PLOT, MY_ITEM_CHECK_FLAG, FALSE );

}

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



then run it from the console: runscript dbg_remove_uberweapon_plot



after that, if you save and reload that save it should work. Alternatively you could just plop your two UT_AddItemToInventory calls into the dbg script and it would just give you the items directly.

#3
Axe_Murderer

Axe_Murderer
  • Members
  • 279 messages
Try this. Plug in the proper TAG for your items where indicated on those two lines...
[dascript]
// ---- 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_uberweapon_plot"

void main()
{
    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.
            if( !IsObjectValid( GetItemPossessedBy( GetHero(), "TAG_of_UberWeaponHeaven_item_goes_here")))
                UT_AddItemToInventory(R"uber_weapon_heaven.uti", 1);
            if( !IsObjectValid( GetItemPossessedBy( GetHero(), "TAG_of_UberWeaponHell_item_goes_here")))
                UT_AddItemToInventory(R"uber_weapon_hell.uti", 1);
            
            // We have dealt with the event we were waiting for.
            // At this point we can stop looking for other events
            break;
    }
}
// ---- SCRIPT ENDS HERE ----
[/dascript]
You really don't need the plot flag.

Modifié par Axe_Murderer, 21 novembre 2009 - 08:28 .


#4
AdamTaylor

AdamTaylor
  • Members
  • 461 messages
Sorry, TAG?

I'm a complete newb at this. I basically just tried to do a step by step as on the blog.



So, I don't need the plot line at all? I can just remove that from the script?

I thought the plot bit was to prevent the items being made every time you load the game.

#5
hwlreckles

hwlreckles
  • Members
  • 44 messages

AdamTaylor wrote...

Sorry, TAG?
I'm a complete newb at this. I basically just tried to do a step by step as on the blog.

So, I don't need the plot line at all? I can just remove that from the script?
I thought the plot bit was to prevent the items being made every time you load the game.



There's more than one way to write scripts that accomplish the same goal.

#6
AdamTaylor

AdamTaylor
  • Members
  • 461 messages
Okay, so I should just replace my script with what Axe listed?

Does that mean I should remove that plot line at the beginning?





But for:



if( !IsObjectValid( GetItemPossessedBy( GetHero(), TAG_of_UberWeaponHeaven_item_goes_here")))



What do I put exactly? Isn't the tag the same are the resource name?

So it would just be "uber_weapon_heaven" then?

#7
weriKK

weriKK
  • Members
  • 106 messages
The solution is very simple, disable your mod, load the game without it. Make a save game. Re-enable your DLC, load your save game and you should have all your items back .

#8
Axe_Murderer

Axe_Murderer
  • Members
  • 279 messages
Look at the properties of the items you are adding. One of the fields is TAG. Whatever is there is what you have to plug into the script.


#9
AdamTaylor

AdamTaylor
  • Members
  • 461 messages
Okay, but so do I remove that #include "plt_uberweapon_plot" bit at the beginning then, if I'm not using the plot anymore?

#10
Axe_Murderer

Axe_Murderer
  • Members
  • 279 messages
Sure you can do that if you aren't using it for anything else.

#11
AdamTaylor

AdamTaylor
  • Members
  • 461 messages
Okay, thanks.