User talk:AdiBeiElderScrolls

From the Oblivion ConstructionSet Wiki
Revision as of 14:52, 13 November 2006 by imported>Entim (please use the Show preview button when editing pages)
Jump to navigation Jump to search

Hi out there, in this great Wiki!

I've learned a lot here, as this wiki provides a lot of helpful hints, but still some questions I can't solve.

I'm still fighting with a good solution for this companion thing. There is some helpful code for having companions with horses, that follow. But it doesn't really work well. Still timing problems may occur and the NPC is standing in front of his horse, without mounting it or time displays that it has elapsed ...

Moreover I would like to give the NPC companion a possibility to call his horse. I tried to add some AI package in the GameMode script of the horse, if a certain script variable is set. But it seems, that the horse, if it is out of sight, just doesn't react or evaluate any package (which makes sense, to keep the game performance).

Here is a code summary of the horse

ScriptName CompanionHorse

short HeardCall
short OnTheWay
long OverallDistance
short Distance1000
short Distance2000
short Distance3000
short Distance4000
short Distance5000
short Distance10000
short Distance15000
short Distance20000
short Distance25000
short Distance30000

Begin GameMode

   If ( Distance1000 == 0)
      Set Distance1000 To 1000
      Set Distance2000 To 2000
      Set Distance3000 To 3000
      Set Distance4000 To 4000
      Set Distance5000 To 5000
      Set Distance10000 To 10000
      Set Distance15000 To 15000
      Set Distance20000 To 20000
      Set Distance25000 To 25000
      Set Distance30000 To 30000
   EndIf

   If HeardCall
      ; load package to travel to companion
      If ( GetIsCurrentPackage HorseTravelToCompanion == 0 )
         ; remove any currently running package 
         RemoveScriptPackage
         ; get travel package
         AddScriptPackage HorseTravelToCompanion
         EvaluatePackage
      EndIf
      Set OverallDistance To GetDistance MyCompanion
      Message "Fabians Horse has heard the call, it is %.0f away", OverallDistance
      ; reset vars
      Set HeardCall To 0
      Set OnTheWay To 1
   EndIf

   ; check if we have arrived
   If OnTheWay

      If ( GetDistance MyCompanion < 1000 )
         Message "Fabians horse is less than %.0f away", Abstand1000
      ElseIf ( GetDistance MyCompanion < 2000 )
         Message "Fabians horse is less than %.0f away", Abstand2000
      ElseIf ( GetDistance MyCompanion < 3000 )
         Message "Fabians horse is less than %.0f away", Abstand3000
      ElseIf ( GetDistance MyCompanion < 4000 )
         Message "Fabians horse is less than %.0f away", Abstand4000
      ElseIf ( GetDistance MyCompanion < 5000 )
         Message "Fabians horse is less than %.0f away", Abstand5000
      ElseIf ( GetDistance MyCompanion < 10000 )
         Message "Fabians horse is less than %.0f away", Abstand10000
      ElseIf ( GetDistance MyCompanion < 15000 )
         Message "Fabians horse is less than %.0f away", Abstand15000
      ElseIf ( GetDistance MyCompanion < 20000 )
         Message "Fabians horse is less than %.0f away", Abstand20000
      ElseIf ( GetDistance MyCompanion < 25000 )
         Message "Fabians horse is less than %.0f away", Abstand25000
      ElseIf ( GetDistance MyCompanion < 30000 )
         Message "Fabians horse is less than %.0f away", Abstand30000
      EndIf

      If ( GetDistance MyCompanion < 350 )
         ; close enough to cancel travel package
         If ( GetIsCurrentPackage HorsePCStay == 0 )
            RemoveScriptPackage
            AddScriptPackage HorsePCStay
         EndIf
         ; reset var
         Set OnTheWay To 0
      EndIf
   EndIf

End

AdiBeiElderScrolls 18:16, 7 November 2006 (EST)

Entim 14:52, 13 November 2006 (EST): Hi AdiBeiElderScrolls. I'd just like to draw your attention to the 'Show preview' button of the page editing screen. Please check the Welcome to Wiki Syntax, Welcome to the Wiki articles and the Recent changes page if you haven't yet. Articles are not the place for questions or chatting, please use the article's Talk page instead.

Thanks for writing up the Debug Scripts article, it's a good initiation.