Construction Set Der Scriptthread

Dieses Thema im Forum "[MW] Plugins und Mods" wurde erstellt von The Nici, 25. April 2006.

  1. Somavakien

    Somavakien Neuankömmling

    Ultra Nice!! Hab mir dein Befehelsreferenz geholt und dein Kurs mach ich schon :).

    Hab auch gleich mein Fehler im timer gefunden!!

    Vielen Dank für dieses Werk!
     
  2. Lyali

    Lyali Abenteurer

    Habe eine kleines Problem: Ich bräuchte für ein Skript eine Zellenabfrage, ob der Spieler in einer speziellen Exterior-Zelle ist (Bitterküste, -7, -6). Es gibt zwar den Befehl GetPCCell, dass Problem nur, wenn ich GetPCCell "Bitterküste" nutze, liefert der Befehl mir eine 1, sobald ich irgendeine Zelle betrete, die mit Bitterküste anfängt. Kennt einer eine Möglichkeit, zu überprüfen, ob der Spieler die gewünschten Zelle betritt, ohne die Zelle im CS zu verändern? Also nicht sowas wie, "positioniere eine Aktivator in der Mitte der Zelle und mach eine Entfernungsabfrage mit Getdistance"?
    Danke schonmal im Voraus.
     
  3. Killfetzer

    Killfetzer Super-Moderator Mitarbeiter

    Die Exteriorzellen haben ja feste Koordinaten im World-Koordinatensystem. Mit einer geschachtelten Abfrage GetInterior=0, GetPos, X > ?, GetPos, X < ?, GetPos, Y > ? , GetPos, Y < ? könnest du somit die Zelle rausfinden.

    Einfacher wäre wahrscheinlich eine GetDistance Abfrage, die halt eine Kugel statt einem Quadrat um deinen Punkt zieht.
     
  4. Lyali

    Lyali Abenteurer

    Bei der GetDistance-Abfrage brauche ich doch aber irgendein Bezugsobjekt, am besten ein einzigartiges Objekt, sonst greift das globale Skript doch bei jeder Annäherung an jedes der vorhandenen Objekte?
     
  5. Killfetzer

    Killfetzer Super-Moderator Mitarbeiter

    Ja, brauchst du. Kannst ja zum Beispiel einen einzigartiges Static mit dem Model eines Draken erstellen und knapp unter dem Boden verstecken.
     
  6. VDMap

    VDMap Neuankömmling

    EDIT: Sry, bin am Phone und hab ausversehen gepostet. Bitte um Nachsicht und Löschung..
     
    Zuletzt bearbeitet: 13. August 2019
  7. VDMap

    VDMap Neuankömmling

    Hallo,
    Hab da ein Problem mit einen Script von Morrowind Crafting, hab es etwas modifiziert, funktioniert leider nur teilweise und wird auch nicht richtig beendet.. :(
    Könnte sich das mal jemand anschauen?

    Danke

    Code:
    begin _vdm_kegstand_xyz
    
    short temp
    short inventory
    short state
    short button
    short daysleft
    short currentday
    float timer
    short doOnce
    
    if ( doOnce == 0 )
        set currentday to dayspassed
        set doonce to 1
        set daysleft to 1
    endif
    
    if ( getdisabled == 1 )
        set timer to ( timer + getsecondspassed )
        if ( timer > 5 )
            setdelete 1
        endif
    endif
    
    if ( currentday != dayspassed )
        set temp to ( dayspassed - currentday )
        set currentday to dayspassed
        if ( daysleft >= 1 )
            set daysleft to ( daysleft - temp )
            if ( daysleft <= 0 )
                set daysleft to 0
                set inventory to 10
            endif
        endif
        set temp to 0
    endif
    
    if ( OnActivate == 1 )
        if ( Inventory > 0 )
            set state to 1
        else
            set state to 4
        endif
    endif
    
    if ( state == 0 )
        return
    endif
    
    if ( state == 1 )
        messagebox "The kegstand contains %g bottles of xyz.", inventory, "Fill a bottle", "Fill as many bottles as possible", "Drain the kegstand", "Cancel"
        set state to 2
    elseif ( state == 2 )
        set button to getbuttonpressed
        if ( button == -1 )
            return
        elseif ( button == 0 )
        if ( player->GetItemCount "misc_com_bottle_01" > 0 )
            player->RemoveItem "misc_com_bottle_01" 1
            player->additem _vdm_xyz_01 1
                set inventory to ( inventory - 1 )
                messagebox "You fill one of your empty bottles."
        elseif ( player->GetItemCount "misc_com_bottle_02" > 0 )
            player->RemoveItem "misc_com_bottle_02" 1
            player->additem _vdm_xyz_01 1
                set inventory to ( inventory - 1 )
                messagebox "You fill one of your empty bottles."
        elseif ( player->GetItemCount "misc_com_bottle_04" > 0 )
            player->RemoveItem "misc_com_bottle_04" 1
            player->additem _vdm_xyz_01 1
                set inventory to ( inventory - 1 )
                messagebox "You fill one of your empty bottles."
        elseif ( player->GetItemCount "misc_com_bottle_05" > 0 )
            player->RemoveItem "misc_com_bottle_05" 1
            player->additem _vdm_xyz_01 1
                set inventory to ( inventory - 1 )
                messagebox "You fill one of your empty bottles."
        elseif ( player->GetItemCount "misc_com_bottle_06" > 0 )
            player->RemoveItem "misc_com_bottle_06" 1
            player->additem _vdm_xyz_01 1
                set inventory to ( inventory - 1 )
                messagebox "You fill one of your empty bottles."
        elseif ( player->GetItemCount "misc_com_bottle_08" > 0 )
            player->RemoveItem "misc_com_bottle_08" 1
            player->additem _vdm_xyz_01 1
                set inventory to ( inventory - 1 )
                messagebox "You fill one of your empty bottles."
        elseif ( player->GetItemCount "misc_com_bottle_09" > 0 )
            player->RemoveItem "misc_com_bottle_09" 1
            player->additem _vdm_xyz_01 1
                set inventory to ( inventory - 1 )
                messagebox "You fill one of your empty bottles."
        elseif ( player->GetItemCount "misc_com_bottle_10" > 0 )
            player->RemoveItem "misc_com_bottle_10" 1
            player->additem _vdm_xyz_01 1
                set inventory to ( inventory - 1 )
                messagebox "You fill one of your empty bottles."
        elseif ( player->GetItemCount "misc_com_bottle_11" > 0 )
            player->RemoveItem "misc_com_bottle_11" 1
            player->additem _vdm_xyz_01 1
                set inventory to ( inventory - 1 )
                messagebox "You fill one of your empty bottles."
        elseif ( player->GetItemCount "misc_com_bottle_13" > 0 )
            player->RemoveItem "misc_com_bottle_13" 1
            player->additem _vdm_xyz_01 1
                set inventory to ( inventory - 1 )
                messagebox "You fill one of your empty bottles."
        elseif ( player->GetItemCount "misc_com_bottle_14" > 0 )
            player->RemoveItem "misc_com_bottle_14" 1
            player->additem _vdm_xyz_01 1
                set inventory to ( inventory - 1 )
                messagebox "You fill one of your empty bottles."
        elseif ( player->GetItemCount "misc_com_bottle_15" > 0 )
            player->RemoveItem "misc_com_bottle_15" 1
            player->additem _vdm_xyz_01 1
                set inventory to ( inventory - 1 )
                messagebox "You fill one of your empty bottles."
                if ( inventory == 0 )
                    set state to 999
                else
                    set state to 0
                endif
                return
            else
                messagebox "You need an empty bottle."
                set state to 0
            endif
        elseif ( button == 1 )
            set temp to 0
            while ( inventory > 0 )
        if ( player->GetItemCount "misc_com_bottle_01" > 0 )
            player->RemoveItem "misc_com_bottle_01" 1
            player->additem _vdm_xyz_01 1
                    set inventory to ( inventory - 1 )
                    set temp to ( temp + 1 )
        elseif ( player->GetItemCount "misc_com_bottle_02" > 0 )
            player->RemoveItem "misc_com_bottle_02" 1
            player->additem _vdm_xyz_01 1
                    set inventory to ( inventory - 1 )
                    set temp to ( temp + 1 )
        elseif ( player->GetItemCount "misc_com_bottle_04" > 0 )
            player->RemoveItem "misc_com_bottle_04" 1
            player->additem _vdm_xyz_01 1
                    set inventory to ( inventory - 1 )
                    set temp to ( temp + 1 )
        elseif ( player->GetItemCount "misc_com_bottle_05" > 0 )
            player->RemoveItem "misc_com_bottle_05" 1
            player->additem _vdm_xyz_01 1
                    set inventory to ( inventory - 1 )
                    set temp to ( temp + 1 )
        elseif ( player->GetItemCount "misc_com_bottle_06" > 0 )
            player->RemoveItem "misc_com_bottle_06" 1
            player->additem _vdm_xyz_01 1
                    set inventory to ( inventory - 1 )
                    set temp to ( temp + 1 )
        elseif ( player->GetItemCount "misc_com_bottle_08" > 0 )
            player->RemoveItem "misc_com_bottle_08" 1
            player->additem _vdm_xyz_01 1
                    set inventory to ( inventory - 1 )
                    set temp to ( temp + 1 )
        elseif ( player->GetItemCount "misc_com_bottle_09" > 0 )
            player->RemoveItem "misc_com_bottle_09" 1
            player->additem _vdm_xyz_01 1
                    set inventory to ( inventory - 1 )
                    set temp to ( temp + 1 )
        elseif ( player->GetItemCount "misc_com_bottle_10" > 0 )
            player->RemoveItem "misc_com_bottle_10" 1
            player->additem _vdm_xyz_01 1
                    set inventory to ( inventory - 1 )
                    set temp to ( temp + 1 )
        elseif ( player->GetItemCount "misc_com_bottle_11" > 0 )
            player->RemoveItem "misc_com_bottle_11" 1
            player->additem _vdm_xyz_01 1
                    set inventory to ( inventory - 1 )
                    set temp to ( temp + 1 )
        elseif ( player->GetItemCount "misc_com_bottle_13" > 0 )
            player->RemoveItem "misc_com_bottle_13" 1
            player->additem _vdm_xyz_01 1
                    set inventory to ( inventory - 1 )
                    set temp to ( temp + 1 )
        elseif ( player->GetItemCount "misc_com_bottle_14" > 0 )
            player->RemoveItem "misc_com_bottle_14" 1
            player->additem _vdm_xyz_01 1
                    set inventory to ( inventory - 1 )
                    set temp to ( temp + 1 )
        elseif ( player->GetItemCount "misc_com_bottle_15" > 0 )
            player->RemoveItem "misc_com_bottle_15" 1
            player->additem _vdm_xyz_01 1
                    set inventory to ( inventory - 1 )
                    set temp to ( temp + 1 )
                else
                    if ( temp == 0 )
                        messagebox "You don't have any empty bottles."
                    else
                        if ( inventory > 1 )
                            messagebox "You managed to fill %g empty bottles.  There are still %g servings of xyz left in the kegstand.", temp, inventory
                        else
                            messagebox "You managed to fill %g empty bottles.  There is still 1 serving of xyz left in the kegstand.", temp
                        endif  
                    endif
                    set state to 0
                    return
                endif
            endwhile
            messagebox "You managed to fill %g empty bottles before the keg went dry.", temp
            set state to 999
            return
        elseif ( button == 2 )
            messagebox "The kegstand still contains %g bottles of xyz.  Are you sure you want to do that?", inventory, "Yes. Empty it.", "Cancel"
            set state to 3
        elseif ( button == 3 )
            set state to 0
        endif
    elseif ( state == 3 )
        set button to getbuttonpressed
        if ( button == -1 )
            return
        elseif ( button == 0 )
            set inventory to 0
            set state to 999
        elseif ( button == 1 )
            set state to 0
            return
        endif
    elseif ( state == 4 )
        messagebox "The kegstand contains fermenting xyz.  What do you want to do?" "Empty it.", "Check it."
        set state to 5
    elseif ( state == 5 )
        set button to getbuttonpressed
        if ( button == -1 )
            return
        elseif ( button == 0 )
            messagebox "You completely drain the kegstand and clean it out."
            set state to 999
        elseif ( button == 1 )
            if ( daysleft > 1 )
                messagebox "The fermenting is going well.  You should have the finished xyz in %g days.", daysleft
            else
                messagebox "The fermenting is going well.  You should have the finished xyz tomorrow."
            endif
            set state to 0
        endif
    
    elseif ( state == 999 )
        placeatme "_vdm_kegstand_empty" 1,0,0
        set state to 0
        set water to 0
        disable
    
    endif
    
    end
     
  8. £exa

    £exa Freund des Hauses

    Ich hab mal versucht, den Sinn zu ergründen und das ganze dann "etwas" umgeschrieben, allerdings habe ich mein Notebook mit Morrowind nicht hier, also kann ich das Ding grad nicht ins CS hauen, um zu schauen, ob der Hund das auch kompiliert. Ist halt schon einige Zeit her, dass ich im CS gescripted habe und in meinem Alter vergisst man schon mal was...

    Code:
    
    begin _vdm_kegstand_xyz
    
    short temp
    short inventory
    short state
    short button
    short daysleft
    short currentday
    short doOnce
    short Counter
    
    if ( doOnce == 0 )
        set currentday to dayspassed
        set doonce to 1
        set daysleft to 1
    endif
    
    if ( getdisabled == 1 )
        set Counter to ( Counter - 1 )
        IF ( Counter == 0 )
          setdelete 1
        ENDIF
        RETURN
    ENDIF
    
    IF ( state == 0 )
    
      IF ( currentday != dayspassed )
        set temp to ( dayspassed - currentday )
        set currentday to dayspassed
        IF ( daysleft >= 1 )
          set daysleft to ( daysleft - temp )
          IF ( daysleft <= 0 )
            set daysleft to 0
            set inventory to 10
          ENDIF
        ENDIF
        set temp to 0
      ENDIF
    
      IF ( OnActivate == 1 )
        IF ( Inventory > 0 )
          set state to 1
        ELSE
          set state to 4
        ENDIF
        activate
      ENDIF
    
      RETURN
    
    ELSEIF ( state == 1 )
      messagebox "The kegstand contains %g bottles of xyz.", inventory, "Fill a bottle", "Fill as many bottles as possible", "Drain the kegstand", "Cancel"
      set state to 2
    ENDIF
       
    IF ( state == 2 )
      set button to getbuttonpressed
    
      IF ( button == -1 )
        RETURN
      ELSE
        set state to 0
      ENDIF
    
      IF ( button == 0 )
        IF ( player->GetItemCount "misc_com_bottle_01" > 0 )
          player->RemoveItem "misc_com_bottle_01" 1
        ELSEIF ( player->GetItemCount "misc_com_bottle_02" > 0 )
          player->RemoveItem "misc_com_bottle_02" 1
        ELSEIF ( player->GetItemCount "misc_com_bottle_04" > 0 )
          player->RemoveItem "misc_com_bottle_04" 1
        ELSEIF ( player->GetItemCount "misc_com_bottle_05" > 0 )
          player->RemoveItem "misc_com_bottle_05" 1
        ELSEIF ( player->GetItemCount "misc_com_bottle_06" > 0 )
          player->RemoveItem "misc_com_bottle_06" 1
        ELSEIF ( player->GetItemCount "misc_com_bottle_08" > 0 )
          player->RemoveItem "misc_com_bottle_08" 1
        ELSEIF ( player->GetItemCount "misc_com_bottle_09" > 0 )
          player->RemoveItem "misc_com_bottle_09" 1
        ELSEIF ( player->GetItemCount "misc_com_bottle_10" > 0 )
          player->RemoveItem "misc_com_bottle_10" 1
        ELSEIF ( player->GetItemCount "misc_com_bottle_11" > 0 )
          player->RemoveItem "misc_com_bottle_11" 1
        ELSEIF ( player->GetItemCount "misc_com_bottle_13" > 0 )
          player->RemoveItem "misc_com_bottle_13" 1
        ELSEIF ( player->GetItemCount "misc_com_bottle_14" > 0 )
          player->RemoveItem "misc_com_bottle_14" 1
        ELSEIF ( player->GetItemCount "misc_com_bottle_15" > 0 )
          player->RemoveItem "misc_com_bottle_15" 1
        ELSE
          messagebox "You need an empty bottle."
          RETURN
        ENDIF
        player->additem _vdm_xyz_01 1
        messagebox "You fill one of your empty bottles."
        set inventory to ( inventory - 1 )
        IF ( inventory == 0 )
          set state to 999
        ENDIF
    
      ELSEIF ( button == 1 )
        set temp to player->GetItemCount "misc_com_bottle_01" + player->GetItemCount "misc_com_bottle_02" + player->GetItemCount "misc_com_bottle_03"
        set temp to temp + player->GetItemCount "misc_com_bottle_04" + player->GetItemCount "misc_com_bottle_05" + player->GetItemCount "misc_com_bottle_06"
        set temp to temp + player->GetItemCount "misc_com_bottle_07" + player->GetItemCount "misc_com_bottle_08" + player->GetItemCount "misc_com_bottle_09"
        set temp to temp + player->GetItemCount "misc_com_bottle_10" + player->GetItemCount "misc_com_bottle_11" + player->GetItemCount "misc_com_bottle_12"
        set temp to temp + player->GetItemCount "misc_com_bottle_13" + player->GetItemCount "misc_com_bottle_14" + player->GetItemCount "misc_com_bottle_15"
     
        IF ( temp == 0 )
          messagebox "You don't have any empty bottles."
          RETURN
        ELSEIF ( temp < inventory )
          set Counter to temp
        ELSE
          set Counter to inventory
          set temp to inventory
        ENDIF
     
        set inventory to ( inventory - Counter )
     
        WHILE ( Counter > 0 )
          IF ( player->GetItemCount "misc_com_bottle_01" > 0 )
            player->RemoveItem "misc_com_bottle_01" 1
          ELSEIF ( player->GetItemCount "misc_com_bottle_02" > 0 )
            player->RemoveItem "misc_com_bottle_02" 1
          ELSEIF ( player->GetItemCount "misc_com_bottle_04" > 0 )
            player->RemoveItem "misc_com_bottle_04" 1
          ELSEIF ( player->GetItemCount "misc_com_bottle_05" > 0 )
            player->RemoveItem "misc_com_bottle_05" 1
          ELSEIF ( player->GetItemCount "misc_com_bottle_06" > 0 )
            player->RemoveItem "misc_com_bottle_06" 1
          ELSEIF ( player->GetItemCount "misc_com_bottle_08" > 0 )
            player->RemoveItem "misc_com_bottle_08" 1
          ELSEIF ( player->GetItemCount "misc_com_bottle_09" > 0 )
            player->RemoveItem "misc_com_bottle_09" 1
          ELSEIF ( player->GetItemCount "misc_com_bottle_10" > 0 )
            player->RemoveItem "misc_com_bottle_10" 1
          ELSEIF ( player->GetItemCount "misc_com_bottle_11" > 0 )
            player->RemoveItem "misc_com_bottle_11" 1
          ELSEIF ( player->GetItemCount "misc_com_bottle_13" > 0 )
            player->RemoveItem "misc_com_bottle_13" 1
          ELSEIF ( player->GetItemCount "misc_com_bottle_14" > 0 )
            player->RemoveItem "misc_com_bottle_14" 1
          ELSE
            player->RemoveItem "misc_com_bottle_15" 1
          ENDIF
          player->additem _vdm_xyz_01 1
          set Counter to ( Counter - 1 )
        ENDWHILE
     
        IF ( inventory > 1 )
          messagebox "You managed to fill %g empty bottles.  There are still %g servings of xyz left in the kegstand.", temp, inventory
        ELSEIF ( inventory = 1 )
          messagebox "You managed to fill %g empty bottles.  There is still 1 serving of xyz left in the kegstand.", temp
        ELSE
          messagebox "You managed to fill %g empty bottles before the keg went dry.", temp
          set state to 999
        ENDIF
    
      ELSEIF ( button == 2 )
        messagebox "The kegstand still contains %g bottles of xyz.  Are you sure you want to do that?", inventory, "Yes. Empty it.", "Cancel"
        set state to 3
      ENDIF; button 3 does zilch, so nothing needed here.
      RETURN
    ENDIF
    
    IF ( state == 3 )
      set button to getbuttonpressed
      IF ( button == 1 )
        set state to 0
      ELSEIF( button == 0 )
        set inventory to 0
        set state to 999
       ENDIF
       RETURN
    
    ELSEIF ( state == 4 )
      messagebox "The kegstand contains fermenting xyz.  What do you want to do?" "Empty it.", "Check it."
      set state to 5
      RETURN
    
    ENDIF
    
    IF ( state == 5 )
     set button to getbuttonpressed
     IF ( button == -1 )
       return
      ELSEIF ( button == 0 )
        messagebox "You completely drain the kegstand and clean it out."
        set state to 999
      ELSE
        IF ( daysleft > 1 )
          messagebox "The fermenting is going well.  You should have the finished xyz in %g days.", daysleft
        ELSE
          messagebox "The fermenting is going well.  You should have the finished xyz tomorrow."
        ENDIF
        set state to 0
      ENDIF
    ENDIF
    
    IF ( state == 999 )
      placeatme "_vdm_kegstand_empty" 1,0,0
      set state to 0
      set Counter to 10
      disable
    ENDIF
    
    end
    
    
     
  9. PRieST

    PRieST Abenteurer

    Ich bin zwar völlig unbedarft was das scripting von MW angeht, aber ist der code vom Script case sensitive?
    Falls ja und ich nicht vollkommen daneben liege, müsste dann nicht
    Code:
    if ( doOnce == 0 )
       set currentday to dayspassed
       set doonce to 1
       set daysleft to 1
    endif
    
    so aussehen?
    Code:
    if ( doOnce == 0 )
       set currentday to dayspassed
       set doOnce to 1
       set daysleft to 1
    endif
    
    Also mit einem großen O
    So als stiller und vollkommen ahnungsloser Beobachter reingeworfen, wo evtl. auch ein Problem liegen könnte...:D
     
  10. £exa

    £exa Freund des Hauses

    Der Morrowind Script Compiler ist zickig... aber so zickig nun doch wieder nicht ;)

    getsecondspassed funktioniert genauso gut wie GetSecondsPassed getSECONDSPASSED oder GETSecondsPassed
     
  11. Killfetzer

    Killfetzer Super-Moderator Mitarbeiter

    Hm, ich erinnere mich da an eine gewisse Funktion, die war so zickig...

    *hust* GetEffect *hust* ;)
     
  12. Werbung (Nur für Gäste)
  1. Diese Seite verwendet Cookies, um Inhalte zu personalisieren, diese deiner Erfahrung anzupassen und dich nach der Registrierung angemeldet zu halten.
    Wenn du dich weiterhin auf dieser Seite aufhältst, akzeptierst du unseren Einsatz von Cookies.
    Information ausblenden