Home » Renegade Discussions » Mod Forum » Question...
Question... [message #465856] |
Tue, 10 April 2012 01:18 |
FeaR
Messages: 87 Registered: January 2006 Location: Netherlands
Karma: 0
|
Recruit |
|
|
Is it possible when i for example have a flare, and put it anywhere on the map, a script zone will be created? and if so how would i do that??
|
|
|
|
Re: Question... [message #465858 is a reply to message #465856] |
Tue, 10 April 2012 01:42 |
FeaR
Messages: 87 Registered: January 2006 Location: Netherlands
Karma: 0
|
Recruit |
|
|
no i mean, ingame i pickup a flare that spawned as a weaponspawner. now i can set that flare anywhere i want on the map. when i did that, a script zone will be created on the place where i had set down the flare.
|
|
|
|
Re: Question... [message #465876 is a reply to message #465858] |
Tue, 10 April 2012 08:16 |
robbyke
Messages: 348 Registered: September 2010 Location: Belgium
Karma: 0
|
Recruit |
|
|
FeaR wrote on Tue, 10 April 2012 10:42 | no i mean, ingame i pickup a flare that spawned as a weaponspawner. now i can set that flare anywhere i want on the map. when i did that, a script zone will be created on the place where i had set down the flare.
|
i believe its possible with a ssgm plugin directly i dunno
Owner of kambot TT server
kambot.freeforums.org
|
|
|
|
Re: Question... [message #465915 is a reply to message #465856] |
Tue, 10 April 2012 19:41 |
|
Whitedragon
Messages: 832 Registered: February 2003 Location: California
Karma: 1
|
Colonel |
|
|
This should be possible, though you'll have to make your own scripts.
You could modify a beacon preset, there are two unused ones from SP, or a C4 preset to deploy the flare. Once the flare is created you can create your script zone with Create_Zone.
Black-Cell.net
Network Administrator (2003 - )
DragonServ, Renegade's first IRC interface bot
Creator and lead coder (2002 - )
Dragonade, Renegade's first server side modification
Lead coder (2005 - )
|
|
|
|
Re: Question... [message #465932 is a reply to message #465856] |
Wed, 11 April 2012 09:03 |
FeaR
Messages: 87 Registered: January 2006 Location: Netherlands
Karma: 0
|
Recruit |
|
|
ok so im stuck here, how would i make that script zone in a script? can anyone give me a example how to do that ?
|
|
|
|
Re: Question... [message #465948 is a reply to message #465856] |
Wed, 11 April 2012 15:15 |
|
Whitedragon
Messages: 832 Registered: February 2003 Location: California
Karma: 1
|
Colonel |
|
|
Try something like this.
void MDB_Create_Zone::Created(GameObject *obj) {
Vector3 Size = Vector3(4.0f,8.0f,2.0f); //Size of the script zone.
Matrix3 Rotation(true);
Rotation.Rotate_Z(Commands->Get_Facing(obj)); //Set the rotation of the script zone to the same as the beacon.
OBBoxClass Box(Commands->Get_Position(obj),Size,Rotation); //Create the bounding box with the position of the beacon, and the size and rotation defined earlier.
GameObject* Zone = Create_Zone("Script_Zone_All",Box);
//Attach whatever script you want to the zone now.
}
Black-Cell.net
Network Administrator (2003 - )
DragonServ, Renegade's first IRC interface bot
Creator and lead coder (2002 - )
Dragonade, Renegade's first server side modification
Lead coder (2005 - )
|
|
|
|
Re: Question... [message #466318 is a reply to message #465948] |
Wed, 18 April 2012 02:31 |
robbyke
Messages: 348 Registered: September 2010 Location: Belgium
Karma: 0
|
Recruit |
|
|
Whitedragon wrote on Thu, 12 April 2012 00:15 | Try something like this.
void MDB_Create_Zone::Created(GameObject *obj) {
Vector3 Size = Vector3(4.0f,8.0f,2.0f); //Size of the script zone.
Matrix3 Rotation(true);
Rotation.Rotate_Z(Commands->Get_Facing(obj)); //Set the rotation of the script zone to the same as the beacon.
OBBoxClass Box(Commands->Get_Position(obj),Size,Rotation); //Create the bounding box with the position of the beacon, and the size and rotation defined earlier.
GameObject* Zone = Create_Zone("Script_Zone_All",Box);
//Attach whatever script you want to the zone now.
}
|
if you create the zone is the object in the middle or in a corner?
if it is in the middle are X and Y then total length
with the example the object would be at 2 on Y and 4 on Y
or would the zone then be a total of 8 X and 16 Y?
Owner of kambot TT server
kambot.freeforums.org
|
|
|
Re: Question... [message #466319 is a reply to message #465856] |
Wed, 18 April 2012 03:14 |
|
Whitedragon
Messages: 832 Registered: February 2003 Location: California
Karma: 1
|
Colonel |
|
|
The object would be in the middle. The size is how far it extends from this point in each direction, so the true size would be twice the values given.
Black-Cell.net
Network Administrator (2003 - )
DragonServ, Renegade's first IRC interface bot
Creator and lead coder (2002 - )
Dragonade, Renegade's first server side modification
Lead coder (2005 - )
|
|
|
Re: Question... [message #466329 is a reply to message #465856] |
Wed, 18 April 2012 08:18 |
robbyke
Messages: 348 Registered: September 2010 Location: Belgium
Karma: 0
|
Recruit |
|
|
what am i doing wrong? cause my script wont work
Vector3 Size = Vector3(35.0f,35.0f,500.0f); //Size of the script zone.
Matrix3 Rotation(true);
Rotation.Rotate_Z(Commands->Get_Facing(o)); //Set the rotation of the script zone to the same as the beacon.
Vector3 Pos = Commands->Get_Position(o);
Pos.Z -= 100;//lowering postion of box to make sure to cover whole base
OBBoxClass Box(Pos,Size,Rotation); //Create the bounding box with the position of the beacon, and the size and rotation defined earlier.
GameObject* Zone = Create_Zone("Script_Zone_All",Box);
Attach_Script_Once(Zone,"",Team);
void KB_Base_Zone::Entered(GameObject *obj, GameObject *enterer)
{
int Team = Get_Int_Parameter("Team");
if (Is_Soldier(enterer))
{
StringClass Msg;
if(Team == Commands->Get_Player_Type(enterer))
{
Commands->Set_Is_Visible(obj,false);
Attach_Script_Once(enterer,"KB_Friendly_Zone_Generated","");
Msg.Format("CMSGP %d 0,255,0 You've moved in range of your base, enemy defences will ignore you from here!",Get_Player_ID(obj));
Console_Input(Msg);
}
else
{
Attach_Script_Once(enterer,"KB_Enemy_Zone_Generated","");
Msg.Format("CMSGP %d 255,0,0 You've moved in range of enemy base you can't build active defenses here!",Get_Player_ID(obj));
Console_Input(Msg);
}
}
if (Is_Vehicle(enterer) && Team == Commands->Get_Player_Type(enterer))
{
Set_Vehicle_Is_Visible(obj,false);
}
}
void KB_Base_Zone::Exited(GameObject *obj, GameObject *exiter)
{
StringClass Msg;
if (Is_Soldier(exiter) && Is_Script_Attached(exiter,"KB_Friendly_Zone_Generated"))
{
if(Is_Script_Attached(exiter,"KB_GAP_Generated")||Is_Script_Attached(exiter,"KB_Char_Spy"))
{
Msg.Format("CMSGP %d 255,0,0 You've moved out of your base",Get_Player_ID(exiter));
Remove_Script(exiter,"KB_Friendly_Zone_Generated");
Console_Input(Msg);
}
else
{
Commands->Set_Is_Visible(exiter,true);
Msg.Format("CMSGP %d 255,0,0 You've moved out of your base, enemy defences will automatically attack you from here!",Get_Player_ID(exiter));
Console_Input(Msg);
Remove_Script(exiter,"KB_Friendly_Zone_Generated");
}
}
if (Is_Vehicle(exiter))
{
if(Is_Script_Attached(exiter,"KB_GAP_Generated")||Is_Script_Attached(exiter,"KB_GAP_Generator")){}
else{Set_Vehicle_Is_Visible(exiter,true);}
}
if (Is_Soldier(obj) && Is_Script_Attached(exiter,"KB_Enemy_Zone_Generated") )
{
Msg.Format("CMSGP %d 255,0,0 You've moved out of the enemy base",Get_Player_ID(exiter));
Console_Input(Msg);
Remove_Script(exiter,"KB_Enemy_Zone_Generated");
}
}
ScriptRegistrant<KB_Base_Zone> KB_Base_Zone_Reg("KB_Base_Zone","Team:int");
its supposed to make ppl invisible in their own base
and unable to build stuff in the enemies
but it does nothing at all not even the message does this mean i made a mistake with the zone somewhere?
Owner of kambot TT server
kambot.freeforums.org
|
|
|
Re: Question... [message #466340 is a reply to message #465856] |
Wed, 18 April 2012 12:56 |
|
Whitedragon
Messages: 832 Registered: February 2003 Location: California
Karma: 1
|
Colonel |
|
|
Look closely at that Attach_Script_Once. Also for what you're doing it seems like it would be easier to place the zone in leveledit and use the modified map file or record its dimensions and spawn it on level load. Don't see why you'd use the beacon thing for this.
Black-Cell.net
Network Administrator (2003 - )
DragonServ, Renegade's first IRC interface bot
Creator and lead coder (2002 - )
Dragonade, Renegade's first server side modification
Lead coder (2005 - )
[Updated on: Wed, 18 April 2012 12:58] Report message to a moderator
|
|
|
Re: Question... [message #466345 is a reply to message #465856] |
Wed, 18 April 2012 15:07 |
|
Omar007
Messages: 1711 Registered: December 2007 Location: Amsterdam
Karma: 0
|
General (1 Star) |
|
|
The only reason you'd want to do it with a beacon/flare is if it is something you'd deploy during mid-game. Something like a temporary stealth field generator or similar.
If this is not the case, do what WhiteDragon said, or look into the RA cloak thing script (can't remember the name :/ ), which cloaks within a certain range of the object having the script attached.
[Updated on: Wed, 18 April 2012 15:08] Report message to a moderator
|
|
|
Re: Question... [message #466347 is a reply to message #466340] |
Wed, 18 April 2012 17:55 |
robbyke
Messages: 348 Registered: September 2010 Location: Belgium
Karma: 0
|
Recruit |
|
|
Whitedragon wrote on Wed, 18 April 2012 21:56 | Look closely at that Attach_Script_Once. Also for what you're doing it seems like it would be easier to place the zone in leveledit and use the modified map file or record its dimensions and spawn it on level load. Don't see why you'd use the beacon thing for this.
|
oh wow how dumb
im not doing trough leveledit because this way i can adjust how the zone works and how big it is alot better.
and i know shit about leveledit and map making so i do everything trough scripting
Owner of kambot TT server
kambot.freeforums.org
[Updated on: Wed, 18 April 2012 18:00] Report message to a moderator
|
|
|
Re: Question... [message #466348 is a reply to message #466347] |
Wed, 18 April 2012 20:01 |
|
Whitedragon
Messages: 832 Registered: February 2003 Location: California
Karma: 1
|
Colonel |
|
|
robbyke wrote on Wed, 18 April 2012 17:55 | i do everything trough scripting
|
I also prefer doing stuff through scripts.
For what you want to do you should create the zone in the level loaded hook.
The code below will create a zone at the base center. For some maps, like Canyon and Glacier, you'll need more than one zone to properly cover the base.
Vector3 Get_Base_Center(int Team) {
Vector3 ReturnPos(0.0f,0.0f,0.0f);
BaseControllerClass *Base = BaseControllerClass::Find_Base(Team);
if (Base) {
int Num = 0;
for (Num = 0;Num < Base->BuildingList.Count();Num++) {
ReturnPos += Commands->Get_Position(Base->BuildingList[Num]);
}
if (Num) {
ReturnPos /= (float)Num;
}
}
return ReturnPos;
}
void LevelLoaded() {
Vector3 Size = Vector3(50.0f,50.0f,50.0f); //Should load the size per map from a config file.
Matrix3 Rotation(true);
Rotation.Rotate_Z(1.0f); //Should load a rotation per map from a config file.
OBBoxClass Box(Get_Base_Center(0),Size,Rotation); //Create the bounding box with the position of the Nod base, and the size and rotation defined earlier.
GameObject* Zone = Create_Zone("Script_Zone_All",Box);
//Attach whatever script you want to the zone now.
}
Black-Cell.net
Network Administrator (2003 - )
DragonServ, Renegade's first IRC interface bot
Creator and lead coder (2002 - )
Dragonade, Renegade's first server side modification
Lead coder (2005 - )
[Updated on: Wed, 18 April 2012 20:02] Report message to a moderator
|
|
|
Re: Question... [message #466390 is a reply to message #466348] |
Thu, 19 April 2012 15:31 |
robbyke
Messages: 348 Registered: September 2010 Location: Belgium
Karma: 0
|
Recruit |
|
|
hmm ive been doing it by creating a zone at each structure wich works pretty well for most maps
some maps do have some holes in it but nothings perfect
oh yea is there a way to find the amount of smart object of a team in a zone there is only one to count all objects of the team
Owner of kambot TT server
kambot.freeforums.org
|
|
|
Re: Question... [message #466392 is a reply to message #465856] |
Thu, 19 April 2012 17:44 |
|
Whitedragon
Messages: 832 Registered: February 2003 Location: California
Karma: 1
|
Colonel |
|
|
int Get_Object_Count_In_Zone(GameObject *obj,int Team) {
if (!obj || !Commands->Get_ID(obj)) {
return 0;
}
ScriptZoneGameObj *Zone = obj->As_ScriptZoneGameObj();
if (!Zone) {
return 0;
}
int Return = 0;
for (SLNode<SmartGameObj> *z = GameObjManager::SmartGameObjList.Head();z;z = z->Next()) {
if ((Get_Object_Type(z->Data()) == Team || Team == 2) && Zone->Inside_Me(z->Data())) {
Return++;
}
}
return Return;
}
int Get_Player_Count_In_Zone(GameObject *obj,int Team) {
if (!obj || !Commands->Get_ID(obj)) {
return 0;
}
ScriptZoneGameObj *Zone = obj->As_ScriptZoneGameObj();
if (!Zone) {
return 0;
}
int Return = 0;
for (SLNode<SoldierGameObj> *z = GameObjManager::StarGameObjList.Head();z;z = z->Next()) {
if ((Get_Object_Type(z->Data()) == Team || Team == 2) && Zone->Inside_Me(z->Data())) {
Return++;
}
}
return Return;
}
Black-Cell.net
Network Administrator (2003 - )
DragonServ, Renegade's first IRC interface bot
Creator and lead coder (2002 - )
Dragonade, Renegade's first server side modification
Lead coder (2005 - )
[Updated on: Thu, 19 April 2012 17:48] Report message to a moderator
|
|
|
Re: Question... [message #466396 is a reply to message #465856] |
Thu, 19 April 2012 18:53 |
robbyke
Messages: 348 Registered: September 2010 Location: Belgium
Karma: 0
|
Recruit |
|
|
whitedragon this line doesnt work
Rotation.Rotate_Z(Commands->Get_Facing(o)); //Set the rotation of the script zone to the same as the beacon.
i fixed it by doing this
Commands->Set_Facing(Zone,Commands->Get_Facing(obj));
if it should work tell me since from what ive tested it didnt
correction i didnt fix it
Owner of kambot TT server
kambot.freeforums.org
[Updated on: Thu, 19 April 2012 18:57] Report message to a moderator
|
|
|
Re: Question... [message #466400 is a reply to message #465856] |
Thu, 19 April 2012 21:15 |
|
Whitedragon
Messages: 832 Registered: February 2003 Location: California
Karma: 1
|
Colonel |
|
|
Set_Facing, Get_Facing, and Set_Position won't work on script zones since they aren't a PhysicalGameObj.
Anyway, how isn't the facing working? Can you not set the facing at all or is it just not facing the way you'd expect?
Black-Cell.net
Network Administrator (2003 - )
DragonServ, Renegade's first IRC interface bot
Creator and lead coder (2002 - )
Dragonade, Renegade's first server side modification
Lead coder (2005 - )
|
|
|
Re: Question... [message #466409 is a reply to message #465856] |
Fri, 20 April 2012 05:52 |
robbyke
Messages: 348 Registered: September 2010 Location: Belgium
Karma: 0
|
Recruit |
|
|
well ive checked the values of rotation.z and get_facing(obj) and they arent equal after those lines so i think somethings not working correct i just dont know what =(
Owner of kambot TT server
kambot.freeforums.org
|
|
|
|
Goto Forum:
Current Time: Sun Nov 03 14:15:25 MST 2024
Total time taken to generate the page: 0.01209 seconds
|