• 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!

[TFS] Limit a rune to a special vocation?

Znote

<?php echo $title; ?>
Staff member
Global Moderator
Premium User
Joined
Feb 14, 2008
Messages
7,030
Solutions
256
Reaction score
2,118
Location
Norway
GitHub
Znote
Hello, I got trouble adding runes to a special vocation on my new TFS server, im using 0.2.10.

What I would like is something like this:
Paralyze runes only work for druids and master sorcerers
SD runes only work for sorc/druid and paladins
(custom sd rune) only work for Summoners

Here is the paralyze rune:
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_RED)

local condition = createConditionObject(CONDITION_PARALYZE)
setConditionParam(condition, CONDITION_PARAM_TICKS, 20000)
--setConditionParam(condition, CONDITION_PARAM_SPEED, -200)
setConditionFormula(condition, -0.9, 0, -0.9, 0)
setCombatCondition(combat, condition)

function onCastSpell(cid, var)
	return doCombat(cid, combat, var)
end
Can anyone add so it only work for vocation id 2, 5 and 6?

In an older server I had, that was evolution based, i could easy add
Code:
<vocation id="1" /><vocation id="5" /></rune>
But this don't work on TFS.

Talaturen said:
Hello.

If it doesn't work to add it inside the <rune> tag then I don't know how to do it inside the XML file, try using a vocation check inside the paralyze rune.lua script itself, something like:

if getPlayerVocation(cid) ~= 2 or getPlayerVocation(cid) ~= 6 then
return FALSE
end

Ohh I posted in the donator board, please move this to public support board if I won't get any help here :p

It would be awesome x100 if anybody could give me the finished paralyze.lua script that got
Code:
if getPlayerVocation(cid) ~= 2 or getPlayerVocation(cid) ~= 6 then or getPlayerVocation(cid) ~= 5 then
or something like that, that actually work it would be great...
 
I think that should help You:
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_YELLOW_RINGS)

local arr = {
	{0, 0, 0, 0, 0, 0, 0},
	{0, 0, 1, 1, 1, 0, 0},
	{0, 1, 1, 1, 1, 1, 0},
	{0, 1, 1, 3, 1, 1, 0},
	{0, 1, 1, 1, 1, 1, 0},
	{0, 0, 1, 1, 1, 0, 0},
	{0, 0, 0, 0, 0, 0, 0}
}

local area = createCombatArea(arr)
setCombatArea(combat, area)

function onTargetCreature(cid, target)
	if isPlayer(target) == 1 then
		local a = math.random(1,20)
		doPlayerRemoveMoney(target,a)
	end
end

setCombatCallback(combat, CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")

function onCastSpell(cid, var)

return doCombat(cid, combat, var)

end

I wrote that some month's ago (simply spell for monster like Bandit which robber players from they money). You can base at it to make Your own script.

Regards.
 
in onCastSpell you have to add vocation check.

like

Code:
if isInArray(getPlayerVocation(cid), {1,4,2,6}) == TRUE then
       return doCombat(cid, combat, var)
else
doPlayerSendTextMessage(cid, 22, "msg") or w/e it is called.
end
 
global.lua:
PHP:
function doVocationCombat(cid, vocs, combat, var)
	if isPlayer(cid) == TRUE then
		if isInArray(vocs, getPlayerVocation(cid)) == FALSE then
			-- doPlayerSendCancel(cid, "Your vocation can not use this rune.")
			return FALSE
		end
	end
	return doCombat(cid, combat, var)
end

script:
PHP:
local vocations = {2, 5, 6}
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_RED)

local condition = createConditionObject(CONDITION_PARALYZE)
setConditionParam(condition, CONDITION_PARAM_TICKS, 20000)
--setConditionParam(condition, CONDITION_PARAM_SPEED, -200)
setConditionFormula(condition, -0.9, 0, -0.9, 0)
setCombatCondition(combat, condition)

function onCastSpell(cid, var)
	return doVocationCombat(cid, vocations, combat, var)
end
 
Back
Top