scripting npc ai

Post » Thu Jun 21, 2012 10:14 am

need help scripting some ai for a quest.

ok i have the quest all set up and finished, but when i turn in the quest to the npc i want the npc to start attacking me(after the quest is completed to avoid quest errors,and because he secretly didnt want me to sucseed).

i figured it would be an event for the actor but "on" what?
how do i reffrense the completion of a quest.
how do you change him from friend to foe on completion of quest.
User avatar
Trish
 
Posts: 3332
Joined: Fri Feb 23, 2007 9:00 am

Post » Thu Jun 21, 2012 10:46 am

http://www.creationkit.com/StartCombat_-_Actor

It would probably be easiest to start a new "mini-quest" ... with a blank log entry and no objectives (called, PlayerFightNPC, or something)

Put the Player and the NPC as Aliases of that new quest
  • Put the "attack script" (StartCombat) on the NPC alias (in the new quest)
  • Put a function http://www.creationkit.com/OnDeath_-_Actor - To Complete the mini-quest when the NPC dies - on the NPC Alias

When you tag your Quest as Complete, the drop down box next to the check-box lets you select another Quest to start (select the new mini-quest)



Note that the functions linked are for Actor, so you will have to cast from an Alias, first, if you do it this way
User avatar
Emma Parkinson
 
Posts: 3401
Joined: Wed Jul 26, 2006 5:53 pm

Post » Thu Jun 21, 2012 5:03 am

awsome! thank you soo much! will add today if i can.
User avatar
phil walsh
 
Posts: 3317
Joined: Wed May 16, 2007 8:46 pm

Post » Thu Jun 21, 2012 12:40 pm

i did what was in the description but when i made the script for the alias in the edit refrense alias screen it keept giving me failures to compile.




StartCombat(Game.GetPlayer())
this is what i used and this

Darunnkin.StartCombat(Player)
none of these worked am i missing something

User avatar
Valerie Marie
 
Posts: 3451
Joined: Wed Aug 15, 2007 10:29 am

Post » Thu Jun 21, 2012 2:01 pm

Exactly how you do it depends on whether or not you are using Aliases in your Quest (you should be, so I'll assume that you are):

.StartCombat()


1. Make myNPCAlias a Reference Alias (set to unique actor of the NPC)
2. My myPlayerAlias a Reference Alias (set to unique actor of Player)
3. ALSO, make BOTH of the above Properties of your script ... Use exactly the same names as the aliases (then they will auto fill)

then
Actor myNPCActor = myNPCAlias.GetActorRef()Actor myPlayerActor = myPlayerAlias.GetActorRef()myNPCActor.StartCombat(myPlayerAliasActor)
User avatar
Natalie Taylor
 
Posts: 3301
Joined: Mon Sep 11, 2006 7:54 pm


Return to V - Skyrim