McFearo Posted January 4, 2021 Share Posted January 4, 2021 Hello! I'm asking a lot of questions lately, but this is my first time writing scripts and stuff so I'm still learning a lot. I want my companion to have 2 variables to respond to how the player is acting towards him, one is called Affinity and the other is called Dickery, each respectively indicating that the player has chosen kind options or dickish options. I have the two variables set up and working fine, but I'd like him to give different greetings depending on which one is higher. It seems to me like if I set different greetings to play at different thresholds of each variable they'd conflict with each other, e.g. if he has a greeting for Affinity 3 ("{Friendly} I am here.") and a greeting for Dickery 3 ("{Annoyed} What?"), he might have trouble selecting which greeting to use if the player has been mixing it up in how they treat him and has both variables set at 3 currently. So I was thinking of writing a script so that he also has a LikesPlayer and DislikesPlayer variable that's set to binary 1 or 0, and never both at the same value at the same time, and have his dialogues check that. But the script won't save so I'm obviously doing something wrong with it when I try to add the new "if Dickery is higher, set DislikesPlayer to 1 and LikesPlayer to 0, else vice versa if Affinity is higher" It goes something like this: ; Increases as the player chooses nice options short bAffinity ; Increases as the player chooses dick options short bDickery ; True if Dickery is higher than Affinity short bDislikesPlayer ; True if Affinity is higher than Dickery short bLikesPlayer Begin GameMode if (MyFollowerQuest.bDickery >= 1 && MyFollowerQuest.bDickery > MyFollowerQuest.bAffinity) set bDislikesPlayer to 1 set bLikesPlayer to 0 elseif (MyFollowerQuest.bAffinity >= 1 && MyFollowerQuest.bAffinity > MyFollowerQuest.bDickery) set bLikesPlayer to 1 set bDislikesPlayer to 0 endif EndSome Greetings would then have conditions to check if DislikesPlayer or LikesPlayer is currently at 1. Is this overthinking it? Should I just go with the "checks for Affinity and Dickery to be at or above a certain threshold" conditions since those are working fine and it's ultimately not THAT likely for the player to get both Dickery and Affinity to the exact same level at the exact same time? Either way I'd like to know for future reference what's not working about this script since it would be a good learning exercise. Link to comment Share on other sites More sharing options...
ashtonlp101 Posted January 4, 2021 Share Posted January 4, 2021 Sometimes Short variables won't save in your script. I think it's an engine bug. So try replacing you variables with simple names like Short A Short B Short C Short D and see if that works, if it saves you just have to rename your variables. Also, using && in variable checks can spotty at times, so try to just run those variables separately, as in: If MyFollowerQuest.BDickery >= 1If MyFollowerQuest.BDickery > MyFollowerQuest.Baffinity[Result here]EndifEndif If MyFollowerQuest.BAffinity >= 1If MyFollowerQuest.BAffinity > MyfollowerQuest.BDickery[Result here]EndifEndif END That's just a personal preference of mine, it stays much better organized in my head when I go back and look at scripts as well. Link to comment Share on other sites More sharing options...
McFearo Posted January 4, 2021 Author Share Posted January 4, 2021 Sometimes Short variables won't save in your script. I think it's an engine bug. So try replacing you variables with simple names like Short A Short B Short C Short D and see if that works, if it saves you just have to rename your variables. Also, using && in variable checks can spotty at times, so try to just run those variables separately, as in: If MyFollowerQuest.BDickery >= 1If MyFollowerQuest.BDickery > MyFollowerQuest.Baffinity[Result here]EndifEndif If MyFollowerQuest.BAffinity >= 1If MyFollowerQuest.BAffinity > MyfollowerQuest.BDickery[Result here]EndifEndif END That's just a personal preference of mine, it stays much better organized in my head when I go back and look at scripts as well.Thank you for the suggestion! I'll try it like that and let you know how it worked out when I'm ready to try this script again. Link to comment Share on other sites More sharing options...
McFearo Posted January 10, 2021 Author Share Posted January 10, 2021 I finally got this to work I think. I haven't playtested it yet but the script is finally saving and should work. The problem I was having was a noob mistake, I was writing MyFollowerQuest into the script for that quest when it wasn't needed (I got used to writing myfollowerquest.baffinity and myfollowerquest.bdickery into other scripts in the game, like Vulpes' script, where it's set to trigger a raise of affinity when he's killed, and into result scripts for dialogues that are meant to trigger affinity or dickery gain). The final script that the GECK ended up accepting looks like this: ; Increases as the player is a dick to Dixie short bDickery ; Increases as the player is kind to Dixie. short bAffinity ; True depending on which is higher, Affinity or Dickery short iLikesPlayer short iDislikesPlayer Begin GameMode if (bDickery >= 1) if (bDickery > bAffinity) set iLikesPlayer to 0 set iDislikesPlayer to 1 endif endif if (bAffinity >= 1) if (bAffinity > bDickery) set iLikesPlayer to 1 set iDislikesPlayer to 0 endif endif if (bDickery == bAffinity) set iLikesPlayer to 0 set iDislikesPlayer to 0 endif EndThe reason I wanted this script is for conversations like "How are we doing?" where the player can ask the companion how he feels about them currently to check their status with him. Rather than having to set a bunch of different dialogues with different conditions for different Dickery or Affinity thresholds, I can just give him dialogues that check for if he likes the player or not, based on which is currently higher, the Dickery of Affinity variable. Looks like at this point it should work but I'll have to test it out. Link to comment Share on other sites More sharing options...
Recommended Posts