Jump to content
Sign in to follow this  
Jones

Reputation Ticket/Chest Item

Recommended Posts

Hello guys, I've written a script that creates a chest that gives you Reputation when you use it. The script is also explained.

 

function ItemUse_rep_ticket ( role , item )

	local curr_rep = GetChaAttr ( role , ATTR_FAME ) -- Gets the character's current reputation. [ role , ATTR_FAME ] = variable for reputation.
	local rep_ticket_add = 100000 -- Input here the amount of reputation you want the reputation ticket to give
	local after_add_rep = curr_rep + rep_ticket_add -- Calculate [after_add_rep] as curr_rep (Current Reputation) + rep_ticket_add.
		if curr_rep > 9999999 then -- If current reputation is over 9.99 mil, then..
		SystemNotice( role , "You have over 9 Million reputation! Your account is saturated!") -- Inititate a System Message
		UseItemFailed ( role ) -- Fail to use the item.
		else -- If the current reputation is NOT over 9.99mil, then...
	SetCharaAttr( after_add_rep , role , ATTR_FAME ) -- Set the character's Reputation to the Calculated value (after_add_rep).
	end -- end the if
end -- end the function

 

This script gives you 100k reputation (you can change it by changing value of "rep_ticket_add"
and will fail if the user's current reputation is over 9.99 mil, initiating a system message that says: "You have over 9 Million reputation! Your account is saturated!"

 

Credits to Jones of BPO :)

  • Like 1

Share this post


Link to post
Share on other sites

it's nice to see guides like these.
Because I've seen you post quite abit of guides lately, let me propose a guide that maybe you could do
and even learn through it. (If you decide to take on the challege and needs help with some function, please pm me!)
So heres the basis:

Go through each built-in function and explain it's functionality. For example:

GetChaAttr(userdata, attr)               -- retrieves an attr of a given player (userdata)
TurnToCha(userdata)                      -- retrieves playerdata (useful when player is a ship)
Notice(string)                           -- writes a string to the ingame chat console (globally)
SystemNotice(userdata, string)           -- writes a string to the ingame chat console (individually - "userdata")

 
Edited by xtc

kong.png

a2.png

Share this post


Link to post
Share on other sites
3 hours ago, xtc said:

it's nice to see guides like these.
Because I've seen you post quite abit of guides lately, let me propose a guide that maybe you could do
and even learn through it. (If you decide to take on the challege and needs help with some function, please pm me!)
So heres the basis:

Go through each built-in function and explain it's functionality. For example:


GetChaAttr(userdata, attr)               -- retrieves an attr of a given player (userdata)
TurnToCha(userdata)                      -- retrieves playerdata (useful when player is a ship)
Notice(string)                           -- writes a string to the ingame chat console (globally)
SystemNotice(userdata, string)           -- writes a string to the ingame chat console (individually - "userdata")


 

like a collaboration of work to define the variables?

sounds interesting.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...