====== Genies--Helper AI ====== :!: //This tutorial requires a custom gamesys.// It is commonly known that AI Conversations are a very powerful tool, capable of doing some things that cannot be done any other way (without custom scripting), such as adding links ingame, etc. When a mission requires the power of the conversation, it has become customary to create a never [[Dromed:Property:AI_Efficiency|efficient]] AI (I usually name it ''Conv'') in a blue room, ready to be called upon at any moment at which it might be needed. There are, however, two flaws with this system: The first is that the AI uses a significant amount of system resources, as the AI needs to have its $$AI->AI Core->[[Dromed:Property:AI_Efficiency|Efficiency Settings]]$$ disabled (otherwise it would only be able to enact conversations when the player was nearby). One AI which is always active is not such a major issue, but in some cases it might be necessary to have multiple conversation-AIs (see below), and with each additional AI the slowdown becomes more significant. The second problem is that in some cases, the AI's conversations might be triggered by the player's actions, which can be unpredictable at best. An example of how this could cause problems is required: First, imagine that the player has a whistle in his inventory, that, when frobbed, triggers a conversation that adds a [[DromEd:Link:ControlDevice]] link from a lever to a door, waits 5000ms, and then removes the link again. Next, imagine that the player is also carrying another item, such as a small chest, and that when this item is opened (frobbed in inventory), two items are added to the player's inventory (by adding ''[[Dromed:Link:Contains]]'' links from the ''Player'' to them via a conversation). Now consider what happens when the player blows the whistle, and then opens the small chest immediately afterwards. The ''[[Dromed:Link:ControlDevice]]'' link is added, the AI starts its 5000ms wait, but is then given a new order (to add the ''[[Dromed:Link:Contains]]'' links), the original conversation is cancelled, and the ''[[Dromed:Link:ControlDevice]]'' link is never removed. Of course, there are other ways of getting around that particular problem, but it makes the point quite clearly. The best way to solve both of these problems is to utilise a 'Genie' AI that is summoned to perform a specific task, and then banished again. To create such a genie, navigate to ''Fnord (-130)'' in the object hierarchy, and create a new archetype named ''Genie''. Configure the properties as follows: * $$AI->AI Core->[[Dromed:Property:AI]]$$ = ``Default`` * $$AI->AI Core>[[Dromed:Property::AI_Team|Team]]$$ = ``Neutral`` * $$AI->AI Core->[[Dromed:Property:AI_Efficiency|Efficiency Settings]]$$ = ``Enabled = False`` * $$AI->AI Core->[[Dromed:Property:AI_AlertCap|Alertness Cap]]$$ = All set to ``(3) High`` * $$AI->Attributes->[[Dromed:Property:AI_Hearing|Hearing]]$$ = ``Null`` * $$AI->Attributes->[[Dromed:Property:AI_Vision|Vision]]$$ = ``Null`` * $$AI->Ability Settings->[[Dromed:Property:AI_InfRsp|Inform: Response Options]]$$ = ``Ignore informs = True`` * $$AI->Ability Settings->[[Dromed:Property:AI_InvKnd|Investigation: Style]]$$ = ``Don't Investigate`` * $$Shape->[[Dromed:Property:ModelName|Model Name]]$$ = ``WayPt`` And now, for the most important property: $$AI->Responses->[[Dromed:Property:AI_AlrtRsp|Alert Response]]$$. For the main ''Genie'' archetype, just set the ??Alert Level?? to ``(3) High``, and the ??Priority?? to ``Absolute`` (not ``Very High``!). Since the Genie's alertness is capped at level ``(3) High``, these responses will always be carried out as soon as it is created. Leave everything else blank for the moment. You also need to make sure that the genie is 'banished' again, so add $$Tweq->[[Dromed:Property:CfgTweqDelete|Delete]]$$, enter ``5000`` into the ??Rate?? field, and add the ``Sim`` flag to ??AnimC??. ??Halt?? should read ``Destroy Object``. Also add $$Tweq->[[Dromed:Property:StTweqDelete|DeleteState]]$$ and set the ??AnimC?? to ``On``. Now, instead of creating a conversation linked to permanent conversation-AI, simply create a new archetype under ''Genie'' and add the pseudo-script steps directly to its $$[[Dromed:Property:AI_AlrtRsp|Alert Response]]$$ property. Instead of triggering the conversation, create the appropriate Genie, either by emitting it from an ''EmitterTrap'', or directly through the ''[[Dromed:Receptron:Create Object]]'' receptron. To make things easier to follow, all Genie archetypes should be given names beginning with ''G-'', for example ''G-SmallBox1''. Remeber that the archetype name must be 15 characters or less if you want to emit it from an ''EmitterTrap''. No bottles required.