Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Tiberian Technologies / Blackhand Studios » Tiberian Technologies Forum » Question regarding reviving buildings
Question regarding reviving buildings [message #455191] Mon, 19 September 2011 09:24 Go to next message
iRANian is currently offline  iRANian
Messages: 4308
Registered: April 2011
Karma: 0
General (4 Stars)
How do you revive buildings? I've tried using

		int Team;
	for( Team = 0; Team < 2; Team++)
	{
		Console_Input("msg looping"); // DEBUG CRAP
		Restore_Building(Find_Power_Plant(Team));
		Restore_Building(Find_Construction_Yard(Team));
		Restore_Building(Find_Refinery(Team));
		Console_Output("%s\n", Get_Translated_Preset_Name(Find_Refinery(Team)));
		Restore_Building(Find_Repair_Bay(Team));
		Restore_Building(Find_Soldier_Factory(Team));
		Restore_Building(Find_Vehicle_Factory(Team));
		Restore_Building(Find_Com_Center(Team));
	}


But that doesn't seem to work. I've tried both teams, the output from Get_Translated_Preset_Name() is fine.


Long time and well respected Renegade community member, programmer, modder and tester.

Scripts 4.0 private beta tester since May 2011.

My Renegade server plugins releases
Re: Question regarding reviving buildings [message #455193 is a reply to message #455191] Mon, 19 September 2011 09:33 Go to previous messageGo to next message
Omar007 is currently offline  Omar007
Messages: 1711
Registered: December 2007
Location: Amsterdam
Karma: 0
General (1 Star)
IDK what your 'Restore_Building' does but this is what it'd need to rebuild buildings (on 3.4.4 that is).

GameObject *o = As_BuildingGameObj(obj); //obj is your input GameObject
if (!o)
{
	return;
}
char *c = (char *)o;
c += 0x778;
bool *x = (bool *)c;
*x = false;

BaseControllerClass *b = BaseControllerClass::Find_Base(Get_Object_Type(o));
if (b && !Is_Building_Dead(o)) //Just to be sure it's revived
{
	if (Is_SoldierFactory(o))
	{
		b->CanGenerateSoldiers = true;
	}
	else if (Is_WarFactory(o) || Is_Airstrip(o))
	{
		b->CanGenerateVehicles = true;
	}
	else if(Is_PowerPlant(o))
	{
		b->IsPowered = true; //Ofcource you can have some feedback messages around this code (ie "Nod base power restored")
	}
	Set_Object_Dirty_Bit_All(b, DB_RARE, true);

	float max = Commands->Get_Max_Health(o);
	Commands->Set_Health(o, max);
}


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

[Updated on: Mon, 19 September 2011 09:39]

Report message to a moderator

Re: Question regarding reviving buildings [message #455195 is a reply to message #455191] Mon, 19 September 2011 10:11 Go to previous messageGo to next message
iRANian is currently offline  iRANian
Messages: 4308
Registered: April 2011
Karma: 0
General (4 Stars)
I had to set the health after reviving the building, works fine now. Thanks! This is what I used as a quick test:

          Restore_Building(Find_Refinery(Team));
		max = Commands->Get_Max_Health(Find_Refinery(Team));
		Commands->Set_Health(Find_Refinery(Team), max);


edit: One thing I've noticed is that your client thinks that the building is dead (e.g. shows the dead building model) until you shoot it with a pistol or anything else.


Long time and well respected Renegade community member, programmer, modder and tester.

Scripts 4.0 private beta tester since May 2011.

My Renegade server plugins releases

[Updated on: Mon, 19 September 2011 10:22]

Report message to a moderator

Re: Question regarding reviving buildings [message #455198 is a reply to message #455195] Mon, 19 September 2011 10:27 Go to previous messageGo to next message
Omar007 is currently offline  Omar007
Messages: 1711
Registered: December 2007
Location: Amsterdam
Karma: 0
General (1 Star)
iRANian wrote on Mon, 19 September 2011 19:11

edit: One thing I've noticed is that your client thinks that the building is dead (e.g. shows the dead building model) until you shoot it with a pistol or anything else.

Hmm if I recall correctly this part of the above code
Set_Object_Dirty_Bit_All(b, DB_RARE, true);

Should update the clients :S


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

[Updated on: Mon, 19 September 2011 10:27]

Report message to a moderator

Re: Question regarding reviving buildings [message #455200 is a reply to message #455191] Mon, 19 September 2011 10:36 Go to previous messageGo to next message
iRANian is currently offline  iRANian
Messages: 4308
Registered: April 2011
Karma: 0
General (4 Stars)
Restore_Building() uses:

base->Set_Object_Dirty_Bit(NetworkObjectClass::BIT_RARE, true);


So I don't know why it acts so weird.


Long time and well respected Renegade community member, programmer, modder and tester.

Scripts 4.0 private beta tester since May 2011.

My Renegade server plugins releases
Re: Question regarding reviving buildings [message #455205 is a reply to message #455200] Mon, 19 September 2011 11:14 Go to previous messageGo to next message
Caveman is currently offline  Caveman
Messages: 2476
Registered: July 2005
Location: Wales, UK
Karma: 0
General (2 Stars)

Zunnie would know he had a server where you could revive buildings.

CarrierII wrote

BLUEHTHEN YOU AR NOT JUST A BIG CHEATAS AND YOU THE BIG HEAD JUST YOU USE FLY H4X FUCK YOU BIG CHEATAS YOUR CHEATZ IS BAD YOU WANT I WRAUGHT THIS YOUR CHEATZ IS BAD HEY IS 1 YEAR YOUR PROMESS A FLY HAX IN MULTIPLAYER AND IS DONT JUST TROOPRM02 I TELL IT ALL WHO REPLYER IN THIS FORUM YOU CHEATZ

Please don't make me type something like that again, not using puntuation is annoying.


http://r9.fodey.com/2158/bc450f3ca15045e9bdd7651fa49f3a0a.0.gif
Re: Question regarding reviving buildings [message #466468 is a reply to message #455191] Sun, 22 April 2012 10:53 Go to previous message
jonwil is currently offline  jonwil
Messages: 3557
Registered: February 2003
Karma: 0
General (3 Stars)

Given that any fix we came up with would (by necessity) be a hack, given that any such hack would not solve most of the issues with trying to bring a building back to life, given that this would only be being done for the benefit of 1 or 2 people's special case mods and given that any fix we make wouldn't solve the problem for 3.4.4 players, we have decided not to add any code at all to support bringing buildings back to life.


Jonathan Wilson aka Jonwil
Creator and Lead Coder of the Custom scripts.dll
Renegade Engine Guru
Creator and Lead Coder of TT.DLL
Official member of Tiberian Technologies
Previous Topic: ChatHistory=C_Key doesnt work anymore
Next Topic: "Unit ready" spam sometimes after joining a 4.0 server
Goto Forum:
  


Current Time: Mon Nov 04 10:19:42 MST 2024

Total time taken to generate the page: 0.01076 seconds