Tfs 1.2
10.77
Can someone make an npc who can change between no-pvp and pvp but when you have no-pvp you gain 25% less exp?
And some sort of payment for this service?
Thanks!
Kind of messed up... you have 28 threads and most of them are in support asking for help with scripts and you want to charge people in requests to make them one.If I understood correctly and you want to change a player from PVP(allowed to fight) to NO-PVP (Not allowed to fight) right?
But that's a server condition, not player's. Anyway, I could do that for you but not for free. PM me if you are interested.
So do it for him for free Codex, if you have time to track my threads and make an usefulness commentary as this one, you have time to do this system for him. I am charging for a service if no one else is up for doing it for free (which do not involve a single script in lua, but source edits also. Which the combination of both I call "system"). Also the threads Ive made was asking for HELP in errors in the scripts I made myself, not for someone doing something I want.Kind of messed up... you have 28 threads and most of them are in support asking for help with scripts and you want to charge people in requests to make them one.
It isn't rocket science.So do it for him for free Codex, if you have time to track my threads
Showing results 1 to 20 of 28
This doesn't need source changes in TFS 1.2 tho. You can do it all with player/creature events (onTargetCombat and onGainExperience)So do it for him for free Codex, if you have time to track my threads and make an usefulness commentary as this one, you have time to do this system for him. I am charging for a service if no one else is up for doing it for free (which do not involve a single script in lua, but source edits also. Which the combination of both I call "system"). Also the threads Ive made was asking for HELP in errors in the scripts I made myself, not for someone doing something I want.
I don't feel forced to write anything and I'm also not forcing him to pay me, he showed interest in giving some payment in the first hand. If you see I wrote "If you are interested PM me". Also I didn't see any rules that forbid someone from paying a requested sort of service in this board section, but I do agree that if someone want a service he should go to the Jobs section, but If you get emotional from seeing someone who is replying to a thread where ppl offer money from any kind of service, you do have any psychological problem related to money itself. What is the problem of paying someone to do something for you? No need to answer that. I believe that we shouldn't be flaming his thread with a senseless fight you started. If you wish to continue that discussion PM me if you are interested, I admire your work in the forums.It isn't rocket science.
https://otland.net/search/1226046/
Code:Showing results 1 to 20 of 28
Btw, my post in this thread isn't about the script he/she wants made, its about the audacity you have, to think you can charge a person for a script on the requests boards... people requesting things in this section of the site don't need to pay for scripts to be made... and no one is forcing you to write it.
And this type of script does not require a source edit.
This doesn't need source changes in TFS 1.2 tho. You can do it all with player/creature events (onTargetCombat and onGainExperience)
Not hating just saying.
I don't feel forced to write anything and I'm also not forcing him to pay me, he showed interest in giving some payment in the first hand. If you see I wrote "If you are interested PM me". Also I didn't see any rules that forbid someone from paying a requested sort of service in this board section, but I do agree that if someone want a service he should go to the Jobs section, but If you get emotional from seeing someone who is replying to a thread where ppl offer money from any kind of service, you do have any psychological problem related to money itself. What is the problem of paying someone to do something for you? No need to answer that. I believe that we shouldn't be flaming his thread with a senseless fight you started. If you wish to continue that discussion PM me if you are interested, I admire your work in the forums.
Well, I am better with C++ than Lua and I know very much TFS sources so I can do a faster and precise job from C++ going to Lua, without causing any game experience changes. So, I always prefer going this way than the other, so I ask excuse for you and @Codex NG for my lack of knowledge in Lua and I would like to invite you both to do this script for our friend @denkan97 considering the purpose of this thread. I would like to learn more about Lua by seeing that script done.
Tfs 1.2
10.77
Can someone make an npc who can change between no-pvp and pvp but when you have no-pvp you gain 25% less exp?
And some sort of payment for this service?
Thanks!
function Creature:onTargetCombat(target)
if self and target then
if self:isPlayer() and target:isPlayer() then
if self:getStorageValue(15500) == 1 or target:getStorageValue(15500) == 1 then
return RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER
end
end
end
return RETURNVALUE_NOERROR
end
if self:getStorageValue(15500) == 1 then
exp = exp * 0.75
end
function Player:onGainExperience(source, exp, rawExp)
if not source or source:isPlayer() then
return exp
end
-- Soul regeneration
local vocation = self:getVocation()
if self:getSoul() < vocation:getMaxSoul() and exp >= self:getLevel() then
soulCondition:setParameter(CONDITION_PARAM_SOULTICKS, vocation:getSoulGainTicks() * 1000)
self:addCondition(soulCondition)
end
-- Apply experience stage multiplier
exp = exp * Game.getExperienceStage(self:getLevel())
-- Stamina modifier
if configManager.getBoolean(configKeys.STAMINA_SYSTEM) then
useStamina(self)
local staminaMinutes = self:getStamina()
if staminaMinutes > 2400 and self:isPremium() then
exp = exp * 1.5
elseif staminaMinutes <= 840 then
exp = exp * 0.5
end
end
if self:getStorageValue(15500) == 1 then
exp = exp * 0.75
end
return exp
end
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
local price = 50000
local function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
end
local player = Player(cid)
if player:isPzLocked() then
npcHandler:say("Come back when you are not in fight!", cid)
npcHandler:releaseFocus(cid)
return false
end
if npcHandler.topic[cid] == 0 then
if msgcontains(msg, "pvp") then
if player:getStorageValue(15500) == 1 then
npcHandler.topic[cid] = 1
npcHandler:say("Would you like to activate your pvp state for " .. price .. " gold coins?", cid)
else
npcHandler.topic[cid] = 2
npcHandler:say("Would you like to deactivate your pvp state for " .. price .. " gold coins?", cid)
end
end
elseif npcHandler.topic[cid] == 1 or npcHandler.topic[cid] == 2 then
if msgcontains(msg, "yes") then
if player:removeMoney(price) then
npcHandler:say("Its done.", cid)
player:setStorageValue(15500, npcHandler.topic[cid] == 1 and -1 or 1)
else
npcHandler:say("You don't have enough money.", cid)
end
else
npcHandler:say("Okay, then what do you want?", cid)
end
npcHandler.topic[cid] = 0
end
return true
end
local function greetCallback(cid)
local player = Player(cid)
if player:isPzLocked() then
npcHandler:say("Come back when you are not in fight!", cid)
return false
end
return true
end
local function onAddFocus(cid)
npcHandler.topic[cid] = 0
end
npcHandler:setCallback(CALLBACK_ONADDFOCUS, onAddFocus)
npcHandler:setMessage(MESSAGE_FAREWELL, "Good bye |PLAYERNAME|!")
npcHandler:setMessage(MESSAGE_WALKAWAY, "How rude!")
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:addModule(FocusModule:new())
What if the player uses an area attack spell?Replace this function in data/events/scripts/creature.lua: (Don't forget to activate the event in events.xml)
Code:function Creature:onTargetCombat(target) if self and target then if self:isPlayer() and target:isPlayer() then if self:getStorageValue(15500) == 1 or target:getStorageValue(15500) == 1 then return RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER end end end return RETURNVALUE_NOERROR end
Add this above the last return exp in PlayernGainExperience in data/events/scripts/player.lua:
Code:if self:getStorageValue(15500) == 1 then exp = exp * 0.75 end
Resulting in:
Code:function Player:onGainExperience(source, exp, rawExp) if not source or source:isPlayer() then return exp end -- Soul regeneration local vocation = self:getVocation() if self:getSoul() < vocation:getMaxSoul() and exp >= self:getLevel() then soulCondition:setParameter(CONDITION_PARAM_SOULTICKS, vocation:getSoulGainTicks() * 1000) self:addCondition(soulCondition) end -- Apply experience stage multiplier exp = exp * Game.getExperienceStage(self:getLevel()) -- Stamina modifier if configManager.getBoolean(configKeys.STAMINA_SYSTEM) then useStamina(self) local staminaMinutes = self:getStamina() if staminaMinutes > 2400 and self:isPremium() then exp = exp * 1.5 elseif staminaMinutes <= 840 then exp = exp * 0.5 end end if self:getStorageValue(15500) == 1 then exp = exp * 0.75 end return exp end
And the npc lua script:
Code:local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end local price = 50000 local function creatureSayCallback(cid, type, msg) if not npcHandler:isFocused(cid) then return false end local player = Player(cid) if player:isPzLocked() then npcHandler:say("Come back when you are not in fight!", cid) npcHandler:releaseFocus(cid) return false end if npcHandler.topic[cid] == 0 then if msgcontains(msg, "pvp") then if player:getStorageValue(15500) == 1 then npcHandler.topic[cid] = 1 npcHandler:say("Would you like to activate your pvp state for " .. price .. " gold coins?", cid) else npcHandler.topic[cid] = 2 npcHandler:say("Would you like to deactivate your pvp state for " .. price .. " gold coins?", cid) end end elseif npcHandler.topic[cid] == 1 or npcHandler.topic[cid] == 2 then if msgcontains(msg, "yes") then if player:removeMoney(price) then npcHandler:say("Its done.", cid) player:setStorageValue(15500, npcHandler.topic[cid] == 1 and -1 or 1) else npcHandler:say("You don't have enough money.", cid) end else npcHandler:say("Okay, then what do you want?", cid) end npcHandler.topic[cid] = 0 end return true end local function greetCallback(cid) local player = Player(cid) if player:isPzLocked() then npcHandler:say("Come back when you are not in fight!", cid) return false end return true end local function onAddFocus(cid) npcHandler.topic[cid] = 0 end npcHandler:setCallback(CALLBACK_ONADDFOCUS, onAddFocus) npcHandler:setMessage(MESSAGE_FAREWELL, "Good bye |PLAYERNAME|!") npcHandler:setMessage(MESSAGE_WALKAWAY, "How rude!") npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:setCallback(CALLBACK_GREET, greetCallback) npcHandler:addModule(FocusModule:new())
Change local price to desired price.
No, the area damage still calls targetcombat. The event is "ontargetcombat" not "ontarget" so its triggered everytime a target combat action is executed.What if the player uses an area attack spell?
From what I can see, that will allow them to attack the player indirectly, no?
Ah I see.No, the area damage still calls targetcombat. The event is "ontargetcombat" not "ontarget" so its triggered everytime an target combat action is executed.
So do it for him for free Codex, if you have time to track my threads and make an usefulness commentary as this one, you have time to do this system for him. I am charging for a service if no one else is up for doing it for free (which do not involve a single script in lua, but source edits also. Which the combination of both I call "system"). Also the threads Ive made was asking for HELP in errors in the scripts I made myself, not for someone doing something I want.
No one cares for your opinion, now go crawl back under your rockYou are right, owned.
little poor guy with poor argumentsNo one cares for your opinion, now go crawl back under your rock
Says the guy who lives in support...little poor guy with poor arguments
Says the guy who lives in support...
Wtf does this even mean? lmfao.Noo, lives in works hard
You live in support trying to stole some noobs ^^
Sorry for the true =)
Don't make me copy and paste all 7 pages of your threads begging for help in support & request..Noo, lives in works hard
You live in support trying to stole some noobs ^^
Sorry for the true =)
ps. make a premium user please, help in something this forum dumb.
no its not, but ur tfs version is important here. If you are using tfs 1.x just edit onTargetCombat like mkalo says then edit look function with something likeits hard to make two types of players?
players with pvp off
You see Hidroponica (Level 95). She is a sorcerer. Pvp-Disabled
and player with pvp on
You see Hidroponica (Level 95). She is a sorcerer. Pvp-Enabled
local msg = "Pvp"
player:getStorageValue(pvpmode) and msg=msg.."-Enabled" or msg=msg.."-Disabled")
...