Jump to content

Photo

Problem with Actor scripting

help scripting actor event onpackageend

  • Please log in to reply
9 replies to this topic

#1
TTR928

TTR928

    Stranger

  • Premium Member
  • 7 posts

hey there , I'm fairly new to papyrus scripting and i can't manage to find any solution as what i did wrong.

what my mod do is adding immersive Brothel to Fallout 4

my mod mainly work on package manipulation and i need to be able to put a script that check package start and End Outside the package tabs because they are used by multiple NPC (so i can't use package fragment menu because it would force me to create 5 nearly identical package per NPC) so the solution that i came up with , is to put a script that check the start and the end of every package 

Scriptname IF_Brothel_AIPackageScriptManager extends ReferenceAlias


Package Property IF_Brothel_OnJob_EscortToRoom Auto Const


Event OnPackageEnd(Package akOldPackage)
debug.messagebox("[AliasScript]EVENNNNNT")
debug.notification("[AliasScript]EVENNNNT")


if (akOldPackage == IF_Brothel_OnJob_EscortToRoom)
debug.messagebox("[AliasScript]Packagggggge")
debug.notification("[AliasScript]Packagggggge")
endif
endEvent
; ps ; the debug.notification and debug.messagebox are just there for testing

I then either attach it to my alias in the DialogueQuest of my NPC or directly to the NPC it self in the Actor Tab

 

my guess is that i did something wrong with the extends of my script , so tried replacing ReferenceAlias by Actor in both my "NPC alias in the DialogueQuest " and directly to the "NPC in the actor tab" , no success

 

Attached File  ActorTab.PNG   245.29KB   0 downloads

 

i didn't find anything that seems to help on internet so hopefully you guys can help :smile:

 

ps : sorry for any English mistakes it is not my main Language

i wont be here for two hours but i 'll try keeping up on my phone 

Thanks for any help



#2
DieFeM

DieFeM

    Old hand

  • Members
  • PipPipPip
  • 974 posts

As far as I know package events only work in the packages, I've even tried to use RegisterForRemoteEvent, which uses to work for this kind of situations, but it doesn't, so you'll need a different approach. I don't see the problem with using the same package on multiple NPC, you can attach the same packages to them all, if you elaborate on this problem we might find a better solution.

 

If they are using the same package, but they must stay on different places, use a linked reference as location, so you can use the same package for all them but the package location depends on the linked reference of each NPC.


Edited by DieFeM, 23 July 2019 - 12:24 PM.


#3
SKK50

SKK50

    Institutum delenda est

  • Premium Member
  • 5,783 posts

As above use Keyword LinkedReferences from Actor to Package locations and if you need to control individual actor behaviors use an ActorValue on the actors as a package conditional to enable/disable the packages or switch between them.

 

Do this a lot to switch between Sneak, Walk, Run packages on the same alias.


Edited by SKK50, 23 July 2019 - 01:40 PM.


#4
TTR928

TTR928

    Stranger

  • Premium Member
  • 7 posts

Thank you for the fast reply and sorry for the lack of information

 

 

As far as I know package events only work in the packages, I've even tried to use RegisterForRemoteEvent, which uses to work for this kind of situations, but it doesn't, so you'll need a different approach. I don't see the problem with using the same package on multiple NPC, you can attach the same packages to them all, if you elaborate on this problem we might find a better solution.

 

If they are using the same package, but they must stay on different places, use a linked reference as location, so you can use the same package for all them but the package location depends on the linked reference of each NPC.

 

the reason multiple package are needed is that their end package event is targeting a different quest "dialogue" for itch NPC , And as it is right now I either have to change the propriety in the script fragement "EndPackage" or the owningquest of the Package

so for exemple in my case I have 3 NPC =======> NPC1 , NPC2 ,NPC3

and 3 "DialogueQuest" representing itch NPC ===> NPC1Dialogue , NPC2Dialogue , NPC3Dialogue

 

currently i'm using the intergarded fragement in " (Package==>Begin,End,Change Tab) Package Start,End,Switch " To affect my NPC1Dialogue QuestStage depending on which package end 

 

here is a picture

 

Attached File  Package.PNG   163.19KB   0 downloads

 

i also use a faction that use ranks to keep track of itch NPC stage in my Scene because multiple NPC can have their DialogueQuest  running at the same time and at different stages  ; there is no problem there though it work fine 

 

every thing related to position is also working as intended . So the real problem is just having itch package running independently for every npc without resulting in exponential difficulty for adding more NPC in the future or incompatibility with other mods adding on mine

 

a solution could be that the package can reconize to which NPC the package is running on and then have something setting a FactionRank that track at which package the NPC is at , and the tracking in the DialogueQuest the evolution of the aliasreference Rank in this Faction .

 

i didn't find any Faction related Event so i'll have to get a bit imaginative here.

 

However For recognizing on which NPC the package is on i have no clue how to do it , if anyone have an idea i'll gladly take it :smile:



#5
TTR928

TTR928

    Stranger

  • Premium Member
  • 7 posts

As above use Keyword LinkedReferences from Actor to Package locations and if you need to control individual actor behaviors use an ActorValue on the actors as a package conditional to enable/disable the packages or switch between them.

 

Do this a lot to switch between Sneak, Walk, Run packages on the same alias.

 

I really like the idea but wouldn't it impact other mod compatibility that are adding on mine, i'm still processing the rest of the message sorry if i misunderstood i'm a bit new to those concepts



#6
SKK50

SKK50

    Institutum delenda est

  • Premium Member
  • 5,783 posts

Imagine a reference collection alias with a stack of actors in it, lets call them prostitutes.

 

Some will be relaxing doing their needlework and such, some will be developing buisness at the bar and some will be delivering service. So you have three packages on the alias;

 

Ho_Relax - Destination LinkedRef Ho_PackageDestinationKeyword - Condition Actor Ho_Package value 1

Ho_Chat - Destination LinkedRef Ho_PackageDestinationKeyword - Condition Actor Ho_Package value 2

Ho_Services - Destination LinkedRef Ho_PackageDestinationKeyword - Condition Actor Ho_Package value 3

 

Or you can use specific destination references, or LinkRef keywords bound to destinations or whatever mix and match fills yer boots. Thats how the base game and most quality mods work.


Edited by SKK50, 23 July 2019 - 03:21 PM.


#7
hereami

hereami

    Enthusiast

  • Members
  • PipPip
  • 205 posts

 

However For recognizing on which NPC the package is on i have no clue how to do it

Can it be as simple, as: "akActor: This is the Actor that is running the package" ?

 

e.g.

Event OnStart(Actor akActor)
    akActor.AddKeyword(keywordToAdd)
EndEvent

 

Function Fragment_End(Actor akActor)
;BEGIN CODE
AkActor.Disable()
;END CODE
EndFunction
 


Edited by hereami, 23 July 2019 - 04:03 PM.


#8
TTR928

TTR928

    Stranger

  • Premium Member
  • 7 posts

thanks for the reply I appreciate it 

 

if i got what you mean , so i should make a quest containing a ref collection alias containing itself the package i used to put into my individual NPC , 

the part i dont really get is the 

condition actor Ho_Package Value X 

i'm not sure i see what is or where you set that "value"

my best guess is that it is the priority order ?

 

but i still have the problem of tracking the end of the package and especially sending a setstage to the corresponding NPCDialogue when one of the package end for exemple (when the player get escorted to his room)

 

on an other topic how do you work with  Ref Collection Alias , I tried to write a scripts using indexes the other day and i couldn't get the corresponding actorRef or at list not one that work with any Actor function on it  (got a Type Error or/and a  function does not exist was 5 days ago so  sorry for the precision)  i was using a GetAt() Function to get the Reference and i seem to got an ObjectReference rather than an ActorReference (as i said i tried it like 5 days ago so might have some elements wrong)



#9
TTR928

TTR928

    Stranger

  • Premium Member
  • 7 posts

 

 

However For recognizing on which NPC the package is on i have no clue how to do it

Can it be as simple, as: "akActor: This is the Actor that is running the package" ?

 

e.g.

Event OnStart(Actor akActor)
    akActor.AddKeyword(keywordToAdd)
EndEvent

 

Function Fragment_End(Actor akActor)
;BEGIN CODE
AkActor.Disable()
;END CODE
EndFunction
 

 

I'll try it right now , thanks for the help 

i'll keep you guys up to date



#10
SKK50

SKK50

    Institutum delenda est

  • Premium Member
  • 5,783 posts

You set the conditions in the packages, so Ho_Relax only runs on actors that have their actorvalue Ho_Package set to 2

 

You set the actor value on on the actor Alias_Prostitiutes.GetAt(99).SetValue(pHo_Package, 2) and the linkedref if they are individual Alias_Prostitiutes.GetAt(99).SetLinkedRef(BarstoolREF, pHo_PackageDestinationKeyword), then (Alias_Prostitiutes.GetAt(99) as Actor).EvaluatePackage()

 

As the begin/end package events are not well exposed you have to find other events to intercept, like register an OnDistanceLessThan(ThisProstitute, ThatBarstoolREF)  event or better have an Event OnSit to script the next move from the barstool. 

 

Yes this is all nasty and complicated.


Edited by SKK50, 23 July 2019 - 04:29 PM.






Also tagged with one or more of these keywords: help, scripting, actor, event, onpackageend

IPB skins by Skinbox
Page loaded in: 1.075 seconds