Jump to content

Chair Script


ArekkusuStorm

Recommended Posts

Greetings, modding community,

 

I have a request for a script that I need for my mod (Not sure if I should put this in this sub forum or the request one), what I need is for the script to detect if a chair is nearby (Stool, chair, and whatever variants of chairs there are in the game) within a few meters from the player character, if there is then setpos x, y, and z & setangle z the chair to the player's location and rotation. Then open pop up menu with two options for playing custom animations, but when choosing the last option, restore the chair's location and rotation to the original. I'm not entirely sure if this is even possible since the chairs have their unique ref id so if it isn't I'll think of an alternative.

 

The reason why I ask for this kind of script is because I want the player to be able to sit anywhere in a room or somewhere close to their outpost but not have a magical chair appear out of thin air. (This isn't a mod just to sit though.)

 

Edit: Alright, that was pretty contradicting, I should say "but not have a random chair pulled from the invisible pack that holds the bottomless pit of inventory items".

 

If there is something I haven't gone into detail on, ask me because I often forget to mention stuff in my requests.

 

Thanks for taking the time to read this.

Edited by ArekkusuStorm
Link to comment
Share on other sites

I might be misunderstanding, apologies if I am, but you want a script to detect nearby chairs, and then move them to the player so that they can sit on them? It's not a specific chair or anything? If so, these lines will detect furniture for you, and move it to your position. From there you'll need to create the menu yourself. If you don't know how to do that, take a look at this: http://geck.bethsoft.com/index.php?title=Adding_an_Options_Menu

ref rChair
float fXChairPos
float fYChairPos
float fZChairPos
float fXPlayerPos
float fYPlayerPos
float fZPlayerPos
float fPlayerZAngle
float fChairZAngle

begin GameMode

	set rChair to GetFirstRef 39 1 0
	if rChair
		set fXChairPos to rChair.GetPos X
		set fYChairPos to rChair.GetPos Y
		set fZChairPos to rChair.GetPos Z
		set fXPlayerPos to Player.GetPos X
		set fYPlayerPos to Player.GetPos Y
		set fZPlayerPos to Player.GetPos Z
		rChair.Setpos X fXPlayerPos
		rChair.Setpos Y fYPlayerPos
		rChair.Setpos Z fZPlayerPos
		rChair.SetAngle Z fPlayerZAngle
		;Display menu here.
		;If you want to select a different chair from the menu, on that menu option include these lines. Make sure to also close the menu, since they will make the above lines process again, causing the menu to open again too:
		;rChair.Setpos X fXChairPos
		;rChair.Setpos Y fYChairPos
		;rChair.Setpos Z fZChairPos
		;rChair.SetAngle Z fChairZAngle
		;set rChair to Pencil01
		;set rChair to GetNextRef
		;GoTo 1
	endif
end

This will only move one chair (and also things like couches and possibly beds) though, and you won't be able to control which one. If you want to narrow down which furniture it chooses from, use a form list, and then check if the chair this has selected is in said list. If it's not use the lines I've recommended using for selecting a different chair in the menu.

 

Anyway, I wish you the best of luck. :smile:

 

Edit:

 

I've been informed that you can't move furniture via script, or console command, so unfortunately the above script won't work. I'm truly sorry to have wasted your time with this. I'll leave the original message so that you (and anyone else) can see what I was trying to do, and maybe you (or they) will get an idea from it. Again, my apologies fro posting a useless solution.

Edited by Jojash
Link to comment
Share on other sites

Right, I forgot to mention that the custom animation I made was suppose to make the PC look like they were sitting (and doing something else) rather than have them regularly sit, but darn that's unfortunate that chairs can't be moved. No apologies needed, it's always nice to learn some new things even if they don't work here because I can apply them to something else in the future.

 

On to plan B then.

Edited by ArekkusuStorm
Link to comment
Share on other sites

  • Recently Browsing   0 members

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