Jump to content
hiddetjuh

I don't know if this script is right, please help me

Recommended Posts

I don't know if this script is right, i want to use it for the gelderland-zuid mod.

The meaning of this script is to make it possible to get a large lamp from a vehicle and put it down on the ground so it can give licht.

I am not sure if the spotlight can be placed on the street and if it is possible to pick up the spotlight. If it isn't, please tell me how i can do that.

//********************************************************************************
*************************
//* #Version 1.0#
//*
//* Added:
//* -Take spotlight from vehicle
//*
//* Script is made by Hiddetjuh
//*
//* This script is only for use at the gelderland-zuid mod. To use this script, you need to have permission from Hiddetjuh
//* Send me a message at forum.emergency-planet.com to ask permission
//********************************************************************************
*************************
object GetSpotlight : CommandScript
{
GetSpotlight()
{
SetValidTargets(ACTOR_VEHICLE | ACTOR_OBJECT);
SetGroupID(CGROUP_GETEQUIPMENT);
SetRestrictions(RESTRICT_NOTDESTROYED | RESTRICT_NOTBURNING | RESTRICT_HASSPOTLIGHT);
SetPossibleCallers(ACTOR_PERSON);
SetNeedsCarWithFlagSet(OF_HAS_SPOTLIGHT);
}

/*bool CheckPossible(GameObject *Caller)
{
if(!Caller->IsValid() || Caller->GetType() != ACTOR_PERSON)
return false;
Person p(Caller);
if (p.GetEquipment()==EQUIP_SPOTLIGHT || p.IsCarryingPerson()||p.IsLinkedWithPerson()|| p.GetFirehoseID()!=0 || p.IsPulling())
return false;
if (!Game::ExistsNormalObjectWithFlagSet(OF_HAS_SPOTLIGHT))
return false;
return true;
}*/

bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
{
if (!Caller->IsValid() || !Target->IsValid() || (Caller->GetID()==Target->GetID()))
return false;

GameObject obj(Target);
if (Caller->GetObjectType()==TYPE_PERSON && Caller->GetEquipment()!=EQUIP_SPOTLIGHT &&
obj.IsValid() && obj.IsFlagSet(OF_HAS_SPOTLIGHT))
{
Person p(Caller);
if(p.IsValid() && (p.IsCarryingPerson()||p.IsLinkedWithPerson()|| p.GetFirehoseID()!=0 || p.IsPulling() || p.GetEnteredCarID() != -1))
return false;

return true;
}

return false;
}

void PushActions(GameObject *Caller, Actor *Target, int childID)
{
Vector TargetPos = Target->GetTargetPoint(Caller, TARGET_EQUIPMENTDOOR);

Caller->PushActionMove(ACTION_NEWLIST, TargetPos);
Caller->PushActionTurnTo(ACTION_APPEND, Target);
Caller->PushActionGetEquipment(ACTION_APPEND, Target, EQUIP_SPOTLIGHT);
}
};

And my other script(also for the same thing):

object Spotlight : CommandScript
{
GetSpotlight()
{
SetValidTargets(ACTOR_VEHICLE | ACTOR_OBJECT);
SetGroupID(CGROUP_GETEQUIPMENT);
SetRestrictions(RESTRICT_NOTBURNING | RESTRICT_NOTDESTROYED | RESTRICT_HAS_FIRE_EXTINGHUISER);
SetPossibleCallers(ACTOR_PERSON);
SetNeedsCarWithFlagSet(OF_HAS_FIRE_EXTINGHUISER);
}

/*bool CheckPossible(GameObject *Caller)
{
if(!Caller->IsValid() || Caller->GetType() != ACTOR_PERSON)
return false;
Person p(Caller);
if (p.GetEquipment()==EQUIP_FIRE_EXTINGHUISER || p.IsCarryingPerson()||p.IsLinkedWithPerson()|| p.GetFirehoseID()!=0 || p.IsPulling())
return false;
if (!Game::ExistsNormalObjectWithFlagSet(OF_HAS_FIRE_EXTINGUISHER))
return false;
return true;
}*/

bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
{
if (!Caller->IsValid() || !Target->IsValid() || (Caller->GetID()==Target->GetID()))
return false;

GameObject obj(Target);
if (Caller->GetObjectType()==TYPE_PERSON && Caller->GetEquipment()!=EQUIP_FIRE_EXTINGHUISER &&
obj.IsValid() && obj.IsFlagSet(OF_HAS_FIRE_EXTINGHUISER))
{
if (obj.GetType() == ACTOR_VEHICLE)
{
Vehicle vec(&obj);
if (vec.IsDestroyed())
return false;
}
Person p(Caller);
if(p.IsValid() && (p.IsCarryingPerson()||p.IsLinkedWithPerson()|| p.GetFirehoseID()!=0 || p.IsPulling() || p.GetEnteredCarID() != -1))
return false;

return true;
}

return false;
}

void PushActions(GameObject *Caller, Actor *Target, int childID)
{
Vector TargetPos = Target->GetTargetPoint(Caller, TARGET_EQUIPMENTDOOR);

Caller->PushActionMove(ACTION_NEWLIST, TargetPos);
Caller->PushActionTurnTo(ACTION_APPEND, Target);
Caller->PushActionGetEquipment(ACTION_APPEND, Target, EQUIP_FIRE_EXTINGHUISER);
}
};

Edit: The 2nd script is updated

Link to comment
Share on other sites

The script is not right because:

EQUIP_SPOTLIGHT is not a game term. The EQUIP_ items are predefined game terms:

enum EquipmentType
{
EQUIP_NONE = 0x00000000,
EQUIP_FIRE_EXTINGUISHER = 0x00000001,
EQUIP_SHEARS = 0x00000002,
EQUIP_CHAINSAW = 0x00000004,
EQUIP_JUMPPAD = 0x00000008,
EQUIP_ROADBLOCK = 0x00000010,
EQUIP_FLASHGRENADE = 0x00000020,
EQUIP_PISTOL = 0x00000040,
EQUIP_RIFLE = 0x00000080,
EQUIP_FIREHOSE = 0x00000100,
EQUIP_FIREAXE = 0x00000200,
EQUIP_EMERGENCY_CASE = 0x00000400,
EQUIP_STARTERFLAG = 0x00000800,
EQUIP_REDIRECTSIGN = 0x00001000,
EQUIP_THW_CASE = 0x00002000,
EQUIP_MEGAPHONE = 0x00004000,
EQUIP_JACKHAMMER = 0x00008000,
EQUIP_BOTTLE = 0x00010000,
EQUIP_LAPTOP = 0x00020000,
EQUIP_DEALERCASE = 0x00040000,
EQUIP_TVCAMERA = 0x00080000,
};

Its the same with OF_HAS_SPOTLIGHT

enum ObjectFlag
{
OF_NONE = 0x00000000,
OF_PERSON_ENCLOSED = 0x00000001, // object has enclosed person
OF_LOCKED = 0x00000002, // object is locked
OF_USABLE = 0x00000004, // object can be used (special action)
OF_BULLDOZABLE = 0x00000008, // can be planated by the bulldozer (wheel loader)
OF_TRANSPORTABLE = 0x00000010, // object can be loaded up (by vehicle)
OF_PULLABLE = 0x00000020, // object can be pulled
OF_ACCESSIBLE = 0x00000040, // object can be entered
OF_COOLABLE = 0x00000080, // object can be cooled by fire fighters
OF_SHOOTABLE = 0x00000100, // object can be shooted at
OF_CUTABLE = 0x00000200, // object can be cut down with chainsaw
OF_USABLE_WITH_MEGAPHONE = 0x00000400, // megaphone can be used on object
OF_RECOVERABLE = 0x00000800, // object can be recovered by recovery crane
OF_FLOTSAM = 0x00001000, // object can be picked up by motor boat
OF_HIDDEN = 0x00002000, // object is invisible
OF_CARRYABLE_BY_BULLDOZER = 0x00008000, // can be carried by the bulldozer (wheel loader)
OF_HAS_FIRE_EXTINGUISHER = 0x00010000, // object carries one/many fire extinguishers
OF_HAS_SHEARS = 0x00020000, // object carries one/many jaws of life
OF_HAS_CHAINSAW = 0x00040000, // object carries one/many chainsaws
OF_HAS_HOSE = 0x00080000, // object carries one/many fire hoses
OF_HAS_JUMPPAD = 0x00100000, // object carries one/many jumppads
OF_HAS_ROADBLOCK = 0x00200000, // object carries one/many roadblocks
OF_HAS_FLASHGRENADE = 0x00400000, // object carries one/many flashgrenades
OF_HAS_FIREAXE = 0x00800000, // object carries one/many fireaxes

OF_BLOCKED = 0x80000000 // no interaction with object possible
};

What your asking to be done can be done> I can probably do it for you after xmas in my free time if you give me the prototype for the spotlight and your specifications.

Regards

James

Link to comment
Share on other sites

The spotlight is gonna be a new item in the mod.

So i have to call the spotlight like Roadblock and edit that in script and then it's done?

No. Take a look at Hoppah's LAPSG1.script file in his mod. Look at DUMMY_PSG and then the rest of the script to see how its done ;)

Regards

James

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