Difference between revisions of "User talk:AdiBeiElderScrolls"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>AdiBeiElderScrolls
 
imported>AdiBeiElderScrolls
Line 9: Line 9:
An answer to a special topic then set the RufVernommen variable.
An answer to a special topic then set the RufVernommen variable.


Here is a code summary of the horse (sorry, but comments are in german)
Here is a code summary of the horse  


<pre>ScriptName 0poScrPferdBegleiter01
<pre>ScriptName CompanionHorse


; Variable, die dem Pferd mitteilt, es wurde gerufen
short HeardCall
short RufVernommen
short OnTheWay
short Unterwegs
float OverallDistance
float Entfernung
short Distance1000
short Abstand1000
short Distance2000
short Abstand2000
short Distance3000
short Abstand3000
short Distance4000
short Abstand4000
short Distance5000
short Abstand5000
short Distance10000
short Abstand10000
short Distance15000
short Abstand15000
short Distance20000
short Abstand20000
short Distance25000
short Abstand25000
short Distance30000
short Abstand30000


Begin GameMode
Begin GameMode


   If ( Abstand1000 == 0)
   If ( Distance1000 == 0)
       Set Abstand1000 To 1000
       Set Distance1000 To 1000
       Set Abstand2000 To 2000
       Set Distance2000 To 2000
       Set Abstand3000 To 3000
       Set Distance3000 To 3000
       Set Abstand4000 To 4000
       Set Distance4000 To 4000
       Set Abstand5000 To 5000
       Set Distance5000 To 5000
       Set Abstand10000 To 10000
       Set Distance10000 To 10000
       Set Abstand15000 To 15000
       Set Distance15000 To 15000
       Set Abstand20000 To 20000
       Set Distance20000 To 20000
       Set Abstand25000 To 25000
       Set Distance25000 To 25000
       Set Abstand30000 To 30000
       Set Distance30000 To 30000
   EndIf
   EndIf


   If RufVernommen
   If HeardCall
       ; lade das Package, um den Besitzer aufzusuchen
       ; load package to travel to companion
       If ( GetIsCurrentPackage "0poAIBegleiter01Aufsuchen" == 0 )
       If ( GetIsCurrentPackage HorseTravelToCompanion == 0 )
         ; jedes Package entfernen, das nicht dafür sorgt, das der Begleiter aufgesucht wird
         ; remove any currently running package
         RemoveScriptPackage
         RemoveScriptPackage
         ; das Package veranlasst das Pferd zum Besitzer zu reisen
         ; get travel package
         AddScriptPackage "0poAIBegleiter01Aufsuchen"
         AddScriptPackage HorseTravelToCompanion
        ; damit die Änderung sofort wirksam wird
         EvaluatePackage
         EvaluatePackage
       EndIf
       EndIf
       Set Entfernung To GetDistance "0poBegleiter01Ref"
       Set OverallDistance To GetDistance MyCompanion
       Message "Fabians Schimmel hat den Ruf vernommen. Es ist %.0f entfernt", Entfernung
       Message "Fabians Horse has heard the call, it is %.0f away", OverallDistance
       ; setze die Variable zurück
       ; reset vars
       Set RufVernommen To 0
       Set HeardCall To 0
       Set Unterwegs To 1
       Set OnTheWay To 1
   EndIf
   EndIf


   ;prüfen, ob wir unser Ziel erreicht haben
   ; check if we have arrived
   If Unterwegs
   If OnTheWay


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


       If ( GetDistance "0poBegleiter01Ref" < 350 )
       If ( GetDistance MyCompanion < 350 )
         ; wir sind jetzt nahe genug, laden wir das PferdInDerWildnis Package
         ; close enough to cancel travel package
         If ( GetIsCurrentPackage "0poAIPferdInDerWildnis" == 0 )
         If ( GetIsCurrentPackage HorsePCStay == 0 )
            ; nicht benötigtes Package entfernen
             RemoveScriptPackage
             RemoveScriptPackage
            ; das Package veranlasst das Pferd zum Besitzer zu reisen
             AddScriptPackage HorsePCStay
             AddScriptPackage "0poAIPferdInDerWildnis"
         EndIf
         EndIf
         ; setze die Variable zurück
         ; reset var
         Set Unterwegs To 0
         Set OnTheWay To 0
       EndIf
       EndIf
   EndIf
   EndIf

Revision as of 18:31, 7 November 2006

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).

An answer to a special topic then set the RufVernommen variable.

Here is a code summary of the horse

ScriptName CompanionHorse

short HeardCall
short OnTheWay
float 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)