[TFS 1.3] [Revscriptsys] Free Lua scripting service - Post your requests! Let's learn it together!

OP
Znote

Znote

<?php echo $title; ?>
Staff member
Global Moderator
Premium User
Joined
Feb 14, 2008
Messages
6,691
Best answers
210
Reaction score
1,393
Location
Norway, Oslo
request this makesay command from mrsheen ot :p
Lua:
local mindcontrol = TalkAction("/mindcontrol")

function mindcontrol.onSay(player, words, param)

	-- Below param parser might not respect talkaction separator
	-- (such as player names with space in them)
	local t = string.explode(param, ",")
	local tmp = t[1]
	if t[2] then
		tmp = t[2]
	end
	
	if param == '' then 
		player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Command param required.')
		return true
	end

	local mindControlled = Player(t[1])
	if not mindControlled then
		player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'This Player no exist.')
		return true
	else
		mindControlled:say(tmp,TALKTYPE_SAY)
	end
	return true
end

mindcontrol:separator(" ")
mindcontrol:register()
 

Evil Puncker

I'd rather kiss a rattlesnake
Joined
May 30, 2009
Messages
5,917
Best answers
33
Reaction score
1,869
Location
160,54,7
is there a way to register on Equip/DeEquip all items that equip on "head" slot without the need to enter ID by ID? and without overwriting the already registered ones? (like level on movements.xml etc)
 

Delusion

Divine Intellect
Support Team
Joined
Feb 14, 2015
Messages
5,340
Best answers
528
Reaction score
3,065
is there a way to register on Equip/DeEquip all items that equip on "head" slot without the need to enter ID by ID? and without overwriting the already registered ones? (like level on movements.xml etc)
Would be unrelated to revscriptsys, use Player:onMoveItem in events/player.lua: if toPosition.x == CONTAINER_POSITION and toPosition.y == CONST_SLOT_HEAD then
 

oen432

Veteran OT User
Joined
Oct 3, 2014
Messages
481
Best answers
11
Reaction score
446
Location
Poland
Would be unrelated to revscriptsys, use Player:onMoveItem in events/player.lua: if toPosition.x == CONTAINER_POSITION and toPosition.y == CONST_SLOT_HEAD then
There is one thing with onItemMove... This event won't handle item requirements (vocation and level) so you don't know if that item can be equipped, not gonna lie, in current state this event shouldn't be used as "item equip" event.
 

Delusion

Divine Intellect
Support Team
Joined
Feb 14, 2015
Messages
5,340
Best answers
528
Reaction score
3,065
There is one thing with onItemMove... This event won't handle item requirements (vocation and level) so you don't know if that item can be equipped, not gonna lie, in current state this event shouldn't be used as "item equip" event.
Yes it will, and yes you can know. After onMoveItem is finished executing, the registered movement will then check for its requirements and determine if it can be equipped or not. Obviously the event itself doesn't check for the requirements, but that was never in question, because he already has the movements registered and wants a blanket event to execute regardless of pre-existing registration.
without overwriting the already registered ones? (like level on movements.xml etc)
 

SixNine

Member
Joined
Dec 12, 2018
Messages
186
Best answers
0
Reaction score
18
My request is spell
  • Teleport next to play not on player
  • Should not allow to teleport trough not passible objects
 

Evil Puncker

I'd rather kiss a rattlesnake
Joined
May 30, 2009
Messages
5,917
Best answers
33
Reaction score
1,869
Location
160,54,7
I tried converting a script to revscriptsys by myself but its not working and I don't know why (yes it is registered on login.lua as well), the modal window opens up with the choices and all, but it just doesn't teleport the player, no error on console

Lua:
local teleports = {
    [0x00] = {cost = 100, pos = Position(1498, 1224, 7)},
    [0x01] = {cost = 100, pos = Position(1498, 1224, 7)},
    [0x02] = {cost = 100, pos = Position(1498, 1224, 7)},
    [0x03] = {cost = 100, pos = Position(1498, 1224, 7)},
    [0x04] = {cost = 100, pos = Position(1498, 1224, 7)}
}

local tiles = {
    [15434] = {
        title = "Escolha seu destino",
        desc = "Escolha a cidade para qual deseja viajar",
        teleports = {
            [1] = {id = 0x00, text = "Dragon Lair - 100gp"},
            [2] = {id = 0x01, text = "Teleport 2 - 100gp"},
            [3] = {id = 0x02, text = "Teleport 3 - 100gp"},
            [4] = {id = 0x03, text = "Teleport 4 - 100gp"},
            [5] = {id = 0x04, text = "Teleport 5 - 100gp"}
        }
    },
    [1001] = {
        title = "Second Teleport Title",
        desc = "Second Teleport Description",
        teleports = {
            [1] = {id = 0x01, text = "Teleport 2 - 100gp"},
            [2] = {id = 0x02, text = "Teleport 3 - 100gp"},
            [3] = {id = 0x03, text = "Teleport 4 - 100gp"},
            [4] = {id = 0x04, text = "Teleport 5 - 100gp"}
        }
    }
}

local tralveModal = MoveEvent()
tralveModal:type("stepin")

function tralveModal.onStepIn(creature, item, position, fromPosition)
    local player = creature:getPlayer()
    local TILE = tiles[item:getActionId()]
    if not TILE then return true end
    if not player:isPlayer() then return true end

    local window = ModalWindow(1860, TILE.title, TILE.desc)

    for i = 1, #TILE.teleports do
        window:addChoice(TILE.teleports[i].id, TILE.teleports[i].text)
    end

    window:addButton(0x00, "Teleportar")
    window:addButton(0x01, "Fechar")
    window:setDefaultEnterButton(0x00)
    window:sendToPlayer(player)
    return true
end

tralveModal:aid(15434)
tralveModal:register()

local tralveModalC = CreatureEvent("tralveModalC")

function tralveModalC.onModalWindow(player, modalWindowId, buttonId, choiceId)
    if modalWindowId ~= 1860 then return true end

    if buttonId == 0x01 then return true end

    local CHOICE = teleports[choiceId]

    if not CHOICE then return true end

    if player:removeMoney(CHOICE.cost) then
        player:teleportTo(CHOICE.pos)
    else
        player:sendCancelMessage("This teleport costs "..CHOICE.cost.."gold coins to use.")
    end
    return true
end

tralveModalC:register()
can you guys give me a light?
 

Klonera

Once upon a time.
Joined
Jul 16, 2016
Messages
543
Best answers
1
Reaction score
93
Location
Sweden
Requesting:
!fold carpet
What it does,
A carpet that's in a house under an item that's unmovable/a door comes into your backpack.
Tfs 1.2/1.3
Source/File: Unknown, no posts exists.
 

Evil Hero

Legacy Member
TFS Developer
Joined
Dec 12, 2007
Messages
1,179
Best answers
15
Reaction score
553
Location
Germany
Requesting:
!fold carpet
What it does,
A carpet that's in a house under an item that's unmovable/a door comes into your backpack.
Tfs 1.2/1.3
Source/File: Unknown, no posts exists.
Can you elaborate that idea a bit more, I don't really get it and also this thread is only for tfs 1.3 master branch which contains revscriptsys
 

Klonera

Once upon a time.
Joined
Jul 16, 2016
Messages
543
Best answers
1
Reaction score
93
Location
Sweden
Can you elaborate that idea a bit more, I don't really get it and also this thread is only for tfs 1.3 master branch which contains revscriptsys
Right, I have no Idea if this req. revscript. My bad.
Information/explanation.
Example item: Rift Carpet.
What the script does: If you put a carpet on a door and use it you cannot browse-field it to pick it up. The script will pick the carpet up for you with the !fold command.
Let's say this, A player puts a carpet on a door and uses it, he regrets putting it there or sells the house to another player and he seller/buyer want's the carpet or just put another carpet there they can type !fold -carpet name and the carpet will go from the floor (Be removed/Picked up) into the players backpack.
TFS 1.3 is what I use, sorry for posting this in here but thought It could be done here.
 

Lucifer

Active Member
Joined
Dec 27, 2014
Messages
145
Best answers
0
Reaction score
31
Location
Sweden
Anyone can help me make a demote/upgrade level scripts?

Talkaction /downgrade, lvl, name
/upgrade, lvl, name

Or is it possible to do? Bec i saw @oen432 wrote to someone that requires source edits.
 

oen432

Veteran OT User
Joined
Oct 3, 2014
Messages
481
Best answers
11
Reaction score
446
Location
Poland
Bec i saw @oen432 wrote to someone that requires source edits.
It does if you don't want someone to logout before you downgrade his stats. Right now there is no method that would decrease experience by given amount. Even now when player dies, exp and level is reduced in source and not Lua side.
 

Lucifer

Active Member
Joined
Dec 27, 2014
Messages
145
Best answers
0
Reaction score
31
Location
Sweden
It does if you don't want someone to logout before you downgrade his stats. Right now there is no method that would decrease experience by given amount. Even now when player dies, exp and level is reduced in source and not Lua side.
Okay thank you so much for your reply.
But I have seen the talkaction on 0.4 tfs so thought it could be done on tfs 1.3 with revscript as well.
 

Nekiro

Support Team
Support Team
Joined
Sep 7, 2015
Messages
1,958
Best answers
86
Reaction score
735
It does if you don't want someone to logout before you downgrade his stats. Right now there is no method that would decrease experience by given amount. Even now when player dies, exp and level is reduced in source and not Lua side.
player:removeExperience?
 

Nekiro

Support Team
Support Team
Joined
Sep 7, 2015
Messages
1,958
Best answers
86
Reaction score
735
When was this added? I'm sure it wasn't there... Or maybe that wasn't 1.3 version I was working with then.
Its in tfs since ages, probably when addExperience was added. Look into luascript.cpp next time before u judge that something does not exist.
 

oen432

Veteran OT User
Joined
Oct 3, 2014
Messages
481
Best answers
11
Reaction score
446
Location
Poland
Its in tfs since ages, probably when addExperience was added.
My bad! It was skill tries, not experience! Yeah, there is only "add" method.
Memory issues or something o_O
 

Gabriel Farré

New Member
Joined
Nov 5, 2019
Messages
1
Best answers
0
Reaction score
0
Location
Brazil
Hello,

Version of TFS: 1.3
Version of Client: 12 / 12.15

My resquest - Talkaction / System:

/jail <player name>

How it works?

When i use this command on a player he's lost 15% of all experience and got teleported in a specific zone of the jail. Example: Teleport to the prison cell 1, 2 or other prison cells avaible. (Ex: Teleport to X= 0000 / Y = 0000 / Z = 0000 or other zone to teleport).

But i need an time jail time. Like: one day, two days or seven days.

Can you help me?

Thank you!
 

Evil Puncker

I'd rather kiss a rattlesnake
Joined
May 30, 2009
Messages
5,917
Best answers
33
Reaction score
1,869
Location
160,54,7
I have a question about the revscriptsys monsters, how do I add an event to it? for example I want that every time I kill certain monster it will execute a player function (i.e: player:addMoney(1)), how would I do it or should I go back to the old way of having to createa new creature event and register it to the monster? (and how do I register it in the revscriptsys monster), @Evil Hero 😁
 

Evil Hero

Legacy Member
TFS Developer
Joined
Dec 12, 2007
Messages
1,179
Best answers
15
Reaction score
553
Location
Germany
I have a question about the revscriptsys monsters, how do I add an event to it? for example I want that every time I kill certain monster it will execute a player function (i.e: player:addMoney(1)), how would I do it or should I go back to the old way of having to createa new creature event and register it to the monster? (and how do I register it in the revscriptsys monster), @Evil Hero 😁
Lua:
monster.events = {
    "nameofevent1",
    "nameofevent2"
}
this will register the event to the monster or use MonsterType("name"):registerEvent("eventName")
I'd rather not try to include the event itself into the monster file as the loading order of script systems might be a problem, you can however try to confirm that aswell if you want to.
 
Top