What is revscriptsys?
Revscriptsys is a new way to register your scripts in an easy drag and drop way without the need to register it with xml.
Basically you just place your .lua file into
The files in data/scripts, are loaded automatically on startup (Unless the filename starts with a # symbol, which means the file is disabled).
Revscriptsys supports multiple different interface methods to be used in one file (Actions, Moveevents, GlobalEvents, ...) which comes in hand if you do prolonged quests and such which usually would need to be done in different files.
You might have heard of the TFS 0.4 mods system? This is similar to that, but in pure Lua, no XML!
With Revscriptsys you should design your script in a header and footer way.
Action onUse example:
@Evil Hero has offered to take on requests, I will also chip in if I can. If you find any script that is not for revscriptsys, even 0.3/4 scripts, we will try to convert them to Revscriptsys for TFS 1.3. We also take on new requests, as long as they arent too complicated, and the request is well written and easy to understand.
We would also appreciate any contributors to the thread, who wants to convert and script Revscriptsys stuff for us, or with us. And it would be awesome if you could try it out! We want to give Revscriptsys a good test in-game to make sure it works great before TFS 1.3 is officially released.
It invokes metatables for:
Supports:
More samples are available here:
WIKI (Work in progress): otland/forgottenserver (https://github.com/otland/forgottenserver/wiki/Revscriptsys)
And if you download the latest version from github, you should get some sample scripts bundled in the default data pack already inside
First submission by @Evil Hero to get the ball rolling:
TFS 1.2 Portal created on monster death? by @mdwilliams
After you kill a boss monster (configure monster name), spawn a teleport at configured x,y,z location:
Thread Accomplishments: (Released revscriptsys files):
Revscriptsys is a new way to register your scripts in an easy drag and drop way without the need to register it with xml.
Basically you just place your .lua file into
data/scripts/
or any subfolder according to your taste, except for monster files, they go into data/monster/
.The files in data/scripts, are loaded automatically on startup (Unless the filename starts with a # symbol, which means the file is disabled).
Revscriptsys supports multiple different interface methods to be used in one file (Actions, Moveevents, GlobalEvents, ...) which comes in hand if you do prolonged quests and such which usually would need to be done in different files.
You might have heard of the TFS 0.4 mods system? This is similar to that, but in pure Lua, no XML!
With Revscriptsys you should design your script in a header and footer way.
Action onUse example:
Lua:
local testAction = Action() -- this would be the "header" first thing we have to write (unless configuration tables and such)
function testAction.onUse(player, item, fromPosition, itemEx, toPosition, isHotkey) -- now we can design the action itself
return print("We used this item: .." item.itemid)
end
testAction.id(2550) -- the item is a scythe
testAction.register() -- this is our "footer" it has to be the last function executed.
@Evil Hero has offered to take on requests, I will also chip in if I can. If you find any script that is not for revscriptsys, even 0.3/4 scripts, we will try to convert them to Revscriptsys for TFS 1.3. We also take on new requests, as long as they arent too complicated, and the request is well written and easy to understand.
We would also appreciate any contributors to the thread, who wants to convert and script Revscriptsys stuff for us, or with us. And it would be awesome if you could try it out! We want to give Revscriptsys a good test in-game to make sure it works great before TFS 1.3 is officially released.
It invokes metatables for:
- Action()
- CreatureEvent()
- GlobalEvent()
- MoveEvent()
- TalkAction()
- Weapon()
- Spell()
Supports:
- Actions
- Creaturescripts
- Globalevents
- Movements
- Talkactions
- Weapons
- Spells
- Monsters
Lua:
local shovel = Action()
local holes = {468, 481, 483}
function shovel.onUse(player, item, fromPosition, target, toPosition, isHotkey)
if toPosition.x == CONTAINER_POSITION then
return false
end
local tile = Tile(toPosition)
if not tile then
return false
end
local ground = tile:getGround()
if not ground then
return false
end
local groundId = ground:getId()
if isInArray(holes, groundId) then
ground:transform(groundId + 1)
ground:decay()
toPosition.z = toPosition.z + 1
tile:relocateTo(toPosition)
elseif groundId == 231 then
local randomValue = math.random(1, 100)
if randomValue == 1 then
Game.createItem(2159, 1, toPosition)
elseif randomValue > 95 then
Game.createMonster("Scarab", toPosition)
end
toPosition:sendMagicEffect(CONST_ME_POFF)
else
return false
end
return true
end
shovel:id(2554)
shovel:register()
More samples are available here:
Revscriptsys · Issue #2555 · otland/forgottenserver
I didn't find this to be on a TODO list even not for 2.0 I'm wondering if there is still any kind of interest in it. Summ and I have been working on it years ago. It's an easy drag and drop system ...
github.com
And if you download the latest version from github, you should get some sample scripts bundled in the default data pack already inside
data/scripts
.First submission by @Evil Hero to get the ball rolling:
TFS 1.2 Portal created on monster death? by @mdwilliams
After you kill a boss monster (configure monster name), spawn a teleport at configured x,y,z location:
Lua:
-- Boss teleport spawn script by mdwilliams.
-- https://otland.net/threads/tfs-1-2-portal-created-on-monster-death.265567/#post-2567024
-- Converted to TFS 1.3 Revscriptsys by Evil Hero.
local teleportToPosition = Position(1000, 1000, 7)
local teleportCreatePosition = Position(2000, 2000, 7)
local bossName = "boss monster"
local killMessage = "You have killed Boss Monster! A teleport has been created but it will disappear in 5 minutes!"
-- Function that will remove the teleport after a given time
local function removeTeleport(position)
local teleportItem = Tile(position):getItemById(1387)
if teleportItem then
teleportItem:remove()
position:sendMagicEffect(CONST_ME_POFF)
end
end
local event = CreatureEvent("BossKill")
function event.onKill(creature, target)
if target:isPlayer() or target:getMaster() or target:getName():lower() ~= bossName then
return true
end
local position = target:getPosition()
position:sendMagicEffect(CONST_ME_TELEPORT)
local item = Game.createItem(1387, 1, teleportCreatePosition)
if item:isTeleport() then
item:setDestination(teleportToPosition)
end
target:say(killMessage, TALKTYPE_MONSTER_SAY, 0, 0, position)
-- Remove portal after 5 minutes
addEvent(removeTeleport, 5 * 60 * 1000, position)
return true
end
event:register()
local login = CreatureEvent("RegisterBossKill")
function login.onLogin(player)
player:registerEvent("BossKill")
return true
end
login:register()
Thread Accomplishments: (Released revscriptsys files):
- @Znote - Teleport Scroll - Create a teleport near player that teleports him to his town position
- @Infernum - Tier upgrade system - Upgrade item tier
- @Infernum - Decoy Spell - Copies the owner's stats such as current health, max health, speed, outfit.
- @Sarah Wesker - Talkaction /attr - edit item, creature and player attributes
- @Infernum - Talkaction /outfit - get outfit/creature type on the fly to make npcs/mobs easier
- @Sarah Wesker - auto feed - automatically eat food from inventory
- @Evil Puncker - Globalevent tile effects resolved Q/A
- @Evil Puncker - revscriptsys item/weapon registration - alternative to items.xml
- @namco - Talkaction /creative, /survival - Toggle between god mode and player mode
- @Znote - Talkaction /mindcontrol - Make other players say things
- @Pox - Talkaction /jail PLAYER,ROOMID,DAYS - Teleport player to jail
- @a Shadou - Globalevent save - Save system that reminds player that a save is starting soon
- @a Shadou - Creatureevent monster onkill - Give a storagevalue to players who participated in killing a monster by monster name
- @a Shadou - Action onUse - Give shop points when you use item
Last edited: