Hey all this is just an addon i made to go with my currentcash script, in other words it requires it to work
, Basically cash is still collected the same it just changes what the player see's, so in the background you could have the players cash balance at 10,546 but the player would see this as 1 gold 5 silver and 46 copper. So this gives the impression of 100 copper = 1 silver, 100 silver = 1 gold. Anyway pretty basic but here it is:
-- LUA Script - precede every function and global member with lowercase name of script + '_main'
-- Displays Cash as Gold Silver an Copper
function golddisplay_main(e)
PlayerDX = g_Entity[e]['x'] - g_PlayerPosX;
PlayerDY = g_Entity[e]['y'] - g_PlayerPosY;
PlayerDZ = g_Entity[e]['z'] - g_PlayerPosZ;
PlayerDist = math.sqrt(math.abs(PlayerDX*PlayerDX)+math.abs(PlayerDY*PlayerDY)+math.abs(PlayerDZ*PlayerDZ));
-- The Math for changing cash to gold, silver and copper
gold = math.floor(currentcash * 0.0001);
silver = math.floor(currentcash * 0.01);
copper = currentcash - ((gold * 10000) + (silver * 100));
-- displays said currency when player gets close enough
if PlayerDist < 80 then
Prompt("Gold =" .. gold .. " Silver =" .. silver .." Copper =" .. copper);
end
end
remember to name this one golddisplay.lua
this script does not require any variables to be added to global.lua as long as you're have the global script from my other thread with the cash scripts it should work straight away.
Note, the reason i have made these variables local is that they are just to make veiwing the money held a bit better, when buying things you can display the price in gold but you would script it to minus the amount in basic cash so if something was to cost 10 silver you would put currentcash = currentcash - 1000