Action Bed Modification Kits

Colandus

Advanced OT User
Joined
Jun 6, 2007
Messages
2,424
Best answers
18
Reaction score
165
Location
Sweden
Houses are saved as they were last seen, no matter how it's mapped...
 
OP
AGS

AGS

DeathSouls Owner
Joined
Oct 29, 2007
Messages
400
Best answers
0
Reaction score
9
Location
Mexico
That needs to be edited in source...

I didn't tested if it saved them on TFS, but I guess that if the map saves if the door was left open or closed or if someone was on the bed or not, or windows opened or closed, I guess modified beds are saved too...
 

gr33nd3v1l

You see a Green Devil.
Joined
Feb 12, 2008
Messages
140
Best answers
0
Reaction score
0
Location
Croatia
Yeah i'm using TFS and it doesn't save them. First i thought i didn't save the server but if it saved me using the kit (kit wasn't in my backpack) then it should have saved the bed as well =\
 
OP
AGS

AGS

DeathSouls Owner
Joined
Oct 29, 2007
Messages
400
Best answers
0
Reaction score
9
Location
Mexico
Then we have to wait untill it's supported by TFS...
 
OP
AGS

AGS

DeathSouls Owner
Joined
Oct 29, 2007
Messages
400
Best answers
0
Reaction score
9
Location
Mexico
As I said, I didn't tested if the beds were saved, and I haven't had time to test that..

I only tested that it transformed the beds.

I will test later.
 

Znote

<?php echo $title; ?>
Staff member
Global Moderator
Premium User
Joined
Feb 14, 2008
Messages
6,691
Best answers
210
Reaction score
1,394
Location
Norway, Oslo
Could anyone give me a npc that sells the kits? Or just tell me the diffrent id's for the kits and i will make it myself. And if you want i can public the npc script here. [will only be tested in TFS mystic spirit.]
 

EvulMastah

๏̯͡๏﴿
Premium User
Joined
Aug 19, 2007
Messages
4,833
Best answers
0
Reaction score
184
7904 - green
7905 - red
7906 - yellow
7907 - removing one

Theyre all typed and named in the script :blink:
 

Znote

<?php echo $title; ?>
Staff member
Global Moderator
Premium User
Joined
Feb 14, 2008
Messages
6,691
Best answers
210
Reaction score
1,394
Location
Norway, Oslo
Ye, im just a lazy ass and i don't understand scripts 100% :p Just good at copypaste. Thx for the ids, will edit this thread with an easy basic npc for thoose who needs it.

EDIT:
Add a xml document in \data\npc
Code:
<?xml version="1.0"?>

<npc name="Bed Specialist" script="data/npc/scripts/housekits.lua" access="3" lookdir="3" autowalk="25">
	<health now="1000" max="1000"/>
	<look type="128" head="20" body="100" legs="50" feet="99"/>
	<parameters>
		<parameter key="module_shop" value="1" />
		<parameter key="message_greet" value="Hello |PLAYERNAME|. I sell green, red, yellow bed kits, and the standard bed kit. You can use theese kits on a bed inside a house to change its design. (each kit cost 300gp)" />
		<parameter key="shop_buyable" value="green bed kit,7904,300;red bed kit,7905,300;yellow bed kit,7906,300;standard bed kit,7907,300" />
	</parameters>
</npc>
And add this in lua format to data\npc\scripts [name it housekits to make this example work]
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

-- OTServ event handling functions start
function onCreatureAppear(cid)				npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) 			npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) 	npcHandler:onCreatureSay(cid, type, msg) end
function onThink() 						npcHandler:onThink() end
-- OTServ event handling functions end

npcHandler:addModule(FocusModule:new())
this is a basic seller npc with params, shoud atleast work with all TFS servers. Nothing is done by me, i just copy pasted the foodscript I had and replaced ids and stuff.
Havent tested this, im at school. But shoud work.
 
Last edited:

EvulMastah

๏̯͡๏﴿
Premium User
Joined
Aug 19, 2007
Messages
4,833
Best answers
0
Reaction score
184
Nevermind, you already did what was posted here.
 
OP
AGS

AGS

DeathSouls Owner
Joined
Oct 29, 2007
Messages
400
Best answers
0
Reaction score
9
Location
Mexico
I didn't mentioned this here:
If you have a border or carpet under the bed, It may not work correctly.
 

slawkens

Developer
Premium User
Joined
Aug 27, 2007
Messages
2,890
Best answers
64
Reaction score
400
Location
Germany
Reorganized version =o, also new things, like magicEffect and you can't place same modification if it already exist.
Code:
local KIT_GREEN = 7904
local KIT_RED = 7905
local KIT_YELLOW = 7906
local KIT_REMOVAL = 7907

local BEDS = {
	[KIT_GREEN] =	{{7811, 7812}, {7813, 7814}},
	[KIT_RED] =	{{7815, 7816}, {7817, 7818}},
	[KIT_YELLOW] =	{{7819, 7820}, {7821, 7822}},
	[KIT_REMOVAL] =	{{1754, 1755}, {1760, 1761}}
}

local function internalBedTransform(item, itemEx, toPosition, id1, id2)
	doTransformItem(itemEx.uid, id1)
	doTransformItem(getThingfromPos(toPosition).uid, id2)
	doRemoveItem(item.uid)

	doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_POFF)
	doSendMagicEffect(toPosition, CONST_ME_POFF)
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local newBed = BEDS[item.itemid]
	if not newBed or getTileHouseInfo(getCreaturePosition(cid)) == FALSE then
		return FALSE
	end

	if isInArray({newBed[1][1], newBed[2][1]}, itemEx.itemid) == TRUE then
		doPlayerSendCancel(cid, "You already have this bed modification.")
		return TRUE
	end

	for kit, bed in pairs(BEDS) do
		if bed[1][1] == itemEx.itemid then
			toPosition.y = toPosition.y + 1
			internalBedTransform(item, itemEx, toPosition, newBed[1][1], newBed[1][2])
			break
		elseif bed[2][1] == itemEx.itemid then
			toPosition.x = toPosition.x + 1
			internalBedTransform(item, itemEx, toPosition, newBed[2][1], newBed[2][2])
			break
		end
	end

	return TRUE
end
 
OP
AGS

AGS

DeathSouls Owner
Joined
Oct 29, 2007
Messages
400
Best answers
0
Reaction score
9
Location
Mexico
Cool, thanks slawkens
I totally forgot about this script :p
 

octavio007

New Member
Joined
Jun 13, 2008
Messages
43
Best answers
0
Reaction score
0
Help

I have the same error but with the rope and the Magic Rope (Exani Tera)
I use TFS 0.2 Patch 23
This is the error in the console:

Exani Tera

[18/02/2009 11:36:43] Lua Script Error: [Spell Interface]
[18/02/2009 11:36:43] data/spells/scripts/support/magic rope.lua:eek:nCastSpell

[18/02/2009 11:36:43] data/spells/scripts/support/magic rope.lua:6: attempt to call global 'getThingfromPos' (a nil value)
[18/02/2009 11:36:44] stack traceback:
[18/02/2009 11:36:44] data/spells/scripts/support/magic rope.lua:6: in function <data/spells/scripts/support/magic rope.lua:3>


Rope


[18/02/2009 11:37:12] Lua Script Error: [Action Interface]
[18/02/2009 11:37:12] data/actions/scripts/tools/rope.lua:eek:nUse

[18/02/2009 11:37:12] data/actions/scripts/tools/rope.lua:3: attempt to call global 'getThingfromPos' (a nil value)
[18/02/2009 11:37:12] stack traceback:
[18/02/2009 11:37:13] data/actions/scripts/tools/rope.lua:3: in function <data/actions/scripts/tools/rope.lua:2>

Help me please!!
 

Snavy

Alpha - AUUU
Joined
Apr 1, 2012
Messages
769
Best answers
6
Reaction score
128
Location
Kepler452b
Ohh. cant you sleep?...
Go and Drink milk :DD ("JOke!")
 
Top