Jump to content

Search the Community

Showing results for tags 'scripting'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • AFK Mods
    • Administration
    • General Discussion
  • Bethesda Games
    • The Elder Scrolls
    • Fallout
    • Tools of the Trade
  • Other Games
    • Total War
    • No Man's Sky
  • Unofficial Patch Project
    • Unofficial Patch Project Bug Tracker
    • Unofficial Fallout 4 Patch
    • Unofficial Skyrim Special Edition Patch
    • Unofficial Skyrim Patches
    • Unofficial Oblivion Patches
    • Unofficial Morrowind Patch

Categories

  • Unofficial Patch Project
    • Files For Fixes
    • Unofficial Patch Betas
    • Skyrim Special Edition
    • Skyrim
    • Fallout 4
    • Oblivion
    • Morrowind
  • Fallout 76
    • Armor & Weapons
    • Cities, Towns & Settlements
    • Companions & NPCs
    • Gameplay Changes
    • Houses & Dwellings
    • Landscaping
    • Miscellaneous
    • Modders Resources
    • Models & Textures
    • Patches & Fixes
    • Quests & Adventures
    • Realism & Immersion
    • Tools & Utilities
  • Fallout 4
    • Armor & Weapons
    • Cities, Towns & Settlements
    • Companions & NPCs
    • Gameplay Changes
    • Houses & Dwellings
    • Landscaping
    • Miscellaneous
    • Modders Resources
    • Models & Textures
    • Patches & Fixes
    • Quests & Adventures
    • Realism & Immersion
    • Tools & Utilities
  • Skyrim Special Edition
    • Audio
    • Armor & Weapons
    • Cities, Towns & Villages
    • Companions & NPCs
    • Gameplay Changes
    • Houses and Dwellings
    • Landscaping
    • Miscellaneous
    • Modders Resources
    • Models & Textures
    • Patches & Fixes
    • Quests & Adventures
    • Realism & Immersion
    • Tools & Utilities
    • Weird Stuff
  • Skyrim
    • Armors & Weapons
    • Cities, Towns & Villages
    • Companions & NPCs
    • Gameplay Changes
    • Houses and Dwellings
    • Landscaping
    • Miscellaneous
    • Modders Resources
    • Models & Textures
    • Patches & Fixes
    • Quests & Adventures
    • Realism & Immersion
    • Tools & Utilities
    • Weird Stuff
  • Fallout: New Vegas
    • Armor & Weapons
    • Cities, Towns & Settlements
    • Companions & NPCs
    • Gameplay Changes
    • Houses & Dwellings
    • Landscaping
    • Miscellaneous
    • Modders Resources
    • Models & Textures
    • Patches & Fixes
    • Quests & Adventures
    • Realism & Immersion
    • Tools & Utilities
  • Fallout 3
    • Armor & Weapons
    • Cities, Towns & Settlements
    • Companions & NPCs
    • Gameplay Changes
    • Houses & Dwellings
    • Landscaping
    • Miscellaneous
    • Modders Resources
    • Models & Textures
    • Patches & Fixes
    • Quests & Adventures
    • Realism & Immersion
    • Tools & Utilities
  • Nehrim
  • Oblivion
    • Unique Landscapes Project
    • Armors & Weapons
    • Cities, Towns & Villages
    • Dungeons
    • Gameplay Changes
    • Houses and Dwellings
    • Landscaping
    • Modders Resources
    • Patches & Fixes
    • Quests & Adventures
    • Visual Enhancements
    • Tools & Utilities
  • Morrowind
    • Cities, Towns & Villages
    • Gameplay Changes
    • Houses and Dwellings
    • Landscaping
  • Civilization
    • Civilization 4 Maps
  • Total War Series
  • Miscellaneous Files

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Title


Location


Interests

Found 2 results

  1. Dear fellows, I have implemented a big ship into my isles mod I want to use as a player's home and to transport followers. I used the same script I have already attached to my trading boat, but I can't get it to work the way I want. I used the script from the mod Sailable Ships and changed it to my needings and it works fine for my boats. But this solution maybe not the best for what I want to do now: Sail a big ship, move followers onboard, use two doors for getting into interior, a ladder as activator at the outer shipwall to being teleported from water onto the ship. What I have so far: Ship is sailable and the wheel activator and the doors move to the right place, when player toggles the anchor. Two ship interior cells I can enter, but not exit anymore. 1: I can toggle sails and anchor and start sailing. Sometimes when I exit sailing with the e key, player gets stuck and nothing but quit the game helps - it worked fine, but suddenly stops working. 2:There are problems with SetVehicle. I placed an XMarker in front of the shipswheel, but player is always attached outside the ship. When I start to sail. player is moved to the middle of the ship. When I exit sailing and activate the shipswheel again, player is positioned right. How can I get the player fixed? I don't really understand how SetVehicle works, because the XMarker is not moving with the ship? 3: I can enter my ship interior, but there is no activator to leave the cell. I guess this is due to the system the whole thing is setup. If you have any ideas, please read on. I explain now the setup and will post the used script: Setup: A dummy cell that includes the static ship with furled sails, an XMarker as movement point, two invisible actors and two load doors. On water: the movable ship with unfurled sails, an XMarker to attach the player to the ship with SetVehicle, and invisible activator at the shipswheel. If player activates the wheel, a messagebox pops up: Toggle sail and anchor or start/stop sailing. If player toggles the anchor, the static ship spawns from the dummy cell at the exact place of the movable ship, the doors are moved to the right place at the ship, the movable ship moves to dummy cell marker. Sails are furled and player can now go inside. If player starts sailing, the doors and the wheel activator are moved to the dummy cell. Player gets attached to the movable ship. When pressing e key, sailing stops, the activator moves from dummy cell back to the wheel. If there is a better solution to achieve my goals, please tell me. And if you want to help me scripting, this is much appreciated. Here comes the script: Scriptname _Tash_ShipRedguardActivatorScript extends ObjectReference ;-- Properties -------------------------------------- static property StaticShip auto ; static ship in dummy cell ObjectReference property MyBoat auto ;actually used ship idle property SitAnim auto actor property BackActor auto ;swimming invisible actor in dummy cell - they are used to detect if ship crashes on land or against an obstacle sound property WaterChurn auto ;ship's noise sound property CollisionSound auto ;if ship crashes on land or obstacle ObjectReference property SpawnedStaticShip auto ;static ship spawned from reference ship in dummy cell sound property BoatSound auto ;ship's second noise message property LongBoatMenu auto ;activation menu for sailing or toggling anchor and sails actor property FrontActor auto ;swimming invisible actor in dummy cell ObjectReference property SeatVehicle auto ;XMarker to attach player to the ship for translation actor property PlayerRef auto ObjectReference property StaticShipMarker auto ;XMarker in dummy cell where the ships are moved ObjectReference property ShipDoorCabin Auto ;Load door for cabin interior ObjectReference property ShipDoorBase Auto Load door for basement interior ;-- Variables --------------------------------------- Int DefLef = 30 ;left Float MaxReverseSpeed Float ZBoatPosition Int DefBac = 31 ;back Bool ToggleAnchor Float CurrentSpeed Int DefRig = 32 ;right Float FrontOffset Bool Activated Float YBoatPosition Float DefaultTiltAngle Int n Float BoatAngleSpeed Float BoatTiltAngle Float MenDepthOffset ;depth of swimming actors Float dir ;movement direction Float BoatAngle Float FrontBackMenOffset ;swimming actors distance from boat Float DefaultAngleSpeed Bool ToggleDrive Float XBoatPosition Int WaterChurnInstanceID Int BoatCreakSoundID Int DefFor = 17 ;forward Float MaxSpeed ;-- Functions --------------------------------------- function OnUpdate() ;get ship position, movement direction and speed. Invisible swimming actors simulate the collision with land ;I need to adjust the values to get it right for this big ship XBoatPosition = MyBoat.GetPositionX() YBoatPosition = MyBoat.GetPositionY() ZBoatPosition = MyBoat.GetPositionZ() BoatAngleSpeed = DefaultAngleSpeed if input.IsKeyPressed(DefFor) || input.IsKeyPressed(DefBac) if input.IsKeyPressed(DefFor) && FrontActor.IsSwimming() if CurrentSpeed > 0 as Float && dir == -1 as Float CurrentSpeed -= 10 as Float dir = -1 as Float elseIf CurrentSpeed < MaxSpeed CurrentSpeed += 10 as Float dir = 1 as Float endIf elseIf input.IsKeyPressed(DefBac) && BackActor.IsSwimming() if CurrentSpeed > 0 as Float && dir == 1 as Float CurrentSpeed -= 10 as Float dir = 1 as Float elseIf CurrentSpeed < MaxReverseSpeed CurrentSpeed += 10 as Float dir = -1 as Float endIf elseIf !FrontActor.IsSwimming() || !BackActor.IsSwimming() CollisionSound.play(PlayerRef as ObjectReference) CurrentSpeed = 0 as Float endIf elseIf CurrentSpeed > 0 as Float CurrentSpeed -= 5 as Float else MyBoat.StopTranslation() game.GetPlayer().StopTranslation() if !ToggleDrive self.UnregisterForUpdate() endIf endIf if CurrentSpeed > 0 as Float if input.IsKeyPressed(DefLef) BoatAngle += -BoatAngleSpeed if BoatAngle <= -360 as Float BoatAngle = 0 as Float endIf BoatTiltAngle = 2 as Float endIf if input.IsKeyPressed(DefRig) BoatAngle += BoatAngleSpeed if BoatAngle >= 360 as Float BoatAngle = 0 as Float endIf BoatTiltAngle = -2 as Float endIf endIf sound.SetInstanceVolume(WaterChurnInstanceID, CurrentSpeed / MaxSpeed) YBoatPosition += dir * -CurrentSpeed * math.Sin(BoatAngle) XBoatPosition += dir * CurrentSpeed * math.Cos(BoatAngle) Float YPlayerPos = YBoatPosition - (-400*math.sin(BoatAngle)) ;400 being the players displacement from the centre of the boat Float XPlayerPos = XBoatPosition - (400* math.cos(BoatAngle)) ;y direction is negative MyBoat.TranslateTo(XBoatPosition, YBoatPosition, ZBoatPosition, BoatTiltAngle, 0 as Float, BoatAngle + FrontOffset, CurrentSpeed, 0 as Float) game.GetPlayer().TranslateTo(XPlayerPos, YPlayerPos, ZBoatPosition + 580 as Float, 0 as Float, 0 as Float, BoatAngle, CurrentSpeed, 0 as Float) FrontActor.MoveTo(MyBoat, FrontBackMenOffset * math.Sin(MyBoat.GetAngleZ()), FrontBackMenOffset * math.Cos(MyBoat.GetAngleZ()), -MenDepthOffset, true) BackActor.MoveTo(MyBoat, -FrontBackMenOffset * math.Sin(MyBoat.GetAngleZ()), -FrontBackMenOffset * math.Cos(MyBoat.GetAngleZ()), -MenDepthOffset, true) if ToggleDrive self.RegisterForSingleUpdate(0 as Float) endIf endFunction function RebindKeys(Int KeySel, Int Code) ;unused if KeySel == 0 DefFor = Code debug.Notification("Forward key has been rebound") elseIf KeySel == 1 DefBac = Code debug.Notification("Back key has been rebound") elseIf KeySel == 2 DefRig = Code debug.Notification("Right key has been rebound") elseIf KeySel == 3 debug.Notification("Left key has been rebound") DefLef = Code else debug.Notification("Keys reset to default arrow keys") DefFor = 17 DefBac = 31 DefLef = 30 DefRig = 32 endIf endFunction function MenuActivated() ;player can unfurl the sails and lift the anchor for sailing or drop the anchor and furl the sails for docking Int MenuValue = LongBoatMenu.Show(0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000) if MenuValue == 0 ToggleDrive = !ToggleDrive if ToggleDrive as Bool && !ToggleAnchor ;if anchor is lifted and sailing is activated ShipDoorCabin.Disable() ShipDoorBase.Disable() game.ForceFirstPerson() game.DisablePlayerControls(true, false, true, false, false, false, true, false, 0) PlayerRef.SetVehicle(SeatVehicle) ;xmarker (SeatVehicle) on ship not working? player is never fixed there PlayerRef.SetGhost(True) WaterChurnInstanceID = WaterChurn.play(PlayerRef as ObjectReference) BoatCreakSoundID = BoatSound.play(PlayerRef as ObjectReference) sound.SetInstanceVolume(BoatCreakSoundID, 1.00000) self.MoveTo(StaticShipMarker, 0.000000, 0.000000, 0.000000, true) ; activator is moved to dummy cell PlayerRef.PlayIdle(SitAnim) ;not working self.UnregisterForUpdate() self.RegisterForKey(DefFor) self.RegisterForKey(DefLef) self.RegisterForKey(DefRig) self.RegisterForKey(DefBac) self.RegisterForKey(18) self.RegisterForSingleUpdate(0 as Float) elseIf !ToggleDrive && !ToggleAnchor ;player did exit sailing with e key ShipDoorCabin.Enable() ShipDoorBase.Enable() game.EnablePlayerControls(true, true, true, true, true, true, true, true, 0) self.UnregisterForAllKeys() self.UnregisterForUpdate() PlayerRef.StopTranslation() PlayerRef.SetVehicle(none) PlayerRef.SetGhost(False) sound.StopInstance(WaterChurnInstanceID) sound.StopInstance(BoatCreakSoundID) CurrentSpeed = 0 as Float ;player has toggled the anchor: move activator and doors to static ship self.MoveTo(MyBoat, 700 as Float * math.Sin(MyBoat.GetAngleZ()), 700 as Float * math.Cos(MyBoat.GetAngleZ()), 580 as Float, true) ShipDoorCabin.MoveTo(SpawnedStaticShip, 640 as Float * math.Sin(SpawnedStaticShip.GetAngleZ()), 640 as Float * math.Cos(SpawnedStaticShip.GetAngleZ()), 340 as Float, true) ShipDoorBase.MoveTo(SpawnedStaticShip, 0 as Float * math.Sin(SpawnedStaticShip.GetAngleZ()), 0 as Float * math.Cos(SpawnedStaticShip.GetAngleZ()), 340 as Float, true) else debug.MessageBox("You must raise the anchor before sailing") ToggleDrive = !ToggleDrive endIf elseIf MenuValue == 1 if !ToggleDrive self.DropAnchor() else debug.MessageBox("You must stop sailing before dropping anchor") endIf endIf endFunction function OnKeyUp(Int keyCode, Float holdTime) ;does nothing? if keyCode == 18 Debug.Trace("Key released after " + holdTime + " seconds") self.MenuActivated() endIf endFunction function DropAnchor() ToggleAnchor = !ToggleAnchor ;if anchor is down and sails furled, spawns a static ship at the exact position of the movable ship. Moves movable ship to dummy cell ;moves activator from dummy cell to static shipswheel, moves doors from dummy cell at their position on static ship if ToggleAnchor SpawnedStaticShip = MyBoat.PlaceAtMe(StaticShip as form, 1, false, false) MyBoat.MoveTo(StaticShipMarker, 0.000000, 0.000000, 0.000000, true) self.MoveTo(SpawnedStaticShip, 700 as Float * math.Sin(SpawnedStaticShip.GetAngleZ()), 700 as Float * math.Cos(SpawnedStaticShip.GetAngleZ()), 580 as Float, true) ShipDoorCabin.MoveTo(SpawnedStaticShip, 640 as Float * math.Sin(SpawnedStaticShip.GetAngleZ()), 640 as Float * math.Cos(SpawnedStaticShip.GetAngleZ()), 340 as Float, true) ShipDoorBase.MoveTo(SpawnedStaticShip, 0 as Float * math.Sin(SpawnedStaticShip.GetAngleZ()), 0 as Float * math.Cos(SpawnedStaticShip.GetAngleZ()), 340 as Float, true) debug.MessageBox("You have dropped the anchor.") else ;moves movable ship from dummy cell to static ship and disables the static ship MyBoat.MoveTo(SpawnedStaticShip, 0.000000, 0.000000, 0.000000, true) SpawnedStaticShip.DisableNoWait(false) SpawnedStaticShip.Delete() debug.MessageBox("You have lifted the anchor.") endIf endFunction function OnActivate(ObjectReference akActionRef) ;choice menu: sailing, anchor and sail toggling or exit self.MenuActivated() endFunction function OnInit() ;set ship speed and movement direction. Set distance from ship for invisible actors. Set movement keys to WSAD MaxSpeed = 400 as Float MaxReverseSpeed = 400 as Float DefaultAngleSpeed = 2 as Float DefaultTiltAngle = 2 as Float FrontOffset = 90 as Float FrontBackMenOffset = 780 as Float dir = 1 as Float MenDepthOffset = 30 as Float DefFor = 17 DefBac = 31 DefLef = 30 DefRig = 32 endFunction I do not understand everything the script does. It's all trial and error for me. The values for the translation and distance of the invisible actors i.e. I simply tried different values until it worked. What do you say? Screenshots here: https://www.afkmods.com/index.php?/gallery/album/149-tashenis-the-isles-of-teia/
  2. I run into a new issue (whatelse ) I was never aware of. My scripting knowledge is very limited and here I'm not sure what the OnInit function really does. I know that OnInit fires twice, tested that with a messagebox. The script is about follower mounting, when player mounts his horse or whatever: scriptName _RubyPlayerMountMonitorScript extends ReferenceAlias ;-- Properties -------------------------------------- actor property Ruby auto visualeffect property Effect auto faction property CurrentFollowerFaction auto actor property PlayerRef auto actor property Assan auto ;-- Variables --------------------------------------- actor Player ;-- Functions --------------------------------------- ; Skipped compiler generated GotoState ; Skipped compiler generated GetState function FollowerMount(actor myFollower, actor myHorse, String asEventName, Float afTime) form EquippedItemLeft = PlayerRef.GetEquippedObject(0) form EquippedItemRight = PlayerRef.GetEquippedObject(1) if myFollower.IsInFaction(CurrentFollowerFaction) == 1 as Bool if myFollower.GetActorValue("WaitingForPlayer") == 0 as Float if EquippedItemLeft as Bool || EquippedItemRight as Bool if asEventName == "tailHorseMount" debug.SendAnimationEvent(Ruby as objectreference, "IdleForceDefaultState") myFollower.OnAnimationEvent(none, "tailHorseMount") Effect.play(myHorse as objectreference, 0.300000, none) myHorse.MoveTo(myFollower as objectreference, 50.0000 * math.sin(myFollower.GetAngleZ() + 90.0000), 50.0000 * math.cos(myFollower.GetAngleZ() + 90.0000), 0.000000, true) utility.Wait(0.100000) myFollower.SetAnimationVariableBool("bIsRiding", 1 as Bool) myFollower.EvaluatePackage() endIf if asEventName == "tailHorseDismount" Bool dismountInitiated = myFollower.Dismount() myFollower.SetAnimationVariableBool("bIsRiding", 0 as Bool) myFollower.EvaluatePackage() endIf else return endIf endIf endIf endFunction function OnInit() ; Debug.Messagebox("Script running") utility.Wait(5.00000) Player = game.GetPlayer() self.RegisterForAnimationEvent(PlayerRef as objectreference, "tailHorseMount") self.RegisterForAnimationEvent(PlayerRef as objectreference, "tailHorseDismount") endFunction function OnAnimationEvent(objectreference akSource, String asEventName) if akSource == PlayerRef as objectreference self.FollowerMount(Ruby, Assan, asEventName, 0.300000) else return endIf endFunction This script is attached to the alias of my follower Ruby in a script started quest. It works very good. With Alternate Start from Arthmoor activated. With only vanilla Skyrim it works very good. Until I open racemenu with the console and change my character. After closing racemenu, script is no longer working. I tested without MO. I tested without changing character, saved the game, shut down, load the game and the save and script runs fine. So it must have to do with racemenu (not the mod racemenu! I don't use). I tested on a start enabled quest. Same result, script stops working. What happens here and what can I do to make that work? And a second problem occurs: I wrote my playerhorse now follows fine again, but that is only partially true, like I just now discovered. It works fine if I use Alternate Start. When I use only vanilla Skyrim, the NPC walks away as soon as I tell her to wait. The horse stays, like she should. A script changes the wait globalvariable to 1, package stack is evaluated for horse and npc and the stay package has the wait globalvariable set as condition as well as a quest stage set. There is no package everywhere that could fire in this quest stage. Why does it work with Alternate Start? And not with vanilla? It's really tiring. Your suggestions are much appreciated. Update: Playerhorse now behaves correctly. CK didn't save my property and I overlooked it.
×
×
  • Create New...