Jump to content

Run a stackable effect on kill?


isra

Recommended Posts

I'm fairly new to modding, and most of what I have done so far has actually been in blender so I'm a bit of a layman with scripting effects.

I started messing around with perks and was trying to make a perk that makes it so an effect kicks in after you kill a target and wears off after, say, 30 seconds.

Plus, the effect would stack up to a cap and the duration would refresh for each target killed within that 30 seconds.

 

I've messed around in G.E.C.K for many hours to see what I can do, but I'm at a loss. If anyone could tell me how to go about doing this, I'd greatly appreciate the help.

Link to comment
Share on other sites

well I've got a perk in my mod that restores health and ap whenever the player kills a "person" (NPC)

 

I use a quest script to check if the player misc stat "people killed" gets changed

 

short numdead
short gDoOnce
short reshp
short resap

Begin GameMode

if gDoOnce == 0

	set gDoOnce to 1
	set deadcheck to GetPCMiscStat "People Killed"

elseif deadcheck != GetPCMiscStat "People Killed"
;incase you kill more than 1 person between script runs
	set numdead to GetPCMiscStat "People Killed" - deadcheck
	set deadcheck to GetPCMiscStat "People Killed"

	elseif player.hasperk sddarkcontract == 1

		set reshp to 5*numdead
		set resap to 10*numdead
		player.RestoreActorValue Health reshp
		player.RestoreActorValue ActionPoints resap
		showmessage sdmsgcontract


	endif
endif

End

 

this won't work if you kill a creature or mutant or robot

I'm sure theres a more elegant way to do it, maybe with FOSE, but this is how I rigged it

Link to comment
Share on other sites

This is where the "Add Leveled List On Death" type Perk Entry Point is awesome - it can be used to detect whenever the player kills an Actor. Just use a "Leveled Item" that consists of a scripted token (unplayable, therefore invisible, piece of armour), that is scripted to apply a certain effect to the player in the way that you want.

 

Because you want to use a cap, I would recommend creating a "VR" Quest in which you store a "sCount" variable that stores the number of tokens that exist at any one time.

 

You could use a script like this for the token's script:

ScriptName DeathEffectTokenScript

short sDoOnce
float fTimer

Begin GameMode

if sDoOnce == 0
	set sDoOnce to 1
	if ExampleVRQuest.sCount >= 30
	; the value "30" is arbitrary - it's just a placeholder for your maximum value
		RemoveMe
	else
		set ExampleVRQuest.sCount to ExampleVRQuest.sCount + 1
	; Apply an effect to the player or to the target
	endif
endif

set fTimer to fTimer + GetSecondsPassed
if fTimer >= 30
	set ExampleVRQuest.sCount to ExampleVRQuest.sCount - 1
	RemoveMe
endif

End

Cipscis

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...