Jump to content

Help with torches


Recommended Posts

I'm trying to make an NPC carry a torch at all times, at least until they go to sleep. I've tried looking at other NPC scripts, such as the Adoring Fan and the IC Guard Night-Shift but couldn't figure out what forces them to carry torches almost permanently.

 

This is what I've tried so far:

1) Put Torch02 in the new NPC's inventory.

2) Attached a script to the NPC to force them to equip it using different methods (using EquipItem):

  • Equip a torch when they start their Wander package
  • Equip a torch as long as they weren't sleeping (using GetSleeping)
  • Equip a torch based on the value returned by IsTorchOut

 

No matter what I tried, the NPC would still repeatedly try to equip the torch resulting in flickering. I'm sure that I'm making this a lot more complicated than it's supposed to be. Any help?

Link to comment
Share on other sites

This is not precisely what you are after, because this character just has a bunch of wander packages taking him on patrol, but it is a script used in one of my mods:

 

SCN AAWImperialLegionSoldierSCRIPT

 

; If he is patrolling a cave, he ought to have a torch.

 

Begin Gamemode

_____If GetEquipped Torch02 == 0

__________EquipItem Torch02

_____EndIf

End

 

What does your script look like? Maybe if you posted it someone would have a brilliant idea come to them.

 

It kind of sounds like your script needs a DoOnce of some sort to let the code only execute once at a given time rather than eternally.

Link to comment
Share on other sites

That was the one I tried.

 

I also had a variation of it that would only run once, but still no luck.

scn DAOwnerSCRIPT

 

short tflag

 

Begin GameMode

___if (GetEquipped Torch02 == 0) && (tflag == 0)

______EquipItem Torch02

______Set tflag to 1

___endif

End

 

This should cause the if statement to run only once, but I can still see a brief instance of where the NPC seems to reequip the already lit torch, causing a flicker. I also tried using a global variable, but still got the same problem.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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