Jump to content

Problem with script


klovok

Recommended Posts

Ideally, the script would work in this manner. I would put items in, and when i exit out of the container, they would be deleted. well apparently

this is a lot more complicated than i thought, and any script I tried to write has failed. Thanks in advance to whoever posts in this topic!

Edited by mtt_asch
Link to comment
Share on other sites

You could try something like this:

 

scn MyGarbageDisposalScript

short iActivated

; put this script on the container

BEGIN OnActivate

if (IsActionREF Player == 1)
	set iActivated to 1
	return
endif

END

BEGIN MENUMODE

return		;don't do anything while container is open

END


BEGIN GAMEMODE

if iActivated == 1
	RemoveAllItems
	set iActivated to 0
endif

END

Link to comment
Share on other sites

ScriptName trashcansafe

 

short iActivated

 

BEGIN OnActivate

if IsActionREF Player == 1

set iActivated to 1

return

endif

END

 

BEGIN MENUMODE

return

END

 

BEGIN GAMEMODE

if iActivated == 1

RemoveAllItems

set iActivated to 0

endif

END

 

 

This is what i was able to get the script down to bear minimum, but still won't save. I am not a very good code troubleshooter, so just wondering if there are any errors.

Edited by mtt_asch
Link to comment
Share on other sites

ScriptName trashcansafe

 

short iActivated

 

BEGIN OnActivate

if IsActionREF Player == 1

set iActivated to 1

return

endif

END

 

BEGIN MENUMODE

return

END

 

BEGIN GAMEMODE

if iActivated == 1

RemoveAllItems

set iActivated to 0

endif

END

 

 

This is what i was able to get the script down to bear minimum, but still won't save. I am not a very good code troubleshooter, so just wondering if there are any errors.

 

P.S. the post doesn't show it, but the code is correctly indented.

Link to comment
Share on other sites

While testing, I managed to get the code into the object. When i go to the safe, it doesnt display anything. I inserted a showmessage command after the delete items command, and found that the script actually worked. What should i do from here? the current code is:

 

P.S. The name was changed for the sake of not matching the object, which it wasn't but just to double check, it contains no words that the object's name does.

 

P.P.S. I never thanked you for replying, so thank you!

 

ScriptName Script01forhq

short iActivated

BEGIN OnActivate
if IsActionREF Player == 1
	set iActivated to 1
	return
endif     
END

BEGIN MENUMODE
return      
END

BEGIN GAMEMODE
if iActivated == 1
         RemoveAllItems
	showmessage message01forhq
         set iActivated to 0
endif     
END

Edited by mtt_asch
Link to comment
Share on other sites

Oh, I forgot something.

 

ScriptName Script01forhq

short iActivated

BEGIN OnActivate
   	if IsActionREF Player == 1
           	set iActivated to 1
			Activate        	;<--- I forgot this
           	return
   	endif 	
END

BEGIN MENUMODE
   	return  	
END

BEGIN GAMEMODE
   	if iActivated == 1
     	RemoveAllItems
           	showmessage message01forhq
     	set iActivated to 0
   	endif 	
END

Link to comment
Share on other sites

What NIF model are you using for the trashcan?

If you are using one of the ingame trashcan's then use the code that rickerhk supplied.

(That code will work on ANY container)

 

If you are using a 'safe' model, or the big metal industrial garbage model, then you can use an alternate script.

The code below will only work on NIF's that have animations for opening/closing. (Open & Close playgroups)

scn trashcanAnimatedScript

Begin OnClose
 RemoveAllItems
End

Link to comment
Share on other sites

when you get it all working i have a suggestion for you.

 

make a new container (dumpster) and use its ref in the removeallitems command.

this way when you close your trash can the items are moved to the dumpster.

 

then on the dumpster if youre using NVSE you can employ GetGameRestarted to clear the contents with removeallitems as above to clear the dumpster each time you reload the game so that whatever you trash has a kind of recycle bin place to go in case you accidentally drop in the wrong thing.

 

if you're not using NVSE there are plenty of other ways to periodically empty the bin still and i would still suggest setting something like this up.

 

if you have fallout 3 there is a mod called HiVE that has this exact system set up(the new vegas edition does not have it so be sure to get the right one). if you have the geck for fallout 3 (& FOSE) as well i welcome you to open the esp and rip the scripts, they should be pretty plug n play and work in new vegas with little/no changes.

Link to comment
Share on other sites

Well I can say, that both of the scripts posted by rickerhk and tunaisafish worked wonderfully :thumbsup: . The only problem I have is deciding which one to keep... So i kept both! As far as the dumpster, I am working on it currently. I also learned a lot more about scripting, and made a simple error when trying to make my own script which was basically tunaisafih's code, except i overcomplicated it horribly by adding the refID :wallbash:. I learn from my mistakes I hope...
Link to comment
Share on other sites

  • Recently Browsing   0 members

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