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

TFS 1.2 Kill monster get 1 soul

Register onKill event and add player a soul point upon kill below max vocation soul points.

what you talking about? Register what? and what the point of increase max vocation soul points its by default at 100

Let me translate for you:

register the "onKill event"

add ONE soul point when you kill a monster IF and ONLY IF the vocations soul point LIMIT is not FULL already.
 
?
Lua:
if isMonster(target) then
        doPlayerAddSoul(cid, 1)
Lua:
if monster is target then
    if player has less than his max soul points then
        add player 1 soul point
    end
end

Lua:
local soul = 1
function onKill(player, target)
     local monster = target:getName():lower()
     if target:isPlayer() or not monster or target:getMaster() then
         return true
     end
     if monster == 'yalahari' then -- monsterName
     local pos = player:getPosition()
            player:addSoul(soul)
            pos:sendMagicEffect(225)
    end
     return true
end
Why are you checking if target Has name?

@Lopaskurwa

Lua:
function onKill(player, target)
    if target:isPlayer() or target:getMaster() then
        return true
    end
    
    if player:getSoul() < player:getMaxSoul() then
        player:addSoul(1)   
    end

    return true
end

login:
Code:
player:registerEvent("SoulMonster")

xml:
XML:
<event type="kill" name="SoulMonster" script="file_name.lua"/>
 
I dont think he want to get soul for every single monster? :eek:
No im looking for every single monster so its okay to check all monsters. And to check few monsters it would be a mess in the code tbh.

Why are you checking if target Has name?

@Lopaskurwa

Lua:
function onKill(player, target)
    if target:isPlayer() or target:getMaster() then
        return true
    end
  
    if player:getSoul() < player:getMaxSoul() then
        player:addSoul(1) 
    end

    return true
end

login:
Code:
player:registerEvent("SoulMonster")

xml:
XML:
<event type="kill" name="SoulMonster" script="file_name.lua"/>
Note tested your script it doesnt work. No errors tho, everything is registered how it should.

It should work but not as God char
tested without god char
 
Try with 200 then instead of player:getMaxSoul()
what you mean try with 200 how could it change anything. Proable something is f up with if target:isPlayer() or target:getMaster() then

Try to remove this part and see if it works
Lua:
if target:isPlayer() or target:getMaster() then
        return true
    end
 
Hi, i went off for almost 7 years and i forgot alot of things about scripting..
Could anyone tell me how to make it work only for premium accounts (tfs1.3)

I know its for 1.2 but i think it would be annoying creating a thread about it..
Thanks in advance.
 
can somebody help me? revscripts tfs 1.5 scripts is not giving error and not working
Lua:
local killevent = CreatureEvent("PVP Reward2")

function killevent.onKill(player, target)

      -- Let's make sure non-viable players can't generate a reward
    local player = creature:getPlayer()
    if player:hasFlag(PlayerFlag_NotGenerateLoot) or player:getVocation():getId() == VOCATION_NONE then
        return false
    end

    local master = killer:getMaster()
    -- If the killer is a player the killer should get rewarded (duh?)
    if killer:isPlayer() then
        master:addSoul(2)   
 return true
    -- When a player's summon kills another player the summoner should get rewarded (master = summoner, we defined it above)
    elseif killer:isMonster() and master:isPlayer() then
        master:addsoul(2)
        return true
    end
    -- If none of these are met, there will be no reward
    return false
end

killevent:register()

local login = CreatureEvent("PVP Reward2")

function login.onLogin(player)
    player:registerEvent("PVP Reward2")
    return true
end
 
Back
Top