Jump to content

General Discussion


Recommended Posts

:P The above code 'almost' worked perfectly.  A minor touch needed... increasing the freakin' counter would be nice!!!

 

BUT it works (once fixed).   And I added upon this concept.  Not just testing for worldSpaces, but exterior cells.

 

Now some may say "You cannot run GETINCELL on an exterior cell!  It's only for interior cells!"  And they would be correct.  However, to test for an exterior cell, you really just need to test if the Actor is in the same cell as a reference IN that cell.  To test if the player is wandering around BorderWatch, just test if he's in the same cell as BorderWatch's Map Marker!!!

 

So now, I have this little plugin set up with two scripts that return (1) whether the player is in a city or town (even exterior towns like Hackdirt) and (2) able to retrieve the names of these locations.  That... might be entertaining for a HUD. 

 

And yes...  I made another plugin that just used GetFormFromMod and generated the replies just fine.

 

This little plugin will have a few more features before I'm done with it.

Link to comment
On 3/17/2024 at 3:17 PM, LongDukDong said:

So now, I have this little plugin set up with two scripts that return (1) whether the player is in a city or town (even exterior towns like Hackdirt) and (2) able to retrieve the names of these locations.  That... might be entertaining for a HUD. 

 

And yes...  I made another plugin that just used GetFormFromMod and generated the replies just fine.

 

Yowza!  I got this concept system running just fine!  

Picture, if you will, the installation of "Locations.esm" with its .ini file into your system.  And assume that this master can return whether a targeted actor (
like your player) is in hallowed ground, is in the city streets (whether in a walled city or dirt streets of a settlement), or a custom location for a HUD system.

 

And picture, if you will that a mod you are using can determine if your player is in a  city, or can use "Locations" as an enhancement to expand the list of available city regions... or the like.

 

The script for my Testing Mod that 'uses' the Locations.esm

Spoiler

 

Scriptname MyQuest

 

;; FUNCTION: A test quest script that loads and runs "External Locations.esm"
;; -----------------------------------------------------------------------------
;; USED BY:  LocationTest <QUST>
;; =============================================================================

 

; Declared Variables:
Ref Stage10             ; Quest Variable: External Locations Stage 10 loader
Ref MyTest1             ; Quest Variable: First Test script:  GetIsCity
Ref MyTest2             ; Quest Variable: Second Test script: GetLocation
Ref MyTest3             ; Quest Variable: Third Test script:  GetEt'Ada
string_var sData        ; Mechanics:      String to load individual rumor
short SwitchFlag        ; Variable:       MODDER SWITCH - Determine what test
short iReturn           ; Variable:       Returned numeric test value
string_Var SReturn      ; Variable:       Returned string test value

 


Begin GameMode

 


    ;; On game load or reload, ensure outside mods updated
    If GetGameLoaded || GetGameRestarted
        ;
        Let Stage10 := GetFormFromMod "External Locations.esm" "806" ; Data Load
        Let MyTest1 := GetFormFromMod "External Locations.esm" "811" ; City
        Let MyTest2 := GetFormFromMod "External Locations.esm" "812" ; Et'Ada
        Let MyTest3 := GetFormFromMod "External Locations.esm" "813" ; Locations
        ;
        ; Cancel/Exit quest function if invalid

        If 0 == IsFormValid MyTest1
            StopQuest LocationTest
        endIf
        ;
        ; Acquire List and exit on success

        If FileExists "Data\ini\LocationsShivering.ini"
            RunBatchScript "Data\ini\LocationsShivering.ini"
            PrintC "External Locations: Loading Shivering Isles Locations."
            Return
        endIf

        ;
        ; Debug message and restart for next iteration

        PrintC "Test plugin functioning"
        Return
        ;
    endIf

    
    ;; CHOOSE WHAT TO TEST HERE
    Let SwitchFlag := 3


    ;; PERFORM TEST BASED ON SWITCH
    If SwitchFlag == 0    
        ;
        ; Test if in any Populated area

        Let iReturn := Call MyTest1 PlayerRef
        If iReturn == 1
            MessageEx "In City"
        else
            MessageEx "Not In City"
        endIf
        ;
    elseIf SwitchFlag == 1
        ;
        ; Test for Aedric Only

        Let iReturn := Call MyTest2 PlayerRef 1
        If iReturn == 1
            MessageEx "Aedric area"
        endIf
        ; Test for Daedric Only
        Let iReturn := Call MyTest2 PlayerRef 2
        If iReturn == 1
            MessageEx "Daedric area"
        endIf
        ; Test for Any Good
        Let iReturn := Call MyTest2 PlayerRef 3
        If iReturn == 1
            MessageEx "Generally good"
        endIf
        ; Test for any Unholy (does include Daedric)
        Let iReturn := Call MyTest2 PlayerRef 4
        If iReturn == 1
            MessageEx "Generally unsettling"
        endIf
        ; Test for any Evil (but not Daedric)
        Let iReturn := Call MyTest2 PlayerRef 4
        If iReturn == 1
            Let iReturn := Call MyTest2 PlayerRef 2
            If iReturn == 1
                MessageEx "There is something evil afoot"
            endIf
        endIf

        ;
    else
        ;
        ; Garner Player location

        Let SReturn := Call MyTest3 PlayerRef 0
        MessageEx "%z" SReturn
        ;
    endif

 


End

 

 

 

And once put into a quest stage, this is the basis script I use to push my 'testing' plugin's own INI file into Locations's system.

Spoiler

 

ScriptName Stage10Cmd

 

;; FUNCTION: Loads individual location strings and pass into the record loader
;; -----------------------------------------------------------------------------
;; USED BY:  LocationTest <QUST> - Stage 10 -
;; =============================================================================

 

; Declared Variables:
Ref StageCommand        ; Variable:       Reference for the Stage 10 loader

 


Begin Function {}

 


    ;; Obtain the Stage 10 command recorded in the quest page
    let StageCommand := LocationTest.Stage10

 

    ;; Execute the Stage 10 command with the loaded string data
    Call StageCommand LocationTest.sData

 

    ;; Cleanup
    sv_Destruct LocationTest.sData

 

 

End

 

 

I basically set up the Master to be pretty easy to use, commandwise:

 

The syntax:

  • ret_value   := GetInCity  actor_ref                     Returns 0 if not in a city, 1 if in a city
  • ret_value   := GetIsEtAda actor_ref test_id      Returns 1 if the area is spiritually active
  • ret_string  := GetInCity  actor_ref test_flag  Returns the name of a location, or optionally '!Unknown Area'

 

The test_id parameter for the Et'Ada command is (0=none, 1=Aedric, 2 = Daedric, 3=Good, 4=Bad).  Granted 1-4 are the only functioning flags.

 

The test_flag parameter for the GetInCity command is (0=loaded values only, 1=read cell names as backup)

 

Most returned strings from the City command include a prefix character (!, @ and ^) for optional words "in", "at" and "on", these added for some HUD or text options.

 

I got a bit more work... Ini editing-wise.  Essentially, adding 'Knights of the Nine" content to the .Ini file I intend to supply.

 

Link to comment
  • 5 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use