MoveEvent Remove/Add wall (first script)

Oscar Lyis

Donator
Joined
May 30, 2008
Messages
634
Best answers
0
Reaction score
1
Location
Sweden
OK, actually I don't know if it works or not so I want someone experience LUA scripter to check this.

addwall:
Code:
--Movement script with removal + add wall by Lord Ockero--

function onStepIn(cid, item, position, fromPosition)
local wall1 = getThingfromPos ({x=1234,y=1234,z=7, stackpos=1} // Set positions
	if (item.actionid == 416) then
	if isPlayer(cid) == 1 then
		doRemoveItem(wall1.uid,1)
		doTransformItem(item.uid, item.itemid+1)

end
end
	return 1
end


function onStepOut(cid, item, position, fromPosition)

local wall1 = getThingfromPos ({x=1234,y=1234,z=7, stackpos=1} // Set positions

	if(item.actionid == 416) then
	if isPlayer(cid) == 1 then
		doCreateItem(1060,1,wall1)
		doTransformItem(item.uid, item.itemid-1)

end
end
	return 1
end
Code:
-- Movement by Lord ockero --
<movevent event="StepIn" actionid="416" script="addwall.lua" />
<movevent event="StepOut" actionid="416" script="addwall.lua" />
add comments on how i can improve it ty
 
OP
Oscar Lyis

Oscar Lyis

Donator
Joined
May 30, 2008
Messages
634
Best answers
0
Reaction score
1
Location
Sweden
someone tested?? i need to know cuz im not home atm and i wont be for 15 days :( so i cant test myself
 

Cykotitan

Experienced G'
Joined
Nov 4, 2008
Messages
16,894
Best answers
4
Reaction score
817
Code:
local cfg = {
	pos = {x=1234,y=1234,z=7},
	itemid = 1060
}
function onStepIn(cid, item, position, fromPosition)
	local v = getTileItemById(cfg.pos, cfg.itemid).uid
	return
		isPlayer(cid) == TRUE and
		v > 0 and
		doRemoveItem(v) and
		doTransformItem(item.uid, item.itemid + 1)
end
function onStepOut(cid, item, position, fromPosition)
	local v = getTileItemById(cfg.pos, cfg.itemid).uid
	return
		isPlayer(cid) == TRUE and
		v == 0 and
		doCreateItem(cfg.itemid, 1, cfg.pos) and
		doTransformItem(item.uid, item.itemid + 1)
end
bleh, this is too advanced for you
 
OP
Oscar Lyis

Oscar Lyis

Donator
Joined
May 30, 2008
Messages
634
Best answers
0
Reaction score
1
Location
Sweden
Code:
local cfg = {
	pos = {x=1234,y=1234,z=7},
	itemid = 1060
}
function onStepIn(cid, item, position, fromPosition)
	local v = getTileItemById(cfg.pos, cfg.itemid).uid
	return
		isPlayer(cid) == TRUE and
		v > 0 and
		doRemoveItem(v) and
		doTransformItem(item.uid, item.itemid + 1)
end
function onStepOut(cid, item, position, fromPosition)
	local v = getTileItemById(cfg.pos, cfg.itemid).uid
	return
		isPlayer(cid) == TRUE and
		v == 0 and
		doCreateItem(cfg.itemid, 1, cfg.pos) and
		doTransformItem(item.uid, item.itemid + 1)
end
bleh, this is too advanced for you
yeh lol but nice setup with local cfg and cfg.pos/cfg.itemid will use this in my next script!!

but does my script work im excited since i'm not home and won't be home in 15~ days and i cant test on this computer
 

Phantom22

The Chosen
Joined
Dec 20, 2009
Messages
334
Best answers
0
Reaction score
2
Ill try and test it on TFS 3.6+ forgotten when i get done mapping for my server, if i can get this to work i have alot of uses for this. "crosses fingers" i really shouldn't be testing this i dont know allot yet about scripts yet just enough to survive :p learning everyday though
 
Top