Takararyuu Posted November 17, 2013 Share Posted November 17, 2013 Hello there! I have a quick question about coding in Papyrus, well, rather the request for a piece of code. What i am trying to make:- Triggerbox, on player pass it will change the height of player to 0.8.- Triggerbox, on player pass it will change the height of player to 1. I am such a noob in this coding that i cannot even get this to work (directly from creationkit wiki site): Scriptname SmallvilleSchrinkPlayer extends ObjectReference {Darkfalls - Smallville, the script that schrinks the player to 0.8 height on entering the village.} Actor Property PlayerREF Auto ; Reffer to the player Event OnTriggerEnter(ObjectReference akActionRef) If akActionRef == PlayerREF ; This condition ensures that only the player will trigger this code Debug.MessageBox("Yippee!") EndIf EndEvent What i did manage to do:1) Create a triggerbox in the Cell the event is supposed to happen.2) Add a blanko code, and inserting the code above. So could someone please tell me how to change the player height on event enter? Thanks in advance and greetings!- Takararyuu Link to comment Share on other sites More sharing options...
djjohnjarvis Posted November 17, 2013 Share Posted November 17, 2013 (edited) You want to put this line into your event PlayerREF.SetScale(0.8) Edited November 17, 2013 by djjohnjarvis Link to comment Share on other sites More sharing options...
djjohnjarvis Posted November 17, 2013 Share Posted November 17, 2013 Why the hell did my post change the ending to a smiley? Anyway that was supposed to be 0.8 inside of some brackets. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted November 17, 2013 Share Posted November 17, 2013 Not sure about SetScale as that is for ObjectReferences... Tho actor does extend ObjectReference. So it might be worth a shot. If you want to go with SKSE you could try something as follows, tho there is no means to return the player to their original height if their starting height was not 1.0 or 0.8. One trigger box to handle both the increase and the decrease. If you want to return the player to their original height, then there needs to be some additional steps taken. Scriptname SmallvilleSchrinkPlayer extends ObjectReference {Darkfalls - Smallville, the script that schrinks the player to 0.8 height on entering the village.} Actor Property PlayerREF Auto ; Reffer to the player Event OnTriggerEnter(ObjectReference akActionRef) If akActionRef == PlayerREF ; This condition ensures that only the player will trigger this code Debug.MessageBox("Yippee!") ;get player's current height Float Height = PlayerREF.GetActorBase().GetHeight() If Height != 1.0 PlayerREF.GetActorBase().SetHeight(1.0) ElseIf Height != 0.8 PlayerREF.GetActorBase().SetHeight(0.8) EndIf EndIf EndEvent @djjohnjarvisthe number eight followed by an end parenthesis results in a smiley. Some forums allow turning smileys off. This forum does not. Link to comment Share on other sites More sharing options...
Takararyuu Posted November 18, 2013 Author Share Posted November 18, 2013 Quoted from IsharaMeradinNot sure about SetScale as that is for ObjectReferences... Tho actor does extend ObjectReference. So it might be worth a shot. If you want to go with SKSE you could try something as follows, tho there is no means to return the player to their original height if their starting height was not 1.0 or 0.8. One trigger box to handle both the increase and the decrease. If you want to return the player to their original height, then there needs to be some additional steps taken. Scriptname SmallvilleSchrinkPlayer extends ObjectReference {Darkfalls - Smallville, the script that schrinks the player to 0.8 height on entering the village.} Actor Property PlayerREF Auto ; Reffer to the player Event OnTriggerEnter(ObjectReference akActionRef) If akActionRef == PlayerREF ; This condition ensures that only the player will trigger this code Debug.MessageBox("Yippee!") ;get player's current height Float Height = PlayerREF.GetActorBase().GetHeight() If Height != 1.0 PlayerREF.GetActorBase().SetHeight(1.0) ElseIf Height != 0.8 PlayerREF.GetActorBase().SetHeight(0.8) EndIf EndIf EndEvent @djjohnjarvisthe number eight followed by an end parenthesis results in a smiley. Some forums allow turning smileys off. This forum does not. This might be a nice piece of code, but it gives compiling errors: Starting 1 compile threads for 1 files... Compiling "SmallvilleSchrinkPlayer"... E:\Program Files\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\SmallvilleSchrinkPlayer.psc(11,42): GetHeight is not a function or does not exist E:\Program Files\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\SmallvilleSchrinkPlayer.psc(11,8): type mismatch while assigning to a float (cast missing or types unrelated) E:\Program Files\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\SmallvilleSchrinkPlayer.psc(14,30): SetHeight is not a function or does not exist E:\Program Files\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\SmallvilleSchrinkPlayer.psc(16,30): SetHeight is not a function or does not exist No output generated for SmallvilleSchrinkPlayer, compilation failed. Batch compile of 1 files finished. 0 succeeded, 1 failed. Failed on SmallvilleSchrinkPlayer Any idea how this can be fixed? Link to comment Share on other sites More sharing options...
meh321 Posted November 18, 2013 Share Posted November 18, 2013 You must have SKSE installed properly to use height functions. Link to comment Share on other sites More sharing options...
Takararyuu Posted November 18, 2013 Author Share Posted November 18, 2013 You must have SKSE installed properly to use height functions. I have, do i need to include it in the Creation Kit somehow? (And if yes; how?) Link to comment Share on other sites More sharing options...
IsharaMeradin Posted November 18, 2013 Share Posted November 18, 2013 You need to install the source scripts (PSC files) as well as the PEX files for SKSE. The Creation Kit looks for the PSC file rather than the PEX file because PEX files can be packed inside of BSA files. Place the source scripts inside your Data > Scripts > Source folder. Link to comment Share on other sites More sharing options...
Takararyuu Posted November 19, 2013 Author Share Posted November 19, 2013 (edited) You need to install the source scripts (PSC files) as well as the PEX files for SKSE. The Creation Kit looks for the PSC file rather than the PEX file because PEX files can be packed inside of BSA files. Place the source scripts inside your Data > Scripts > Source folder. Thanks for the help so far! I did as you said for the SKSE, but now i run into a completely different problem; This is the code i currently use for testing: Scriptname SmallvilleSchrinkPlayer extends ObjectReference {Darkfalls - Smallville, the script that schrinks the player to 0.3 height on entering the village.} Actor Property PlayerREF Auto ; Reffer to the player Event OnTriggerEnter(ObjectReference akActionRef) ;Set player height to 0.8 Game.GetPlayer().GetActorBase().SetHeight(0.3) PlayerRef.QueueNiNodeUpdate() EndEvent But when i run though the trigger it does not affect the player size, when sleeping afterwards the player does run as slow as a 0.3 height character would, but no change in looks. When i immediately load the autosave of that nap, it does change! (Yay, at least that works!) But how can i let the player character 're-load' (or something) right after passing through the trigger? Also, how can i make a nice IF statement of this?I.E.: If Height > 0.31 Game.GetPlayer().GetActorBase().SetHeight(0.3) PlayerRef.QueueNiNodeUpdate() ElseIf Height == 0.3 Game.GetPlayer().GetActorBase().SetHeight(1.0) PlayerRef.QueueNiNodeUpdate() EndIf , because that doesn't seem to work. PS: Yes i use 0.3 for testing, this was not an failure. Edited November 19, 2013 by Takararyuu Link to comment Share on other sites More sharing options...
IsharaMeradin Posted November 19, 2013 Share Posted November 19, 2013 (edited) QueueNiNodeUpdate() is for changes to the head parts and armor addons. I do not think it is applicable to changing the player's size while in game. Please note that I have not tested this, but you may want to try the following... My thought process required adapting the whole script Scriptname SmallvilleSchrinkPlayer extends ObjectReference {Darkfalls - Smallville, the script that schrinks the player to 0.3 height on entering the village.} Actor Property PlayerREF Auto ; Reffer to the player Float Property NewHeight Auto ; as a property you can easily change the value in the CK without constantly updating the script ;AND you can use the script for other values in other locations String Property SaveNameTextShrunk Auto ;descriptive text for save being made String Property SaveNameTextRestored Auto ;descriptive text for save being made Float OriginalHeight Int Index = 0 Event OnInit() OriginalHeight = PlayerREF.GetActorBase().GetHeight() EndEvent Event OnTriggerEnter(ObjectReference akActionRef) Index += 1 If akActionRef == PlayerRef If PlayerREF.GetActorBase().GetHeight() != NewHeight Game.GetPlayer().GetActorBase().SetHeight(0.3) SaveGame(Game.GetPlayer().GetName()+" "+SaveNameTextShrunk+" "+Index) Utility.Wait(1.0) ;wait a bit LoadGame(Game.GetPlayer().GetName()+" "+SaveNameTextShrunk+" "+Index) Else ;restore player to original height Game.GetPlayer().GetActorBase().SetHeight(OriginalHeight) SaveGame(Game.GetPlayer().GetName()+" "+SaveNameTextRestored+" "+Index) Utility.Wait(1.0) ;wait a bit LoadGame(Game.GetPlayer().GetName()+" "+SaveNameTextRestored+" "+Index) EndIf EndEvent The thinking is this. Since it corrects the height after a save, why not save and reload using the SKSE functions of SaveGame and LoadGame. You might need to play with the wait time. No idea how long is needed to make the save. Also I added a means to restore the player to their original height. You could probably move that out if you want. But since there are some mods that change the height of races and/or between genders, it might be a good idea to have a means of restoring original height rather than going back to 1.0 Edited November 19, 2013 by IsharaMeradin Link to comment Share on other sites More sharing options...
Recommended Posts