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

Killstreak give a spell

Lucifer

Active Member
Joined
Dec 27, 2014
Messages
145
Reaction score
33
Location
Sweden
Searching someone who can help me to make a script for TFS 1.3.

When you have a killstreak 10 without die you will get a unique spell until you die.

if the script is hard to do i can pay some money to.
 
Solution
Searching someone who can help me to make a script for TFS 1.3.

When you have a killstreak 10 without die you will get a unique spell until you die.

if the script is hard to do i can pay some money to.
You can try this:

creaturescripts/creaturescripts.xml
XML:
<event type="death" name="Kill_Streak" script="other/kill_streak.lua" />

creaturescripts/scripts/other/kill_streak.lua
Lua:
local kill_streak = {} -- DO NOT CHANGE
local spell_name = "YOU CUSTOM SPELL NAME HERE"

function onDeath(creature, corpse, killer, mostDamageKiller, lastHitUnjustified)
    local player = creature:getPlayer()
    if not player then return true end

    if killer and killer:isPlayer() then
        if not kill_streak[killer.uid] then...
Searching someone who can help me to make a script for TFS 1.3.

When you have a killstreak 10 without die you will get a unique spell until you die.

if the script is hard to do i can pay some money to.
You can try this:

creaturescripts/creaturescripts.xml
XML:
<event type="death" name="Kill_Streak" script="other/kill_streak.lua" />

creaturescripts/scripts/other/kill_streak.lua
Lua:
local kill_streak = {} -- DO NOT CHANGE
local spell_name = "YOU CUSTOM SPELL NAME HERE"

function onDeath(creature, corpse, killer, mostDamageKiller, lastHitUnjustified)
    local player = creature:getPlayer()
    if not player then return true end

    if killer and killer:isPlayer() then
        if not kill_streak[killer.uid] then
            kill_streak[killer.uid] = 0
        end
        kill_streak[killer.uid] = kill_streak[killer.uid] + 1
        local string = "Kill Streak: " .. kill_streak[killer.uid]
        if kill_streak[killer.uid] >= 10 and not killer:hasLearnedSpell(spell_name) then
            killer:learnSpell(spell_name)
            string = string .. ". You may now use " .. spell_name .. "."
        end
        killer:sendTextMessage(MESSAGE_INFO_DESCR, string)
    end

    kill_streak[player.uid] = 0
    if player:hasLearnedSpell(spell_name) then
        player:forgetSpell(spell_name)
    end
    return true
end

creaturescripts/scripts/login.lua -> add this at the bottom along with other registerEvents:
Lua:
player:registerEvent("Kill_Streak")

EDIT: Added text message for kill streak and when you gain use of spell.
 
Last edited:
Solution
The player need to "learn the spell" until he die. For now everything work without learn the spell" xD
I got needlearn="1" but when the player got 10 killstreaks it need to get learned but when he die he will lose it again. @Apollos
 
The player need to "learn the spell" until he die. For now everything work without learn the spell" xD
I got needlearn="1" but when the player got 10 killstreaks it need to get learned but when he die he will lose it again. @Apollos
That's what it should be doing. Is it sending the text message when you kill? And does it say you learned spell at 10 kills?
 
09:26 Kill Streak: 10, You may now use utani hur.

Code:
        <instant group="support" spellid="6" name="Haste" words="utani hur" level="10" mana="60" premium="0" aggressive="0" selftarget="1" cooldown="2000" groupcooldown="2000" needlearn="1" script="support/haste.lua">
        <vocation name="Druid" />
        <vocation name="Elder Druid" />
        <vocation name="Sorcerer" />
        <vocation name="Master Sorcerer" />
        <vocation name="Paladin" />
        <vocation name="Royal Paladin" />
        <vocation name="Knight" />
        <vocation name="Elite Knight" />
    </instant>

"You need to learn this spell first."
"09:26 Kill Streak: 10, You may now use utani hur. " @Apollos

35914
 
09:26 Kill Streak: 10, You may now use utani hur.

Code:
        <instant group="support" spellid="6" name="Haste" words="utani hur" level="10" mana="60" premium="0" aggressive="0" selftarget="1" cooldown="2000" groupcooldown="2000" needlearn="1" script="support/haste.lua">
        <vocation name="Druid" />
        <vocation name="Elder Druid" />
        <vocation name="Sorcerer" />
        <vocation name="Master Sorcerer" />
        <vocation name="Paladin" />
        <vocation name="Royal Paladin" />
        <vocation name="Knight" />
        <vocation name="Elite Knight" />
    </instant>

"You need to learn this spell first."
"09:26 Kill Streak: 10, You may now use utani hur. " @Apollos

View attachment 35914
Spell name isn't "utani hur", but "Haste". Did u try it?
 
Back
Top