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

Soul?

Ninja Bodil

New Member
Joined
Mar 7, 2009
Messages
116
Reaction score
0
Where do i change settings for soul like:
Maximum amount of soul.
Disable to get soul by killing monsters.
Get 1 soul point every minute.

Please help
I rep++
^_^
 
Code:
function onThink(interval, lastExecution, thinkInterval)
for p = 5, 8 do
    if getPlayerVocation(cid) == p then
        if getPlayerSoul(cid) <= 199 then
            for _, cid in ipairs(getOnlinePlayers()) do
                doPlayerAddSoul(cid, 1)
            end
        end
    end
    if getPlayerVocation(cid) <= 4 then
        if getPlayerSoul(cid) <= 99 then
            for _, cid in ipairs(getOnlinePlayers()) do
                doPlayerAddSoul(cid, 1)
            end
        end
    end
    return TRUE
end
then just put in globalevents.xml - interval="60"
 
@up
lol.. You use cid where you don't even have cid, also why you loop for vocations 5,8 ?
Also there is 1 end to less..

Try mine:
PHP:
local vocations,max_soul = {{1,2,3,4},{5,6,7,8}},{100,200}
function onThink(interval, lastExecution, thinkInterval)
    for _, cid in ipairs(getPlayersOnline()) do
        local maxsoul = isInArray(vocations[1],getPlayerVocation(cid)) and max_soul[1] or max_soul[2]
        if getPlayerSoul(cid) < maxsoul then
            doPlayerAddSoul(cid, 1)
        end
    end
    return TRUE
end

//Edit:

I think you can disable soul gain changing this:
Go to data/XML/vocations.xml and replace every gainsoulticks="120" and gainsoulticks="15" with gainsoulticks="0"
 
Last edited:
@up
[16/05/2010 19:10:50] [Error - GlobalEvent Interface]
[16/05/2010 19:10:50] data/globalevents/scripts/soul.lua onThink
[16/05/2010 19:10:50] Description:
[16/05/2010 19:10:50] data/globalevents/scripts/soul.lua:5: attempt to compare boolean with number
[16/05/2010 19:10:50] stack traceback:
[16/05/2010 19:10:50] data/globalevents/scripts/soul.lua:5: in function <data/globalevents/scripts/soul.lua:2>
[16/05/2010 19:10:50] [Error - GlobalEvents::think] Couldn't execute event: soul
 
Ye sorry, used wrong function for online players..
Edited my post. It works now..
 
Well it was just a assumption that it could work. I guess you will need source edit to remove normal soul gain.

Or you could try to set gainsoulticks="-1"
 
You can try to put -1 there as I told up or edit the sources..

Source Edit -> open player.cpp and search this part:
Code:
bool Player::gainExperience(double& gainExp, bool fromMonster)
{
	if(!rateExperience(gainExp, fromMonster))
		return false;

	//soul regeneration
	if(gainExp >= level)
	{
		if(Condition* condition = Condition::createCondition(
			CONDITIONID_DEFAULT, CONDITION_SOUL, 4 * 60 * 1000))
		{
			condition->setParam(CONDITIONPARAM_SOULGAIN,
				vocation->getGainAmount(GAIN_SOUL));
			condition->setParam(CONDITIONPARAM_SOULTICKS,
				(vocation->getGainTicks(GAIN_SOUL) * 1000));
			addCondition(condition);
		}
	}

	addExperience((uint64_t)gainExp);
	return true;
}

and replace it with that:
Code:
bool Player::gainExperience(double& gainExp, bool fromMonster)
{
	if(!rateExperience(gainExp, fromMonster))
		return false;

	addExperience((uint64_t)gainExp);
	return true;
}

and then compile your server..
 
Back
Top