Jump to content

I want to add an NPC to a faction through dialogue...


chajapa

Recommended Posts

Posted

If I create a mod, and in that mod I create a faction.... let's say... MyTestFaction...

 

and then in dialogue leading up to it, can I simply add a script fragment like this?:

 

akActor.AddToFaction(MyTestFaction)

 

 

... and that's it? I'm trying to add the NPC to whom I am speaking to a faction I would create beforehand. Just trying to determine if I've got the correct syntax and if that's all I need to do.

 

thanks

 

Posted

Yes chajapa, your code is right.

 

If the Actor is the one that is speaking usually the variable is called akSpeaker.

akActor is common in fragments for packages, while dialog fragments use akSpeaker.

 

if you want to change also the rank of the actor for the faction you can use

akActor.SetFactionRank(MyTestFaction, 3)

where "3" is the rank you want

 

Be sure to add to the fragment (or the script) a property like

Faction Property MyTestFaction Auto

 

 

Posted

Thank you!

 

So I will need to add the property line:

Faction Property MyTestFaction Auto 

 

to the script fragment, and then go into Edit Properties of the script and set the property value?

 

And have:

 

akActor.AddToFaction(MyTestFaction) in the script fragment window of the dialogue.

 

correct?

 

Posted

Mh, almost.

 

First, important point: dialogue fragments use akSpeaker, NOT akActor.

Are you writing a dialog script fragment or what?

 

Second: yep, you are right. Edit the script, go to the very bottom and add the line to make a possible reference to your faction.

Save, and then go in the properties and click on auto-fill.

Of course "auto fill" will work only if you use exactly the name of your faction.

 

You can add your property also in the user interface if you like. I don't like doing it like this, way faster editing the code in Notepad++ and then compiling it in CK.

Posted

I am writing a dialogue.

 

My character is speaking to an NPC.

 

My character will say something like... "Do you want to join my club?)

NPC responds with "yes" (because I won't give them a choice" 

 

and script fragment should add them to MyTestFaction

 

so... are you telling me that the NPC I'm speaking to is akSpeaker?

 

EDIT:

Ahhh... yes I just looked at a script fragment and I see...... so I'll add akSpeaker to the faction

 

 

Posted

Yep.

 

The actual player has no references set. The "player words" are never scripted nor they are controllable.

You can add script, conditions, and so on only on the responses the NPC will do.

So in the script the akSpeaker is always the NPC that is giving the answer. 

(remarkable exception is when the player AI is controller and the player is involved in a scene, in this case akActor inside a package points to the player)

 

If you need to add the faction to the player do explicitly

 

Actor Property playerRef Auto

PlayerRef.AddToFaction(yourFaction)

 

Posted

Hmmmmm.... hadn't thought about adding my player to the faction. I would need to do it only once. 

I think I can make a dialogue to add the player and it would only show if the player is not already in that faction. 

I'm not sure at this point if I will NEED the player to be in the faction, but it might be a good idea.

 

 

Archived

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

  • Recently Browsing   0 members

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