Jump to content

Scripting Error


Launius

Recommended Posts

I'm trying to use the IsActorAssigned function but when I try to compile the script in the ck it says it doesn't exist. Is there another way to run it? I just need to check if the object is assigned and block activation if it's not.

Link to comment
Share on other sites

I appreciate the input. I got the script to work by extending workshopobjectscript. But now I'm having a whole new problem where I can't actually find a way to assign a settler to an activator, so I still can't get it to work, lol.

Link to comment
Share on other sites

The components you will need to use are;

Quest Property pWorkshopParent Auto Const Mandatory

If (ThisActor is WorkshopNPCScript) && (ThisObject is WorkshopObjectScript)
   (pWorkshopParent as WorkshopParentScript).AssignActorToObjectPUBLIC((ThisActor as WorkshopNPCScript), (ThisObject as WorkshopObjectScript), bResetMode = false) ;this automatically checks/adds to workshop
Else
   ThisObject.SetActorRefOwner(ThisActor as Actor)
EndIf				

If you are looking for script elegance, follow the WorkshopParentScript calls to WorkshopObjectScript and call those function direct. Because WorkshopParentScript spends a lot of time with an overloaded queue of backlogged calls.

Link to comment
Share on other sites

I've spent a few hours trying to understand that, but I'm really just kind of stumbling my way through all of this. I'm learning a lot, but the last game I played with code in was New Vegas. That was like 10 years ago. I've been able to get Fallout 4 to do things I want it to sometimes, lol, but your knowledge is far above my own. I'm very thankful, just know I'm kind of an idiot.

Link to comment
Share on other sites

Your script is attached to an ObjectReference, therefore you can call functions that are declared in ObjectReference Script, if you want to access functions that are declared in another script, which is the case of IsActorAssigned, that is declared in WorkshopObjectScript, you need 2 things, in first place WorkshopObjectScript must be attached to the base object or the reference and, in your script, you need to cast your script (self) to such script, for example:

 

WorkshopObjectScript WSObject = Self As WorkshopObjectScript

 

then you can use the resulting object to call the function:

 

If WSObject.IsActorAssigned()

;your code here

EndIf

Link to comment
Share on other sites

I'm thankful for the input DieFeM. I think I've moved past that problem. I'm trying to run the script on an activator, which, lo and behold, cannot be assigned. The script is doing what it's supposed to. I've tried adding the bool property bAllowPlayerAssignment set to true, but to no avail.

 

ADDED:: I think that SKK is leading me in the right direction, which is how I got to the bAllowPlayerAssignment property. But I seem to be missing something, I think. It's making my brain hurt, lol.

Edited by Launius
Link to comment
Share on other sites

  • Recently Browsing   0 members

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