oldrayzor Posted February 21, 2019 Posted February 21, 2019 This simple script should outfit a list of actors with armors posted in an outfit list. The script compiles without error. The message box presents all the Actor references as "None" when looping, though the outfit reference appears correctly. It doesn't outfit anyone. When using a formlist of actors drawn from the non-player category, must they be convert to use as a Reference Object? Script: Spoiler Scriptname DebutOutfitter Extends Quest {Sets DefaultOutfit for listed NPCs} FormList Property myNPCList Auto FormList Property myOutfitList Auto Outfit Property DebutOutfit Auto Outfit Property NullOutfit Auto Armor Property myArmorRef Auto Actor Property myActorRef Auto Event OnInit() Debug.MessageBox("Quest DebutOutfitter Start") SetDebutOutfits() EndEvent Function SetDebutOutfits() Int NPCListCnt = myNPCList.GetSize() while NPCListCnt NPCListCnt -=1 myActorRef = myNPCList.GetAt(NPCListCnt) as Actor myActorRef.SetOutfit (NullOutfit) DebutOutfit = myOutfitList.GetAt(NPCListCnt) as Outfit myActorRef.SetOutfit (DebutOutfit) Debug.MessageBox("Actor #"+NPCListCnt+" : "+myActorRef+" : "+Debutoutfit) Int OutfitListCnt = DebutOutfit.GetNumParts() while OutfitListCnt OutfitListCnt -=1 myArmorRef = debutOutfit.GetNthPart(OutfitListCnt) as Armor myActorRef.additem (myArmorRef,1,TRUE) myActorRef.equipItem (myArmorRef,0,TRUE) EndWhile EndWhile Debug.MessageBox("Script Complete") EndFunction Script Properties: Spoiler
Guest Posted February 21, 2019 Posted February 21, 2019 Actor is a special case of ObjectReference, e.g. an ActorBase placed in the world. ActorBase is the definition of an actor, but not the actor itself. For example you can have multiple actors using the same actorbase (think about the guards.)
oldrayzor Posted February 21, 2019 Author Posted February 21, 2019 1 hour ago, CPU said: Actor is a special case of ObjectReference, e.g. an ActorBase placed in the world. ActorBase is the definition of an actor, but not the actor itself. For example you can have multiple actors using the same actorbase (think about the guards.) Thanks. Sorry I'm such a noob at this. While, yes, I do get the difference in your example, I don't understand which is incorporated into a FormList (simple drag-n-drop from Non-player category and how it is applied with SetOutfit(). It appears the form list contains the reference to a named NPC but it does not appear to work as applied in the script above.
coldloc Posted February 21, 2019 Posted February 21, 2019 i give u some general ideas on debugging, better than messagebox or notification, inject debug.trace method on every suspicious method and varible types in your scripts and monitor the error logs statments outputted and value dump in papyrus0.log it will help u a lot in script debugging , sometimes much helpful and faster than waiting ppl provide an answer.
Guest Posted February 21, 2019 Posted February 21, 2019 21 minutes ago, oldrayzor said: Thanks. Sorry I'm such a noob at this. While, yes, I do get the difference in your example, I don't understand which is incorporated into a FormList (simple drag-n-drop from Non-player category and how it is applied with SetOutfit(). It appears the form list contains the reference to a named NPC but it does not appear to work as applied in the script above. The outfit is actually not part of Actor but is part of ActorBase. I am not home right now, so I cannot give you good examples. Tomorrow evening I will try to give you a better, visual, example.
oldrayzor Posted February 21, 2019 Author Posted February 21, 2019 1 hour ago, CPU said: Tomorrow evening I will try to give you a better, visual, example. Always appreciated. ?
oldrayzor Posted February 21, 2019 Author Posted February 21, 2019 2 hours ago, coldloc said: It will help u a lot in script debugging Thanks for the tip.
coldloc Posted February 21, 2019 Posted February 21, 2019 11 minutes ago, oldrayzor said: Thanks for the tip. realtime gameplay logs can be printed via notification, console and papyrus0.log , most script error issues can be identified during watch papyrus0.log which prints out a error stack telling u which specific line of ur psc script stopped function well .
oldrayzor Posted April 12, 2019 Author Posted April 12, 2019 On 2/21/2019 at 10:25 AM, CPU said: The outfit is actually not part of Actor but is part of ActorBase. I am not home right now, so I cannot give you good examples. Tomorrow evening I will try to give you a better, visual, example. Apologies, been preoccupied with other parts of the mod, but did manage to get the outfitter to work. Problem is I have a formlist comprised of actorbases and can't find how to add items to an actorbase or to convert actorbase to reference or maybe simply can't add an item to the base. Not sure.
Guest Posted April 12, 2019 Posted April 12, 2019 OK, the function to set an outfit is this one: anActor.SetOutfit(akOutfit, abSleepOutfit) This should update the outfit of the actor.
oldrayzor Posted April 12, 2019 Author Posted April 12, 2019 1 hour ago, CPU said: OK, the function to set an outfit is this one: Thanks, yes I have the default outfit no problem, but I wish to add a weapon to the NPCs inventory yet I only have the ActorBase original to work with. Does the additem function work with the ActorBase? I've tried, but may have done something wrong.
Guest Posted April 12, 2019 Posted April 12, 2019 No, it does not work with ActorBase. You need an ObjectReference that can be considered a container (an Actor, for example.)
oldrayzor Posted April 13, 2019 Author Posted April 13, 2019 21 hours ago, CPU said: No, it does not work with ActorBase. You need an ObjectReference that can be considered a container (an Actor, for example.) That's very interesting. Explains why Immersive Weapons replaces the entire NPC record to add weapons to an NPC's inventory. Thank you for your assistance CPU.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.