• 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!
  • If you're using Gesior 2012 or MyAAC, please review this thread for information about a serious security vulnerability and a fix.

Feature [TFS 1.3] Monster Levels

Kuantikum

Member
Joined
Jul 3, 2015
Messages
215
Solutions
1
Reaction score
19
code: aasfdfdasfdafdasf · Vulcanx/[email protected]

config.lua:
Lua:
monsterBonusHealth = 0.5
monsterBonusSpeed = 0.02
monsterBonusDamage = 0.02

how to add to monsters (monster xml file):
XML:
<level min="5" max="100" />

for tfs 1.2 users, configmanager is changed in 1.3, so ignore the configmanager.h and configmanager.cpp changes in the main post
instead, use these changes for configmanager in 1.2: as,d,JS<KjDDDD · Vulcanx/[email protected]



When a monster appears as level 10 for example, when you kill it, do you gain more EXP / loot than killing a level 5?
 

Joriku

Working in the mines, need something?
Joined
Jul 16, 2016
Messages
1,034
Solutions
15
Reaction score
327
Location
Sweden
YouTube
Joriku
How do I add a skull system Into this?
It's solved already or?
 

tuduras

Member
Joined
Jun 4, 2017
Messages
42
Solutions
1
Reaction score
5
data/events/events.xml
Code:
<event class="Player" method="onGainExperience" enabled="1" />
data/events/scripts/player.lua
Change or Add (idk. depends on your choice and reading of whole function etc.) in Player:eek:nGainExperience(source, exp, rawExp) function:
Code:
    if source:isMonster() and source:getLevel() > 0 then
    exp = (((exp * Game.getExperienceStage(self:getLevel()))/2) * source:getLevel())
    else
    exp = exp * Game.getExperienceStage(self:getLevel())
    end

It is possible to rewrite Code line
player.cpp ---->>
C++:
    g_events->eventPlayerOnGainExperience(this, source, exp, rawExp);
    if (exp == 0) {
        return;
    }


including ----->>

C++:
 if source:isMonster() and source:getLevel() > 0 then

    exp = (((exp * Game.getExperienceStage(self:getLevel()))/2) * source:getLevel())

    else

    exp = exp * Game.getExperienceStage(self:getLevel())

    end
 

Yan18

Member
Joined
Jun 14, 2014
Messages
104
Solutions
3
Reaction score
16
It works successfully in my TFS 1.3. But, after I add that system in my server, all monsters (same having tag hostile = 0 in xml) are hostile. Monsters like Rabbit for example, are attacking me.

How I fix this problem?
 
OP
OP
Infernum

Infernum

Senator
Joined
Feb 14, 2015
Messages
5,640
Solutions
559
Reaction score
3,916
It works successfully in my TFS 1.3. But, after I add that system in my server, all monsters (same having tag hostile = 0 in xml) are hostile. Monsters like Rabbit for example, are attacking me.

How I fix this problem?
you did something wrong or added something else other than this system
this code does not change any monster logic whatsoever, only multipliers to preexisting values
 

Yan18

Member
Joined
Jun 14, 2014
Messages
104
Solutions
3
Reaction score
16

Pox

Advanced OT User
Joined
Apr 28, 2020
Messages
163
Solutions
10
Reaction score
170
It is possible to rewrite Code line
player.cpp ---->>
C++:
    g_events->eventPlayerOnGainExperience(this, source, exp, rawExp);
    if (exp == 0) {
        return;
    }


including ----->>

C++:
 if source:isMonster() and source:getLevel() > 0 then

    exp = (((exp * Game.getExperienceStage(self:getLevel()))/2) * source:getLevel())

    else

    exp = exp * Game.getExperienceStage(self:getLevel())

    end

Yes
C++:
    const Monster* monster = source->getMonster();
    if (monster && monster->getLevel() > 0){
        exp += (exp * 0.08) * monster->getLevel();
    }
    g_events->eventPlayerOnGainExperience(this, source, exp, rawExp);
    if (exp == 0) {
        return;
    }
 
Last edited:

Mr Noxi

Noxus Otserver
Premium User
Joined
May 13, 2010
Messages
273
Solutions
3
Reaction score
93
Location
Sweden
@Infernum Wanna lend a hand to maybe understand what am missing out? Put all the added and removed the xtra lines and when am compiling i get this?
1611587152594.png
 

GuidedCheater

New Member
Joined
Jan 19, 2021
Messages
14
Reaction score
2
edit Monster::Monster() constructor in monster.cpp and set skull to w/e you like based on level
 

Rodrigo13

New Member
Joined
Jul 2, 2008
Messages
12
Reaction score
2
Any idea how to modify the "place monster" command to create monster with a specific level?
 

Pox

Advanced OT User
Joined
Apr 28, 2020
Messages
163
Solutions
10
Reaction score
170
Any idea how to modify the "place monster" command to create monster with a specific level?

I wrote a separate placeCreature with level function:

C++:
bool Game::placeCreatureWithLevel(Creature* creature, const Position& pos, bool extendedPos /*=false*/, bool forced /*= false*/, int32_t level)
{
    if (!internalPlaceCreature(creature, pos, extendedPos, forced)) {
        return false;
    }

    creature->setMonsterLevel(level);

    SpectatorVec spectators;
    map.getSpectators(spectators, creature->getPosition(), true);
    for (Creature* spectator : spectators) {
        if (Player* tmpPlayer = spectator->getPlayer()) {
            tmpPlayer->sendCreatureAppear(creature, creature->getPosition(), true);
        }
    }

    for (Creature* spectator : spectators) {
        spectator->onCreatureAppear(creature, true);
    }

    creature->getParent()->postAddNotification(creature, nullptr, 0);

    addCreatureCheck(creature);
    creature->onPlacedCreature();
    return true;
}
 
Top