forums | blogs | polls | tutorials | downloads | rules | help

Error message

Deprecated function: The each() function is deprecated. This message will be suppressed on further calls in remember_me_form_alter() (line 78 of /var/www/siegetheday.org/sites/all/modules/contrib/remember_me/remember_me.module).

Pets with large inventory check MOD

Pardon me for your time and hopefully generous knowledge.
I am trying to solve an issue I have that involves using 'ZhixalomsDS2BWInventory' mods. Namely, I dont alwas count the objects correctly when storing items in my pets inventory, which causes a corrupt save(pet is stuck at the Inn/trying to access him causes an EXE fault).
I stumbled upon the coding that uses 'GetFullRatio' that I assume is an 'Inventory Check'. It is used only twice(thrice but xLogic replaces Logic...), so seemly is my best oppurtunity for a resolution.

\\ denotes my remarks in below code tags as opposed to standard code remarks of //

\\cut&paste from {Logic}\world\ai\jobs\common\job_collect_loot.skrit

void ContinueCollectingLoot$( void )
{
// If our inventory is full we are done.
if( Math.IsOne( m_Go$.Inventory.GetFullRatio() ) )
{
// finish
report.reportf("collect_loot", "collect_loot: go[%s] is done collecting loot because inventory is full.\n", m_Go$.TemplateName );
SetState DoneCollecting$;
return;
}

// See if the front job is collect_loot
eJobAbstractType actionJat$ = m_Mind$.FrontActionJat;
if( actionJat$ == JAT_GET )
{
return; // we are still collecting loot
}
else if( actionJat$ == JAT_COLLECT_LOOT )
{
// We are still performing the collect loot job so lets continue looting!
if( LootClosestItem$() )
{
return; // we are looting a new item
}
}

// The front job is not JAT_COLLECT_LOOT or JAT_GET so the user must have interupted our
// collect loot job, lets shutdown this job.
report.reportf("collect_loot", "collect_loot: go[%s] is done collecting loot because can't find any loot to collect.\n", m_Go$.TemplateName );
SetState DoneCollecting$;
return;
}

The other instance of 'GetFullRatio'.

\\cut&paste from {xLogic}\auto\test\sprocket.skrit \\Not sure this is even used ingame but might as well add the check for safety

if(bPickup$)
{
if(hero$.Go.Inventory.GetFullRatio() > inventoryRatio$)
{
Sprocket.PrepareCall("sprocket_shop");
bPathfinderAfterCall$ = true;
setstate GetNextTask$;
//setstate GotoMerchant$;
return;
}
}

I was hoping to be able to adapt 'Killergremels StorageVault Mod' coding(below) to my use in adding an 'Item Count Check' to the above 'Inventory Checks'.
I dont need nor want the displayable aspects; just get a number to evaluate for an 'if>#' that duplicates the finish/escape coding.

AIQuery.TempGopColl1.Clear();

\\assumption:'pStashGoid$' replaced by 'm_Go$' and 'hero$' in above 'inventory check' codings.

pStashGoid$.Go.Inventory.ListItems( IL_MAIN, AIQuery.TempGopColl1, false );

\\ maybe using 'GetCount(?syntax?)' would be a simpler method, but I dont have the knowledge needed of DSII coding methods

int numItems$ = AIQuery.TempGopColl1.Size();
int numSubItems$ = 0;
int i$ = 0;
while( i$ < numItems$ )
{
Go item$ = AIQuery.TempGopColl1.Get( i$ ) ;
if ( item$ != NULL )
{
if ( item$.HasInventory() ) // FOR SPELL BOOKS OR MAYBE BACK-PACKS ONCE:
{
eInventoryLocation inv_loc$ = ( item$.HasGui && item$.Gui.IsSpellBook ) ? IL_ALL_SPELLS : IL_MAIN ;
AIQuery.TempGopColl2.Clear();
item$.Inventory.ListItems( inv_loc$, AIQuery.TempGopColl2, false );
numSubItems$ += AIQuery.TempGopColl2.size();
}
}
i$ += 1;
}
numItems$ += numSubItems$;

Specifically, do I need to declare any variables in the skrit header and where to place the added code to end the JOB at the start.
From my further explorations and testing I may need to add the code to GET JOB and GIVE JOB as well.
I have not "played" at coding in years/decade. Any knowledgeable commentary would be most welcome.

thank you for your time
-whomisold

Succeeded in getting the 'collect loot' to behave as I wish.
Mule can now picks-up 244 items then ignores further requests.
244 items is a safety so a spellbook containing 10 spells could be picked up without exceeding the 256 item savegame limit.
As a bonus I removed the offending code which caused single item pick-ups after the inventory page got ~65 slots filled.

Now the harder tasks of party item exchanges and etc.

Finally got UI 'command_give' to behave as I wish. 'Job_give' was just too late in the chain of events for my purposes.
I spent a few days trying to create a local or global function since the code snippet I am using is being reused in so many places. I have dropped the idea since I am not familiar enough on how to implement it. Back to the easier inline coding for me.
I now need to address the multi-inventory interaction in command_util.skrit. Objects are getting confused as to their owner(I broke it with command_give change) and causing "Multiple-Personality Disorders". I am fairly sure I can get it fixed without disabling some/all Multi-inventory on mouse feature(last ditch effort if I fail).

Seems the multiple inventory interactions/object cloning are hard coded. The do job sequencing is far to complex for me to even attempt providing safe exit/reversal coding at the soft script level.

Killergremal's enumeration messaging is probably the closest I will come to solving my dilemma. Should not be too difficult to apply the method to pets and controlled humans via header_bar which is fairly empty, since I moved the view/gear button to main_tab. This opened up space for an auxiliary spellbook expansion idea. This gave access to the View/gear button to pets for whatever good or ill may come. Not that Im interested in giving pets an equipment grid.

The tweak to the loot collection job was worth the few weeks of learning experience. Still need to move the code snippet down to where an item is identied so I can enum it and raise the limit from 244 to 255. Finally resolved all the conflicts between Zhix's Inventory mod and Arianna Legacy Alpha 3H. My custom mod now has the essential elements I want from Zhix/s Inventory mod, Killergremals Storage Vault and neccasary tweaks for Alpha3H. Abate I still need to cleanup a lot before I am satisfied.

Lots of personal tweaking will keep me busy for weeks. Already started expanding the main_tab downward for my Average Damage per Second display idea and adding space for Blocking/Dodging display. Moved specialty tab over so I can get the main_tab to display while assigning skill points.

Thanks for whatever time I utilized in your thoughts. I wont clutter the forum further with my updates as most are too tightly linked to my playing style, system configuration and KG,s Alpha3H.

a few things to note about the 255 item limit here:

firstly, the 255 item limit includes all equipped items (as well as the spells in the equipped spellbook) for PCs and hireable NPCs as well. in case u didnt know, this limit is due to the hardcoded limitation (and maybe bug?) of the way the game parses item info stored inside the savegame file.

this brings me to the second part. i did not see any check in the code u provided that checks to see if the GO performing the collect loot job is a packmule, a pet or a PC/NPC that can equip items.

this distinguishment is important as pets and packmules cant equip items, therefore it is fine to have the item pickup limit at 255 for them. however, for equipment capable PCs/NPCs u MUST set the item pickup limit at around 233. this accounts for all equippable item slots and the 10 spells in the equipped spellbook.

either that or u add the check that u made in the other post that takes into account a GO's equipped items. or else u will get the smart heap library error and/or exception detected error msg when u try to load the game or add an overloaded char from the inn.

For now the improved storage vault is providing a reliable method.
http://www.siegetheday.org/?q=node/1439#comments
Including the check in "disband" and "savegame" procedures is as safe as Large Inventories will get.