patrick_cvs
New Member
- Joined
- Apr 21, 2020
- Messages
- 12
- Reaction score
- 0
Someone give you strength? I want to add a quest that her reward is the same as in svargrond arenas, you will win an item and it will have the description "Item given to (nomedoplayer) for help", so I made some adjustments using script file arenaTrophy.lua.
Since it is the same function to receive the prize. However the part of the file that he creates this Description modified with the name of the player looks like this: rewardItem: setDescription (string.format (ARENA [arenaId] .reward.desc, creature: getName ()))
how can I leave descript like that : 'Item given by ... to the player (Playername) 'Because the player helped save the world'
Script:
local t = {
storage = 56482680
}
function onStepIn(creature, item, position, fromPosition)
if not creature:isPlayer() then
return true
end
local arenaId = item.uid - 23500
if arenaId <= creature:getStorageValue(t.storage) then
return true
end
local cStorage = 1
if creature:getStorageValue(cStorage) ~= 1 then
local rewardPosition = creature:getPosition()
rewardPosition.x = rewardPosition.x + 1
local rewardItem = Game.createItem(5785, 1, rewardPosition)
if rewardItem then
rewardItem:setDescription(string.format('Item given by ... to the player (Playername) 'Because the player helped save the world'))
end
creature:setStorageValue(t.storage, 56482680)
creature:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
end
return true
end
Since it is the same function to receive the prize. However the part of the file that he creates this Description modified with the name of the player looks like this: rewardItem: setDescription (string.format (ARENA [arenaId] .reward.desc, creature: getName ()))
how can I leave descript like that : 'Item given by ... to the player (Playername) 'Because the player helped save the world'
Script:
local t = {
storage = 56482680
}
function onStepIn(creature, item, position, fromPosition)
if not creature:isPlayer() then
return true
end
local arenaId = item.uid - 23500
if arenaId <= creature:getStorageValue(t.storage) then
return true
end
local cStorage = 1
if creature:getStorageValue(cStorage) ~= 1 then
local rewardPosition = creature:getPosition()
rewardPosition.x = rewardPosition.x + 1
local rewardItem = Game.createItem(5785, 1, rewardPosition)
if rewardItem then
rewardItem:setDescription(string.format('Item given by ... to the player (Playername) 'Because the player helped save the world'))
end
creature:setStorageValue(t.storage, 56482680)
creature:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
end
return true
end