Jump to content

Writing a math calculation script? (simple addition to reach a sum)


Guest Messenjah

Recommended Posts

Guest Messenjah

So, I need a bit of help on my nightclub. I thought of an idea last night. Now that I'm a bit more comfortable with scripting, I would like to add a challenge to my project.

 

What I was thinking, is that instead of just having dancers, dance on the stage, maybe I could also add some kind of tip system. For instance, on various locations of the stage, you will find an invisible activator, where you can give the dancer a tip. How it works, is that when you click on it, you will get a menu that will ask you for a value. You pick what value, that you feel you can afford. Those values will then need to add up to create a larger value that will get the dancers attention.

 

The only part I'm not sure how to script is the money part and adding values. For example, you could give them 5 caps, 10 caps, or 20 caps. You give them say, a five cap tip, two twenty cap tips, and a 10 cap tip. 20+20+10+5=55cap value. How would I write a math-based script to calculate these numbers?

Link to comment
Share on other sites

I'm not the best with scripting. I would separate the Total tip and Current tip into two different variables. Then for the NPC packages, have them refer to the total tip value as a condition for that package.

 

Then whenever the player tips, the current tip is added to the total tip.

 

I can't think of any way to add variables in GECK, and if that is the case, then you could then make it easier and only have the NCP's conditions only refer to the current tip and only play the animation for a specified time.

Link to comment
Share on other sites

Guest Messenjah

Actually, I thought of an idea.....

 

 

The problem with this set up, is that I would have to not only store the values but find a way to tell the game how to add them together manually.

 

However, the game can already do this another way....

 

I could set up an activator at the stage and some sort of storage or perhaps even on each dancer's inventory. Basically, moving the value from the players inventory to the dancer's inventory. Then, use a getitemcount to check the Dancer's inventory and check the value as a condition for whatever result I want. This way, the game adds it for me without setting up a long calculation script.

 

I run my dancers on "States" where they have different AI packages that are assigned depending on what the variable assigned that that state is. During one of these states, the dancer can empty the tip money from their inventory into a bank. Perhaps this bank could be found and robbed by the player at some point. :)

 

It's funny, the last few days, I keep writing up questions but I usually figure out an answer to my own question. :) Wish I had a few more weeks to work on this before I have to give it up until Summer. (I am a college student in an IT based program, but every break I get, I continue my work on this mod.)

Link to comment
Share on other sites

  • Recently Browsing   0 members

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