The forum has been set to read-only mode. For community discussion and questions, head over to our Discord: https://discord.taleoftwowastelands.com

Bezerker Perk - Scripting Help

General modding guides and authoring tutorials.
Post Reply
User avatar
morbidly_strong
Posts: 35
Joined: Thu Nov 15, 2018 4:20 pm

Bezerker Perk - Scripting Help

Post by morbidly_strong » Mon Dec 03, 2018 2:20 pm

Basic concept is a perk with multiple ranks that increases stats whenever you kill an enemy, up to a maximum of 5 stacks and then resets on combat end.

I got some advice to use event handlers and so I've been reading the Wiki and this is what I've come up with so far. I know there's a lot wrong with it, I'm still reading and learning.

; Gives a perk rank for each kill the player gets, resets ranks when combat ends, rank 1 should give no bonuses - so might be 6 ranks with the 1st rank having no effect

--
; Function script to increase perk rank per kill

scn BezerkerKillScript

ref r1
ref r2

int iPerkRank

Begin Function { r1,r2 }

Set iPerkRank to player.SetPerkRank Bezerker 1
If iPerkRank != 6
Set iPerkRank to iPerkRank + 1
endif

END

--
; Function script to reset rank on combat end

scn BezerkerCombatEndScript

int iCombatEnd

Begin Function { iCombatEnd }

Set iCombatEnd to player.SetPerkRank Bezerker 1

END

--
; Quest script to set even handles and check for melee weapon

scn BezerkerQuestScript

Begin GameMode

StopQuest BezerkerQuest

; Checks for melee weapon here -- not sure how?

SetEventHandler "OnDeath" BezerkerKillsScript "second"::PlayerRef
SetEventHandler "OnCombatEnd" BezerkerCombatEndScript "second"::PlayerRef

END
--
These are 3 separate scripts if it wasn't clear.

I'm not sure if SetPerkRank is the correct function to use to increase the perk rank by 1 each kill.
I'm also not sure how to set it to only take effect when the player is using a melee weapon.

Post Reply