Reigor Posted April 11, 2013 Posted April 11, 2013 Hello folks, I'm trying my hand at scripting again and have run into a problem that's been driving me batty for the last 3 days. While trying out sexout hookups I noticed that my girl wasn't being paid for whoring. I looked at the mod in Geck and noticed it used result scripts in the dialogue topics "HUAFemaleCashOnly" by adding weightless armor tokens to the npc as a marker for caps. For example additem.SexoutHUACaps 4 1 Its then followed up when the sexing begins by this result script. int iCount set iCount to GetItemCount SexoutHUACaps if iCount > 0 Removeitem Caps001 iCount 1 PlayerRef.AddItem Caps001 iCount 0 endif Removeitem SexoutHUACaps 9999 1 This should add caps to the player equal to the amount of HUAcaps the npc was given by the previous script then remove the HUAcaps tokens from the npc. Only it doesn't happen, at least there is not pay out to the player. So I decided to experiment, using Sexoutsex which hookups seemed to be based on, adding a new whoring topic with this result script. int whorepay set whorepay to player.getactorvalue charisma ((I've also tried barter)) set whorepay to whorepay*5 player.additem Caps001 whorepay This doesn't work either. The only time I've had any success in the result script is by not using a variable at all and just... player.additem caps001 20 Which pays out 20 caps at the completion of the dialogue. So THAT works but neither the sexout hookup method nor the simpler method I devised work. So what's wrong?
BruceWayne Posted April 11, 2013 Posted April 11, 2013 You are overwriting your "whorepay" variable right after setting it. Why don't you just "set whorepay to ((player.getactorvalue charisma)*5)" right away, instead of having two lines. Also, you might want to consider putting the variable inside of a quest script and set/reset it in the result scripts. As soon as the result script has run its course, it "forgets" that it was declared and might result in weirdness or nothing happening at all. My advice would be: set the flexible amount in the begin block, if only one topic, and clear out the variable in the result script of the callback dialogue or whenever the transaction is completed, if you want different results for different characters/values.
Reigor Posted April 12, 2013 Author Posted April 12, 2013 Thanks Bruce for the response My first attempt did just have one line like "set whorepay to player.getav barter" so I guess its just the result script wonkiness with variables. I'll try next to do as you suggested and declare the variables in a separate quest script and see if that works. EDIT: I declared the variable integer (in this case iWhorePay) in the SexoutHUAS quest script and referenced it in the result window by using it this manner that links it back the quest script. set SexoutHUAS.iWhorePay to GetItemCount SexoutHUACaps and it worked! Hurray! Thanks again!
zippy57 Posted April 18, 2013 Posted April 18, 2013 For future reference, it's best to avoid declaring temp variables in a dialogue script. Due to an engine oddity, if the Subject NPC has a script with variables on it, the variables declared in the dialogue script will overwrite them.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.