Jaki Maoh
Member
- Joined
- Sep 13, 2017
- Messages
- 52
- Reaction score
- 12
Hello Community.
The idea is to have a message pop up everytime the player changes locations, with the intent of making the locations and name of the places better known.
Searching the forum I found some ways to make messages appear on the screen, but almost always based on a timer (onThink events).
So I tried modifying this script by @Sarah Wesker :
And got poor results, because the system was still based on an interval, and not on the previous storage (meaning the player that stands still on the "passage" between two places will have the message appearing from time to time).
So I've decided to ask for help, because my script modifying techniques are not near enough to do the modifications that I need.
If anyone can help me build a similar script based on the idea of "keeping the storage of the last message shown" and only show the next one after the player approaches the location of the new message it would be great!
Keep in mind that this script by Sarah is ideal (imo) because it is not based on movements and do not require the player to step on a specific tile (or set of tiles) to trigger the messages (avoiding the need to fill the entire map with endless actionIDs, in specific, narrowed down paths).
Thanks for your time!
Jaki
The idea is to have a message pop up everytime the player changes locations, with the intent of making the locations and name of the places better known.
Searching the forum I found some ways to make messages appear on the screen, but almost always based on a timer (onThink events).
So I tried modifying this script by @Sarah Wesker :
Here is a example TFS 1.3
data/scripts/texteffects.lua
Lua:local config = { interval = 5000, texts = { { pos = Position(3191, 1810, 7), text = "Temple!", effects = { CONST_ME_TELEPORT, CONST_ME_DRAWBLOOD } }, { pos = Position(3188, 1811, 7), text = "Depots!", effects = { CONST_ME_ICEAREA, CONST_ME_ENERGYHIT } }, { pos = Position(3191, 1814, 7), text = "Skills!", effects = { CONST_ME_ENERGYAREA, CONST_ME_FERUMBRAS } } } } local textOnMap = GlobalEvent("TextOnMap") function textOnMap.onThink(interval) local player = Game.getPlayers()[1] if not player then return true end for k, info in pairs(config.texts) do player:say(info.text, TALKTYPE_MONSTER_SAY, false, nil, info.pos) info.pos:sendMagicEffect(info.effects[math.random(1, #info.effects)]) end return true end textOnMap:interval(config.interval) textOnMap:register()
And got poor results, because the system was still based on an interval, and not on the previous storage (meaning the player that stands still on the "passage" between two places will have the message appearing from time to time).
Lua:
local config = {
interval = 1000,
texts = {
{ pos = Position(1633, 1530, 6), text = "Test 1"},
{ pos = Position(1637, 1530, 6), text = "Test 2"},
{ pos = Position(1641, 1530, 6), text = "Test 3"}
}
}
local textOnMape = GlobalEvent("TextOnMape")
function textOnMape.onThink(interval)
local player = Game.getPlayers()[1]
if not player then
return true
end
if player:getStorageValue(30004) < os.time() then
for k, info in pairs(config.texts) do
player:say(info.text, TALKTYPE_MONSTER_SAY, false, nil, info.pos)
-- info.pos:sendMagicEffect(info.effects[math.random(1, #info.effects)])
player:setStorageValue(30004, os.time() + 6)
end
end
return true
end
textOnMape:interval(config.interval)
textOnMape:register()
So I've decided to ask for help, because my script modifying techniques are not near enough to do the modifications that I need.
If anyone can help me build a similar script based on the idea of "keeping the storage of the last message shown" and only show the next one after the player approaches the location of the new message it would be great!
Keep in mind that this script by Sarah is ideal (imo) because it is not based on movements and do not require the player to step on a specific tile (or set of tiles) to trigger the messages (avoiding the need to fill the entire map with endless actionIDs, in specific, narrowed down paths).
Thanks for your time!
Jaki