| Author: | Adam |
| Author Website: | http://www.mudsolutions.com/~adam/nwn/index.html |
| Script Name: | EQ-Style Lore Items |
| Description: | This script prevents a player from possessing more than 1 of any item with a tag of "LORE_xxxx". The "LORE" part of the tag is not case sensitive and the "xxxx" part is replaced with any name of your choosing. |
| Instructions on Use: | Place the first script into the Module event: OnAcquireItem, place the second script into the Module event: OnUnAcquireItem. In order to make an item lore, simply change the tag of the item by adding "LORE_" at the beginning (this is not case sensitive, so don't worry). |
Script 1 (OnAquireItem):
| void main() { object oItem = GetModuleItemAcquired(); object oPlayer = GetItemPossessor( oItem ); // determine if item acquired is lore string sItemTag = GetTag( oItem ); // if item is lore, check the player to see if they have the item already if( GetStringLowerCase( GetStringLeft( sItemTag, 5 ) ) == "lore_" ) { int bHasItem = GetLocalInt( oPlayer, "bHas_" + sItemTag ); // if they don't have it, set the variable if ( bHasItem == 0 ) { SetLocalInt( oPlayer, "bHas_" + sItemTag, 1 ); // otherwise, get rid of the second item } else { AssignCommand( oPlayer, ActionPutDownItem( oItem ) ); SendMessageToPC( oPlayer, "Lore Item ( " + GetName( oItem ) + " ) duplicated." ); } } } |
Script 2 (OnUnAcquireItem):
| void main() { object oItem = GetModuleItemLost(); object oPlayer = GetModuleItemAcquiredFrom(); // determine if item acquired is lore string sItemTag = GetTag( oItem ); // if item is lore, check the player to see if they have the item already if( GetStringLowerCase( GetStringLeft( sItemTag, 5 ) ) == "lore_" ) { SetLocalInt( oPlayer, "bHas_" + sItemTag, 0 ); } } |