Jump to content

adding AI packages via script


cfh85

Recommended Posts

the functions I've found all seem to edit AI packages instead of just adding them.

This is for my summon anything mod. The mod uses createfullactorcopy to create a new summon. The problem with this is that the copy doesn't have any AI packages

 

as always, any help would be much appreciated

Link to comment
Share on other sites

I love it when I ask such questions and look like a tool :wallbash: got stuck on setpackage...

 

edit. I checked this one. It says that it's removed the next time the actor reevaluates it's packages. Not sure it it's usable.

 

edit again. I didn't think about setting an impossible must complete condition. Thanks for your help

Edited by cfh85
Link to comment
Share on other sites

You could always add a script package (AddScriptPackage). For a summon that needs only the one package - to follow the player - that should work easily enough. You could add an ability to the summon that ensures the script package is re-added using GetIsCurrentPackage to check.

 

If you really need finer control, you could manually add a pre-defined script to the summon (SetScript, read article for quirks on actors and workarounds), that adds and removes script packages depending on circumstances. It could be used to make the summon follow orders or something. As a secondary use, the script could also have an empty OnActivate block to make sure the player doesn't speak to the summon and accidently advance a quest at the wrong time.

Edited by WarRatsG
Link to comment
Share on other sites

I've just released two updates in about an hour :D I think I'll try adding the empty onactivate script to the summons as you've suggested, to prevent the PC talking to the summon. However, would this stop the NPC from talking? The ideal in my mind would be if the summon just couldn't talk.

 

I've managed to get the summons to follow the PC and the package is added every time the summon is cast. I'm not interested in more complex commands. The mod includes 2 other spells, besides the custom summon. NPCsummonselect and NPCsummon. The first selects the NPC to be summoned and does nothing to them, the second just temporary moves them to the player without doing anything to them. The NPC will then behave exactly as normal, which obviously varies depending on the NPC, situation etc. I've suggested that it primarily be used to summon companions as that would give it the most functionality.

Edited by cfh85
Link to comment
Share on other sites

Be careful with the addscriptpackage, if you have the package added repeatedly, you'll end up with essential actors can't get back up and if you don't have it repeat somehow they'll go back to their old packages. I use a addscriptpackage if a certain variable is checked and theirs a certain amount of distance between you and the follower and they have some sort of check : variable,token,etc. Make sure you have an IsInCombat == 0 before the check though, or else your summons won't fight due to the packaging.
Link to comment
Share on other sites

An actor can have only one script package at a time. When calling the function twice on the same actor, the second package replaces the first one added.

Straight from the wiki. Link above.

 

The packages are also added to custom summon actors, that all have been set to non essential. Also they don't have old packages - they are created by the function that creates the bruma statue and it doesn't copy packages (but sadly it does copy factions with isn't ideal)

Link to comment
Share on other sites

I've been doing this for my latest companion mods and had some weird things happen. Just wanted to give a bit of a heads up from experience. They don't seem to mention some of the bugs that can happen on the wiki, or last time I checked anyway. Better to be safe than sorry. Edited by scarycave
Link to comment
Share on other sites

  • 5 years later...

the summon, is it created in the construction kit or in game?

 

My summon mod was for creating summons in game by cloning existing actors, which is very different from if you, the modder, has already decided on what the summon actor will be.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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