Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » Question...
Question... [message #465856] Tue, 10 April 2012 01:18 Go to next message
FeaR is currently offline  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 #465857 is a reply to message #465856] Tue, 10 April 2012 01:34 Go to previous messageGo to next message
TankClash is currently offline  TankClash
Messages: 456
Registered: June 2003
Location: Kingston, Ontario
Karma: 0
Commander
So if you make a "Script zone, is it possible to add a flare?"











Yes, more details coming for other sources...


http://img.photobucket.com/albums/v453/MrRoberto/smokejag.png

http://www.youtube.com/watch?v=TWG7-SkWpjU&feature=relmfu
Here's a compelling comment instead.
Re: Question... [message #465858 is a reply to message #465856] Tue, 10 April 2012 01:42 Go to previous messageGo to next message
FeaR is currently offline  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 #465871 is a reply to message #465858] Tue, 10 April 2012 07:05 Go to previous messageGo to next message
TankClash is currently offline  TankClash
Messages: 456
Registered: June 2003
Location: Kingston, Ontario
Karma: 0
Commander
You mean in game type of thing, it would need to be some kind of action script, or pre-set before the game is loaded (coded before play), it's possible if you make an object, take beacons for example, plausible.

http://img.photobucket.com/albums/v453/MrRoberto/smokejag.png

http://www.youtube.com/watch?v=TWG7-SkWpjU&feature=relmfu
Here's a compelling comment instead.

[Updated on: Tue, 10 April 2012 07:07]

Report message to a moderator

Re: Question... [message #465876 is a reply to message #465858] Tue, 10 April 2012 08:16 Go to previous messageGo to next message
robbyke is currently offline  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 #465912 is a reply to message #465856] Tue, 10 April 2012 16:56 Go to previous messageGo to next message
Ethenal is currently offline  Ethenal
Messages: 2532
Registered: January 2007
Location: US of A
Karma: 0
General (2 Stars)

You mean pick up a flare as a weapon? I'm pretty sure that would definitely require a client-side mod, but as far as throwing one... maybe you could use one of the mine presets? I'm thinking maybe that would be in tt.dll, not scripts.dll. But I could very well be wrong.

-TLS-DJ-EYE-K wrote on Mon, 18 March 2013 07:29

Instead of showing us that u aren't more inteligent than a Toast, maybe you should start becomming good in renegade Thumbs Up

Re: Question... [message #465915 is a reply to message #465856] Tue, 10 April 2012 19:41 Go to previous messageGo to next message
Whitedragon is currently offline  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 #465921 is a reply to message #465856] Wed, 11 April 2012 01:27 Go to previous messageGo to next message
FeaR is currently offline  FeaR
Messages: 87
Registered: January 2006
Location: Netherlands
Karma: 0
Recruit
Thnx Smile ill look into those options you all gave, those beacons would fit in nice for what im doing.
Re: Question... [message #465932 is a reply to message #465856] Wed, 11 April 2012 09:03 Go to previous messageGo to next message
FeaR is currently offline  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 #465941 is a reply to message #465856] Wed, 11 April 2012 13:40 Go to previous messageGo to next message
jlhill17 is currently offline  jlhill17
Messages: 45
Registered: September 2011
Karma: 0
Recruit
I've never done it myself, but I imagine you could do it by simply attaching a vehicle regen script to the beacon object as well as replace_when_repaired. Make sure the armor type of the beacon is a vehicle armor, and modify the health of the beacon so it doesn't start out at full health. Make the script replace the beacon with the custom script zone preset you made, then maybe use a zone_resize script to make it the size you want.

There may be an easier way to do this, but this is my best idea.
Re: Question... [message #465948 is a reply to message #465856] Wed, 11 April 2012 15:15 Go to previous messageGo to next message
Whitedragon is currently offline  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 #466008 is a reply to message #465948] Thu, 12 April 2012 13:40 Go to previous messageGo to next message
FeaR is currently offline  FeaR
Messages: 87
Registered: January 2006
Location: Netherlands
Karma: 0
Recruit
thnx Very Happy


Whitedragon wrote on Wed, 11 April 2012 15: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.
}


Re: Question... [message #466318 is a reply to message #465948] Wed, 18 April 2012 02:31 Go to previous messageGo to next message
robbyke is currently offline  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 Go to previous messageGo to next message
Whitedragon is currently offline  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 Go to previous messageGo to next message
robbyke is currently offline  robbyke
Messages: 348
Registered: September 2010
Location: Belgium
Karma: 0
Recruit
what am i doing wrong? cause my script wont work Sad



					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 Go to previous messageGo to next message
Whitedragon is currently offline  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 Go to previous messageGo to next message
Omar007 is currently offline  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.


http://tiberiumredux.omarpakker.nl/Old Unused Parts/Plaatjes/PromoteBanner_Hades_small.jpg

[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 Go to previous messageGo to next message
robbyke is currently offline  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 Sad

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 Go to previous messageGo to next message
Whitedragon is currently offline  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 Go to previous messageGo to next message
robbyke is currently offline  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 Go to previous messageGo to next message
Whitedragon is currently offline  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 Go to previous messageGo to next message
robbyke is currently offline  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 Go to previous messageGo to next message
Whitedragon is currently offline  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 Go to previous messageGo to next message
robbyke is currently offline  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
Re: Question... [message #466410 is a reply to message #465856] Fri, 20 April 2012 06:14 Go to previous messageGo to previous message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
Isn't facing the Y axis, not the Z axis? Also I'm not sure they are supposed to be equal since the rotational matrix takes into account more than just the generic 'facing' of the object.

http://steamsignature.com/card/1/76561197975867233.png
Previous Topic: scripts when changing character
Next Topic: C&C Hourglass Amsterdam's Red Light District Progress
Goto Forum:
  


Current Time: Mon Jul 15 19:54:54 MST 2024

Total time taken to generate the page: 0.01694 seconds