Jump to content

[Scripting] GetSlotmask from form is not working (because I m a noob I guess :D)


Nymra

Recommended Posts

Posted

Ok, 

so I want to scan inventory for items that can be robbed.

That works so far...

But BLOCKING items from beeing robbed does NOT Work and I am out of ideas why that is the case.

 

These are my two functions:

 

Robbery:

 

Spoiler

Function StartRobbery(Actor akRobber)                ;#robbery
            
Debug.trace("Naked Defeats configquest - StartRobbery() - ROBBER: "+GetLeveledActorBaseName(akRobber))
    
    bool robberyrunning = false
    
    if (akRobber != None) && akRobber.IsEnabled() && !akRobber.IsDead()

        if !DefeatRobberyGold 
                    
        ShowScreenMessage("All your belongings have been robbed by "+GetLeveledActorBaseName(akRobber))

        RobbedGold = PlayerRef.GetGoldAmount()
        PlayerRef.RemoveItem(Gold001, RobbedGold, True, akRobber)
            
        Int iFormIndex = PlayerRef.GetNumItems()    
        Int iFormCount
        Form RobbedItem
                    
            While iFormIndex > 0
                iFormIndex -= 1
                RobbedItem = PlayerRef.GetNthForm(iFormIndex)
                
                if !RobbedItem.HasKeyword(SexlabNoStrip)
                ShowDebugTrace("NAKED DEFEAT configquest: Robbed: "+RobbedItem.GetName())
                    if CheckItem(RobbedItem)
                    iFormCount = PlayerRef.GetItemCount(RobbedItem)
                    PlayerRef.RemoveItem(RobbedItem, iFormCount, True, akRobber)
                    endif
                else
                ShowDebugTrace("NAKED DEFEAT configquest: Not Robbed (SexlabNoStrip): "+RobbedItem.GetName())
                endif
                
            EndWhile
            
            PlayerRef.QueueNiNodeUpdate()

  endif

 

EndFunction

 

the "problematic" part is "CheckItem(Form)" which somehow fails to work like it should :P
It should check the Form if its armor or clothing (the same function works on other scripts with using From as armor somehow...) 

 

I m getting these errors:

 

Error: Cannot call GetSlotMask() on a None object, aborting function call
stack:
    [nade_ConfigQuest (E90012C5)].nade_configquest_scr.CheckItem() - "nade_configquest_scr.psc" Line 2143
    [nade_ConfigQuest (E90012C5)].nade_configquest_scr.StartRobbery() - "nade_configquest_scr.psc" Line 2032
    [nade_CalmQuest (E90B7967)].nade_calmquest_qf_scr.Fragment_8() - "nade_calmquest_qf_scr.psc" Line 925
[05/15/2022 - 10:27:55PM] WARNING: Assigning None to a non-object variable named "::temp195"
stack:
    [nade_ConfigQuest (E90012C5)].nade_configquest_scr.CheckItem() - "nade_configquest_scr.psc" Line 2143
    [nade_ConfigQuest (E90012C5)].nade_configquest_scr.StartRobbery() - "nade_configquest_scr.psc" Line 2032
    [nade_CalmQuest (E90B7967)].nade_calmquest_qf_scr.Fragment_8() - "nade_calmquest_qf_scr.psc" Line 925

I m really confused since I cannot find a pattern in the trace messages I get or why the warnings occur and when. 

Can I not check a "Form" for any keyword I want? I mean how do I find out what a form is if not like this? 

 

what IS working are the keywords (sexlabnotstrip) and the armor keyword detection) 

 

Spoiler


Bool Function CheckItem(Form akItem)

 

if akItem.HasKeyword(ArmorClothing) || akItem.HasKeyword(ArmorLight) || akItem.HasKeyword(ArmorHeavy)

 

ShowDebugTrace("NAKED DEFEAT configquest: Robbery IS armor/clothing:" +akItem.GetName())

 

    int SlotMask = (akItem as armor).GetSlotMask()
    ShowDebugTrace("NAKED DEFEAT configquest: SlotMask "+SlotMask)
    
    if (SlotMask == 8000)
    ShowScreenMessage("Hello")
    endif

    if (SlotMask == 10) && !AllowSlot[4]            ;34 - Forearms
    return false
    elseif (SlotMask == 20) && !AllowSlot[5]        ;35 - Amulet
    return false
    elseif (SlotMask == 40) && !AllowSlot[6]        ;36 - Ring 
    return false
    elseif (SlotMask == 100) && !AllowSlot[8]        ;38 - Calves
    return false
    elseif (SlotMask == 200) && !AllowSlot[9]        ;39 - SHIELD    
    return false
    elseif (SlotMask == 400) && !AllowSlot[10]        ;40 - TAIL 
    return false
    elseif (SlotMask == 800) && !AllowSlot[11]        ;41 - Long Hair    
    return false    
    elseif (SlotMask == 2000) && !AllowSlot[13]        ;43 - Ears 
    return false
    elseif (SlotMask == 4000) && !AllowSlot[14]        ;44 - Unnamed     (DD Gag/Mouth, SexlabTongue)
    return false
    elseif (SlotMask == 8000) && !AllowSlot[15]        ;45 - Unnamed         (DD Collars)    
    return false
    elseif (SlotMask == 10000) && !AllowSlot[16]    ;46 - Unnamed         (DD Armbinder/Yoke, Cloaks)
    return false    
    elseif (SlotMask == 20000) && !AllowSlot[17]    ;47 - Unnamed         (DD -, Backpacks, Wings)
    return false    
    elseif (SlotMask == 40000) && !AllowSlot[18]    ;48 - Unnamed         (DD plugs anal, Backpack left pouch)
    return false    
    elseif (SlotMask == 80000) && !AllowSlot[19]    ;49 - Unnamed         (DD Body harness/Chastity belt)
    return false        
    elseif (SlotMask == 100000) && !AllowSlot[20]    ;50 - Decap. Head    (DD Piercings Vaginal, bracelets)
    return false    
    elseif (SlotMask == 200000) && !AllowSlot[21]    ;51 - Decapitate 
    return false    
    elseif (SlotMask == 400000) && !AllowSlot[22]    ;52 - Unnamed
    return false    
    elseif (SlotMask == 800000) && !AllowSlot[23]    ;53 - Unnamed    (DD Cuffs Legs)
    return false    
    elseif (SlotMask == 1000000) && !AllowSlot[24]    ;54 - Unnamed    (DD Plugs vaginal)
    return false    
    elseif (SlotMask == 2000000) && !AllowSlot[25]    ;55 - Unnamed    (DD Blindfold)
    return false    
    elseif (SlotMask == 4000000) && !AllowSlot[26]    ;56 - Unnamed    (DD Chastity Bra)
    return false
    elseif (SlotMask == 8000000) && !AllowSlot[27]    ;57 - Unnamed    (DD Vaginal Plugs)
    return false
    elseif (SlotMask == 10000000) && !AllowSlot[28]    ;58 - Unnamed    (DD Body Harness/Corset
    return false
    elseif (SlotMask == 20000000) && !AllowSlot[29]    ;59 - Unnamed    (DD Cuffs Arms)
    return false
    elseif (SlotMask == 40000000) && !AllowSlot[30]    ;60 - Unnamed
    return false    
    elseif (SlotMask == 80000000) && !AllowSlot[31]    ;61 - Unnamed
    return false
    else
    return true
    endif
    
endif

EndFunction

 

Posted

1.:

int SlotMask = (akItem as armor).GetSlotMask()

if akItem is not Armor you get:

Error: Cannot call GetSlotMask() on a None object, aborting function call

becuae (akItem as armor) will return "none"

 

2.:

[05/15/2022 - 10:27:55PM] WARNING: Assigning None to a non-object variable named "::temp195"
stack:
    [nade_ConfigQuest (E90012C5)].nade_configquest_scr.CheckItem() - "nade_configquest_scr.psc" Line 2143

 

Thats because CheckItem can return 'none" and not always a bool.

The very first "if" in CheckItem does not have "else" part and/or you don't return "true/false" just before EndFuction.

 

If you are checking whats in Actors inventory, you can't assume it has only Armor.

 

Posted
9 minutes ago, Fotogen said:

1.:

int SlotMask = (akItem as armor).GetSlotMask()

if akItem is not Armor you get:

Error: Cannot call GetSlotMask() on a None object, aborting function call

becuae (akItem as armor) will return "none"

 

the check did not work on armor even when I just ran ALL items through it. 
I got alot of errors, but the armor parts within STILL did not return a slotmask hmm

 

9 minutes ago, Fotogen said:

2.:

[05/15/2022 - 10:27:55PM] WARNING: Assigning None to a non-object variable named "::temp195"
stack:
    [nade_ConfigQuest (E90012C5)].nade_configquest_scr.CheckItem() - "nade_configquest_scr.psc" Line 2143

 

Thats because CheckItem can return 'none" and not always a bool.

The very first "if" in CheckItem does not have "else" part and/or you don't return "true/false" just before EndFuction.

 

If you are checking whats in Actors inventory, you can't assume it has only Armor.

 

 

true. fixed that.

 

But what does NOT work is the keywords check now... sigh...

 

Form akItem

if akItem.HasKeyword(ArmorClothing) || akItem.HasKeyword(ArmorLight) || akItem.HasKeyword(ArmorHeavy)

seems to not recognize any armor piece (that I then want to check for the Slot) 
ironically it detects: Robbery IS armor/clothing: Sleeping Tree Sap 

 

properties are set in the ESP... 

 

Posted
10 hours ago, Nymra said:

if (SlotMask == 10) && !AllowSlot[4]            ;34 - Forearms
    return false

That "== 10". Shouldn't that be in hex, like "== 0x10"?

Posted
4 hours ago, Fotogen said:

That "== 10". Shouldn't that be in hex, like "== 0x10"?

 

it works only with dec.... so now its a 16 ^^
 

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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