Aller au contenu

Photo

Armor unequipped when loading a saved game


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

#1
4760

4760
  • Members
  • 1 207 messages
As the title says: the Valsharess armor (custom content, with OnEquip and OnUnequip scripts) is sometimes found in the character's inventory when a previously saved game is reloaded, although it was equipped at the time of the save.

I suppose this comes from the OnEquip/OnUnequip scripts (depending on what other pieces of armor - necklace or belt - the character wears, the default appearance is changed to reflect the presence or absence of these other parts. This works well in game, so I'm sure the scripts are fine).

Question: without changing any module script (to make the armor useable everywhere), is there a way to force the OnEquip script upon loading a save?

#2
kevL

kevL
  • Members
  • 4 061 messages
onEquip should automatically fire for PC + Roster members on all equipped items when loading a save.

Is the PC with the armor the only party member in the save? that makes things simpler when debugging because if there's other party members, messages for the PC get hidden for whatever reason. (at least on my system)

I'm thinking you should try something like this in the onPlayerEquip:
object oDebug = GetPCItemLastEquippedBy();
object oArmor = GetItemInSlot(INVENTORY_SLOT_CHEST, oDebug);
if (GetIsObjectValid(oArmor))
    SendMessageToPC(GetFirstPC(FALSE), "armor = " + GetTag(oArmor));
else
    SendMessageToPC(GetFirstPC(FALSE), "no armor on Chest");

you can also look in the save folder at the .IFO ( or .ROS ) file of the character ( w/ TlkEdit2 ) to see if the armor was even *saved* in the slot


but, uh, if you really want to force the onEquip script to run,
ExecuteScript("the_on_equip_script", GetModule());


#3
4760

4760
  • Members
  • 1 207 messages
I already added SendMessage statements in the OnEquip/OnUnequip scripts, and the conclusion is that they don't fire when the saved game is loaded. Thanks for the tip with TlkEdit2, I'll have a look right now.

#4
kevL

kevL
  • Members
  • 4 061 messages

I already added SendMessage statements in the OnEquip/OnUnequip scripts, and the conclusion is that they don't fire when the saved game is loaded.


try PrintString() to the logfile, if it's set up in your .Ini

#5
4760

4760
  • Members
  • 1 207 messages

you can also look in the save folder at the .IFO ( or .ROS ) file of the character ( w/ TlkEdit2 ) to see if the armor was even *saved* in the slot

 

Yep, it was saved in the armor slot, as expected.

 

try PrintString() to the logfile, if it's set up in your .Ini

Thanks, will try tonight.



#6
4760

4760
  • Members
  • 1 207 messages

try PrintString() to the logfile, if it's set up in your .Ini

Thanks a lot KevL, that gave me the information I needed (namely: if an OnEquip script calls another OnEquip script, there's no guarantee the called OnEquip script will finish BEFORE the calling script gets the focus again [too much VB programming I guess]).

 

Now solved, thanks again.



#7
kevL

kevL
  • Members
  • 4 061 messages
np,
that sounds oddly like something I was banging my head against for 2hr yesterday .....

<g>