Jump to content
Quincy

CheckTarget scripting help

Recommended Posts

Hi, I'm trying to make it so this script can also pickup objects that fire fighters can pull (i.e. rubble on top of victims). If tried what I think would work and it doesnt. I know it has to do with the CheckTarget loop but I just don't know what to write to make that happen, I've tried multiple things with no success. (Script Credit: Kreuzung from emergency-forum.de)

 

Snippet of code I need help with:

  Quote

 

object HeliLift : CommandScript

{
HeliLift()
{
SetPossibleCallers(ACTOR_VEHICLE);
SetValidTargets(ACTOR_VEHICLE | ACTOR_OBJECT);
SetRestrictions(RESTRICT_NOTBURNING);
SetGroupID(CGROUP_CRANE);
SetIcon("liftwithcrane");
SetCursor("liftwithcrane");
}
 
bool CheckPossible(GameObject *caller) { return caller->IsChildEnabled("hook") && Game::ExistsObjectWithFlagSet(OF_RECOVERABLE); }
bool CheckGroupVisibility(GameObject *caller) { return caller->IsChildEnabled("hook"); }
 
bool CheckTarget(GameObject *caller, Actor *target, int childID)
{
GameObject tgt(target);
 
if(!tgt.IsFlagSet(OF_RECOVERABLE))
return false;
 
if(tgt.GetType() == ACTOR_VEHICLE)
{
Vehicle v(target);
if(v.IsSmoking() || v.GetNumPassengers() || v.GetNumTransported() || v.HasAnyAction()
|| ((v.HasCommand("flyto") || v.GetVehicleType() == VT_TV_HELI) && !v.IsOnGround()))
return false;
if(v.GetVehicleType() > VT_NOSQUAD && (v.GetVehicleType() < VT_TAXI || v.GetVehicleType() > VT_TV_HELI) && !v.IsCommandable())
return false;
}
return true;
}

 

Full Script: (For Reference)

  Reveal hidden contents

BTW the CODE tag on the forum is broken, had to use quote tag. :(

Link to comment
Share on other sites

Make sure the objects that can be picked up have a flag set that's called 'RECOVERABLE'. That seems to be the only restriction for objects that are no vehicles. The rubble probably only has the flag set 'PULLABLE', so you may want to change that for either the object in the editor, or change the script so the heli can also pick up objects with the flag set 'PULLABLE'.

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...