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

Searching a function like: doSummonMonster

Summ

(\/)(;,,;)(\/) Y not?
Staff member
Global Moderator
Joined
Oct 15, 2008
Messages
4,152
Solutions
12
Reaction score
1,107
Location
Germany :O
Hello
I am doing a script and I need a function like doSummonMonster(cid,name), but there should be a option to tell where it should be summoned..

It should spawn on the next position to me. It should on a position I can edit. -> pos = {x=0,y=0,z=0} like this just with a pos..

Btw.
How does this function work? Please an example..
doMonsterSetTarget(cid,target)
 
Well Zonet, there is no cid in the parameters list of these functions.

I want it to create a summon which belongs to a player and it should spawn on the position I choose..

How is the name of the function with which I can make a monster attack another one or a summon?
 
Last edited:
Code:
function doPlayerAddSummon(cid, name, pos)  
    local MyCreature = doSummonCreature(name, pos)  
    doConvinceCreature(cid, MyCreature)
end

function onSay(cid, words, param, channel)
local summons = getCreatureSummons(cid)
local level = 30
local mana = 200
local vocsCanUse = {1, 2, 3, 4, 5, 6, 7,8}
local canBeSummoned = {"Dog", "Troll", "Bug", "Fire Devil", "Fire Elemental"}


if(table.maxn(summons) >= 2) then
                        doPlayerSendCancel(cid, "You may not summon more than 2 creatures.")
                return TRUE
        end

if getPlayerLevel(cid) < level then
                doPlayerSendCancel(cid, "Your level is too low.")
                return TRUE
        end


if getCreatureMana(cid) < mana then
                doPlayerSendCancel(cid, "You do not have enough mana.")
                return TRUE
        end
        
if(not isInArray(vocsCanUse, getPlayerVocation(cid))) then
                doPlayerSendCancel(cid, "Your vocation cannot use this spell.")
                return TRUE
        end
        
if(not isInArray(canBeSummoned, param)) then
                doPlayerSendCancel(cid, "You cannot summon this creature.")
                return TRUE
        end
        
        
doPlayerAddSummon(cid, param, getCreaturePosition(cid))
          doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_RED)
        return TRUE
end
 
Thanks Chris.

I just got one question.
I had the same idea to covince the monster, after creating, but doesn't the monster need to be convinceable??

Because I want it to be possible with all monsters.
 
Is there a posibility to make the summoned monster (and convinced) make attack another summoned monster?

setMonsterTarget or smth?

There is such a function?
 
Hello
I got another problem now and I have 2 questions about it.
In my script there is a line like this:
Code:
monster = doSummonMonster(cid,"Demon")
doMonsterSetTarget(getplayer[2].uid, monster.uid)

-> getplayer[2].uid is another player, and the script also gets him and monster.uid should be the summoned monster.

Now my questions.
1. I need to set the player as "cid" (doMonsterSetTarget(cid,target)) or the creature wich should attack? -
I used the player (getplayer[2].uid)
2. Why the script doesn't get the monster.uid?
It says:
Code:
Lua Script Error: [Action Interface]
data/actions/scripts/new/monsterfight.lua:onUse

data/actions/scripts/new/monsterfight.lua:48: attempt to index global 'monster' (a number value)
stack traceback:
        data/actions/scripts/new/monsterfight.lua:48: in function <data/actions/scripts/new/script.lua:1>

Line 48 is this:
Code:
doMonsterSetTarget(getplayer[2].uid, monster.uid)

Another question:
getCreatureSummons(cid) returns a table with the summons. How can I get the uid of the summons, because doesn't it just return the names of the summons a player got?
 
I got a script like this and I want the demons to attack each other and it should work, but I get an error in console and I don't know whats wrong.
Code:
m1 = doSummonMonster(player1.uid, "Demon")
m2 = doSummonMonster(player2.uid, "Demon")
doMonsterSetTarget(m1.uid, m2.uid)
doMonsterSetTarget(m2.uid, m1.uid)
 
I wont be able to help on the code but i can tell you a day ago I summoned a creature from a spell and if it was not convisable and it went around and killed me...twice.
 
Back
Top