Difference between revisions of "Summon Object"

16 bytes added ,  00:41, 1 May 2009
m
no edit summary
imported>Wrye
m (Category)
imported>Tekuromoto
m
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[Category: Useful Code]]
[[Category: Useful Code]]
It's now known that the PlaceAtMe command is likely to cause bloating. Used a few times, no problem. Used a lot of times, problem. However, you can often avoid it by defining a permanent ref object and moving it to the player. But suppose that you don't want it right at the player's feet, but instead in front of them?  
It's now known that the [[PlaceAtMe]] command is likely to cause bloating. Used a few times, no problem. Used a lot of times, problem. However, you can often avoid it by defining a permanent ref object and [[MoveTo|moving]] it to the player. But suppose that you don't want it right at the player's feet, but instead in front of them?  


Here are some considerations:
Here are some considerations:
Line 7: Line 7:
* Moving a displayed object fails to update its collision data (notably required for getting activation cursors to work correctly). You can fix this by disabling the object and the re-enabling it.
* Moving a displayed object fails to update its collision data (notably required for getting activation cursors to work correctly). You can fix this by disabling the object and the re-enabling it.
* However, if you move, disable and then re-enable, the object will appear briefly at the player and then reappear at new position. Instead, you should disable, move and then re-enable. And there should be a time gap of a frame or two before enabling and disabling.
* However, if you move, disable and then re-enable, the object will appear briefly at the player and then reappear at new position. Instead, you should disable, move and then re-enable. And there should be a time gap of a frame or two before enabling and disabling.
* The original ref has to be placed and set to permanent somewhere. If you want the original to be unfindable, a simple thing to do is place it in the Aleswell dummy cell.
* The original ref has to be placed somewhere and set to persistent. If you want the original to be unfindable, a simple thing to do is place it in the Aleswell dummy cell.


So here's a chunk of code that does this for Wrye's [http://wrye.ufrealms.net/Summon%20Bed.html Summon Bed] mod. (Some irrelevant code trimmed for the purpose of clarity.)
So here's a chunk of code that does this for Wrye's [http://wrye.ufrealms.net/Summon%20Bed.html Summon Bed] mod. (Some irrelevant code trimmed for the purpose of clarity.)
Anonymous user