Jump to content

Please help me get this simple script working


irswat

Recommended Posts

What is that update for? Re-checking for your weapon(s) to be equipped and swapping if necessary? If so, that could work. Just double check if possible at the extreme ends. I'm not sure if 17:59 would round up to 18 or down to 17. The game can be fickle with how it converts floats to ints. Hopefully, you'll keep it all floats and it should be fine.

 

You are lacking an = 6 as well as an = 18. Should the player hit precisely at 6 or 18, your code will fail.

Link to comment
Share on other sites

  • Replies 135
  • Created
  • Last Reply

Top Posters In This Topic

  On 9/4/2016 at 5:17 AM, IsharaMeradin said:

What is that update for? Re-checking for your weapon(s) to be equipped and swapping if necessary? If so, that could work. Just double check if possible at the extreme ends. I'm not sure if 17:59 would round up to 18 or down to 17. The game can be fickle with how it converts floats to ints. Hopefully, you'll keep it all floats and it should be fine.

 

You are lacking an = 6 as well as an = 18. Should the player hit precisely at 6 or 18, your code will fail.

Yes that update is in case the weapon is equipped and the player waits, or sleeps, etc. It seems OnEquipped only triggers when a weapon is equipped, and updates very slowly otherwise. Thanks for all the help peoples!

Link to comment
Share on other sites

I found a neat function so I don't need to convert to real time. It should also avoid any problems with real time if a person waits, uses the menu, etc in game.

RegisterForSingleUpdateGameTime()

Edited by irswat
Link to comment
Share on other sites

For some reason it won't dynamically update meaning if I have the sword equipped at 5:55 and the script registers for a single update in 5 minutes, and I hold onto until it turns 6 the sword is not automatically being swapped out for the other. It is only when I try to re equip the sword that the sword changes.

Link to comment
Share on other sites

that fixed it! sweet! This should be optimally efficient now right? thanks again!

  Reveal hidden contents



Next: is there a way to dynamically temper weapons, or can I only manually change base damage? mod author wants the swords to upgrade for every 12 kills up to legendary.

Edited by irswat
Link to comment
Share on other sites

This part of your script has duplication of code which could be simplified by calling a function and passing in the desired parameters. As a result it can be shortened.

Your posted code:

 

  Reveal hidden contents

 

Can be changed to:

 

  Reveal hidden contents

 

 

Also, there is no need to check for the player's equipped weapon to be in either hand and then check again for the specific hand. A single check per hand with processing for that hand is sufficient. Such change is demonstrated above.

 

I'm not sure about tempering. You can change just about any stat you want including the name. But the game might not recognize it as having been tempered.

Link to comment
Share on other sites

Is there a function GetIsInt that returns whether a variable is an integer or not?

will this work:

;function with help from FamilyFrank
Function IncrementKillCount(Bool bIdentity)
 If bIdentity ; its dawnfang
	DawnfangFragCount.Mod(1)
	KillLevel=(DawnfangFragCount.GetValue()/12)
	if (KillLevel==KillLevel.GetValue() As Int)
		tempering=KillLevel*0.1
		TemperWeapon(tempering,adventurerdawnfang)
	endif
 Else ; its duskfang
	DuskfangFragCount.Mod(1)
	KillLevel=(DuskfangFragCount.GetValue()/12)
	if (KillLevel==KillLevel.GetValue() As Int)
		tempering=KillLevel*0.1
		TemperWeapon(tempering,tsasciduskblade)
	endif
 Endif
EndFunction
;function taken from http://www.creationkit.com/index.php?title=SetItemHealthPercent_-_ObjectReference
Function TemperWeapon(float btempering, Form weaponRef)
	weaponref.SetItemHealthPercent(1 +btempering)
EndFunction

The hope is that there are 6 levels of tempering for each weapon, so 72 kills to make each weapon legendary.

Edited by irswat
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...