////////////////////////////////////////////////////////////////////////////// // // File : equip_armor_limit.skrit // Author(s): Witness (Lisa Hui) // Purpose : checks the armor type of the item in the specified slot and // kicks itself, the item in the slot or both into inventory // Version : v2.0 [October 30, 2004] // - total rewrite to use k_inc_limit, which is used to centralize // equip limit handling with job_get and job_equip // // v1.0 [August 6, 2004] // - experimenting with different calls to kick equipped item to // inventory // //---------------------------------------------------------------------------- // Version: 2.0 Date: October 30, 2004 //---------------------------------------------------------------------------- ////////////////////////////////////////////////////////////////////////////// property eEquipSlot slot$ = ES_CHEST doc = "equip slot to check for matching armor type"; property string match$ = "" doc = "list of armor types to match against"; owner = GoSkritComponent; #include "k_inc_limit" Goid user$, item$; startup State Begin$ { trigger OnGoHandleMessage$( WE_EQUIPPED ) { if ( owner.Go.Parent == NULL ) { return; } user$ = owner.Go.Parent.Goid; AddArmorLimit$( user$, slot$, match$ ); //report.screen("equip_limit - checking limits..."); Go equipped$ = user$.Go.Inventory.GetEquipped( slot$ ); if ( !IsArmorAllowed$( user$, equipped$.Goid ) ) { //report.screen("equip_limit - armor is NOT ALLOWED"); user$.Go.Inventory.RSRemove( owner.Go, true ); owner.Go.Aspect.SSetIsVisible( false ); this.CreateTimer( 1, 0.1 ); } //else { // report.screen("equip_limit - armor is allowed"); //} } trigger OnTimer$( 1 ) { user$.Go.Inventory.RSAdd( owner.Go, IL_MAIN, AO_HUMAN, true ); } trigger OnGoHandleMessage$( WE_UNEQUIPPED ) { RemoveArmorLimit$( user$, slot$, match$ ); } }