Jump to content

Scripting Question


tnu

Recommended Posts

It looks like it's not a script, but his AI. Until you finish his quest, the highest-priority package he has is a "sleep" package. If you wanted to replicate the effect for a spell/power, I would imagine it would go something like...

 

ScriptEffectUpdate

if (GetIsCurrentPackage MySleepPackage == 0)
 AddScriptPackage MySleepPackage
endif

 

ScriptEffectFinish

if (GetIsCurrentPackage MySleepPackage)
 RemoveScriptPackage
endif

 

...With MySleepPackage being a Sleep AI Package with no fallout behavior and a wide-radius "location" at the actor's current location.

Link to comment
Share on other sites

If you were making a new NPC, you would do that by giving them only one AI package; the sleep AI Package. If you wanted it to be permanent and use it for a power, you might remove the ScriptEffectFinish bit from whatever effect you wanted to... Affect them.

 

It might help if you opened up an actor in the CS and looked under "AI". All of their "Standard" behavior, reading, eating, traveling, following, waiting, wandering, sleeping, etc, is done through AI packages done at certain times, under certain conditions. There's no way to make an NPC eat without them having an "Eat" AI Package, there's no way to make one sleep without a "Sleep" AI Package, etc. If multiple AI Packages on a single actor have their conditions met, the one highest up is run. The scripting function AddScriptPackage is a method of getting an actor to use an AI Package that isn't in their AI list, but it will be removed next time they evaluate their AI Packages unless they have a "Must Complete" tag or somesuch.

 

Try opening up an AI Package in the CS. The Package Type in the upper-right corner determines what, broadly, that package makes its subject do. The flags involve various "Supplementary" behavior, such as always running or keeping their weapon out, that NPCs using that package will do as well.

 

The "Conditions" tab determines what has to be the case for an actor with that AI Package to run it. An example would be an NPC wandering around in a shop, with the condition "GetItemCount Gold001 > 10". The NPC would only look around the shop if he had more than 10 gold on him. If it doesn't have any conditions, the NPC will always run it if there's nothing more high-priority that has its conditions met.

 

The "Location" and "Target" tabs depend more on the AI Package in question. A "Sleep" AI Package can't take a target, and the location is optional, governing in what area the actor will take a bed. For example, if the location is a specific "Bedroom" cell, the actor will only sleep in a bed in said bedroom as opposed to grabbing the unowned bedroll right beside him (He was outside). An NPC running an "Eat" AI Package with the location set to "Near Current Location" and a radius of 1000 will take and snack on any food within 1000 units of his current position. If his Responsibility is low enough, even if it's owned by someone else.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...