• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Help script

Scurzo

New Member
Joined
Aug 23, 2008
Messages
66
Reaction score
0
I suck at scripting so I was wondering if anyone could help me to make this:

1. A magic item that summons 2 "x" monsters

2. A magic item that gives 1000hp/1000mana each second for 20 seconds when used SOLVED

Rep++
 
Last edited:
1. :)
But I made a script that when you use the item it doesn't remove(write when want to change it)
actions/scripts/summon.lua
Lua:
function onUse(cid, item, frompos, item2, topos)
local pos = getPlayerPosition(cid) 
monster = {x=pos.x+1, y=pos.y, z=pos.z}
monster2 = {x=pos.x, y=pos.y+1, z=pos.z}
	if getTilePzInfo(pos) == FALSE then
		if getTilePzInfo(monster) == FALSE then
			if getTilePzInfo(monster2) == FALSE then
				doSummonCreature("rat", monster)
				doSummonCreature("rat", monster2)
			else
			doPlayerSendCancel(cid,"You cannot summon monster in Protection Zone.")
			end
		else
		doPlayerSendCancel(cid,"You cannot summon monster in Protection Zone.")
		end
	else
	doPlayerSendCancel(cid,"You cannot use this item when you're in a Protect Zone.")
	end
return 1
end

actions/actions.xml
Code:
<action itemid="[COLOR="Red"]xxxx[/COLOR]" event="script" value="summon.lua"/>
Write id of your item
[Tested on TFS 0.3.6]
 
I didn't know how to do that event, but I made it this way(maybe noob script but work :p)
actions/script/heal.lua
Lua:
function onUse(cid, item, frompos, item2, topos)
local czas = 0
local tick = 1000
local function heal(i)
doCreatureAddHealth(cid, 1000)
doCreatureAddMana(cid, 1000)
end
if(czas == 0)then
addEvent(heal, 1000)
addEvent(heal, 2000)
addEvent(heal, 3000)
addEvent(heal, 4000)
addEvent(heal, 5000)
addEvent(heal, 6000)
addEvent(heal, 7000)
addEvent(heal, 8000)
addEvent(heal, 9000)
addEvent(heal, 10000)
addEvent(heal, 11000)
addEvent(heal, 12000)
addEvent(heal, 13000)
addEvent(heal, 14000)
addEvent(heal, 15000)
addEvent(heal, 16000)
addEvent(heal, 17000)
addEvent(heal, 18000)
addEvent(heal, 19000)
addEvent(heal, 20000)
czas = os.time()
	end
		 if(os.time() <= 0)then
		stopEvent(heal)
		end

end

actions/actions.xml
Code:
<action itemid="[COLOR="Red"]XXXX[/COLOR]" event="script" value="heal.lua"/>

[Tested on TFS 0.3.6]
 
Code:
local condition = createConditionObject(CONDITION_REGENERATION)
setConditionParam(condition, CONDITION_PARAM_SUBID, 4)
setConditionParam(condition, CONDITION_PARAM_BUFF, true)
setConditionParam(condition, CONDITION_PARAM_TICKS, 20 * 1000)
for i = 4, 7 do
	setConditionParam(condition, i, 1000)
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
	doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_GREEN)
	doAddCondition(cid, condition)
	return true
end
 
Code:
[30/04/2010 16:06:58] [Error - Action Interface] 
[30/04/2010 16:06:58] data/actions/scripts/testing.lua:onUse
[30/04/2010 16:06:58] Description: 
[30/04/2010 16:06:58] (luaDoAddCondition) Creature not found
Maybe I pasted something wrong ? xD

Will try again

EDIT
Only green stars, no healing ? :p
Ok, with healing
sorry for the problem
Ur script is OK :D
 
1. :)
But I made a script that when you use the item it doesn't remove(write when want to change it)
actions/scripts/summon.lua
Lua:
function onUse(cid, item, frompos, item2, topos)
local pos = getPlayerPosition(cid) 
monster = {x=pos.x+1, y=pos.y, z=pos.z}
monster2 = {x=pos.x, y=pos.y+1, z=pos.z}
	if getTilePzInfo(pos) == FALSE then
		if getTilePzInfo(monster) == FALSE then
			if getTilePzInfo(monster2) == FALSE then
				doSummonCreature("rat", monster)
				doSummonCreature("rat", monster2)
			else
			doPlayerSendCancel(cid,"You cannot summon monster in Protection Zone.")
			end
		else
		doPlayerSendCancel(cid,"You cannot summon monster in Protection Zone.")
		end
	else
	doPlayerSendCancel(cid,"You cannot use this item when you're in a Protect Zone.")
	end
return 1
end

actions/actions.xml
Code:
<action itemid="[COLOR="Red"]xxxx[/COLOR]" event="script" value="summon.lua"/>
Write id of your item
[Tested on TFS 0.3.6]

Thanks everybody, and about this script I ment the monsters had to be minions of the one using the item
 
Last edited:
Lua:
function onUse(cid, item, frompos, item2, topos)
local pos = getPlayerPosition(cid)
	if getTilePzInfo(pos) == FALSE then
		for i = 1, 2 do
			local monster_to_summon = doSummonCreature("rat", pos)
			doConvinceCreature(cid, monster_to_summon)
		end

		doRemoveItem(item.uid, 1)

		else
			doPlayerSendCancel(cid, "You cannot use this item when you're in a Protect Zone.")
		end

	return true
end
 
Last edited by a moderator:
Back
Top Bottom