Jump to content

Static Activators?


Evan555alpha

Recommended Posts

Posted

Basically, what I'm trying to do is make those framed paintings you see around into activators where there'll be options to either cancel or remove the picture and place it somewhere else. This idea is mostly piggy-backing off of http://www.nexusmods.com/newvegas/mods/45464/?, but I'm stuck as to how I would make those paintings into activators. I've got the scripting down, and pretty much everything else down as well.

 

Do I need to convert anything in the Nif?, or is it just something in the Geck I have to point the script to?

Posted

Take an activator WITHOUT script, this is pretty much important. Take for example ElectricalSwitch 1 or 2. Duplicate it and put your new base ID, i.e. MyPaintingActivator. Take a static paint, double click on it, check the nif path, select it and CTRL+C (copy). Save your esp, then fire up FNVEdit, load your plugin, look for the activator you created - here, you will see it points to the electrical switch mesh, simply edit it and CTRL + V paste your painting path. Quit and save, and you'll have a painting activator.

 

You can skip the FNVEdit part if you extract the meshes somewhere and point to them directly editing the path on MyPaintingActivator

 

EDIT: I just noticed your pic shows some custom paintings, not vanilla... so you probably don't need to set the vanilla path using FNVEdit and you simply will point to the file in the correct path.

Posted

 

EDIT: I just noticed your pic shows some custom paintings, not vanilla... so you probably don't need to set the vanilla path using FNVEdit and you simply will point to the file in the correct path.

They actually are the Vanilla ones. I just retextured them, is all.

 

Edit: Well, it worked. Just need to clean up the world model so that it has a back texture, and I'll be able to repeat for the next 7 paintings, then release it as a mod. Maybe.

  • 1 month later...
Posted

Continuing from this thread because I'm working with the same activators.

 

I've been trying to change the scale for these paintings from a message box via script. So far, I've not had any luck doing so, past the point where the script saves in the geck.

 

Here's the script:

SCN Painting01Script

;setting variables and such
Ref Self
Short Button
Float Scale

;"placement" of the painting, turning it into an activator
Begin OnActivate
	Set Self to GetContainer
	If GetIsId PlaceablePainting01 == 1
		Self.PlaceAtMe Painting01Activator 1
			Self.Disable
				Self.MarkforDelete
	ElseIf GetIsId Painting01Activator == 1 && Player.GetItemCount PLPaintingRemover == 0
	ElseIf GetIsId Painting01Activator == 1 && Player.GetItemCount PLPaintingRemover > 0
		ShowMessage PLPaintingMSG
	EndIf
End

;if the PC has the removal key, show this message
Begin GameMode
	Set Button to GetButtonPressed
	Self.SetOwnerShip
	If Button == 0
	ElseIf Button == 1
		Self.MarkForDelete
			Player.AddItem PlaceablePainting01 1
	Elseif Button == 2
			ShowMessage PLPScale
	EndIf
End

;Now for scaling
Begin GameMode
	Set Button to GetButtonPressed
	Set Scale to Self.GetScale
	Set Self to GetSelf
;adding in various increments
	If Button == 0 && Scale < 30
		Set Scale to ( Scale + 1 )
		Self.SetScale Scale
	EndIf
End

I know that the script works, but the last part about scaling doesn't apply the scale to the reference, which should be the activator used to show the message in the first place. Anyone have any ideas?

 

Thanks.

Posted

Who is "container"? (referring to Set Self to GetContainer)

What kind of item is PlaceablePainting01? is it in game or in your inventory? is this script attached to PlaceablePainting01?

Posted

Who is "container"? (referring to Set Self to GetContainer)

What kind of item is PlaceablePainting01? is it in game or in your inventory? is this script attached to PlaceablePainting01?

I read somewhere that the use of GetSelf is a rather bad idea, so I changed it to GetContainer. I can change that back should I need to.

 

PlaceablePainting01 is the item that the PC drops to "place" the thing. When the PC goes to pick it up, it places a static activator in it's place, and deletes itself, leaving only the activator. What I am trying to do is have the option to change the scale of this newly placed activator through a menu. The entire script should be tied to both items.

Posted

A bunch of thoughts.

 

 


I read somewhere that the use of GetSelf is a rather bad idea, so I changed it to GetContainer. I can change that back should I need to.

Mainly, I'm not sure it would return a value different than zero in this case. MyPicture.GetContainer should returns the player while it is in inventory, and I would expect it returning zero if you drop it, but I never had a chance to call it on a dropped item.

Yes, I would use GetSelf, as you are already used it on the GameMode blocktype.

 

It also could be a good idea to "protect" the script from being executed on ncps, something like this:

Begin OnActivate Player

About the scale, it would require some extra debug, but I think it simply doesn't behave how you'd expect. Menus can be tricky, and so their functions, I'd strongly suggest to use tokens for sub-levels as Cipscis explains in this tutorial, they never fail and are pretty readable. You can do these menus in different ways, just don't forget to stage them. Something like this:

Int MyMenuLevel
...
If MyMenuLevel == 0
   ; shows the options for level 0 and the rest of the code
elseif MyMenuLevel == 1
   ; shows the options for level 1 and the rest of the code
   ; etc.
...

Last, I suppose there's a risk of unexpected weird behaviours / glitches.

It is a GameMode, it will start running when you drop the item on the floor / on the wall / whatever, or everytime it is loaded in memory (i.e. if you come back in the cell).

This means it will run a lot of times, every frame, even when you are not interested.

The code continuously sets the Button variable to GetButtonPressed - but if I remember well that variable is setted in the next frame of a generic menumode, it doesn't make distintion among menumodes.

Posted

The menu stuff I've got down, so far. The only thing troubling me beyond my knowledge is the entire scale part of it. Setting the self reference to Painting01Activator doesn't seem to do anythng. Should I be using something else? Using a different reference, or perhaps mode?

Posted

Here's the new script. I haven't tested it in game so far, but it'll save into the Geck at least.

SCN Painting01Script

;setting variables and such
Ref Self
Short Button
Float Scale
Short MenuLevel
Float ModdedScale

;"placement" of the painting, turning it into an activator
Begin OnActivate
	Set Self to GetContainer
	If GetIsId PlaceablePainting01 == 1
		Self.PlaceAtMe Painting01Activator 1
			Self.Disable
				Self.MarkforDelete
	ElseIf GetIsId Painting01Activator == 1 && Player.GetItemCount PLPaintingRemover == 0
	ElseIf GetIsId Painting01Activator == 1 && Player.GetItemCount PLPaintingRemover > 0
		ShowMessage PLPaintingMSG
	EndIf
End

;if the PC has the removal key, show message PLPaintingMSG
Begin GameMode
	Set Button to GetButtonPressed
	Self.SetOwnerShip
	If Button == 0
	ElseIf Button == 1
		Self.MarkForDelete
		Player.AddItem PlaceablePainting01 1
	Elseif Button == 2
		ShowMessage PLPScale
	Endif
End

;The Scale Menu, PLPScale
Begin GameMode
	;Setting things
	Self.SetOwnerShip
	Set Scale to Self.GetScale
	Set ModdedScale to Self.GetScale

	;checking for player choice
	If MenuLevel == 0
		Set Button to GetButtonPressed
		If Button == 0
			Set MenuLevel to 1
			ShowMessage PLPAddScale
		ElseIf Button == 1
			ShowMessage PLPTakeScale
			Set MenuLevel to 2
		ElseIf Button == 2;Reset the scale
			Set Scale to 1
			Self.SetScale Scale
		ElseIf Button == 3
			Set MenuLevel to 0
			Return
		EndIf

	;Addition part of the scale menu
	ElseIf MenuLevel == 1
		Set Button to GetButtonPressed
		If Button == 0;Example, will change for more buttons
			Set Scale to ( Scale + 1 )
			Self.SetScale Scale
		ElseIf Button == 1
			Set Scale to ModdedScale
			Self.SetScale ModdedScale
		ElseIf Button == 2
			Set MenuLevel to 0
			Return
		EndIf

	;Subtraction part of the scale menu
	ElseIf MenuLevel == 2
		Set Button to GetButtonPressed
		If Button == 0;Example, will change for more buttons
			Set Scale to ( Scale - 1 )
			Self.SetScale Scale
		ElseIf Button == 1
			Set Scale to ModdedScale
			Self.SetScale ModdedScale
		ElseIf Button == 2
			Set MenuLevel to 0
			Return
		EndIf
	EndIf
End

p.s. I hope that I'm not coming off as rude, as I don't mean to be. If I am, then do know that I'm sorry for that.

Posted

I wrote a fast example ESP, every useful ID starts with aaa

Go in game and check what it does, if it's like you want it to work.

You receive 5 items in few seconds, they are under MISC category and are called aaaItem (bottom of the list), you drop them and then interact with them.

This should avoid any gamemode glitches I could think about.

I think it requires NVSE 2+ due to Update3D function used on the havoked ball

Hope it will help you

aaaEwan.esp

Posted

As far as I can tell, they work as intended. I'll do what you did, and split my scripts up into different parts, depending on which item they're attatched to. I'll post again when/if I manage to get it working.

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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