Difference between revisions of "Talk:GetRider"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>QQuix
(Answering ABO)
imported>ABO
Line 12: Line 12:
</dl>
</dl>
:[[User:QQuix|QQuix]] 10:34, 3 August 2009 (EDT)
:[[User:QQuix|QQuix]] 10:34, 3 August 2009 (EDT)
: Yeah, sorry it does work and my code that didn't work was probably using it wrong. The following code didn't seem to ever detect when being ridden:
<dl><dd>
if (getRider == 0)
  ; do something when we are not being ridden
  else
  ; do something when we are being ridden
endif
<dl>
However assigning 'tempRef = getRider' seems to work correctly.
[[User:ABO|ABO]] 09:19, 5 August 2009 (EDT)

Revision as of 08:19, 5 August 2009

This appears to not be working for me using OBSE 0017b... did it ever work? What is it supposed to return if the horse is being ridden by the player? What is it supposed to return if no one is riding the horse? What is supposed to happen if it is called on something that isn't a horse? ABO 09:13, 3 August 2009 (EDT)

It works for me both in OBSE v17b and v18. It correctly returns the player or NPC reference. Returns a null reference if there is no one riding the horse. Returns a null reference if called on an NPC or on a container. Used this code for testing:
 ;*Player mounts the horse* set xRef to MyHorse.GetRider PrintToConsole "Rider = %i %n" xRef xRef ;Shows Player FormID and Name  ;*Player dismounts the horse* MyHorse.activate MyNPC 1  ; MyNPC mounts the horse set xRef to MyHorse.GetRider PrintToConsole "Rider = %i %n" xRef xRef ;Shows MyNPC FormID and Name
QQuix 10:34, 3 August 2009 (EDT)
Yeah, sorry it does work and my code that didn't work was probably using it wrong. The following code didn't seem to ever detect when being ridden:
if (getRider == 0)  ; do something when we are not being ridden else  ; do something when we are being ridden endif
However assigning 'tempRef = getRider' seems to work correctly. ABO 09:19, 5 August 2009 (EDT)