Home » Renegade Discussions » Mod Forum » vtach/detach command
Re: vtach/detach command [message #436911 is a reply to message #436900] |
Thu, 23 September 2010 22:04 |
|
reborn
Messages: 3231 Registered: September 2004 Location: uk - london
Karma:
|
General (3 Stars) |
|
|
robbyke wrote on Thu, 23 September 2010 15:59 | well i started searching and found the command JFW_CarryAll
now my problem is that i need to attach to a bone but how do i find the bone that i have to attach
its the orca that doing vtach and it should only be up close any help is appreciated
|
I once started work some time ago on a carry-all plugin. It never got finished and this doesn't work, but with some time it might...
#include "scripts.h"
#include <stdarg.h>
#ifdef WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
#include "engine.h"
#include "gmmain.h"
#include "CarryAll.h"
bool Activated[128];
bool HasAgreed[128];
ExampleSettingsStruct *ExampleSettings = 0;
void ExampleSettingsStruct::Load()
{
SettingsLoader::Load();
}
int ObjectHookID = 0;
ObjectCreateHookStruct *ObjectHookStruct = 0;
void ObjectHookCall(void *data,GameObject *obj)
{
if(Is_Vehicle(obj))
{
if (strstr(Commands->Get_Preset_Name(obj),"CnC_Nod_Transport") || strstr(Commands->Get_Preset_Name(obj),"CnC_GDI_Transport"))
{
Attach_Script_Once(obj,"CarryAll","");
}
}
else if(Commands->Is_A_Star(obj))
{
Attach_Script_Once(obj,"carryvarsetter","");
}
}
void Plugin_Load()
{
ExampleSettings = new ExampleSettingsStruct("Example.ini");
ObjectHookStruct = new ObjectCreateHookStruct;
ObjectHookStruct->hook = ObjectHookCall;
ObjectHookStruct->data = 0;
ObjectHookID = AddObjectCreateHook(ObjectHookStruct);
}
void CarryAll::Custom(GameObject *obj, int message, int param, GameObject *sender)
{
if (message == CUSTOM_EVENT_VEHICLE_ENTER)
{
if (Get_Vehicle_Owner(obj))
{
Console_Input(StrFormat("ppage %d This vehicle has been modified to be a \"Carry-All\", when you get close to a team-mate's vehicle you'll be able to transport them if they type \"!carryme\" in team chat.", Get_Player_ID(sender)).c_str());
Console_Input(StrFormat("ppage %d To activate the Carry-All and grant permission to carry passengers, you must type \"!activate\" in team chat.", Get_Player_ID(sender)).c_str());
Commands->Start_Timer(obj, this, 1.0f, 1);
}
}
}
void CarryAll::Timer_Expired(GameObject *obj, int number)
{
if(number == 1)
{
GameObject *driver = Get_Vehicle_Owner(obj);
if(driver && Activated[Get_Player_ID(driver)] == true)
{
int team = Get_Object_Type(obj);
Vector3 CurPosition = Commands->Get_Position(obj);
GenericSLNode *x = BaseGameObjList->HeadNode;
while (x)
{
GameObject *o = (GameObject *)x->NodeData;
if (o && As_ScriptableGameObj(o) && Is_Vehicle(o))
{
if (Get_Object_Type(o) == team)
{
printf("Found someone.\n");
Vector3 CurPositiono = Commands->Get_Position(o);
float Dist = Commands->Get_Distance(CurPosition, CurPositiono);
if(Dist <= 10.0f)
{
printf("Found someone in distance.\n");
GameObject *driver2 = Get_Vehicle_Occupant(o, 0);
if(driver2)
{
printf("Found someone in distance and a driver.\n");
if(HasAgreed[Get_Player_ID(driver2)] == true)
{
printf("Found someone in distance and a driver and has agreed.\n");
//do some shit
GameObject *Harness = Commands->Create_Object_At_Bone(obj, "Invisible_Object", "v_fuselage3");
Commands->Set_Model(Harness,"XG_HD_Harness");
Commands->Attach_To_Object_Bone(Harness, obj, "v_fuselage3");
Console_Input(StrFormat("ppage %d You have just picked up aa vehicle, to release the vehicle type \"!release\".", Get_Player_ID(driver2)).c_str());
Destroy_Script();
}
}
}
}
}
x = x->NodeNext;
}
}
Commands->Start_Timer(obj, this, 1.0f, 1);
}
}
ScriptRegistrant<CarryAll> CarryAll_Registrant("CarryAll","");
void carryvarsetter::Killed(GameObject *obj, GameObject *shooter)
{
Activated[Get_Player_ID(obj)] = false;
HasAgreed[Get_Player_ID(obj)] = false;
}
ScriptRegistrant<carryvarsetter> carryvarsetter_Registrant("carryvarsetter","");
void Plugin_Unload()
{
delete ExampleSettings;
RemoveObjectCreateHook(ObjectHookID);
delete ObjectHookStruct;
}
class AChatCommand : public ChatCommandClass {
void Triggered(int ID,const TokenClass &Text,int ChatType)
{
Activated[ID] = true;
Console_Input(StrFormat("ppage %d You have just activated the Carry-All feature of this transport helicopter, any team mates in vehicles who have agreed to be transported can now be carried and wil attach when you approach them.",ID).c_str());
Console_Input(StrFormat("ppage %d To de-activate the Caary-All feature, type \"!deactivate\" in team chat.",ID).c_str());
}
};
ChatCommandRegistrant<AChatCommand> AChatCommandReg("!ACTIVATE;!Activate;!activate",CHATTYPE_ALL,0,GAMEMODE_ALL);
class DChatCommand : public ChatCommandClass {
void Triggered(int ID,const TokenClass &Text,int ChatType)
{
Activated[ID] = false;
Console_Input(StrFormat("ppage %d You have just removed permission for passengers to be carried.",ID).c_str());
}
};
ChatCommandRegistrant<DChatCommand> DChatCommandReg("!DEACTIVATE;!Deactivate;!deactivate",CHATTYPE_ALL,0,GAMEMODE_ALL);
class CMChatCommand : public ChatCommandClass {
void Triggered(int ID,const TokenClass &Text,int ChatType)
{
HasAgreed[ID] = true;
Console_Input(StrFormat("ppage %d You have agreed to be carried by a team mate using a transport helicopter, to remove permission type \"!cancelcarry\".",ID).c_str());
}
};
ChatCommandRegistrant<CMChatCommand> CMChatCommandReg("!carryme;!CARRYME;!Carryme;!CarryMe",CHATTYPE_ALL,0,GAMEMODE_ALL);
class CCChatCommand : public ChatCommandClass {
void Triggered(int ID,const TokenClass &Text,int ChatType)
{
HasAgreed[ID] = false;
Console_Input(StrFormat("ppage %d You have removed permission for you to be carried.",ID).c_str());
}
};
ChatCommandRegistrant<CCChatCommand> CCChatCommandReg("!CANCELCARRY;!cancelcarry;!Cancelcarry;!CancelCarry",CHATTYPE_ALL,0,GAMEMODE_ALL);
extern "C"
{
DLLEXPORT void SSGM_Level_Loaded_Hook()
{
ExampleSettings->Load();
for(int i = 0; i < 128; i++)
{
Activated[i] = false;
HasAgreed[i] = false;
}
}
DLLEXPORT void SSGM_Player_Leave_Hook(int ID)
{
Activated[ID] = false;
HasAgreed[ID] = false;
}
}
|
|
|
|
|
vtach/detach command
By: robbyke on Thu, 23 September 2010 12:59
|
|
|
Re: vtach/detach command
By: reborn on Thu, 23 September 2010 22:04
|
|
|
Re: vtach/detach command
By: robbyke on Fri, 24 September 2010 09:30
|
|
|
Re: vtach/detach command
By: robbyke on Thu, 30 September 2010 12:09
|
|
|
Re: vtach/detach command
By: Jerad2142 on Thu, 30 September 2010 12:13
|
|
|
Re: vtach/detach command
By: robbyke on Fri, 01 October 2010 10:19
|
|
|
Re: vtach/detach command
By: reborn on Sat, 02 October 2010 04:20
|
|
|
Re: vtach/detach command
By: robbyke on Sat, 02 October 2010 11:42
|
|
|
Re: vtach/detach command
By: reborn on Sat, 02 October 2010 14:30
|
|
|
Re: vtach/detach command
By: robbyke on Sat, 02 October 2010 16:08
|
Goto Forum:
Current Time: Mon Dec 23 17:31:13 MST 2024
Total time taken to generate the page: 0.00708 seconds
|