AlexxEG Posted March 17, 2010 Share Posted March 17, 2010 Let's say a object have a script that goesBegin OnLoad PlaceAtMe Explosion End(I don't realy have that as the script, it's just a example)If I then use "PlaceAtMe ObjectsFormID", will the script trigger when it's spawned? Link to comment Share on other sites More sharing options...
pkleiss Posted March 17, 2010 Share Posted March 17, 2010 No it won't as the OnLoad block runs once when a cell is loaded, not an object. You could just use this instead: scn MySpawnedExplosionScript Short DoOnce Begin GameMode If DoOnce == 0 PlaceAtMe Explosion Set DoOnce to 1 disable ;Makes the spawned item vanish markfordelete ;will remove the item from the game permanently after a few frames EndIf End Link to comment Share on other sites More sharing options...
AlexxEG Posted March 17, 2010 Author Share Posted March 17, 2010 No it won't as the OnLoad block runs once when a cell is loaded, not an object. You could just use this instead: scn MySpawnedExplosionScript Short DoOnce Begin GameMode If DoOnce == 0 PlaceAtMe Explosion Set DoOnce to 1 disable ;Makes the spawned item vanish markfordelete ;will remove the item from the game permanently after a few frames EndIf EndAhhh.... Okey thanks^^ Link to comment Share on other sites More sharing options...
amcclell Posted March 17, 2010 Share Posted March 17, 2010 No it won't as the OnLoad block runs once when a cell is loaded, not an object. You could just use this instead: scn MySpawnedExplosionScript Short DoOnce Begin GameMode If DoOnce == 0 PlaceAtMe Explosion Set DoOnce to 1 disable ;Makes the spawned item vanish markfordelete ;will remove the item from the game permanently after a few frames EndIf EndAhhh.... Okey thanks^^ Though, for reference, explosion type objects automatically mark themselves for deletion after their duration expires, so in this particular instance you wouldn't need markfordelete. Most other object types you do, though. Link to comment Share on other sites More sharing options...
Cipscis Posted March 18, 2010 Share Posted March 18, 2010 OnLoad blocks will run when the scripted reference is loaded into memory. This can happen when the player enters the cell containing it, or when it is moved to the player's location from a distance cell, or when a previously disabled object is enabled (for objects with 3D data). In some cases, OnLoad blocks won't run because an object may already be loaded in memory. For example, if I start Fallout 3 and load a save in which a reference with the following script attached to it, the global "TimeScale" variable will be set to 5:ScriptName InitTimeScaleScript Begin OnLoad set TimeScale to 5 EndHowever, if I then load that same save from in-game, the value of "TimeScale" will be read from the save, but because the object is already loaded its OnLoad block won't run again, so "TimeScale" won't be updated. For this reason, I usually recommend avoiding this blocktype - the fact that it can be ignored so easily makes it pretty useless in most cases. Cipscis Link to comment Share on other sites More sharing options...
AlexxEG Posted March 18, 2010 Author Share Posted March 18, 2010 Got it ;) However, if a object have 3D Data, what does that mean? Totaly off-topic btw Link to comment Share on other sites More sharing options...
Cipscis Posted March 18, 2010 Share Posted March 18, 2010 Just about every object will have 3D Data. A notable exception (and the only example that I can think of) would be a trigger box. As far as I know, if an object has a mesh associated with it then it has 3D Data. Cipscis Link to comment Share on other sites More sharing options...
pkleiss Posted March 18, 2010 Share Posted March 18, 2010 OnLoad blocks will run when the scripted reference is loaded into memory. I did not know this, Thanks again Cipscis. Link to comment Share on other sites More sharing options...
AlexxEG Posted March 18, 2010 Author Share Posted March 18, 2010 Okey, thanks for all the help from all three of you^^ Link to comment Share on other sites More sharing options...
Recommended Posts