View unanswered posts | View active topics It is currently Tue Nov 21, 2017 11:12 am



Reply to topic  [ 3 posts ] 
 [Solved] Adding money/gold using Lua 
Author Message

Joined: Fri Jun 15, 2012 3:22 am
Posts: 10
Reply with quote
Post [Solved] Adding money/gold using Lua
:oops: I feel guilty making this post because I'm certain this has been asked before but this forum's search function is nothing short of satanic. I couldn't "find" anything on the LuaDocs under keywords gold, money, or cash either.

THE POST:
I intend to make an actor of some sort generate income over time. What lua script or function could I call to add gold (the currency, not nuggets) to the game? Is there a one-liner for this or would I have to create some complicated work around to add money?

Thanks!


Last edited by nomnum on Mon Dec 05, 2016 4:55 am, edited 1 time in total.



Mon Dec 05, 2016 2:32 am
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 8693
Location: Here
Reply with quote
Post Re: Adding money/gold using Lua
The functions in question should be
Code:
ActivityMan:GetActivity():GetTeamFunds(team_number)
ActivityMan:GetActivity():SetTeamFunds(gold_amount, team_number)

So you could have something like
Code:
ActivityMan:GetActivity():SetTeamFunds( ActivityMan:GetActivity():GetTeamFunds(team_number) + add_gold , team_number)


Run based on a timer or something.


Mon Dec 05, 2016 4:31 am
Profile

Joined: Fri Jun 15, 2012 3:22 am
Posts: 10
Reply with quote
Post Re: Adding money/gold using Lua
CaveCricket48 wrote:
The functions in question should be
Code:
ActivityMan:GetActivity():GetTeamFunds(team_number)
ActivityMan:GetActivity():SetTeamFunds(gold_amount, team_number)

So you could have something like
Code:
ActivityMan:GetActivity():SetTeamFunds( ActivityMan:GetActivity():GetTeamFunds(team_number) + add_gold , team_number)


Run based on a timer or something.


Ahh... I saw the setTeamFunds function and didn't even think to just redifine it with basic math :roll:
Thank you!


Mon Dec 05, 2016 4:58 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.022s | 15 Queries | GZIP : Off ]