• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Feature Vocations.xml mod, set different amount of summons for each vocation.

ArkSeyonet

Chancho
Joined
Nov 11, 2008
Messages
201
Reaction score
11
Okay I have finally finished the system I wanted to use, and now you can set the amount of summons a player can have individually based on his/her vocation. For example, you can make it where a sorcerer can summon two monsters, and a druid can only summon one. You can also create custom classes that can summon different numbers of monsters.

1. spells.cpp

Find:
Code:
    if (player->getSummonCount() >= 2) {
       player->sendCancel("You cannot summon more creatures.");
       g_game.addMagicEffect(player->getPosition(), NM_ME_POFF);
       return false;
     }

Replace it with:
Code:
    if (player->getSummonCount() >= player->getMaxSummons()) {
       player->sendCancel("You cannot summon more creatures.");
       g_game.addMagicEffect(player->getPosition(), NM_ME_POFF);
       return false;
     }

---------------------------------------------------------------------------------

2. vocations.h

Find:
Code:
uint32_t getCapGain() const {
     return gainCap;
}

After it paste:
Code:
uint32_t getMaxSummons() const {
     return maxSummons;
}

Find:
Code:
uint32_t gainCap;

After it paste:
Code:
uint32_t maxSummons;

---------------------------------------------------------------------------------

3. vocations.cpp

Find:
Code:
          if (readXMLInteger(p, "gaincap", intVal)) {
             voc->gainCap = intVal;
           }

After it paste:
Code:
if(readXMLInteger(p, "maxsummons", intVal)) {
     voc->maxSummons = intVal;
}

Find:
Code:
gainCap = 5;

After it paste:
Code:
maxSummons = 2;

---------------------------------------------------------------------------------

4. player.h

Find:
Code:
    Vocation* getVocation() const {
       return vocation;
     }

After it paste:
Code:
uint32_t getMaxSummons() const {
     return vocation->getMaxSummons();
}

---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------

Now go into data/xml and open vocations.xml!
You must add maxsummons="0" after gaincap="0"
Example vocations.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<vocations>
<vocation id="0" clientid="0" name="None" description="none" gaincap="10" maxsummons="2" gainhp="5" gainmana="5" gainhpticks="6" gainhpamount="1" gainmanaticks="6" gainmanaamount="1" manamultiplier="4.0" attackspeed="2000" basespeed="220" soulmax="100" gainsoulticks="120" fromvoc="0">
<formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0"/>
<skill id="0" multiplier="1.5"/>
<skill id="1" multiplier="2.0"/>
<skill id="2" multiplier="2.0"/>
<skill id="3" multiplier="2.0"/>
<skill id="4" multiplier="2.0"/>
<skill id="5" multiplier="1.5"/>
<skill id="6" multiplier="1.1"/>
</vocation>
<vocation id="1" clientid="3" name="Sorcerer" description="a sorcerer" gaincap="10" maxsummons="2" gainhp="5" gainmana="30" gainhpticks="6" gainhpamount="5" gainmanaticks="3" gainmanaamount="5" manamultiplier="1.1" attackspeed="2000" basespeed="220" soulmax="100" gainsoulticks="120" fromvoc="1">
<formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0"/>
<skill id="0" multiplier="1.5"/>
<skill id="1" multiplier="2.0"/>
<skill id="2" multiplier="2.0"/>
<skill id="3" multiplier="2.0"/>
<skill id="4" multiplier="2.0"/>
<skill id="5" multiplier="1.5"/>
<skill id="6" multiplier="1.1"/>
</vocation>
<vocation id="2" clientid="4" name="Druid" description="a druid" gaincap="10" maxsummons="2" gainhp="5" gainmana="30" gainhpticks="6" gainhpamount="5" gainmanaticks="3" gainmanaamount="5" manamultiplier="1.1" attackspeed="2000" basespeed="220" soulmax="100" gainsoulticks="120" fromvoc="2">
<formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0"/>
<skill id="0" multiplier="1.5"/>
<skill id="1" multiplier="1.8"/>
<skill id="2" multiplier="1.8"/>
<skill id="3" multiplier="1.8"/>
<skill id="4" multiplier="1.8"/>
<skill id="5" multiplier="1.5"/>
<skill id="6" multiplier="1.1"/>
</vocation>
<vocation id="3" clientid="2" name="Paladin" description="a paladin" gaincap="20" maxsummons="0" gainhp="10" gainmana="15" gainhpticks="4" gainhpamount="5" gainmanaticks="4" gainmanaamount="5" manamultiplier="1.4" attackspeed="2000" basespeed="220" soulmax="100" gainsoulticks="120" fromvoc="3">
<formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0"/>
<skill id="0" multiplier="1.2"/>
<skill id="1" multiplier="1.2"/>
<skill id="2" multiplier="1.2"/>
<skill id="3" multiplier="1.2"/>
<skill id="4" multiplier="1.1"/>
<skill id="5" multiplier="1.1"/>
<skill id="6" multiplier="1.1"/>
</vocation>
<vocation id="4" clientid="1" name="Knight" description="a knight" gaincap="25" maxsummons="0" gainhp="15" gainmana="5" gainhpticks="3" gainhpamount="5" gainmanaticks="6" gainmanaamount="5" manamultiplier="3.0" attackspeed="2000" basespeed="220" soulmax="100" gainsoulticks="120" fromvoc="4">
<formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0"/>
<skill id="0" multiplier="1.1"/>
<skill id="1" multiplier="1.1"/>
<skill id="2" multiplier="1.1"/>
<skill id="3" multiplier="1.1"/>
<skill id="4" multiplier="1.4"/>
<skill id="5" multiplier="1.1"/>
<skill id="6" multiplier="1.1"/>
</vocation>
<vocation id="5" clientid="3" name="Master Sorcerer" description="a master sorcerer" gaincap="10" maxsummons="2" gainhp="5" gainmana="30" gainhpticks="4" gainhpamount="10" gainmanaticks="2" gainmanaamount="10" manamultiplier="1.1" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="1">
<formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0"/>
<skill id="0" multiplier="1.5"/>
<skill id="1" multiplier="2.0"/>
<skill id="2" multiplier="2.0"/>
<skill id="3" multiplier="2.0"/>
<skill id="4" multiplier="2.0"/>
<skill id="5" multiplier="1.5"/>
<skill id="6" multiplier="1.1"/>
</vocation>
<vocation id="6" clientid="4" name="Elder Druid" description="an elder druid" gaincap="10" maxsummons="2" gainhp="5" gainmana="30" gainhpticks="4" gainhpamount="10" gainmanaticks="2" gainmanaamount="10" manamultiplier="1.1" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="2">
<formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0"/>
<skill id="0" multiplier="1.5"/>
<skill id="1" multiplier="1.8"/>
<skill id="2" multiplier="1.8"/>
<skill id="3" multiplier="1.8"/>
<skill id="4" multiplier="1.8"/>
<skill id="5" multiplier="1.5"/>
<skill id="6" multiplier="1.1"/>
</vocation>
<vocation id="7" clientid="2" name="Royal Paladin" description="a royal paladin" gaincap="20" maxsummons="0" gainhp="10" gainmana="15" gainhpticks="3" gainhpamount="10" gainmanaticks="3" gainmanaamount="10" manamultiplier="1.4" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="3">
<formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0"/>
<skill id="0" multiplier="1.2"/>
<skill id="1" multiplier="1.2"/>
<skill id="2" multiplier="1.2"/>
<skill id="3" multiplier="1.2"/>
<skill id="4" multiplier="1.1"/>
<skill id="5" multiplier="1.1"/>
<skill id="6" multiplier="1.1"/>
</vocation>
<vocation id="8" clientid="1" name="Elite Knight" description="an elite knight" gaincap="25" maxsummons="0" gainhp="15" gainmana="5" gainhpticks="2" gainhpamount="10" gainmanaticks="4" gainmanaamount="10" manamultiplier="3.0" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="4">
<formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0"/>
<skill id="0" multiplier="1.1"/>
<skill id="1" multiplier="1.1"/>
<skill id="2" multiplier="1.1"/>
<skill id="3" multiplier="1.1"/>
<skill id="4" multiplier="1.4"/>
<skill id="5" multiplier="1.1"/>
<skill id="6" multiplier="1.1"/>
</vocation>
</vocations>

---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------

Well there you go. I hope everyone enjoys, and I tested this on TFS 0.4.5972
 
Last edited:
Simple, yet useful for whoever may need this or use this as a "guide" to do something else other than summons.
It's great to see someone contribute to the OpenTibia community.

Great work ArkSeyonet! Hopefully you have more in the store to share.
 
Thank you for the comment and appreciation Evan, it means a lot. I didn't really look at it as a good starting point, but now that you mention it, it is a great idea to use it to learn to do other things with for other members. :)

I have updated the thread formatting to fit the new website.
 
I won't use it, but it's a nice thing to have for custom servers. Here, have my like! :)
 
Honestly,

It would be possible with enough coding, but would be completely different than any of this code.
You would have better luck trying to edit playerdeath.lua and script it to check which vocation you are when you die, and provide you with a corpse that is fitting to that vocation.
 
Looks like this inclusion is useless, you have not used any of it's functionality. :p

Yeah, I forgot to remove that part from when I converted my old thread code into the new one. :p

Thanks for pointing that out.
 
This is awesome! Thank you for releasing, my sources were slightly different but I got what you were doing and modified it so it works with my sources... Thanks man its truly awesome, now if you could please help with maybe adding in... "doPlayerSetMaxSummon" or "doPlayerAddMaxSummon" that would be awesome for my summoner class to be able to have its summons increased by certain eq or wands....
 
He told you where to put everything, just do as he said and try to compile, if it fails, post the error here...
 
in 0.3.6pl no lines because some functions are transmitted directly to the configmanager.cpp type if ((int32_t) player-> getSummonCount ()> = g_config.getNumber (ConfigManager :: MAX_PLAYER_SUMMONS))
 
in 0.3.6pl no lines because some functions are transmitted directly to the configmanager.cpp type if ((int32_t) player-> getSummonCount ()> = g_config.getNumber (ConfigManager :: MAX_PLAYER_SUMMONS))

Replace
Code:
   >= g_config.getNumber (ConfigManager :: MAX_PLAYER_SUMMONS))

with
Code:
 >= player->getMaxSummons())
 
Well I apprecaite that you guys liked the code, but unfortunately Im really out of scripting and coding again. Sorry, and I wish everyone the best.
 
Back
Top