Jump to content

Having trouble implant script


EssArrBee

Recommended Posts

I've been trying to edit the behavior of the Monocyte Breeder Implant to give 2 health for 30 seconds when combat starts and to only do it three times a day. After 30 seconds it returns to it's normal function. I've tried doing a few different ways but each way seems to freeze the game on entering combat when I test it out.

 

Here is a way I tried by creating an ingestible that is added and equipped when combat starts:

scn ImplantRegenScript

; First Monocyte Breeder Upgrade
; Increases regen rate 20% over base model
; Adds accelerated health regen

int iNanobotCount
float fMicroRegen
float fDayReset

Begin ScriptEffectStart
	set iNanobotCount to 0
	set fDayReset to GameDaysPassed + 1
End

begin ScriptEffectUpdate


	if fDayReset < GameDaysPassed ; check if day passed to reset three uses
		set fDayReset to GameDaysPassed + 1
		set iNanobotCount to 0
	endif
	
	if (Player.IsInCombat && iNanobotCount < 3) ;In combat player gets 2HP per second for 30 seconds
		AddItem TCxNanobotCombatRecovery 1 1
		EquipItem TCxNanobotCombatRecovery 1 1
		set iNanobotCount to iNanobotCount + 1
	else ;Regular regen rate
		set fMicroRegen to ScriptEffectElapsedSeconds / 8
		RestoreAv Health fMicroRegen
	endif

end

Begin ScriptEffectFinish
	RemoveItem TCxNanobotCombatRecovery 100 1
End

The TCxNanobotCombatRecovery is supposed to be an ingestible that regens 2 HP for 30 seconds. I did it that was because, well, it was easy to make in the GECK. I think the problem may be that I'm using the wrong blocktype, but I've never really messed around with coding this stuff, so I'm still trying to learn the ins and out of each type. Any help is appreciated.

Link to comment
Share on other sites

Well, first of all - variables in your script are spell variables - they exists only while spell works so you can't use them to store gameday. You need to use quest for that. And I don' really understand what you're trying to do here. Spell works only for its duration which means that code inside "begin ScriptEffectUpdate" will execute only while spell is active. I think it's better to create a quest for what you want to do instead of spell.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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