Jump to content
The Loot

Carrying Over Command Position From One Script Activation To Another

Recommended Posts

Basically, I'm trying to add a delay when I use a modified LA Call Vehicle Command, so that there's a wait period during the radio audio, and a vehicle behind chosen and taking actions itself.

Vector CmdPos = Game::GetCommandPos(); is outside of Child sections at the top of the script.

Under ChildID 0, I have tried both of these commands: 

Caller->PushActionExecuteCommand(ACTION_APPEND, "PcmdCallALSAmb", CmdPos, 1, false); - It throws this error log:

Spoiler

?(_LACall_EMS873d0): Error: Can't call Person::PushActionExecuteCommand(ACTION_APPEND,"PcmdCallALSAmb",CmdPos,1,false) in current scope
?(_LACall_EMS873d0):  FILE:mod:/scripts/game/command/LACall_EMS.script873d0 LINE:107
?(_LACall_EMS873d0): Possible candidates are...
?(_LACall_EMS873d0): filename       line:size busy function type and name  
?(_LACall_EMS873d0): (in Person)
?(_LACall_EMS873d0): filename       line:size busy function type and name  
?(_LACall_EMS873d0): (in GameObject)
?(_LACall_EMS873d0): (compiled)        0:0    0 
?(_LACall_EMS873d0): public: 
?(_LACall_EMS873d0): void 
?(_LACall_EMS873d0): PushActionExecuteCommand(
?(_LACall_EMS873d0): ActionInsertMode
?(_LACall_EMS873d0):  Mode_
?(_LACall_EMS873d0): ,
?(_LACall_EMS873d0): const char*
?(_LACall_EMS873d0):  Command_
?(_LACall_EMS873d0): ,
?(_LACall_EMS873d0): Actor*
?(_LACall_EMS873d0):  Target_
?(_LACall_EMS873d0): =NULL
?(_LACall_EMS873d0): ,
?(_LACall_EMS873d0): int
?(_LACall_EMS873d0):  ChildID_
?(_LACall_EMS873d0): =0
?(_LACall_EMS873d0): ,
?(_LACall_EMS873d0): bool
?(_LACall_EMS873d0):  CheckTarget_
?(_LACall_EMS873d0): =true
?(_LACall_EMS873d0): )
?(_LACall_EMS873d0): ;
?(_LACall_EMS873d0): 
?(_LACall_EMS873d0): (compiled)        0:0    0 
?(_LACall_EMS873d0): public: 
?(_LACall_EMS873d0): void 
?(_LACall_EMS873d0): PushActionExecuteCommand(
?(_LACall_EMS873d0): ActionInsertMode
?(_LACall_EMS873d0):  Mode_
?(_LACall_EMS873d0): ,
?(_LACall_EMS873d0): const char*
?(_LACall_EMS873d0):  Command_
?(_LACall_EMS873d0): ,
?(_LACall_EMS873d0): Vector&
?(_LACall_EMS873d0):  Pos_
?(_LACall_EMS873d0): )
?(_LACall_EMS873d0): ;
?(_LACall_EMS873d0): 
?(_LACall_EMS873d0): filename       line:size busy function type and name  
?(_LACall_EMS873d0): (in Actor)
?(_LACall_EMS873d0): Error: Failed to evaluate class member 'PushActionExecuteCommand(ACTION_APPEND,"PcmdCallALSAmb",CmdPos,1,false)' (p.PushActionExecuteCommand(ACTION_APPEND,"PcmdCallALSAmb",CmdPos,1,false))
?(_LACall_EMS873d0): Possible candidates are...
?(_LACall_EMS873d0): filename       line:size busy function type and name  
?(_LACall_EMS873d0): 
?(_LACall_EMS873d0): !!!Dictionary position rewound... 
?(_LACall_EMS873d0): !!!Error recovered!!!

Caller->PushActionExecuteCommand(ACTION_APPEND, "PcmdCallALSAmb", CmdPos.Target, 1, false); - Saw something like that in the Move command, but it throws this much smaller error log:

Spoiler

?(_LACall_EMS87452): Error: Failed to evaluate class member 'Target' (CmdPos.Target)
?(_LACall_EMS87452): !!!Dictionary position rewound... 
?(_LACall_EMS87452): !!!Error recovered!!!


ChildID 1 contains the actual bulk of the script.

Is this even possible?

Link to comment
Share on other sites

2 hours ago, itchboy said:

CmdPos is not considered a valid target in Em4. You need to use an actual gameObject as the target so that the script doesnt crap out.

I suppose it's the method that complicates using a vector in this case, but I've seen them used in seemingly similar ways elsewhere.

1 hour ago, Squad 65 said:

Look at Jackson County @The Loot it has a few scripts that do that.

That mod seems to have some gameplay elements I've gone for myself, so I'll probably check it out in general now.

Link to comment
Share on other sites

The way I would do it is create a gameObject as the target. This gO must be positioned at the point where the user clicks, so using the "GetCommandPos" line works.

From there you have a permanent (or temporary, your choice) variable that you can extract a user set position from.

Link to comment
Share on other sites

Alright, finally got it working.

The caller creates a copy of themselves at the command position, it gets hidden (normal method caused an issue with getting a final vector, changing model to an invisible one works), find it with another caller command, make it execute the final command at its position, and then delete itself. I was going to just use an empty object prototype, but the prototype of the caller is essential to the functioning of the scripts.

  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...