Jump to content

vn524135

Members
  • Posts

    13
  • Joined

  • Last visited

Nexus Mods Profile

About vn524135

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

vn524135's Achievements

Rookie

Rookie (2/14)

0

Reputation

  1. I apologize for replying to your message late. I thought the forum notifications appeared in the non-forum notifications of the site. Many thanks for your message and this information. While working on the script, I learned these improvements when searching the forum and made the adjustments to the script. The final version of the script is in my last message. It would have been better to edit my first message and add the final version of the script to avoid confusions, I apologize for not doing that. Here is the final version of the script: And I want to say that I published the mod here; https://www.nexusmods.com/skyrim/mods/118622 Thank you again!
  2. Then, as I understand it, if it is defined as akCaster = FollowerActor, the follower is considered the caster, even if the player or a non-follower NPC casts the spell. Following your information, I changed the script so there will not be unnecessary updates every five seconds when the player is fatigued and can't run. This is a big improvement, and I thank you very much for your help. Here is the current version of the script:
  3. Unfortunately, I don't have much knowledge. According to wiki, akTarget is "the Actor this effect was applied to", and akCaster is "the Actor that cast the spell this effect was from.". Both can be the player or an NPC. I can use them in the code like this; if akCaster == Game.GetPlayer() endif if akTarget == Game.GetPlayer() endif But I didn't see the need to use them because the player is the only actor with the magic. Edit: The caster and the target is the player. Casts itself by pressing the Z key.
  4. I'm almost done with the mod, and I want to share the final scripts with you. The scripts seem to be working well. After running for 60 seconds, the player can't run for 180 seconds, but this can be ended by sleeping or using options in the Magic > Powers menu. These options include animations like sitting and lying down, which also apply to followers. Please let me know if you have any comments or suggestions. Scriptname modRunningFatiguePlayerScript extends ReferenceAlias Actor PlayerRef Float currentCarryWeight Int runningCounter Int fatigueCounter Bool bOnFatigue Function StartFatigue() currentCarryWeight = PlayerRef.GetActorValue("CarryWeight") PlayerRef.DamageActorValue("CarryWeight", currentCarryWeight) runningCounter = 0 bOnFatigue = true EndFunction Function StopFatigue() PlayerRef.RestoreActorValue("CarryWeight", currentCarryWeight) runningCounter = 0 fatigueCounter = 0 bOnFatigue = false EndFunction Function StartWarningFatigue() ;This is to warn the player when they are close to entering the fatigue state. currentCarryWeight = PlayerRef.GetActorValue("CarryWeight") PlayerRef.DamageActorValue("CarryWeight", currentCarryWeight) Utility.Wait(4) PlayerRef.RestoreActorValue("CarryWeight", currentCarryWeight) EndFunction Event OnInit() PlayerRef = Game.GetPlayer() bOnFatigue = false runningCounter = 0 fatigueCounter = 0 RegisterForSleep() RegisterForSingleUpdate(3.0) EndEvent Event OnUpdate() if bOnFatigue == true fatigueCounter+=5 elseif PlayerRef.IsRunning() && !PlayerRef.IsInCombat() && !PlayerRef.IsSneaking() runningCounter+=5 endif if runningCounter == 45 runningCounter = 50 ;If the player doesn't run and, therefore, the counter doesn't increase, then startWarningFatigue will be executed in every update. Setting runningCounter to 50 prevents this. StartWarningFatigue() endif if runningCounter >= 60 ;The player can exceed the 60-second time limit by sprinting. However, once sprinting stops, they enter the fatigue state. if !PlayerRef.IsSprinting() StartFatigue() endif endif if fatigueCounter == 180 StopFatigue() endif RegisterForSingleUpdate(5.0) EndEvent Event OnSleepStop(bool abInterrupted) StopFatigue() EndEvent This is the script of one of the resting options accessible from the Magic > Powers menu. Scriptname aaaModRestSpellAScript extends activemagiceffect Idle Property IdleSitCrossLeggedExit Auto modRunningFatiguePlayerScript Property pModRunningFatiguePlayerScript Auto FollowerAliasScript Property pFollowerAliasScript Auto Actor PlayerRef Event OnInit() PlayerRef = Game.GetPlayer() EndEvent Event OnEffectStart(Actor akTarget, Actor akCaster) Game.SetPlayerAIDriven() Game.DisablePlayerControls(0,1,0,0,1,0,1) Debug.SendAnimationEvent(PlayerRef, "IdleSitCrossLeggedEnter") Utility.Wait(0.7) ;This is to make it realistic, by playing the follower's animation shortly after the player's. Actor FollowerActor = pFollowerAliasScript.GetActorRef() as Actor Debug.SendAnimationEvent(FollowerActor, "IdleSitCrossLeggedEnter") EndEvent Event OnEffectFinish(Actor akTarget, Actor akCaster) pModRunningFatiguePlayerScript.StopFatigue() PlayerRef.PlayIdle(IdleSitCrossLeggedExit) Game.SetPlayerAIDriven(false) Game.EnablePlayerControls() Utility.Wait(0.5) Actor FollowerActor = pFollowerAliasScript.GetActorRef() as Actor Debug.SendAnimationEvent(FollowerActor, "IdleChairExitStart") EndEvent
  5. Following your informations, I changed the frequency of checking the player's running status to every five seconds, instead of every second. And if the player is running during the check, they are counted as having run for five seconds. I was concerned that the player could exploit this by running for less than five seconds to prevent the counter from incrementing, but it doesn't seem likely since they can't detect the check times. This is the current version of the script, and I hope it's ready to use. Thank you all again for your help. Scriptname PlayerScript extends ReferenceAlias int counter float currentCarryWeight Event OnInit() RegisterForSingleUpdate(1.0) RegisterForSleep() EndEvent Event OnUpdate() if Game.GetPlayer().IsRunning() && !Game.GetPlayer().IsInCombat() && !Game.GetPlayer().IsSneaking() counter+=5 endif if counter == 60 counter=0 currentCarryWeight = Game.GetPlayer().GetAV("CarryWeight") Game.GetPlayer().DamageAV("CarryWeight", currentCarryWeight) Utility.WaitGameTime(1) Game.GetPlayer().RestoreAV("CarryWeight", currentCarryWeight) RegisterForSingleUpdate(1.0) Else RegisterForSingleUpdate(5.0) endif EndEvent Event OnSleepStop(bool abInterrupted) counter = 0 EndEvent
  6. I wasn't aware of that due to negative values given for DamageAV are converted to positive (https://ck.uesp.net/wiki/DamageActorValue_-_Actor). Thank you for the warning.
  7. I edited the script without using states as you suggested. Scriptname PlayerScript extends ReferenceAlias int counter float currentCarryWeight Event OnInit() RegisterForSingleUpdate(1.0) RegisterForSleep() EndEvent Event OnUpdate() if Game.GetPlayer().IsRunning() && !Game.GetPlayer().IsInCombat() && !Game.GetPlayer().IsSneaking() counter+=1 endif if counter == 60 counter=0 currentCarryWeight = Game.GetPlayer().GetAV("CarryWeight") Game.GetPlayer().DamageAV("CarryWeight", -currentCarryWeight) Utility.WaitGameTime(1) Game.GetPlayer().RestoreAV("CarryWeight", currentCarryWeight) RegisterForSingleUpdate(1.0) Else RegisterForSingleUpdate(1.0) endif EndEvent Event OnSleepStop(bool abInterrupted) counter = 0 EndEvent
  8. Thank you for your comments. I'm using translation because my English is not good. Please forgive me if I miss anything you say. If I understand correctly, what you said is that the bKeepUpdating is unnecessary because it is always true. I didn't notice this detail because I'm new to coding. I replaced my code with the code you suggested and it works without problems. Thank you for your warnings about using RegisterForSingleUpdate, and other information and suggestions. The final version of the script is as follows; Scriptname PlayerScript extends ReferenceAlias int counter float currentCarryWeight Event OnInit() RegisterForSingleUpdate(1.0) RegisterForSleep() GotoState("Counting") EndEvent State Counting Event OnUpdate() if Game.GetPlayer().IsRunning() && !Game.GetPlayer().IsInCombat() && !Game.GetPlayer().IsSneaking() counter+=1 endif if counter == 60 counter=0 GotoState("Fatigue") Else RegisterForSingleUpdate(1.0) endif EndEvent Event OnSleepStop(bool abInterrupted) counter = 0 EndEvent EndState State Fatigue Event OnBeginState() currentCarryWeight = Game.GetPlayer().GetAV("CarryWeight") Game.GetPlayer().DamageAV("CarryWeight", -currentCarryWeight) Utility.WaitGameTime(1) GotoState("Counting") EndEvent Event OnEndState() Game.GetPlayer().RestoreAV("CarryWeight", currentCarryWeight) RegisterForSingleUpdate(1.0) EndEvent EndState Here's how the code works in my mind: RegisterForSingleUpdate runs until the player completes the total running time of 60 seconds. When the counter reaches 60, the player enters a fatigue state, and RegisterForSingleUpdate doesn't run until the end of this state.
  9. Edit: The final version of the script is here: I am designing a mod where the player gets tired after running for a certain period of time and can only walk for a certain period of time. I would be very grateful if you could review the script I have written below. I am particularly interested in whether I am using the OnUpdate, RegisterForSingleUpdate and RegisterForSleep commands correctly, which I have read many times that they should be used carefully.
  10. I had added indented bullet points by typing the Alt code. Actually, I wanted them as empty bullet points (◦), but I couldn't do it by typing the Alt code. However, I realized I could add them using the copy-paste method. And I understand now why I couldn't add them like here. Thank you for your help.
  11. https://www.nexusmods.com/skyrim/mods/edit/?id=117757&game_id=110&step=details On the Mod Details page, in the Detailed Description section, I can add a bullet point using the unordered list feature, but when I press Enter to go to the next line and press the Tab key, a sub-bullet point is not added. Instead, the Tab key performs its normal function of creating an indent. However, I can add sub-bullet points here in this community forum's page using the same method.
  12. I cannot add sub-bullet points on the mod description page, like it is here. a a
×
×
  • Create New...