//:://///////////////////////////////////////////// //:: Example Item Event Script //:: x2_it_example //:: Copyright (c) 2003 Bioware Corp. //::////////////////////////////////////////////// /* This is an example on how to use the new default module events for NWN to have all code concerning one item in a single file. Note that this system only works, if the following events set on your module OnEquip - x2_mod_def_equ OnUnEquip - x2_mod_def_unequ OnAcquire - x2_mod_def_aqu OnUnAcqucire - x2_mod_def_unaqu OnActivate - x2_mod_def_act */ //::////////////////////////////////////////////// //:: Created By: Georg Zoeller //:: Created On: 2003-09-10 //::////////////////////////////////////////////// /************************************************* * Hijacked by Mr. Nathan for the protection * of purple worms everywhere. * * To change the DC of the swallow attack * set PW_BITE_DC to the desired level. * Default is 22. **************************************************/ #include "x2_inc_switches" #include "prc_inc_spells" const int PW_BITE_DC=22; void main() { int nEvent =GetUserDefinedItemEventNumber(); object oItem; // * This code runs when the item has the OnHitCastSpell: Unique power property // * and it hits a target(weapon) or is being hit (armor) // * Note that this event fires for non PC creatures as well. if (nEvent ==X2_ITEM_EVENT_ONHITCAST) { oItem = PRCGetSpellCastItem(); // The item casting triggering this spellscript object oSpellOrigin = OBJECT_SELF ; object oSpellTarget = PRCGetSpellTargetObject(); if(!ReflexSave(oSpellTarget, PW_BITE_DC)) { FloatingTextStringOnCreature("You have been swallowed.", oSpellTarget); DelayCommand(1.0, AssignCommand(oSpellTarget, ClearAllActions())); DelayCommand(1.1, AssignCommand(oSpellTarget, JumpToLocation(GetLocation(GetWaypointByTag("WP_PW_Stomach"))))); SetLocalObject(GetArea(GetWaypointByTag("WP_PW_Stomach")), "Worm", oSpellOrigin); SetLocalLocation(oSpellTarget, "WormReturn", GetLocation(oSpellTarget)); //This is an artifact of the respawning system I use inside the //worm's stomach. It should not be removed unless that is modified. SetLocalInt(GetArea(GetWaypointByTag("WP_PW_Stomach")), "Populated", TRUE); } } }