Jump to content

Conditions in AI Packages?


NexBeth

Recommended Posts

Admitedly, I know next to nothing about using conditions.

 

Is there a way to use a condition to equip an item on NPC at the start of an AI Package? I'm assuming it would be GetEquipped. I've played around some with it but can't get it to work.

 

Thanks for any help.

Link to comment
Share on other sites

ive not done much with packages myself just basic bits and pieces. BUT I can recommend going on youtube if you can and search for darkfox127. he has a tutorial on packages and would explain a lot more for you. If he don't explain exactly what your after he would give you more details and you maybe able to figure it out from that. I do know there is a way to have an npc training on a training dummy or archery target by using packages, ive done this myself, but I'm not sure how to go about it as I googled it and found a little tutorial on how to do it. But I digress, as I say darkfox127's tutorials are really good, he don't tell you stuff you don't need to know but covers everything you do need to know, I find his tutorials the best out there, but if you cant get the info you need there I would suggest maybe searching for packages tutorials. I hope you have luck in finding what you need, Happy modding

Link to comment
Share on other sites

Thanks, OMB. Not sure how to even do that but at least I won't chase a wild goose. Looking at a tutorial I ran across, was able to get NPCs to go inside when it rains using Conditions on AI packages, so, I was hoping to also equip an item.

Link to comment
Share on other sites

Packages are a bit limited in the kinds of things you can do 'out of the box', which is why they have a place for adding extra scripting.

 

Try this:

 

(1) in the OnBegin of your package, just type a semicolon, click 'compile' and close the package. This will cause a dummy papyrus script to be attached to the package.

(2) Re-open the package and you will see it now has a script attached. It will probably have a name starting with PF. Right click and that and open its properties.

(3) Add an armor or weapon property (as appropriate), give it name that makes sense to you and assign its value to be the item you want to be equipped.

(4) Suppose you called your property 'ThingToEquip'. In the OnBegin space, where you had the semicolon, hit edit. Remove the semicolon and put in the line

akActor.EquipItem(ThingToEquip)

(5) Hit compile again and save the package.

 

Link to comment
Share on other sites

OldMansBeard, I was able to get that script fragment into my package with your help, but the item does not come off after the end of the package (unless, apparently, the npc changes to another cell)? I'm assuming that the On End section of the Package needs to be similarly done with an UnEquipitem function, creating another script?

 

Also, is there a way to do this with a generic script attachment so I can use only one script and use it in more than one package? I'm assuming not since there doesn't seem to be an "add" button to the Begin/End/Change tap area.

 

I do not know how to script at all so please forgive my very basic questions.

Link to comment
Share on other sites

Ah, yes, you didn't say you wanted to remove it again but you have the right idea. Except put it in the OnChange, not the OnEnd. The OnChange is for when the actor changes to a different package, which is what you want. The OnEnd is less useful.

 

When you do that, it won't actually generate a new script; it will add it as an extra function in the script you have already made. This is handy because you already have the item set up as a property so you can just refer to it again in the Unequip().

 

It is possible to re-use the same package fragment script in multiple packages but you can't do it in the CK. If you duplicate the finished package, it will generate a duplicate script and you can't tell it not to be so silly :D

Link to comment
Share on other sites

If you duplicate the finished package, it will generate a duplicate script and you can't tell it not to be so silly :D

And that actually does make sense to me.... :teehee: Thanks again.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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