Hey Mmowned
I'm a bit stuck working on a lua script. I'm attempting to make a gossip script that trades reputation for an amount of rep tokens (the player can fill in the amount they want to trade in a code box). I'm kinda stuck however, as I was only able to find SetStanding(faction, amount) in the lua engine core to change reputation values with. So what I'm trying to do is getting the player's current rep in a number value, and set the new reputation with a formula. like so:
my problem is in the part that is supposed to get the player's reputation. I'm using Player:GetStanding(Faction_ID) to get a numeric value, but it keeps returning nil values regardless of the player's reputation causing the script to fail because it can't do math with a nil value. I've tried printing a number of factions to the console, but all of them returned nil. I'm running arcemu r3462 and using luahyparc as an engine.Code:if (intid == 99990) then local Amount_Code = tonumber(code) local Standing_Number = Player:GetStanding(Faction_ID) if (Amount_Code ~= nil) and (Amount_Code ~= "") then if (Player:GetItemCount(180928) >= Amount_Code) then Player:RemoveItem(180928, Amount_Code) RepAdd = Standing_Number + (Token_Rep * Amount_Code) AddedRep = Token_Rep * Amount_Code end end Player:SetStanding(Faction_ID, RepAdd) Player:SendBroadcastMessage("Added "..AddedRep.." reputation with the faction of your choice at the cost of "..Amount_Code.." Rep tokens.") end
any help/suggestion would be very much appreciated!![]()