Allan Silva
Member
- Joined
- May 30, 2018
- Messages
- 39
- Solutions
- 1
- Reaction score
- 7
Script: Roulette System by Xikini
Hello everyone!
I'm using Xikini roulette system and I made a small change, the roulette generates items with rarities (rare, epic, legendary). The rarity is assigned to item normally, but rarity prefix does not appear in message, only name of item, as shown below.
Message when winning item and the item that was received.
Note: I put script to return null value if the item name is not rare, epic or legendary, as shown below.
Function to check the rarity of the item.
I see in terminal (with print in scripts) that name of item searches not come with a prefix and it's returning null.
I don't know any other way to search for the name assigned to item (rare, epic or legendary), to put the attribution in the message.
Would anyone have a solution to this problem?
Any help is welcome.
Thank you!
Hello everyone!
I'm using Xikini roulette system and I made a small change, the roulette generates items with rarities (rare, epic, legendary). The rarity is assigned to item normally, but rarity prefix does not appear in message, only name of item, as shown below.
Message when winning item and the item that was received.
Note: I put script to return null value if the item name is not rare, epic or legendary, as shown below.
Function to check the rarity of the item.
Lua:
-- Function to check the rarity of the item
function checkRarity(item)
local itemName = item:getName()
if itemName:find("rare") then
return "rare"
elseif itemName:find("epic") then
return "epic"
elseif itemName:find("legendary") then
return "legendary"
else
return "nul"
end
end
local playerName = player:getName()
local itemName = item:getName()
local itemRarity = checkRarity(item)
print("Item Rarity: " .. itemRarity)
print("Item name: " .. itemName)
broadcastMessage("The player " .. playerName .. " won a " .. itemRarity .. " " .. itemName .. " from the roulette!", MESSAGE_EVENT_ADVANCE)
I see in terminal (with print in scripts) that name of item searches not come with a prefix and it's returning null.
I don't know any other way to search for the name assigned to item (rare, epic or legendary), to put the attribution in the message.
Would anyone have a solution to this problem?
Any help is welcome.
Thank you!
Attachments
-
1702059674457.png13.9 KB · Views: 6 · VirusTotal
-
1702059759408.png11.5 KB · Views: 6 · VirusTotal