• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua Monk train skill to everybody around

caquinha

Member
Joined
Aug 8, 2016
Messages
248
Solutions
1
Reaction score
24
I saw a idea on forum to monks train shield for all around it...

I tryed to help the guys and make it to mee too xD
But not work...
Show me this error when start the server:
Code:
[6:30:13.889] [Warning - Monsters::deserializeSpell] Monk - Unknown shootEffect: physical
[6:30:13.889] [Warning - Monsters::deserializeSpell] Monk - Unknown areaEffect: 14

Anyone could help me to fix it?

Monk.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<monster name="Monk" nameDescription="a monk" race="blood" experience="200" speed="200" manacost="600">
   <health now="240" max="240"/>
   <look type="57" corpse="6080"/>
   <targetchange interval="4000" chance="10"/>
   <flags>
       <flag summonable="1"/>
       <flag attackable="1"/>
       <flag hostile="1"/>
       <flag illusionable="1"/>
       <flag convinceable="0"/>
       <flag pushable="0"/>
       <flag canpushitems="1"/>
       <flag canpushcreatures="1"/>
       <flag targetdistance="1"/>
       <flag staticattack="90"/>
       <flag runonhealth="0"/>
   </flags>
   <attacks>
       <attack name="melee" interval="2000" skill="5" attack="10"/>
       <attack name="physical" interval="2000" chance="50" range="1" radius="2" target="1" min="0" max="0">
           <attribute key="shootEffect" value="physical"/>
           <attribute key="areaEffect" value="14"/>
       </attack>
   </attacks>
   <defenses armor="30" defense="30">
       <defense name="healing" interval="500" chance="15" min="30" max="50">
           <attribute key="areaEffect" value="blueshimmer"/>
       </defense>
       <defense name="speed" interval="2000" chance="15" speedchange="300" duration="5000">
           <attribute key="areaEffect" value="redshimmer"/>
       </defense>
   </defenses>
   <elements>
       <element holyPercent="50"/>
       <element deathPercent="50"/>
       <element physicalPercent="-10"/>
   </elements>
   <immunities>
       <immunity invisible="1"/>
   </immunities>
   <voices interval="5000" chance="10">
       <voice sentence="Repent Heretic!"/>
       <voice sentence="A prayer to the almighty one!"/>
       <voice sentence="I will punish the sinners!"/>
   </voices>
   <loot>
       <item id="2148" countmax="18" chance="15000"/><!-- gold coin -->
       <item id="2689" chance="20000"/><!-- bread -->
       <item id="1949" chance="2000"/><!-- scroll -->
       <item id="2044" chance="880"/><!-- lamp -->
       <item id="10563" chance="4930"/><!-- Book of Prayers -->
       <item id="2015" chance="820"/><!-- brown flask -->
       <item id="12448" chance="2950"/><!-- rope belt -->
       <item id="12449" chance="1001"/><!-- safety pins -->
       <item id="2401" chance="440"/><!-- staff -->
       <item id="2177" chance="1002"/><!-- life crystal -->
       <item id="2193" chance="2240"/><!-- ankh -->
       <item id="2166" chance="100"/><!-- power ring -->
   </loot>
</monster>
 
Ty you a lot guys

But not working yet,
when i invite party show me this:
Code:
doPlayerSendTextMessage(targets[i], 20, "You need to join a party with owner of Monk to train shield.")

Else, nothing happen
Cuz of you I had to open OTS and check it step by step.
Here you are, tested and working:

Ofc, if someone from your party enters the area of your monk, your mage MAY get combat, but NEVER skull.
Code:
local config = {
    range = 2 -- 1 means square 3x3 like exori, 2 means square 5x5, 3 means square 7x7
}

function onCastSpell(cid, var)
    local leader = getPartyLeader(getCreatureMaster(cid))
    local targets = getSpectators(getCreaturePosition(cid), config.range, config.range, false)
    if targets ~= nil then
        doCreatureSay(cid, "Targets=" ..(#targets)..", leader=" ..leader.. ", cid=" ..cid, 1)
        for i = 1, #targets do
            if isPlayer(targets[i]) == true and targets[i] ~= cid then
                if leader ~= 0 and leader == getPartyLeader(targets[i]) then
                    doPlayerAddSkillTry(targets[i], 5, 1)
                end
            end
        end
    end
    return true
end

.

Simple lesson:

To solve things like this I'm using:
Code:
doCreatureSay(cid, "Targets=" ..(#targets)..", leader=" ..leader.. ", cid=" ..cid, 1)
Put it after
Code:
if targets ~= nil then
And it will show you the magic :), try it yourself in your other scripts. This thing will help you solve many issues.
Ex.
Code:
doCreatureSay(cid, "Cid have number " ..cid.. " right now.", 1)
or
print("Cid have number " ..cid.. " right now.") -- this will show the magic in the console.
 
Last edited:
Cuz of you I had to open OTS and check it step by step.
Here you are, tested and working:

Ofc, if someone from your party enters the area of your monk, your mage MAY get combat, but NEVER skull.
Code:
local config = {
    range = 2 -- 1 means square 3x3 like exori, 2 means square 5x5, 3 means square 7x7
}

function onCastSpell(cid, var)
    local leader = getPartyLeader(getCreatureMaster(cid))
    local targets = getSpectators(getCreaturePosition(cid), config.range, config.range, false)
    if targets ~= nil then
        doCreatureSay(cid, "Targets=" ..(#targets)..", leader=" ..leader.. ", cid=" ..cid, 1)
        for i = 1, #targets do
            if isPlayer(targets[i]) == true and targets[i] ~= cid then
                if leader ~= 0 and leader == getPartyLeader(targets[i]) then
                    doPlayerAddSkillTry(targets[i], 5, 1)
                end
            end
        end
    end
    return true
end

.

Simple lesson:

To solve things like this I'm using:
Code:
doCreatureSay(cid, "Targets=" ..(#targets)..", leader=" ..leader.. ", cid=" ..cid, 1)
Put it after
Code:
if targets ~= nil then
And it will show you the magic :), try it yourself in your other scripts. This thing will help you solve many issues.
Ex.
Code:
doCreatureSay(cid, "Cid have number " ..cid.. " right now.", 1)
or
print("Cid have number " ..cid.. " right now.") -- this will show the magic in the console.

PERFECT! THANK YOU SO MUCH!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
Back
Top