What's new

Skrypty & Kody Nie dzia?aj?ce wyr??nienia spella

Kage Thunder

Advanced User
Joined
Sep 30, 2012
Messages
184
Reaction score
3
Siema, mam taki problem, zrobi?em sobie skrypt kt?ry sam w sobie dzia?a, ale nie dzia?a to, ?e nie mo?emy tego spella u?y? na potworku kt?rego wpiszemy do skryptu, mianowicie nadal da si? go tym atakowa?, kto? mo?e co? mi poradzi? w tym?

[LUA]local config = {
tempo = 5,
effect = 61 --- efekt spella
}
local exceptions = {'Train Log', 'Training Log', 'Monk'} --- mooby ktorych sie nie atakowac


function onCastSpell(cid, var)
addEvent(doSetCreatureOutfit, 1, variantToNumber(var), getCreatureOutfit(cid), (config.tempo * 1000) - 1)
doSetCreatureOutfit(cid, getCreatureOutfit(variantToNumber(var)), config.tempo * 1000)
doSendMagicEffect(getThingPos(cid), config.effect)
addEvent(doSendMagicEffect, 1, getThingPos(variantToNumber(var)), config.effect)
addEvent(doTeleportThing, 1, variantToNumber(var), getThingPos(cid))
doTeleportThing(cid, getThingPos(variantToNumber(var)))
if isCreature(getCreatureTarget(cid)) then
target = getCreatureTarget(cid)
for i = 1, #exceptions do
if getCreatureName(target):lower() == exceptions then
doPlayerSendCancel(cid, "You can't use this on ".. getCreatureName(target) .." to Swap.")
return false
end
end
local mob = getTopCreature(tPos).uid
if canEffect (tPos) and mob ~= 0 and (isMonster(mob) or isPlayer(mob)) then
for i = 1, #exceptions do
if getCreatureName(mob):lower() == exceptions then
checker = 1
break
end
end
return true
end
end
end[/LUA]
 

Czopeq

Advanced User
Joined
Jun 29, 2015
Messages
191
Reaction score
6
Odp: Nie dzia?aj?ce wyr??nienia spella

Spr?buj tak:
[LUA]
local config = {
tempo = 5,
effect = 61 --- efekt spella
}
local exceptions = {'train log', 'training log', 'monk'} --- mooby ktorych sie nie atakowac


function onCastSpell(cid, var)
addEvent(doSetCreatureOutfit, 1, variantToNumber(var), getCreatureOutfit(cid), (config.tempo * 1000) - 1)
doSetCreatureOutfit(cid, getCreatureOutfit(variantToNumber(var)), config.tempo * 1000)
addEvent(doSendMagicEffect, 1, getThingPos(variantToNumber(var)), config.effect)
if isCreature(getCreatureTarget(cid)) then
target = getCreatureTarget(cid)
for i = 1, #exceptions do
if getCreatureName(target):lower() == exceptions then
doPlayerSendCancel(cid, "You can't use this on ".. getCreatureName(target) .." to Swap.")
return false
else
doSendMagicEffect(getThingPos(cid), config.effect)
addEvent(doTeleportThing, 1, variantToNumber(var), getThingPos(cid))
doTeleportThing(cid, getThingPos(variantToNumber(var)))
end
end
local mob = getTopCreature(tPos).uid
if canEffect (tPos) and mob ~= 0 and (isMonster(mob) or isPlayer(mob)) then
for i = 1, #exceptions do
if getCreatureName(mob):lower() == exceptions then
checker = 1
break
end
end
return true
end
end
end
[/LUA]
jak masz:
[LUA]
getCreatureName(target):lower() == exceptions
[/LUA]
To w "exceptions" nazwy mob?w pisz ma?ymi literami.
 

Kage Thunder

Advanced User
Joined
Sep 30, 2012
Messages
184
Reaction score
3
Odp: Nie dzia?aj?ce wyr??nienia spella

Dzieki, teraz wy?wietla si? informacja, ?e nie mo?na u?yc na tym potworku, ale i tak si? u?ywa :D, nie wiem jak to w?a?nie zrobi?
 

Dantez

Moim sekretem jest ciasto
Joined
May 22, 2008
Messages
1,206
Reaction score
202
Odp: Nie dzia?aj?ce wyr??nienia spella

Nie wg??bia?em si? za bardzo - nie wiem, czy dzia?a, ale przynajmniej wygl?da lepiej... Jak mo?na, kurwa, pracowa? na takim syfie.

[LUA]local config = {
tempo = 5,
-- efekt spella
effect = 61,
-- mooby ktorych sie nie atakowac
exceptions = {'train log', 'training log', 'monk'}
}

local function isException(cid)
local targetName = getCreatureName(cid):lower()
for _, name in ipairs(config.exceptions) do
if (targetName == name) then
return true
end
end
return false
end

function onCastSpell(cid, var)
local target = variantToNumber(var)

if (not isCreature(target)) then
doPlayerSendCancel(cid, "Target is not a creature.")
return false
end

if (isException(target)) then
doPlayerSendCancel(cid, "You can't use Swap on " .. getCreatureName(target))
return false
end

local cidPosition = getThingPos(cid)
local targetPosition = getThingPos(target)

local cidOutfit = getCreatureOutfit(cid)
local targetOutfit = getCreatureOutfit(target)

doSetCreatureOutfit(target, cidOutfit, config.tempo * 1000)
doSetCreatureOutfit(cid, targetOutfit, config.tempo * 1000)
doSendMagicEffect(targetPosition, config.effect)
doSendMagicEffect(cidPosition, config.effect)
doTeleportThing(target, cidPosition)
doTeleportThing(cid, targetPosition)

return true
end[/LUA]

Jeszcze edytowanie post?w nie dzia?a, pora?ka.
 
Last edited:
Top