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

How to use doRemoveCreature?

tatu hunter

Insane Mind~
Joined
Jun 6, 2007
Messages
354
Reaction score
23
Location
Itaporã, Brazil
I've made a script to players summon Monk Treiners...
I want the player cant summon other treiner until the first die...

Look what I have for now =S.
Code:
local vocations = {1,2,5,6}
local monsterStorage = 34165
function onSay(cid, words, param)
    if getPlayerStorageValue(cid,monsterStorage) == 1 then
        doRemoveCreature('Treiner Inicial')
        setPlayerStorageValue(cid, monsterStorage, -1)
    elseif getPlayerStorageValue(cid,monsterStorage) == 2 then
        doRemoveCreature('Treiner Intermedio')
        setPlayerStorageValue(cid, monsterStorage, -2)
    elseif getPlayerStorageValue(cid,monsterStorage) == 3 then
        doRemoveCreature('Treiner Avancado')
        setPlayerStorageValue(cid, monsterStorage, -3)
    elseif getPlayerStorageValue(cid,monsterStorage) == 4 then
        doRemoveCreature('Treiner Superior')
        setPlayerStorageValue(cid, monsterStorage, -4)
    elseif getPlayerStorageValue(cid,monsterStorage) == 5 then
        doRemoveCreature('Treiner Supremo')
        setPlayerStorageValue(cid, monsterStorage, -5)
    else
        if isInArray(vocations, getPlayerVocation(cid)) then    
            if getPlayerLevel(cid) > 20 and getPlayerLevel(cid) < 40 then
                local treiner = doSummonCreature("Treiner Inicial", getPlayerPosition(cid))
                doConvinceCreature(cid, treiner)
                setPlayerStorageValue(cid,monsterStorage,1)
            elseif getPlayerLevel(cid) > 40 and getPlayerLevel(cid) < 60 then
                local treiner = doSummonCreature("Treiner Intermedio", getPlayerPosition(cid))
                doConvinceCreature(cid, treiner)
                setPlayerStorageValue(cid,monsterStorage,2)
            elseif getPlayerLevel(cid) > 60 and getPlayerLevel(cid) < 80 then
                local treiner = doSummonCreature("Treiner Avancado", getPlayerPosition(cid))
                doConvinceCreature(cid, treiner)
                setPlayerStorageValue(cid,monsterStorage,3)
            elseif getPlayerLevel(cid) > 80 and getPlayerLevel(cid) < 100 then
                local treiner = doSummonCreature("Treiner Superior", getPlayerPosition(cid))
                doConvinceCreature(cid, treiner)
                setPlayerStorageValue(cid,monsterStorage,4)
            elseif getPlayerLevel(cid) > 100 then
                local treiner = doSummonCreature("Treiner Supremo", getPlayerPosition(cid))
                doConvinceCreature(cid, treiner)
                setPlayerStorageValue(cid,monsterStorage,5)
            end
        end
    end
end
and this part... I dont know if it is correct:
Code:
if isInArray(vocations, getPlayerVocation(cid)) then
How to remove the creature the player summoned?...
The command to summon is !summon.

Can someone help me here?
 
Code:
local vocations = {1,2,5,6}
local monsterStorage = 34165
function onSay(cid, words, param)
	local creature = getPlayerStorageValue(cid, monsterStorage)
	if(isCreature(creature) == TRUE) then
		doRemoveCreature(creature)
	elseif(isInArray(vocations, getPlayerVocation(cid)) then    
		local level, name = getPlayerLevel(cid)
		if(level >= 100) then
			name = "Treiner Supremo"
		elseif(level >= 80) then
			name = "Treiner Superior"
		elseif(level >= 60) then
			name = "Treiner Avancado"
		elseif(level >= 40) then
			name = "Treiner Intermedio"
		elseif(level >= 20) then
			name = "Treiner Inicial"
		else
			doPlayerSendCancel(cid, "You are too low.")
			return FALSE
		end
		local trainer = doSummonCreature(name, getPlayerPosition(cid))
		doConvinceCreature(cid, trainer)
		setPlayerStorageValue(cid, monsterStorage, trainer)
	end
	return FALSE
end

This should work as you wanted. But just a note: People could use this to block demons and stuff. It'll ruin your server. Obviously, you only allowed druids and sorcerers which are vocations that do not depend on training skills. My advice would be not to add this feature into your OTServ.
 
Last edited:
Thx Ispiro, I'll test it...
But I made a area non-pvp in my server, then I want to know if have a lua function to check if the tile is non-pvp...

my idea is if the tile is non-pvp the he can summon if no he cant...

I think u get my point.

thx again

edit...
You missed a " ) " in line 7
elseif(isInArray(vocations, getPlayerVocation(cid))) then
and the scripts works XD thx
 
Last edited:
Thx Ispiro, I'll test it...
But I made a area non-pvp in my server, then I want to know if have a lua function to check if the tile is non-pvp...

my idea is if the tile is non-pvp the he can summon if no he cant...

I think u get my point.

thx again

edit...
You missed a " ) " in line 7
and the scripts works XD thx
I think a function to check PZ would be getTilePzInfo(pos). But in this case, I don't think monsters would be able to move either(not sure if monsters can be summoned in PZ in the first place). The whole idea of players summoning trainers shouldn't be there. Because 1 way or another, it's still abusable. Trainers in a trainer's room would work perfectly fine. Unless there's another reason for the trainers, I still don't think this should be added in any server. That's just my opinion and I might not know exactly what you're trying to create. Sorry about the missing ")", didn't notice it while making the script.

I'm not sure how getTilePzInfo(pos) is used, but I believe it returns 1 if it's a PZ, 0 if not. That's just a guess.
 
hehe thx for your help but you dont understand what I want...
RME Map Editor have a function to make the tiles NON-PVP ZONE, and I want a function to check this tile if is non-pvp and not pz. I think now you understand ;P

I want a function like...
getTileNonPVP(pos)
 
hehe thx for your help but you dont understand what I want...
RME Map Editor have a function to make the tiles NON-PVP ZONE, and I want a function to check this tile if is non-pvp and not pz. I think now you understand ;P

I want a function like...
getTileNonPVP(pos)

Oh, I forgot about that. I don't think there's such a function yet :(
 
Back
Top