Creating an Intelligent Item

The talking sword Enserric was scripted with community builders in mind so it shouldnt be too difficult to include an intelligent item in your module.


1) Create the item, don't forget when you add properties to the item that in order to talk to it you will need to add the 'Cast Spell: Talk To' property with unlimited uses per day. Also, if you want it to speak during combat etc you will need to add the 'On Hit Cast Spell: Intelligent Weapon (Level 1)' property. (Note: the Level of the Intelligent Weapon has no effect at the moment.) Make a note of the Tag of the new item.


2) In the standard placeable objects list find the 'Enserric the sword' invisible object under the 'Secret Object' heading. Edit a copy of the item giving it a new name and portrait. Set the blueprint ResRef of the placeable to be the same as the Tag of the Item you created.


3) Open Enserrics dialog file, x2_iw_enserric, in the conversation editor and save it in a new file called whatever Tag you gave the new item.


4) Remove all of Enserrics story related Dialog so that only the battlecries and one liners are left in the dialog tree. Add any conversation you want the item to have and don't forget to leave at least one line without a script in the 'Text Appears When...' box so that people can always talk to the sword.


5) Open the file x2_inc_intweapon, you will need the 'All Resources' button checked when you look through the list of resources. Then go through the file to the IWStartIntelligentWeaponConversation function and change the code as follows:


object oCreate = CreateObject(OBJECT_TYPE_PLACEABLE,"x2_plc_intwp",GetLocation(OBJECT_SELF));
//becomes
object oCreate = CreateObject(OBJECT_TYPE_PLACEABLE,GetTag(oWeapon),GetLocation(OBJECT_SELF));

Save it, without compiling it.


6) Open x2_s3_intitemtlk, put a single space anywhere in the file, and then delete it again. This will signal to the toolset that this file needs to be recompiled. Save the file.


7) Repeat all of the above steps from 1 to 4 if you want to add another item.


8) Start testing, it should pretty much work at this point.





 author: Georg Zoeller, editor: Grimlar, additional contributor(s): EgoAnt, Ghost Rider