Jump to content

NPC Reference Alias script


hfiani

Recommended Posts

hi all. i have a quick question:

i have a ReferenceAlias in a quest having state1 and state2

i have an ActorBase having attached a script having state3 and state4

 

ok so the ReferenceAlias will contain the actor of the ActorBase when i activate the actor. so at first ActorBase goes from state3 to state4. and after 2 seconds ReferenceAlias goes from state1 to state2

 

my question is: will ReferenceAlias nullify the state4 because it went into state2 after the time state4 was reached?

 

PS: it is a compatibility problem with another mod. i want to check whether the problem is from the issue described above.

Link to comment
Share on other sites

it is a compatibility problem with another mod

What exactly is your problem? No source code? Are you talking about a real STATE or some mechanism of your own design? Did you know the Reference Alias tab has check boxs and radio buttons to create actors from actorbases without needing to write any scripts?

Link to comment
Share on other sites

the problem is that i use: OnUpdate() to keep something running, and i use registerforsingleupdate(0.01) i even tried the game time update along with periodic updates. but it seems that the OnUpdate() is only doing 1 time (and yes i put RegisterForSingleUpdate() in it, i am not new here)

the ReferenceAlias is from the other mod, and the script is on my ActorBase

here is the full diagnostics:

1) before i install the new version of convenient horses along with UFO. the saves are running my mod very well.

2) in the saves after i had 4 followers and configured their horses with CH the mods runs the OnUpdate() only once

3) in the latest saves, if i uninstall ALL the mods properly and only run mine, it will still not work, as if there was a bunch of scripts hanging somewhere, making the whole system so slow.

4) using all kinds of events work, but theOnUpdate() works only once.

5) my mod is about a mount that uses script to work well, of else it would be another mount.

6) i just might put CH as a possible incompatible mod if this does not work with me before i finish my mod

7) CH put any mount ridden into a ReferenceAlias then sends it into"multitap" or "boundkey" or "passive", my mod sends the mount into "activemount" when ridden, then sends it back to "" when unmount.

 

this will summarize all my tests. any helo is appreciated

Link to comment
Share on other sites

and i use registerforsingleupdate(0.01)

 

It's probably not the best idea to use RegisterForSingleUpdate() with such a low value. If the update interval is shorter than the scirpt needs to execute, you are asking for savegame bloat. It may also be the reason why the script doesn't work correctly. Sorry, but without looking at the code, it's hard to help you with the problem. :confused:

Link to comment
Share on other sites

no man the RegisterForSingleUpdate() can even be used with 0. what you are talking about is: RegisterForUpdate() with interval updates. the RegisterForSingleUpdate() is put at the end of the OnUpdate() code, which will result into an immediate update. i cannot put it more than 0.25 seconds, or else the effect will be far from correct. i cannot send you the code right now i am sorry. i am trying to keep the mod as a new idea mod to a point. but i can let you see this:

Event OnInit()
   {
   doing what i need to initialize
   }
   RegisterForSingleUpdate(0.01)
EndEvent

Event OnUpdate()
   {
   doing idle stuff while waiting to ride
   }
   RegisterForSingleUpdate(0.01)
EndEvent

Event OnActivate()
   {
   do stuff
   }
   Ride = True
   GoToState("ActivateState")
   RegisterForSingleUpdate(0.01)
EndEvent

State ActivateState
   Event OnActivate()
       if(Ride == True)
           Ride = False
       endif
   EndEvent

   Event OnUpdate()
       {
       do stuff
       }

       if(Ride == true)
           RegisterForSingleUpdate(0.01)
       else
           GoToState("")
           RegisterForSingleUpdate(0.01)
       EndIf
   EndEvent
EndState

Edited by hfiani
Link to comment
Share on other sites

  • Recently Browsing   0 members

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