Lopaskurwa
Well-Known Member
- Joined
- Oct 6, 2017
- Messages
- 914
- Solutions
- 2
- Reaction score
- 50
How can i activate when you kill 1 monster you get 1 soul?
what you talking about? Register what? and whats the point of increase max vocation soul points its by default at 100Register onKill event and add player a soul point upon kill below max vocation soul points.
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
what you talking about? Register what?
?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.
if isMonster(target) then
doPlayerAddSoul(cid, 1)
?
LUA:if isMonster(target) then doPlayerAddSoul(cid, 1)
if monster is target then
if player has less than his max soul points then
add player 1 soul point
end
end
Why are you checking if target Has name?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
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
player:registerEvent("SoulMonster")
<event type="kill" name="SoulMonster" script="file_name.lua"/>
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.I dont think he want to get soul for every single monster?![]()
Note tested your script it doesnt work. No errors tho, everything is registered how it should.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"/>
tested without god charIt should work but not as God char
Try with 200 then instead of player:getMaxSoul()tested without god char
what you mean try with 200 how could it change anything. Proable something is f up with if target:isPlayer() or target:getMaster() thenTry with 200 then instead of player:getMaxSoul()
if target:isPlayer() or target:getMaster() then
return true
end
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