Hello everybody!
I’m also trying to do the following:
I’m also trying to do the following:
I’m trying to create an NPC that will grant character bonuses for completing a mission.
Could you check whether this function will work?
The last time I dealt with something like this (about 20 years ago), I had an issue with experience removal. The character would gain 1 level, but after gaining any experience in the game, the level would revert to what it was before turning in the quest.
Did I properly define the structure for saving what the NPC grants? Or maybe different commands are needed? Could they behave the same way as GM commands? For example, I can reward a player by ID with strength, HP, agility, or constitution. But after teleporting to another city or relogging, the character’s stats return to their original values.
Is there some kind of function to “permanently закрепить” (lock in / persist) the acquired bonuses so they stay with the character forever?
The quest is intended to be long-term.
So after each completion, depending on whether the player has a certain item and has completed it before, the reward bonus would increase.
What do you think?
function dream_talk28()
Talk(1,"Bring me 5 required items, kill 6 monster groups, and pay 10000 gold. I will rebuild your character and give rewards.")
InitTrigger()
-- Если миссии нет, предложить взять
TriggerCondition(1, NoMission, 9000)
TriggerCondition(1, NoRecord, 9000)
TriggerAction(1, AddMission, 9000)
TriggerAction(1, ReAll)
-- Если миссия уже есть, просто показать текст
TriggerFailure(1, JumpPage, 2)
Text(1,"I want to accept the mission.", MultiTrigger, GetMultiTrigger(), 1)
Talk(2,"You already have this mission or have already completed it.")
end
function CustomResetReward(Player)
--------------------------------------------------
-- 1. СБРОС УРОВНЯ И ОПЫТА
--------------------------------------------------
SetChaAttr(Player, ATTR_LV, 1)
SetChaAttr(Player, ATTR_CEXP, 0)
--------------------------------------------------
-- 2. СТАТЫ СТАВИМ ПО 10
--------------------------------------------------
SetChaAttr(Player, ATTR_STR, 10)
SetChaAttr(Player, ATTR_DEX, 10)
SetChaAttr(Player, ATTR_AGI, 10)
SetChaAttr(Player, ATTR_CON, 10)
SetChaAttr(Player, ATTR_STA, 10)
--------------------------------------------------
-- 3. СВОБОДНЫЕ ПОИНТЫ
--------------------------------------------------
SetChaAttr(Player, ATTR_AP, 10)
--------------------------------------------------
-- 4. ПОСТОЯННЫЕ БОНУСЫ
--------------------------------------------------
-- Max HP +10000?
-- Или ATTR_MXHP?
local cur_mxhp = GetChaAttr(Player, ATTR_MXHP)
SetChaAttr(Player, ATTR_MXHP, cur_mxhp + 10000)
-- DEF +100
local cur_def = GetChaAttr(Player, ATTR_DEF)
SetChaAttr(Player, ATTR_DEF, cur_def + 100)
-- Move Speed +100
local cur_mspd = GetChaAttr(Player, ATTR_MSPD)
SetChaAttr(Player, ATTR_MSPD, cur_mspd + 100)
--------------------------------------------------
-- 5. ФЛАГ ДЛЯ СОХРАНЕНИЯ / ПРОВЕРКИ
--------------------------------------------------
-- Сохраняем бонусы ?
-- можно проверять этот record?
SetRecord(Player, 9100)
--------------------------------------------------
-- 6. ОБНОВЛЕНИЕ
--------------------------------------------------
SyncCha(Player)
SystemNotice(Player, "Reset complete. Your character was rebuilt successfully.")
end
