Jump to content

Ways to set companion affinity via dialogue script or other trigger?


NikaCola

Recommended Posts

So, I've gotten affinity to work when doing things like taking drugs, swimming (lol) and etc. But I'm trying to figure out a way to do it where a dialogue fragment or some other script can set affinity levels as well. Has anyone done that before? I've tried googling and the creation kit wiki but couldn't find anything. Thank you for any help! =)

Link to comment
Share on other sites

I maybe wrong as I haven't done that before, but still will try to help. If you know the needed functions from the script which is attached to CompanionAffinity(That's the correct name as I remember) quest, you can call any function from that script by creating a property of that script in another one. Property should look like this (Name may be different)

CompanionAffinityScript property CompAff Auto Const Mandatory

function somefunction()
CompAff.someCompanionFunction() ;this should be the vanilla function from CompanionAffinity script which controls affinity change for specific companion
endfunction
Edited by shavkacagarikia
Link to comment
Share on other sites

This is how I do it and I feel like it's a nice and clean way. Simply go to your affinityquest (hope you made your own instead of editing vanilla quest).

 

Then, make stage for each one (dislike, like etc) and put your quest "allow repeated stages".

 

Then, in the stages, for example stage 50 "likes".

 

Fragment in that stage is: first fill kmyQuest with xxxCompanionBaseGameAffinityEventScript or whatever is the script name in your quest.

 

Then just simply put code in the fragment: kmyQuest.CompanionName_Likes() <-- no need properties, you just call the function from your script attached to your affinity quest.

 

Then, when you want to make likes event(in another quest or script or whatever), you fill a property with your quest and do: MyAffinityQuest.SetStage(50) and you see "cxxx liked that".

 

Clean and easy, I think. Well, atleast thats how I do it :D

 

Edit: Problem with this way is, there is no cooldown, so it can be abused easily, unless you put if statement and make some kind of timer script too. Or maybe you can make simple variable where you called this event like:


int didwedoit

if(didwedoit==0)
MyAffinityQuest.SetStage(50)
didwedoit = 1
endif

So people can't just exit dialogue over and over again and trigger this. Or, like people said before, call the "real" function from followersscript and it has cooldown built to it I think. Affinity events for quests don't have cooldown, they trigger by event which only fires once anyway.

 

Edit: Seems like this is global function anyway FollowersScript.SendAffinityEvent(akSender, CA_Event_xxxx)

 

For example: FollowersScript.SendAffinityEvent(self, CA_Event_HackComputer) <-- this way it has natural cooldown and you can call it from anywhere, just need property for ca_event

What to put as akSender and when, I have no idea.

Edited by vkz89q
Link to comment
Share on other sites

  • Recently Browsing   0 members

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