Difference between revisions of "Talk:Detect Player Cell Change (Without Polling)"

Jump to navigation Jump to search
no edit summary
imported>DavidJCobb
m (i found a thing)
imported>Granson
Line 10: Line 10:


:Confirmed: this doesn't seem to work entirely well for load screens. [[Talk:IsPlayerMovingIntoNewSpace#Exact methodologies|Here is a method that does.]] [[User:DavidJCobb|DavidJCobb]] ([[User talk:DavidJCobb|talk]]) 2015-07-20T05:33:15 (EDT)
:Confirmed: this doesn't seem to work entirely well for load screens. [[Talk:IsPlayerMovingIntoNewSpace#Exact methodologies|Here is a method that does.]] [[User:DavidJCobb|DavidJCobb]] ([[User talk:DavidJCobb|talk]]) 2015-07-20T05:33:15 (EDT)
The method is great, but for me the tracker always stopped working quite soon.
When the player enters a new cell, the magic effect is applied, the event triggered and the invisible object gets moved to the player cell as intended. However, when the player runs around, he sometimes crosses multiple cell borders a second, even when running straight in one direction. In this case the player leaves the new cell, before the condition 'object is not in player cell' is checked again a second later. The condition then continues to evaluate to true for all times - unless the player re-enters the cell with the invisible object by chance, which is unlikely because he doesn't get informed about the glitch and continues to run until finally realizing something isn't right. The effect never finishes and the OnEffectStart event doesn't get triggered any more.
So you need to add code to move the invisible object again, if the effect starts but doesn't finish in due time:
      Event OnEffectStart(Actor akTarget, Actor akCaster)
   
  RegisterForSingleUpdate(<couple of seconds, I took 7>)
  <do fancy stuff>
          Utility.Wait(0.1) ;maybe not necessary
          invisibleObject.MoveTo(playerRef)
EndEvent
Event OnUpdate()
    invisibleObject.MoveTo(playerRef)
    RegisterForSingleUpdate(<couple of seconds, I took 4>)
EndEvent
[[User:Granson|Granson]] ([[User talk:Granson|talk]]) 2015-10-24T14:19:19 (EDT)
Anonymous user

Navigation menu