Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » Buying Back Dead Buildings
Buying Back Dead Buildings [message #315170] Sat, 02 February 2008 18:50 Go to next message
_SSnipe_ is currently offline  _SSnipe_
Messages: 4121
Registered: May 2007
Location: Riverside Southern Califo...
Karma: 0
General (4 Stars)
Since i dont know anything about c++ and im doing my friend a favor since he dont have much time to do this himself =/ i want to know if anyone has a

buy back a building script that i can have? and idk how but ill return the favor back any way i could...please?
Re: Buying Back Dead Buildings [message #315194 is a reply to message #315170] Sat, 02 February 2008 22:23 Go to previous messageGo to next message
Veyrdite is currently offline  Veyrdite
Messages: 1471
Registered: August 2006
Location: Australia, Sydney
Karma: 0
General (1 Star)
You'd have to server-side some customs to create a new building controller.
Or learn LUA.


WOL: Veyrdite Previously: Dthdealer ( a long time ago )

[Updated on: Sat, 02 February 2008 22:23]

Report message to a moderator

Re: Buying Back Dead Buildings [message #315201 is a reply to message #315170] Sat, 02 February 2008 23:35 Go to previous messageGo to next message
_SSnipe_ is currently offline  _SSnipe_
Messages: 4121
Registered: May 2007
Location: Riverside Southern Califo...
Karma: 0
General (4 Stars)
well its for a freind who has a server and idk hwo to use this or have the time to learn how to make one ill take me months and months im jsut asking if someome has one there willing to let me have
Re: Buying Back Dead Buildings [message #315207 is a reply to message #315170] Sun, 03 February 2008 02:42 Go to previous messageGo to next message
hatstand
Messages: 21
Registered: January 2008
Location: Australia
Karma: 0
Recruit

shouldnt be *that* hard to do.... just grab the status of the building, wrap that into an if statement, have another if statement related to the cost of the building, then crate a new controller... the wf/airstrip/refineries might be a bit harder to do though, what with the zones, etc.....

http://www.xxlimg.com/images/n97dowecj7wfz1kx6q48.png
Re: Buying Back Dead Buildings [message #315214 is a reply to message #315207] Sun, 03 February 2008 03:45 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
hatstand wrote on Sun, 03 February 2008 04:42

shouldnt be *that* hard to do.... just grab the status of the building, wrap that into an if statement, have another if statement related to the cost of the building, then crate a new controller... the wf/airstrip/refineries might be a bit harder to do though, what with the zones, etc.....


Building controllers must be created on the start of the map, you cannot simply create a new one if one is dead.
You also can't really create a "spare" one either...
You have to actually bring it back from the dead.
V00d00 managed to do this, however he said that when you join the map, the client is told of the building is dead or not, when it is set to dead then the only way a client can be told that the controller is alive again is if he exits the map then rejoins for the purchase terminals to work again.
Not really a major problem for something like an AGT (although still an issue), but it's a bit of a problem for other buildings.

The server that Zunnie and Iwar created that MP-Gaming is running now makes use of this in it's ultra aow server. I may actually have a copy of the source code for it somewhere but I didn't write it and it isn't really mine to distribute.
TBH it's a totally crappy way of doing it imo, I mean honestly.. Leave and rejoin?

There are other ways of achieving the same effect, but in the strictest sense, no one has really successfully managed to bring a building back from the dead server side without the need for clients to exit then rejoin the server.

If I was going to attempt this, I would look into doing it a little more sneaky, I would perhaps try to set the health of all the buildings to 2001, then when the health of the building reaches 1, I would set it's skin type to Blamo, remove the power from the building and either move/destroy or disable somehow the purchase terminals. If it was a weapons factory then I would destroy any vehichle created immediately and refund the price to the purchaser, and apply that same type of method to the other buildings. Essentially rendering them dead (although on the PT I guess they would still show up).
Then if I wanted to bring it back to life (although really it never died) I would set it's health to 2001 again and change it's skin type back to normal.
You would also have to allow for win conditions too (i.e if all buildings health where at 1 for a particular team, then I would destroy that teams controllers).
That still isn't preferable, and just because that's the way I would do it, it doesn't mean that's the best way by a very long shot. There must be a way to do it properly, but it's deffinately out of my reach. Perhaps Silent_Kane might one day shed some light on it, I was told by v00d00 (I think) some time ago that he had managed to do it, but I never saw this for myself.



Re: Buying Back Dead Buildings [message #315216 is a reply to message #315170] Sun, 03 February 2008 03:46 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)

And I'm not sure how you'd change the building aggregates from the destroyed model to the healthy model...

-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: Buying Back Dead Buildings [message #315218 is a reply to message #315170] Sun, 03 February 2008 03:56 Go to previous messageGo to next message
mrãçķz is currently offline  mrãçķz
Messages: 3069
Registered: August 2007
Karma: 0
General (3 Stars)
Permabanned for trying and failing DDoS
Kamuix_Rebuild_Structure_Zone
Re: Buying Back Dead Buildings [message #315219 is a reply to message #315218] Sun, 03 February 2008 04:11 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
MadRockz wrote on Sun, 03 February 2008 05:56

Kamuix_Rebuild_Structure_Zone


That script will create a preset, the buildings are not presets.
Commands->Create_Object(preset,spawn_position);


Where the preset variable is defined as:
preset = Get_Parameter("Preset");




Re: Buying Back Dead Buildings [message #315256 is a reply to message #315170] Sun, 03 February 2008 11:58 Go to previous messageGo to next message
_SSnipe_ is currently offline  _SSnipe_
Messages: 4121
Registered: May 2007
Location: Riverside Southern Califo...
Karma: 0
General (4 Stars)
hmm ill send him this link and ask him if this helps
Re: Buying Back Dead Buildings [message #315275 is a reply to message #315170] Sun, 03 February 2008 15:00 Go to previous messageGo to next message
Yrr is currently offline  Yrr
Messages: 556
Registered: October 2006
Location: Germany
Karma: 0
Colonel

Get Resurrection, enable revivable buildings in configuration and attach script RR_ReviveBuilding to the building to revive it.

Re: Buying Back Dead Buildings [message #315279 is a reply to message #315275] Sun, 03 February 2008 15:16 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
Yrr wrote on Sun, 03 February 2008 17:00

Get Resurrection, enable revivable buildings in configuration and attach script RR_ReviveBuilding to the building to revive it.


Please can you explain how that works in depth? Did you actually manage find the right calls and update the client or have you done it some other way?
Please can you explain it with detail?



Re: Buying Back Dead Buildings [message #315282 is a reply to message #315170] Sun, 03 February 2008 15:35 Go to previous messageGo to next message
mrãçķz is currently offline  mrãçķz
Messages: 3069
Registered: August 2007
Karma: 0
General (3 Stars)
Permabanned for trying and failing DDoS
Kamuix_Revive_Structure
Re: Buying Back Dead Buildings [message #315287 is a reply to message #315282] Sun, 03 February 2008 16:29 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
MadRockz wrote on Sun, 03 February 2008 17:35

Kamuix_Revive_Structure


That script merely sets the health to 500. OK the building is back to life, but it wouldn't set the dependancies back again. By that I mean if the HON died then you set it's health back to 500, it would technically be alive, but you would not be able to buy advanced infantry (even leaving and rejoining).

Here..
I wrote a simple chat hook to do just that actually, you can see for yourself this way.

class idChatCommand : public ChatCommandClass {
	void Triggered(int ID,const TokenClass &Text,int ChatType) {
		GameObject *obj = Get_GameObj(ID);
         int BuildingID = Commands->Get_ID(Find_Soldier_Factory(0));
		 		GameObject *thebuilding = Commands->Find_Object(BuildingID);
				char mad[255];
					Console_Input(mad);
					sprintf(mad,"msg Setting Hand Of Nod health to 100");
					Console_Input(mad);

		Commands->Set_Health(thebuilding,100);

	}
};
ChatCommandRegistrant<idChatCommand> idChatCommandReg("!id",CHATTYPE_TEAM,0,GAMEMODE_AOW);


That script will set the health of the Hand Of Nod to 100, regardless of whether it is dead or not.. Try it out. It will set the health fine.. But try and buy and advanced character from the PT.
If it was really as simple as setting the health, I would of done it myself Razz



[Updated on: Sun, 03 February 2008 16:31]

Report message to a moderator

Re: Buying Back Dead Buildings [message #315291 is a reply to message #315279] Sun, 03 February 2008 16:40 Go to previous messageGo to next message
Yrr is currently offline  Yrr
Messages: 556
Registered: October 2006
Location: Germany
Karma: 0
Colonel

reborn wrote on Sun, 03 February 2008 23:16

Yrr wrote on Sun, 03 February 2008 17:00

Get Resurrection, enable revivable buildings in configuration and attach script RR_ReviveBuilding to the building to revive it.


Please can you explain how that works in depth? Did you actually manage find the right calls and update the client or have you done it some other way?
Please can you explain it with detail?


Since a real revive for normal Renegade users is impossible, RR does it like that:

On building destruction, it sends the following information to non-RR clients instead of sending the destruction:
- set health to 1hp
- turn power off

So non-RR clients can still target the building and it is not darkened, but from inside it looks like destroyed ans there is no health bar.

RR-clients have a client-side fix to allow resurrectable buildings so they see buildings destroyed as usual.

Once RR revives a building, it sets health to 50%, enables power, reinitializes it, re-attaches preset scripts and for AGT and Obelisk, it re-initializes their turrets.

Took me some days to make all that work correctly.


It can be used easily soon, since I'm currently a plugin system for RR, and there you only have to use building.revive();


Re: Buying Back Dead Buildings [message #315297 is a reply to message #315291] Sun, 03 February 2008 17:32 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
Yrr wrote on Sun, 03 February 2008 18:40

reborn wrote on Sun, 03 February 2008 23:16

Yrr wrote on Sun, 03 February 2008 17:00

Get Resurrection, enable revivable buildings in configuration and attach script RR_ReviveBuilding to the building to revive it.


Please can you explain how that works in depth? Did you actually manage find the right calls and update the client or have you done it some other way?
Please can you explain it with detail?


Since a real revive for normal Renegade users is impossible, RR does it like that:

On building destruction, it sends the following information to non-RR clients instead of sending the destruction:
- set health to 1hp
- turn power off

So non-RR clients can still target the building and it is not darkened, but from inside it looks like destroyed ans there is no health bar.

RR-clients have a client-side fix to allow resurrectable buildings so they see buildings destroyed as usual.

Once RR revives a building, it sets health to 50%, enables power, reinitializes it, re-attaches preset scripts and for AGT and Obelisk, it re-initializes their turrets.

Took me some days to make all that work correctly.


It can be used easily soon, since I'm currently a plugin system for RR, and there you only have to use building.revive();



That's pretty cool. But how do you make the Purchase terminal appear "disabled" for the non-rr clients when a building is supposed to be dead?
Also, how do you make the clients see the prices doubled for when the power plant is supposed to be dead, but really it's just had it's health set to 1?

v00d00 also said it was impossible to make clients update the purchase terminal without rejoining the server, however, I also heard that Silent Kane manged it server-side. Perhaps it was a Chinese whisper :-/



Re: Buying Back Dead Buildings [message #315302 is a reply to message #315297] Sun, 03 February 2008 18:04 Go to previous messageGo to next message
Yrr is currently offline  Yrr
Messages: 556
Registered: October 2006
Location: Germany
Karma: 0
Colonel

reborn wrote on Mon, 04 February 2008 01:32

Yrr wrote on Sun, 03 February 2008 18:40

reborn wrote on Sun, 03 February 2008 23:16

Yrr wrote on Sun, 03 February 2008 17:00

Get Resurrection, enable revivable buildings in configuration and attach script RR_ReviveBuilding to the building to revive it.


Please can you explain how that works in depth? Did you actually manage find the right calls and update the client or have you done it some other way?
Please can you explain it with detail?


Since a real revive for normal Renegade users is impossible, RR does it like that:

On building destruction, it sends the following information to non-RR clients instead of sending the destruction:
- set health to 1hp
- turn power off

So non-RR clients can still target the building and it is not darkened, but from inside it looks like destroyed ans there is no health bar.

RR-clients have a client-side fix to allow resurrectable buildings so they see buildings destroyed as usual.

Once RR revives a building, it sets health to 50%, enables power, reinitializes it, re-attaches preset scripts and for AGT and Obelisk, it re-initializes their turrets.

Took me some days to make all that work correctly.


It can be used easily soon, since I'm currently a plugin system for RR, and there you only have to use building.revive();



That's pretty cool. But how do you make the Purchase terminal appear "disabled" for the non-rr clients when a building is supposed to be dead?
Also, how do you make the clients see the prices doubled for when the power plant is supposed to be dead, but really it's just had it's health set to 1?

v00d00 also said it was impossible to make clients update the purchase terminal without rejoining the server, however, I also heard that Silent Kane manged it server-side. Perhaps it was a Chinese whisper :-/


- The PP multiplier is simple since disabling the PP's power has the same effect.
- The terminals are not disabled as usual. Non-RR clients can still enter the soldier and the vehicle purchase menu. But all soldiers and vehicles in these windows are disabled. That can be set server-side even without destroying any building.

Since the buildings are never destroyed for non-RR clients, there is no problem with joining or having to rejoin.


Re: Buying Back Dead Buildings [message #315315 is a reply to message #315170] Sun, 03 February 2008 20:17 Go to previous messageGo to next message
_SSnipe_ is currently offline  _SSnipe_
Messages: 4121
Registered: May 2007
Location: Riverside Southern Califo...
Karma: 0
General (4 Stars)
wow some interesting stuff
Re: Buying Back Dead Buildings [message #315349 is a reply to message #315302] Mon, 04 February 2008 03:24 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
Yrr wrote on Sun, 03 February 2008 20:04

reborn wrote on Mon, 04 February 2008 01:32

Yrr wrote on Sun, 03 February 2008 18:40

reborn wrote on Sun, 03 February 2008 23:16

Yrr wrote on Sun, 03 February 2008 17:00

Get Resurrection, enable revivable buildings in configuration and attach script RR_ReviveBuilding to the building to revive it.


Please can you explain how that works in depth? Did you actually manage find the right calls and update the client or have you done it some other way?
Please can you explain it with detail?


Since a real revive for normal Renegade users is impossible, RR does it like that:

On building destruction, it sends the following information to non-RR clients instead of sending the destruction:
- set health to 1hp
- turn power off

So non-RR clients can still target the building and it is not darkened, but from inside it looks like destroyed ans there is no health bar.

RR-clients have a client-side fix to allow resurrectable buildings so they see buildings destroyed as usual.

Once RR revives a building, it sets health to 50%, enables power, reinitializes it, re-attaches preset scripts and for AGT and Obelisk, it re-initializes their turrets.

Took me some days to make all that work correctly.


It can be used easily soon, since I'm currently a plugin system for RR, and there you only have to use building.revive();



That's pretty cool. But how do you make the Purchase terminal appear "disabled" for the non-rr clients when a building is supposed to be dead?
Also, how do you make the clients see the prices doubled for when the power plant is supposed to be dead, but really it's just had it's health set to 1?

v00d00 also said it was impossible to make clients update the purchase terminal without rejoining the server, however, I also heard that Silent Kane manged it server-side. Perhaps it was a Chinese whisper :-/


- The PP multiplier is simple since disabling the PP's power has the same effect.
- The terminals are not disabled as usual. Non-RR clients can still enter the soldier and the vehicle purchase menu. But all soldiers and vehicles in these windows are disabled. That can be set server-side even without destroying any building.

Since the buildings are never destroyed for non-RR clients, there is no problem with joining or having to rejoin.



Ah OK, I didn't realise turning the power off for the PP had that effect, I never noticed before. Thankyou.
It would be nice to actually show the purchase terminal as destroyed, but I guess that's as close as you're going to get it.

Using the same method it should be possible to replicate this in the renegade API for non-rr server owners. I might give it a go.



Re: Buying Back Dead Buildings [message #315392 is a reply to message #315349] Mon, 04 February 2008 08:24 Go to previous messageGo to next message
_SSnipe_ is currently offline  _SSnipe_
Messages: 4121
Registered: May 2007
Location: Riverside Southern Califo...
Karma: 0
General (4 Stars)
reborn wrote on Mon, 04 February 2008 02:24

Yrr wrote on Sun, 03 February 2008 20:04

reborn wrote on Mon, 04 February 2008 01:32

Yrr wrote on Sun, 03 February 2008 18:40

reborn wrote on Sun, 03 February 2008 23:16

Yrr wrote on Sun, 03 February 2008 17:00

Get Resurrection, enable revivable buildings in configuration and attach script RR_ReviveBuilding to the building to revive it.


Please can you explain how that works in depth? Did you actually manage find the right calls and update the client or have you done it some other way?
Please can you explain it with detail?


Since a real revive for normal Renegade users is impossible, RR does it like that:

On building destruction, it sends the following information to non-RR clients instead of sending the destruction:
- set health to 1hp
- turn power off

So non-RR clients can still target the building and it is not darkened, but from inside it looks like destroyed ans there is no health bar.

RR-clients have a client-side fix to allow resurrectable buildings so they see buildings destroyed as usual.

Once RR revives a building, it sets health to 50%, enables power, reinitializes it, re-attaches preset scripts and for AGT and Obelisk, it re-initializes their turrets.

Took me some days to make all that work correctly.


It can be used easily soon, since I'm currently a plugin system for RR, and there you only have to use building.revive();



That's pretty cool. But how do you make the Purchase terminal appear "disabled" for the non-rr clients when a building is supposed to be dead?
Also, how do you make the clients see the prices doubled for when the power plant is supposed to be dead, but really it's just had it's health set to 1?

v00d00 also said it was impossible to make clients update the purchase terminal without rejoining the server, however, I also heard that Silent Kane manged it server-side. Perhaps it was a Chinese whisper :-/


- The PP multiplier is simple since disabling the PP's power has the same effect.
- The terminals are not disabled as usual. Non-RR clients can still enter the soldier and the vehicle purchase menu. But all soldiers and vehicles in these windows are disabled. That can be set server-side even without destroying any building.

Since the buildings are never destroyed for non-RR clients, there is no problem with joining or having to rejoin.



Ah OK, I didn't realise turning the power off for the PP had that effect, I never noticed before. Thankyou.
It would be nice to actually show the purchase terminal as destroyed, but I guess that's as close as you're going to get it.

Using the same method it should be possible to replicate this in the renegade API for non-rr server owners. I might give it a go.

intersting ...info....
Re: Buying Back Dead Buildings [message #315408 is a reply to message #315170] Mon, 04 February 2008 10:49 Go to previous messageGo to next message
cnc95fan is currently offline  cnc95fan
Messages: 1260
Registered: July 2007
Karma: 0
General (1 Star)
I'm sure I was in the MP-Gaming server (reborn?) when I got a PM from the "host" buy back your dead power plant for 14,000....

Cabal8616 wrote on Sun, 27 April 2008 15:50

I say a personal fanning of the genitals would be awesome.


RA3 AUTOMATICLY SUCKS
www.battlefordune.co.uk
Re: Buying Back Dead Buildings [message #315410 is a reply to message #315408] Mon, 04 February 2008 10:57 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
cnc95fan wrote on Mon, 04 February 2008 12:49

I'm sure I was in the MP-Gaming server (reborn?) when I got a PM from the "host" buy back your dead power plant for 14,000....


As said in this thread, v00d00 found the calls and then made a function for Zunnie. Zunnie then made use of the call to bring the building back to life through a chat hook that cost x amount of cash. However v00d00 never found a way to update the clients purchase terminals after a dead building had been revived. Clients wishing to use the purchase terminal have to leave and rejoin. Or they can use switches which have a poke and buy script on it.
I had nothing to do with the development of that server mod BTW, I actually cannot stand the mod and think it's quite tacky TBH. I do still host it, but that's only because I always seem to get side-tracked with other things rather then make a replacement (although it is in development, I just never seem to make time for it).



Re: Buying Back Dead Buildings [message #315415 is a reply to message #315170] Mon, 04 February 2008 11:27 Go to previous messageGo to next message
Genesis2001
Messages: 1397
Registered: August 2006
Karma: 0
General (1 Star)
Tbh, reborn we think alike...

The idea you mentioned above is similar, if not exactly, how I was thinking about doing it...lol

~Zack
Re: Buying Back Dead Buildings [message #315441 is a reply to message #315415] Mon, 04 February 2008 14:20 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
Zack wrote on Mon, 04 February 2008 13:27

Tbh, reborn we think alike...

The idea you mentioned above is similar, if not exactly, how I was thinking about doing it...lol

~Zack


Well according to Yrr, that's how he decided to do it too for non-rr clients. Apparantly all three of us had a similar approach.



Re: Buying Back Dead Buildings [message #315533 is a reply to message #315170] Tue, 05 February 2008 03:30 Go to previous messageGo to next message
Sir Kane
Messages: 1701
Registered: March 2003
Location: Angerville
Karma: 0
General (1 Star)
The client just doesn't handle settings buildings back to alive. Should be a really simple fix, though.

Proud N9500 and proud N6270 user. Creator of the IEE libraries (original bhs.dll) and the RB series software.
http://n00bstories.com/image.fetch.php?id=1189992501http://www.n00bstories.com/image.fetch.php?id=1257492907
Re: Buying Back Dead Buildings [message #315605 is a reply to message #315533] Tue, 05 February 2008 12:38 Go to previous messageGo to previous message
CarrierII is currently offline  CarrierII
Messages: 3804
Registered: February 2006
Location: England
Karma: 0
General (3 Stars)

Sir Kane wrote on Tue, 05 February 2008 10:30

The client just doesn't handle settings buildings back to alive. Should be a really simple fix, though.


Going to make one and release it? Thought not. There's really little point you being here unless you release something.



Renguard is a wonderful initiative
Toggle Spoiler
Previous Topic: need file name
Next Topic: Predator Stealth?
Goto Forum:
  


Current Time: Tue Nov 05 06:14:59 MST 2024

Total time taken to generate the page: 0.01187 seconds