Summon Creature AI Problems

Post » Wed Jun 20, 2012 1:10 pm

Hello Everyone,

I created a spell that summons a wolf NPC with a specific AI package that allows him to do only one thing and ignore all combat. If I place him in the game world, he follows the instructions. If I create a script using PlaceActorAtMe() that spawns him and attach that to a MGEF and subsequently attach that to a spell and cast it, he follows the instructions. If I create a magic effect of type 'Summon Creature' and then cast it, the 'Summon Creature' spell seems to override his AI packages and applies some default "Summoned Creature" AI package that is not visible in the editor because it isn't present until run-time.

This is problematic for a few reasons:

1) PlaceActorAtMe doesn't always put the ref in FRONT of the player. I use a RegisterForSingleLOSLostUpdate() function on the actor as soon as he spawns, so this immediately triggers the scripted OnLOSLost() event if he spawns just outside of the player's view, which KILLS HIM.

2) The utility of the spell relies on the AI package assigned to the Actor.

Can anyone point me in the right direction or provide some guidance on how I could handle this problem? I spent a good three hours working on the LOS issue alone last night and learning the CK and Papyrus is frustrating enough as it is.
User avatar
Claire Jackson
 
Posts: 3422
Joined: Thu Jul 20, 2006 11:38 pm

Post » Wed Jun 20, 2012 5:17 am

This is most likely also the reason why horses you spawn by a standart summon creature spell can't be ridden.
User avatar
Harry-James Payne
 
Posts: 3464
Joined: Wed May 09, 2007 6:58 am

Post » Wed Jun 20, 2012 5:34 am

Bump for great justice. Anyone have any ideas that might help?
User avatar
lisa nuttall
 
Posts: 3277
Joined: Tue Jun 20, 2006 1:33 pm

Post » Wed Jun 20, 2012 1:02 pm

make the spell a "Scripting" type instead and just place an Xmarker and PlaceAtMe?
User avatar
Hearts
 
Posts: 3306
Joined: Sat Oct 20, 2007 1:26 am

Post » Wed Jun 20, 2012 3:05 am

It is a scripting type spell in it's current form, the problem is that PlaceActorAtMe doesn't place the actor in front of me 100% of the time. I guess I'll have to use the projectile/explosion/object drop method to ensure he spawns somewhere the player can see him.
User avatar
Nauty
 
Posts: 3410
Joined: Wed Jan 24, 2007 6:58 pm

Post » Wed Jun 20, 2012 4:09 am

What about if you wanted to do it the opposite?

Have the NPC go out of sight of the player and vanish?
User avatar
Ann Church
 
Posts: 3450
Joined: Sat Jul 29, 2006 7:41 pm

Post » Wed Jun 20, 2012 3:54 am

If I create a magic effect of type 'Summon Creature' and then cast it, the 'Summon Creature' spell seems to override his AI packages and applies some default "Summoned Creature" AI package that is not visible in the editor because it isn't present until run-time.

Yes. If you look up some of the topics I've started recently, you'd see that I've been frustrated by similar limitations. The Summon/Reanimate archetypes are FUBAR!

You should be able to script around your OnLOSLost problem though.
Add a bool variable that initializes to false and conditionalize your OnLosLost code with a check of the bool variable (i.e. "if variable")
the PlaceActorAtMe function returns the ID of the placed actor so set an Actor variable to that ("Actor placedActor = PlaceActorAtMe(whatevs)")
You can then do some math to figure out where "in front of the player" is and use MoveTo on your new Actor variable to move it in front of the player.
Then just set your bool variable to true so that your OnLosLost works.

My trig is a little rusty so I'm afraid I can't help with the math, but hopefully its not too hard.
User avatar
Sxc-Mary
 
Posts: 3536
Joined: Wed Aug 23, 2006 12:53 pm

Post » Wed Jun 20, 2012 5:44 pm

IMO Redwood Elf's suggestion really would be the most solid since you could move the marker directly in front of you. Scotty's method would work as well but it feels like a hack. No offense, Scotty. I hack often myself. :)

Another possible solution would be to simply unregister your LoS code for a minute while you force the actor to be in front of you:
UnregisterForLOS(refPlayer, refWolf)refWolf.MoveTo(refPlayer, 80 * Math.Sin(refPlayer.GetAngleZ()), 80 * Math.Cos(refPlayer.GetAngleZ()), refPlayer.GetHeight())Wait(0.2)RegisterForSingleLOSLost(refPlayer, refWolf)

Not sure what you're trying to accomplish but I've had trouble with LOSLost before. I had to switch to using http://www.creationkit.com/ObjectReference.GetDistance_%28Papyrus%29 on the actor when I wanted them to leash.
User avatar
Carlos Rojas
 
Posts: 3391
Joined: Thu Aug 16, 2007 11:19 am

Post » Wed Jun 20, 2012 4:12 pm

IMO Redwood Elf's suggestion really would be the most solid since you could move the marker directly in front of you. Scotty's method would work as well but it feels like a hack. No offense, Scotty. I hack often myself. :smile:

Another possible solution would be to simply unregister your LoS code for a minute while you force the actor to be in front of you:
UnregisterForLOS(refPlayer, refWolf)refWolf.MoveTo(refPlayer, 80 * Math.Sin(refPlayer.GetAngleZ()), 80 * Math.Cos(refPlayer.GetAngleZ()), refPlayer.GetHeight())Wait(0.2)RegisterForSingleLOSLost(refPlayer, refWolf)
This ^ = exactly what I was going for, just written better and with intact mathness ;P
I always forget about the UnregisterForX's
User avatar
Steve Smith
 
Posts: 3540
Joined: Sat Jun 30, 2007 10:47 am


Return to V - Skyrim