Jump to content

Recommended Posts

Posted

Ive got a script for auto undressing for getting into a pool,saving the outfit for redressing later,but it wont compile, its telling me that GetWornForm is not a function or does not exist for lines 23-28 but im sure ive seen somewhere else that it is. can somebody take a look and tell me what im doing wrong ? thanks.  

Pool_UndressScript.pscFetching info...

Posted

No, the script is attached to trigger area around the pool, so extending ObjectReference is correct.

Other thoughts:   
Auto properties are generally for giving script access to game forms.   I suppose you can use them like this too, but really you should be just declaring them as local variables.

Scriptname Pool_UndressScript extends ObjectReference

Armor PlayerGear[]

Event OnTriggerEnter(ObjectReference akRef)
    Actor NPC = akRef as Actor
    if NPC == None || NPC.IsDead()
        return
    endif

    if NPC == Game.GetPlayer()
        ; Save current gear before undressing
        If PlayerGear.Length == 0
          PlayerGear = new Armor[32]
        EndIf
        int slot = 0
        while slot < 32
          PlayerGear[slot] = NPC.GetWornForm(Math.LeftShift(1, slot)) as Armor
          slot += 1
        endWhile

        NPC.UnequipAll()
        Debug.Notification("Player undressed and outfit saved.")
    else
        NPC.UnequipAll()
        Debug.Notification("NPC undressed.")
    endif
EndEvent

Event OnTriggerLeave(ObjectReference akRef)
    if (akRef as Actor) == Game.GetPlayer()
        int slot = 0
        while slot < 32
          if PlayerGear[slot]
            Game.GetPlayer().equipItem(PlayerGear[slot])
            PlayerGear[slot] = none
          endif
          slot += 1
        endWhile
    endif         
EndEvent
    

And yeah, you need to make sure that source scripts included with SKSE are properly placed into your source directory   (pretty sure SKSE64 by default drops them into scripts/source instead of source/scripts)

  • Like 1
Posted
  On 5/22/2025 at 10:04 PM, scorrp10 said:

No, the script is attached to trigger area around the pool, so extending ObjectReference is correct.

Other thoughts:   
Auto properties are generally for giving script access to game forms.   I suppose you can use them like this too, but really you should be just declaring them as local variables.

Scriptname Pool_UndressScript extends ObjectReference

Armor PlayerGear[]

Event OnTriggerEnter(ObjectReference akRef)
    Actor NPC = akRef as Actor
    if NPC == None || NPC.IsDead()
        return
    endif

    if NPC == Game.GetPlayer()
        ; Save current gear before undressing
        If PlayerGear.Length == 0
          PlayerGear = new Armor[32]
        EndIf
        int slot = 0
        while slot < 32
          PlayerGear[slot] = NPC.GetWornForm(Math.LeftShift(1, slot)) as Armor
          slot += 1
        endWhile

        NPC.UnequipAll()
        Debug.Notification("Player undressed and outfit saved.")
    else
        NPC.UnequipAll()
        Debug.Notification("NPC undressed.")
    endif
EndEvent

Event OnTriggerLeave(ObjectReference akRef)
    if (akRef as Actor) == Game.GetPlayer()
        int slot = 0
        while slot < 32
          if PlayerGear[slot]
            Game.GetPlayer().equipItem(PlayerGear[slot])
            PlayerGear[slot] = none
          endif
          slot += 1
        endWhile
    endif         
EndEvent
    

And yeah, you need to make sure that source scripts included with SKSE are properly placed into your source directory   (pretty sure SKSE64 by default drops them into scripts/source instead of source/scripts)

Expand  

Thank you! I will add the dummy ring method for for the NPCs into the script. If i do end up publishing, i'll credit you for the help. Thanks.

Posted
  On 5/22/2025 at 10:04 PM, scorrp10 said:

No, the script is attached to trigger area around the pool, so extending ObjectReference is correct.

Other thoughts:   
Auto properties are generally for giving script access to game forms.   I suppose you can use them like this too, but really you should be just declaring them as local variables.

Scriptname Pool_UndressScript extends ObjectReference

Armor PlayerGear[]

Event OnTriggerEnter(ObjectReference akRef)
    Actor NPC = akRef as Actor
    if NPC == None || NPC.IsDead()
        return
    endif

    if NPC == Game.GetPlayer()
        ; Save current gear before undressing
        If PlayerGear.Length == 0
          PlayerGear = new Armor[32]
        EndIf
        int slot = 0
        while slot < 32
          PlayerGear[slot] = NPC.GetWornForm(Math.LeftShift(1, slot)) as Armor
          slot += 1
        endWhile

        NPC.UnequipAll()
        Debug.Notification("Player undressed and outfit saved.")
    else
        NPC.UnequipAll()
        Debug.Notification("NPC undressed.")
    endif
EndEvent

Event OnTriggerLeave(ObjectReference akRef)
    if (akRef as Actor) == Game.GetPlayer()
        int slot = 0
        while slot < 32
          if PlayerGear[slot]
            Game.GetPlayer().equipItem(PlayerGear[slot])
            PlayerGear[slot] = none
          endif
          slot += 1
        endWhile
    endif         
EndEvent
    

And yeah, you need to make sure that source scripts included with SKSE are properly placed into your source directory   (pretty sure SKSE64 by default drops them into scripts/source instead of source/scripts)

Expand  

It now works. Great. I had to change one line though, the first one, i had to change " Armor PlayerGear[] " to "Armor[] PlayerGear" then it was fine. I wouldnt compile at first because for some reason my CK is looking in the wrong folder for the source files so i set up a symlink in the " incorrect folder " to send CK to the correct one.

  • Recently Browsing   0 members

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