Jump to content

Require math script for half earnings


Recommended Posts

OK, so basically what I want is this. Character is a prostitute, agrees to give 50% of earnings for to her pimp. She charges 7, 5 and 3 respectively for anal, vaginal and oral.

 

At end of day, she reports to pimp, and gives half of whatever she earned that day. The problem is, the player may already have money/caps/credits in his/her inventory before starting, so I can't just do a simple 1/2 of money/caps/credits formula.

 

Anyone have any idea what I can do here, script wise? Some sort of variable after each trick, or a formula at the end of day dialogue?

 

Any help would be greatly appreciated.

 

CK

Link to comment

1. Create a variable for each sex type

2. Increase the variable every time the player does the respective sex type via dialogue script

3. Run a quick math equation when talking to the pimp ((7X+5Y+3Z)/2), also via dialogue script

4. Remove the result of that equation from the player's inventory

5. Realize half of the time that equation is going to end in .5 because the player is charging odd numbers

Link to comment

Thanks Zippy, concise and to the point as ever. I'm obviously going to change the earnings to even numbers to avoid the .5 scenarios! :P

 

But how exactly would the equation go in the dialogue option?

 

So far, I've encountered stuff like this before:

 

short wage
   set wage to ((player.getAV Charisma * SexoutWorkingGirl.ProstitutionLevel) + (Player.getAV Barter / 8))
   player.additem Caps001 wage
   set SexoutWorkingGirl.tricks to SexoutWorkingGirl.tricks + 1

 

So I'm guessing I'll have to fiddle somewhat with short and int, but what exactly would I have to add to the script, and how would the actual script in the dialogue look, especially the "remove the result of that equation" bit?

 

Thanks again! ;)

Link to comment

Well, first thing is don't ever use a local variable in dialogue scripts. That's what was causing issues with Willow a while back; the engine doesn't handle it properly, and if the NPC you're talking to has a script on them with variables, the local variables you declare in the dialogue overwrite the variables in their script. Chaos ensues. Just toss the variable as a temp thing into a quest and do this:

set quest.total to (((quest.a * 7) + (quest.v * 5) + (quest.o * 3)) / 2)
player.RemoveItem Caps001 quest.total

If the dialogue script doesn't like the something.something for whatever reason, put this in the dialogue instead:

set quest.doThis to 1

and this in the quest script

if doThis == 1
set total to ((quest.a * 7) + (quest.v * 5) + (quest.o * 3) / 2)
player.RemoveItem Caps001 total
set doThis to 0
endif

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use