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

Utevo REs [Only 1 monster with same name]

WiLDTuRTLE

Member
Joined
Feb 26, 2011
Messages
478
Reaction score
5
So im trying to find a way to make my utevo res script, [normal one] to only summon one monster type, i mean, my druids can summon up to 3 summons, but they can't summon 2 fire elemental, but 1 fire element, 1 fire devil, 1 rat.
welp
 
No, I want them to be able to summon 3 monsters, but cant summon 2x the same.
sorry my english sucks lol i can't find the right words, ima give a try with google traduction lol.

-> the druid can not summon twice the same monster
 
Go to spells.xml, search for the line with the summon spell, change the event="function" to event="script", change the value to "summon.lua".
Now, go to spells/scripts, create a new lua file, name it "summon.lua" (without the quotation marks of course) and throw this script inside of it:
Lua:
function onCastSpell(cid, var)
    local maxsummons = xx -- change xx to the maximum number of summons a player may have at one time.
    local newsummon = variantToString(var)
    local summons, summonedcreaturenames = getCreatureSummons(cid), {}
	local pos = getThingPos(cid)
	local firstval = math.random(-2, 2)
    if((table.maxn(summons) > 0) and (isString(newsummon))) then
        for _, pid in ipairs(summons) do
        	local name = getCreatureName(pid)
			table.insert(summonedcreaturenames, name)
        end
    end
	if not table.find(summonedcreaturenames, newsummon) then
	    doConvinceCreature(cid, doCreateMonster(newsummon, getClosestFreeTile(cid, {x=pos.x+firstval,y=pos.y+firstval,z=pos.z}), false))
	elseif table.find(summonedcreaturenames, newsummon) then
	    doSendMagicEffect(pos, CONST_ME_POFF)
            doPlayerSendCancel(cid, "You may not summon two monsters of the same name.")
        elseif table.maxn(summonedcreaturenames) >= maxsummons then
	    doSendMagicEffect(pos, CONST_ME_POFF)
            doPlayerSendCancel(cid, "You may not summon more than ".. maxsummons .." summons at one time.")
	end
	return true
end
Enjoy. (I'll be here to help if anything goes wrong with this script, it's untested.)
 
Last edited:
Oh and by the way, my previous script will work the same for all vocations that are registered in the spells.xml part.
If you want me to limit it to Druids only, feel free to ask me to. (your request isn't exactly that obvious so I have to ask.)
 
312wzzt.png


<!-- Summon Spells -->
<instant name="Summon Creature" words="utevo res" lvl="25" params="1" exhaustion="1000" groups="3,1000" icon="9" needlearn="0" event="script" value="new/summon.lua">
<vocation id="2"/>
<vocation id="6"/>
</instant>

Monsters wont spawn
 
Last edited:
Yeah this is only doable in the sources. (Unless someone thinks it's funny to try and get every single value of mana and required level of every single summonable monster, and every single non-summonable monster in the "utevo res" spell... If that happens, I'll be glad to help you)
 
I can make it working and all but there would be a few problems. Here's a list:
1- You will have to make a list of all the monsters that cannot be summoned (I'll add a tutorial inside the script to help with this)
2- You will either make a constant mana value for all monsters that can be summoned, or make a list of mana values for every single summon-able monster. (I'll add a tutorial inside the script to help with the latter in case you want to do it)
3- It will NOT be a spell, it will be a talkaction. (Although players won't be capable of telling the difference, it will look exactly the same)

If you don't mind all of the aforementioned problems, I can gladly script this for you.
 
Here you go man. If you want it for everyone, instead of the paste in spells.cpp that is on that thread use this:

[cpp]
if(g_config.getBoolean(ConfigManager::SUMMON_LIMITER))
{
for (Creature* summon : player->getSummons())
{
std::string monsterName = param;
std::string newMonsterName = summon->getName();
boost::to_upper(newMonsterName);
boost::to_upper(monsterName);

if(newMonsterName == monsterName)
{
player->sendCancel("You can only summon one of each type of creature.");
g_game.addMagicEffect(player->getPosition(), NM_ME_POFF);
return false;
}
}
}
}
[/cpp]

Link To My Thread: http://otland.net/f35/limit-dupilicate-creature-summons-name-197114/
 
Here you go man. If you want it for everyone, instead of the paste in spells.cpp that is on that thread use this:

[cpp]
if(g_config.getBoolean(ConfigManager::SUMMON_LIMITER))
{
for (Creature* summon : player->getSummons())
{
std::string monsterName = param;
std::string newMonsterName = summon->getName();
boost::to_upper(newMonsterName);
boost::to_upper(monsterName);

if(newMonsterName == monsterName)
{
player->sendCancel("You can only summon one of each type of creature.");
g_game.addMagicEffect(player->getPosition(), NM_ME_POFF);
return false;
}
}
}
}
[/cpp]

Link To My Thread: http://otland.net/f35/limit-dupilicate-creature-summons-name-197114/
I can't see that thread apparently I don't have permission... Is there anyway I could get that information?
 
Back
Top