Jump to content

Trying to make objects outside of containers respawn, need some help.


axman36

Recommended Posts

With the release of Skyrim, Bethesda added in a feature I've been wanting for a while. Items outside of containers now can actually respawn.

 

I've been looking for a way to make this happen in Fallout 3 and New Vegas without any luck. However recently I've come up with a script that comes close to replicating this.

 

SCN PanRespawn
float ftimer
int isactivated
short DoOnce

begin onactivate
if isactivated == 0
set isactivated to 1
endif
end

begin gamemode
if isactivated == 1
	if DoOnce == 0
		player.additem PanCookingMetal 1
		disable
		set DoOnce to 1
	endif
    if ( ftimer <= 5 )
        		set ftimer to ftimer + getSecondsPassed
    	else                                                                
		enable
		set isactivated to 0
		set DoOnce to 0
		set ftimer to 0
    endif
endif

 

However the main issue arises that I cannot add this script to ammo, it affects any item dropped by the player as well, and that this is done on realtime rather than in game time. Ammo is one of the biggest reasons why I want such a mod to exist in the first place.

 

So I came here to ask, is it possible to set this script on ammo?

 

Is it possible to create a script so that in general any grabbable object activated by the player will not exactly be added into the player's inventory but instead disable itself and eventually reenable itself or would I have to add this script onto each and every item?

 

The only workarounds I can think about is making a miscellaneous object with the ammo's model and then replacing all the ammo with that which, unless there's a simple way to replace all objects in the world with another, would take well too long and will not account for any other mods or DLC that adds these items into the world.

 

Any help would be much appreciated.

Link to comment
Share on other sites

Is it possible to create a script so that in general any grabbable object activated by the player will not exactly be added into the player's inventory but instead disable itself and eventually reenable itself or would I have to add this script onto each and every item?

 

Don't think so, at least not with vanilla scripting. I'm not familiar with FOSE/NVSE, but maybe someone who is can say whether those have that capability.

 

The only workarounds I can think about is making a miscellaneous object with the ammo's model and then replacing all the ammo with that which, unless there's a simple way to replace all objects in the world with another, would take well too long and will not account for any other mods or DLC that adds these items into the world.

 

FO3Edit/FNVEdit should be able to to change en masse the base form ID for references. It would not, as you point out, account for other mods or DLC.

Link to comment
Share on other sites

Theoretically you could check for the item the player is looking at and use GetCrosshairRef to compare it to a list (best option cause you can easily add mod items with patches) of items, and based on that list do whatever should be done.

 

So for example, you have a box of 10mm ammo sitting on a table. The script (running as a quest script set to a very low delay time) would see that the player is pointing at and within activate distance of the 10mm ammo. You then wait for the player to press the action key (should use the actual action key value in case they remapped it from default) and when/if they do, you disable the ref and your script then does whatever you have it programmed to do. In this instance it would add X amount of 10mm ammo to the player. Ideally these add values might be set from globals, so that the values can be tweaked easily later on without having to read through potentially thousands of lines of script.

 

To re-enable the items, you could build a form list of refIDs of each disabled item, and run a check every time a cell loads to see if the cell contains any of these disabled items. If it does, then you would check to see if your respawn time had been reached or passed, and then re-enable them if it had.

 

All in all a whole awful lot of work, but the end result could be really cool, especially with mod patches. I know that FWE has a sort of reverse system that will despawn placed items upon entering a cell. So you might take a look at that for reference.

 

It would be kind of cool to see a mod like this, even if I probably wouldn't use it. In Fo3 it might not make as much sense, but it would be pretty cool in Vegas, where more people live and there is actual economy and society.

Link to comment
Share on other sites

  • 4 weeks later...

I've done this in my Replayability mod before. The basic script I've come up with is this:

 

 

---

 

scn Script

 

float fPosition

ref rActivator

 

begin onactivate

 

set rActivator to getactionref

 

disable

rActivator.additem (THE ITEM FORM) 1 1

 

end

 

begin onreset

 

set fPosition to getstartingpos x

setpos x fPosition

set fPosition to getstartingpos y

setpos y fPosition

set fPosition to getstartingpos z

setpos z fPosition

 

set fPosition to getstartingangle x

setangle x fPosition

set fPosition to getstartingangle y

setangle y fPosition

set fPosition to getstartingangle z

setangle z fPosition

 

enable

 

end

 

------

 

I would then add it to a "dummy" misc. item identical to the item you want except with that script so it looks the same. You can't add the script to the original item though. This script resets the item whenever the cell/world resets, which I think is fair, but if you really want 5 seconds or something you have to incorporate a timer into this.

 

If you really then want to replace all in-game instances of a certain object, then use the GECK's find and replace function to replace all instances of "SugarBombs01" with the new "SugarBombs01Respawning" or something and don't check any of the boxes like in this cell only etc.

 

I hope this helps!

Edited by Dandys
Link to comment
Share on other sites

  • Recently Browsing   0 members

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