Jump to content

Make player walk only.


antstubell

Recommended Posts

The player in my mod can 'carry' a bucket of water in his/her inventory. I want to make it so that when they are carrying the bucket of water they can only walk (no running, jumping, fighting). Also if player drops the bucket of water - removes from inventory - then it spills and a empty bucket appears where the player droppws the bucket of water.

Happy New Year and thanks.

Link to comment
Share on other sites

Solved the drop a bucket of water but the empty bucket spawns directly under player's feet. How can I script it so it appears in front of player?

 

MiscObject Property Bucket02b Auto

Event OnContainerChanged(ObjectReference newContainer, ObjectReference oldContainer)
if (newContainer != Game.GetPlayer())
self.delete()
debug.notification("Bucket Of Water Spilled.")
Game.GetPlayer().PlaceAtMe(Bucket02b, 1)

EndIf
EndEvent

 

Link to comment
Share on other sites

You will need to tinker with it a little, i just put the number randomly, and i wrote it from the top of my head.

 

 

MiscObject Property Bucket02b Auto
 
Event OnContainerChanged(ObjectReference newContainer, ObjectReference oldContainer)
if (newContainer != Game.GetPlayer())
    Self.Disable()
    debug.notification("Bucket Of Water Spilled.")
    ObjectReference Bucket02bRef = Game.GetPlayer().PlaceAtMe(Bucket02b, 1)
    Bucket02b.SetPosition(0, 0, 10)
    Utility.Wait(0.4)
    Self.Delete()
EndIf
EndEvent

 

 

 

Edit: Typo...

Edited by maxarturo
Link to comment
Share on other sites

  • 2 weeks later...

Error.

psc(10,14): SetPosition is not a function or does not exist

Adjust the following lines in maxarturo's script:

 

 

From:

    ObjectReference Bucket02bRef = Game.GetPlayer().PlaceAtMe(Bucket02b, 1)
    Bucket02b.SetPosition(0, 0, 10)

To:

    ObjectReference Bucket02bRef = Game.GetPlayer().PlaceAtMe(Bucket02b, 1)
    Bucket02bRef.SetPosition(0, 0, 10)

 

 

Should solve the problem. At the very least it targets the correct object.

 

Regarding making the player walk slow:

You can change the speed multiplier to make them walk even when trying to run. Sprinting would be affected too but only that it might make it more like the default run. This could be potentially counteracted by listening for the key press for sprint and changing the speed multiplier again. Yet, that might show a burst of speed followed by a slow down. <-- Changing speed multiplier via SetActorValue or ModActorValue does not require SKSE but listening for the key press with OnKeyDown or IsKeyPressed does.

The other way to do this is to change the weight of an object that the player is carrying, say your bucket. When the bucket is added to inventory, initially change its weight so that it is one pound over the current weight. Then listen to the player's inventory with OnItemRemoved (either in a state specific to the scenario or utilizing a bool or global variable condition check) and adjust the bucket's weight as needed to retain one pound over. Reset the bucket weight to initial value when it is removed from player inventory. The drawback to this method is the player will see the notification about being overencumbered the entire time. <-- Requires SKSE and a maintenance script to re-set the weight on each game session. SetWeight changes the base form value. Be sure to use a custom to this purpose object so as to not screw up any other instance of the object.

You can disable fighting with DisablePlayerControls.

 

I do not think jumping can be disabled. At least I have no knowledge in that regard.

Link to comment
Share on other sites

  • 3 weeks later...

Been playing around with -

Bucket02b.SetPosition(0, 0, 10)

Appears that x,y,z coordinates refer to the position in the cell because when bucket is dropped, no matter where player is in the cell, the bucket appears at the same location.

I think I have seen some authors first get the player's position, add an amount to one or more of the values and then set the position of their object. I, however, have not done that so am not certain on the way to approach that.

Link to comment
Share on other sites

Yeap, this was a mistake from my part, 'setposition' uses the X,Y,Z,=0 coordinates of the cell.
Use the following script, coordinates are all set to '0', adjust them according to your needs.

 

 

MiscObject Property Bucket02b Auto
 
Event OnContainerChanged(ObjectReference newContainer, ObjectReference oldContainer)
       if (newContainer != Game.GetPlayer())
           Self.Disable()
           debug.notification("Bucket Of Water Spilled.")
           Game.GetPlayer().PlaceAtMe(Bucket02b, 1)
           Bucket02b.MoveTo(Game.GetPlayer(), 0.0, 0.0, 0.0, abMatchRotation = true)      
           Utility.Wait(0.4)
           Self.Delete()
EndIf
EndEvent

 

 

Edited by maxarturo
Link to comment
Share on other sites

  • Recently Browsing   0 members

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