Aller au contenu

Photo

Addin for Single Player fires only once.


11 réponses à ce sujet

#1
Aslend

Aslend
  • Members
  • 63 messages
I followed a tutorial on how to create and Addin for the Single Player Campaign, and after starting a new game it works only once. I am thinking the plot flag is staying set. Here is the script, any assistance would be greatly appreciated.
[b]
event handler script
#include "utility_h"
#include "wrappers_h"
#include "plt_makers_set_plot"
void main()
{
    if ( WR_GetPlotFlag( PLT_MAKERS_SET_PLOT, MAKERS_SET_CHECK_FLAG ) == TRUE )
    return;
    event ev = GetCurrentEvent();
    int nEventType = GetEventType(ev);
    switch ( nEventType )
    {
    case EVENT_TYPE_MODULE_LOAD:
    {
            UT_AddItemToInventory(R"makers_hat.uti", 1);
            UT_AddItemToInventory(R"makers_light_armor.uti", 1);
            UT_AddItemToInventory(R"makers_light_hat.uti", 1);
            UT_AddItemToInventory(R"makers_light_slippers.uti", 1);
            UT_AddItemToInventory(R"makers_longsword.uti", 1);
            UT_AddItemToInventory(R"makers_med_armor.uti", 1);
            UT_AddItemToInventory(R"makers_shield.uti", 1);
            UT_AddItemToInventory(R"makers_slippers.uti", 1);
            UT_AddItemToInventory(R"makers_sting.uti", 2);
            UT_AddItemToInventory(R"makers_wand.uti", 1);
            UT_AddItemToInventory(R"makers_med_touch.uti", 1);
            UT_AddItemToInventory(R"makers_light_touch.uti", 1);
             WR_SetPlotFlag( PLT_MAKERS_SET_PLOT, MAKERS_SET_CHECK_FLAG, TRUE );
          break;
        }
        default:
            break;
    }
}
Posted Image

#2
Proleric

Proleric
  • Members
  • 2 350 messages
I'm not sure I understand the question. The MODULE_LOAD event only occurs once, which is normally what you want with equipment, so I don't think you need the plot flag.

#3
DavidSims

DavidSims
  • BioWare Employees
  • 196 messages
What exactly is the problem? That seems like the kind of code you wouldn't only want to run once. Is the problem that it's only running once per game, or somehow that it's only running once even if you start a new character? If it'sthe former, how often/when do you want it to load? That would determine what event to move it to, and the plot flag would have to be removed. If it's the latter, then that is very unusual behavior.

#4
Magic

Magic
  • Members
  • 187 messages
Is it really not working for a newly created character, or are you maybe re-importing the one for which it already worked?

#5
-Semper-

-Semper-
  • Members
  • 2 256 messages
the problem is if you create such an addin which places items into your inventory it fires only if you load a game. when you start a new character the custom script wont fire. that's not the case with bio's item addins like blood armor. it has to do with the script because if you deactivate your custom addin dlc, start a new character, save your game, activate your dlc and load your game the item will appear.



perhaps the script has problems with the character creater because there is no real inventory and therefore bioware places a "safety loop" within their script. i dunno and we cannot recompile the scripts :D

#6
ladydesire

ladydesire
  • Members
  • 1 928 messages

-Semper- wrote...

the problem is if you create such an addin
which places items into your inventory it fires
only if you load a game. when you start a new
character the custom script wont fire. that's not
the case with bio's item addins like blood
armor. it has to do with the script because if
you deactivate your custom addin dlc, start a
new character, save your game, activate your
dlc and load your game the item will appear.

perhaps the script has problems with the
character creater because there is no real
inventory and therefore bioware places a "
safety loop" within their script. i dunno and we
cannot recompile the scripts :D


Maybe they use a different event, like one of the area ones for this.

#7
Craig Graff

Craig Graff
  • Members
  • 608 messages
Or maybe we use the PRCSCR 2da scripts. Who knows?

#8
-Semper-

-Semper-
  • Members
  • 2 256 messages
hm, but i thought the prcscr is just to define a starting point for the script but the event "module_load" is already a defined starting point. i don't get why we should use the pcrsrc handler. the item shall appear at module load and not after entering a specific area. or am i mixing something wrong?^^

the easiest workaround should be to not use a specific event for this but a prcscr with area tag "any" in combination with a plot flag.

Modifié par -Semper-, 24 mars 2010 - 05:38 .


#9
Proleric

Proleric
  • Members
  • 2 350 messages

-Semper- wrote...

hm, but i thought the prcscr is just to define a starting point for the script but the event "module_load" is already a defined starting point. i don't get why we should use the pcrsrc handler. the item shall appear at module load and not after entering a specific area. or am i mixing something wrong?^^

the easiest workaround should be to not use a specific event for this but a prcscr with area tag "any" in combination with a plot flag.

We recently learned that character generation typically wipes the inventory. That's the sort of timing issue that explains why the module load event appears not to work with new games, but does work with saved games.

In all likelihood, the module load always works, but subsequently character generation may wipe the items.

PRCSCR is simply one robust way of ensuring that the custom script runs after character generation, I think.

The module start event has its uses, but evidently inventory management isn't one of them.

#10
-Semper-

-Semper-
  • Members
  • 2 256 messages
but then isn't character creation not also some form of entering an area? in this case prcscr won't be a solution.

#11
Proleric

Proleric
  • Members
  • 2 350 messages

-Semper- wrote...

but then isn't character creation not also some form of entering an area? in this case prcscr won't be a solution.

The order of events is - module start, character generation, enter area. So PRCSCR is a solution, because entering an area happens after character generation.

As far as I know, no area is established during character generation - at any rate, PRCSCR happens later.

#12
-Semper-

-Semper-
  • Members
  • 2 256 messages
that would be cool^^

right now it's not a problem because i'm only creating art ressources. i thought so because the stage of the character creation is also an area. but it's good to know. thx ;)