Jump to content

Recommended Posts

Posted
  On 8/8/2021 at 6:14 AM, glowplug said:
scn QstOnDeathNPCScript
;Quest called QstOnDeathNPC, priority 100, Start Game Enabled ticked.

float fQuestDelayTime

Begin GameMode
    if GetGameLoaded
        let fQuestDelayTime := 0.1
    endif

    call FnDeadActorAddItem 35 ;NPC
    call FnDeadActorAddItem 36 ;Creature
    ;call FnDeadActorAddItem 37 NO LeveledCreature is instantiated as 36
End
scn FnDeadActorAddItem

int iFormTypeID
ref refActor

Begin Function { iFormTypeID }
    
    if PlayerRef.IsInInterior
        let refActor := GetFirstRef iFormTypeID
    else
    ;___GetFirstRef FormTypeID, CellDepth - 1 resulting in local + 8 surrounding
        let refActor := GetFirstRef iFormTypeID, 1
    endif

    while refActor != 0
        if refActor.GetDead
        ;___NonAcumulation armor: Playable unticked, player can't loot ensuring bonus item(s) added once only
            if refActor.GetItemCount NonAccumulation == 0
                refActor.AddItem NonAccumulation, 1
                if refActor.GetInFaction ConjurerFaction || refActor.GetInFaction DaedraFaction
                    refActor.AddItem LL2NPCStaff100 1
                elseif refActor.GetInFaction DremoraFaction || refActor.GetInFaction BanditFaction
                    refActor.AddItem BonusDaedricHelmet, 1
                elseif refActor.GetInFaction CreatureFaction || refActor.GetInFaction VampireFaction
                    refActor.AddItem Gem4SapphireBonus 1
                endif
            endif
        endif
        let refActor := GetNextRef
    loop

End

 

Excellent approach! I made a few changes to appease the stealthy pickpocket, along with using an array instead of a long list of elseifs. Very happy with the result and I learned a few things too. Thanks again.

Posted

Glad to help, I'm curious as to how an array could isolation Faction(s) or whether you went for another requirement or whether I'm simply missing the point.

Posted

For each index in the array, I assigned the value of 'ref.GetInFaction faction'. Then I dropped that in the while loop and used ar_Find to determine if a value is true.

  • Recently Browsing   0 members

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