Data Realms Fan Forums
http://forums.datarealms.com/

[Solved] Adding money/gold using Lua
http://forums.datarealms.com/viewtopic.php?f=73&t=46105
Page 1 of 1

Author:  nomnum [ Mon Dec 05, 2016 2:32 am ]
Post subject:  [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!

Author:  CaveCricket48 [ Mon Dec 05, 2016 4:31 am ]
Post subject:  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.

Author:  nomnum [ Mon Dec 05, 2016 4:58 am ]
Post subject:  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!

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/