[SSGM 4.0 Plugin] Building Revival Console Commands v2.0 [message #482927] |
Fri, 02 August 2013 10:22 ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
iRANian
Messages: 4307 Registered: April 2011
Karma: 0
|
General (4 Stars) |
|
|
BuildingRevivalConsoleCommands SSGM 4.0 plugin v2.0
This plugin adds console commands for reviving buildings to the FDS. There are console commands for every building and two special console commands to revive a building by preset name and by object ID. Reviving buildings on maps with multiple buildings of the same type (e.g. two Obelisk) is supported too. Note there are two issues with this plugin, an inconvenient one requiring clients to rejoin the server and a potential issue on servers or maps running special scripts/code on buildings (e.g. custom repair scripts). These issues are explained in the following paragraphs.
If during building revival after the building is restored the Ref is alive and harvester is dead a new harvester will be requested. All console commands except ReviveBuildingByID will revive the first dead building found of a type. If there are two Obelisks on the map the first dead one will be revived when these commands are executed. ReviveBuildingByID will revive a building by its ID so you can use it to decide what building to revive if there are multiple structures with the same preset name.
The plugin handles the Obelisk and AGT weapons correctly now (in v1.0 they were bugged). After reviving the building any object create hooks are executed for the building. You need to make sure the code on the server supports this properly. For example code that assumes a building only gets the object create hook called for it only once per level load might act up.
The building revival code does a bit of hackery to make sure the right scripts are attached to the building when it is revived (and hopefully in the right state). This might break special scripts on buildings like the building repair scripts on buildings on C&C_Cairo and custom code attaching scripts to buildings, beware.
ON MAPS WITH SPECIAL REPAIR SCRIPTS ON BUILDINGS REVIVING A BUILDING WILL PROBABLY BREAK THE REPAIR SCRIPT. THIS HAPPENS ON C&C_Cairo FOR EXAMPLE.
After reviving a building I've noticed the following bugs appearing on clients:
1.) If the building is destroyed again no death announcement is played.
2.) If the building is a production facility clients can't build from that facility anymore
3.) If the building is a Communication Centre which controls radar, the radar will stay off-line
These bugs go away after the client restarts his game. They happen because the client doesn't sync the 'is destroyed' setting for a building with the server after building revival (on the server the building is no longer destroyed but on clients it's still destroyed). Hopefully TT will add the following client-side fix I wrote to Scripts 4.0 patch 2:
http://www.renegadeforums.com/index.php?t=msg&th=40362&start=0&rid=2 5967#msg_num_12
All revive console commands except ReviveBuildingByPreset and ReviveBuildingByID might not be able to revive a building type or they might REVIVE THE WRONG BUILDING TYPE on CUSTOM MAPS WITH REALLY NON-STANDARD BUILDING PRESET NAMES OR BUILDING TYPE SET ON BUILDING. If that's the case use ReviveBuildingByPreset or ReviveBuildingByID. I HAVEN'T SEEN THIS HAPPEN YET BUT IT IS A POSSIBILITY.
One way to get the object ID of a building is by opening the map in LevelEdit, checking the ID set on the building controller for that building.
The following console commands are added by this plugin:
REVIVEBUILDINGBYID <OBJECTID> - Revives a building by its object ID.
REVIVEBUILDINGBYPRESET <PRESET NAME> - Revives a building by its preset name.
REVIVEBAR - Revives the GDI Barracks.
REVIVEHON - Revives the Hand of Nod.
REVIVEGDIPP - Revives the GDI Power Plant.
REVIVENODPP - Revives the Nod Power Plant.
REVIVEGDICONYARD - Revives the GDI Construction Yard.
REVIVENODCONYARD - Revives the Nod Construction Yard.
REVIVEGDIREF - Revives the GDI Refinery.
REVIVENODREF - Revives the Nod Refinery.
REVIVEGDIREPBAY - Revives the GDI Repair Bay.
REVIVENODREPBAY - Revives the Nod Repair Bay.
REVIVEWF - Revives the GDI Weapons Factory.
REVIVEAIR - Revives the Nod Airstrip.
REVIVEGDICOMMCENTER - Revives the GDI Communications Center.
REVIVENODCOMMCENTER - Revives the Nod Communications Center.
REVIVEAGT - Revives the GDI Advanced Guard Tower.
REVIVEOB - Revives the Nod Obelisk.
REVIVENODSILO - Revives the Nod Tiberium Silo.
REVIVEGDISILO - Revives the GDI Tiberium Silo.
REVIVENODHELIPAD - Revives the Nod Helipad.
REVIVEGDIHELIPAD - Revives the GDI Helipad.
REVIVESHRINE - Revives the Shrine of Nod.
To install place 'BuildingRevivalConsoleCommands.dll' in the root FDS folder and add an entry for it in SSGM.ini under the [Plugins] section.
You can contact me by PM'ing me on renegadeforums.com under the name "iRANian" or on the usual IRC servers under the nick "Iran".
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: Sun, 04 May 2014 13:06] Report message to a moderator
|
|
|
|
|
|
Re: [SSGM 4.0 Plugin] Building Revival Console Commands v2.0 [message #491999 is a reply to message #482927] |
Mon, 13 February 2017 01:14 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
|
Here is a small update to the code.
Calls to Revive_Building are replaced with calls to Restore_Building (which is the correct engine call to use)
CommandREVIVEBAR and CommandREVIVEHON dont need to call Set_Can_Generate_Soldiers as SoldierFactoryGameObj::On_Revived does that for you.
CommandREVIVEGDIPP and CommandREVIVENODPP are fixed to use Find_Power_Plant.
CommandREVIVEGDICY and CommandREVIVENODCY dont need to call Is_Building_Dead as BuildingGameObj::On_Revived handles that all for you.
CommandREVIVENODSILO and CommandREVIVEGDISILO are fixed to not need the revived variable anymore.
CommandREVIVEAGT and CommandREVIVEOB are fixed to use Find_Base_Defense.
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
|
|
|
Re: [SSGM 4.0 Plugin] Building Revival Console Commands v2.0 [message #492000 is a reply to message #491999] |
Mon, 13 February 2017 10:01 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
dblaney1
Messages: 358 Registered: March 2014 Location: United States
Karma: 0
|
Commander |
|
|
jonwil wrote on Mon, 13 February 2017 01:14 | Here is a small update to the code.
Calls to Revive_Building are replaced with calls to Restore_Building (which is the correct engine call to use)
CommandREVIVEBAR and CommandREVIVEHON dont need to call Set_Can_Generate_Soldiers as SoldierFactoryGameObj::On_Revived does that for you.
CommandREVIVEGDIPP and CommandREVIVENODPP are fixed to use Find_Power_Plant.
CommandREVIVEGDICY and CommandREVIVENODCY dont need to call Is_Building_Dead as BuildingGameObj::On_Revived handles that all for you.
CommandREVIVENODSILO and CommandREVIVEGDISILO are fixed to not need the revived variable anymore.
CommandREVIVEAGT and CommandREVIVEOB are fixed to use Find_Base_Defense.
|
The revived variable was there so that it didn't play the revive sound twice if there were two silos. I actually meant to remove the can generate soldier stuff. Forgot to remove that line. The powerplant was going through all the buildings as there are several maps with multiple powerplants. Thats why it was coded that way. Same for the base defense thing. There are maps out there with multiple Obelisks and AGTs.
Here is a slightly updated version with some of the unnecessary stuff removed using the correct Restore_Building call.
[Updated on: Mon, 13 February 2017 10:17] Report message to a moderator
|
|
|
|
|
|
Re: [SSGM 4.0 Plugin] Building Revival Console Commands v2.0 [message #492016 is a reply to message #482927] |
Fri, 17 February 2017 18:49 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
![](http://renegadeforums.com/images/avatars/Viseroid.jpg) |
Gen_Blacky
Messages: 3250 Registered: September 2006
Karma: 1
|
General (3 Stars) |
|
|
Just add to an existing da project. No reason to make it a game feature.
Added chat command use and you can use your bot to setaccesslevel
Added NavelFactory AirFactory Still need to add sounds and stuff. Does anyone have all building announcements sounds in strings handy?
Created Building Revive functions to stop code duplication
I was experiencing a weird problem where if a refinery gameobejct was passed it would crash on Revive_Building because of some reference to ScriptableGameObj Get_Definition() it would crash on !obj->As_BuildingGameObj(). But it seems to have fixed itself and not sure what was happening.
https://youtu.be/Vn_LQ9fU9g8
![http://s18.postimage.org/jc6qbn4k9/bricks3.png](http://s18.postimage.org/jc6qbn4k9/bricks3.png)
[Updated on: Sun, 19 February 2017 21:13] Report message to a moderator
|
|
|
|
|
|
Re: [SSGM 4.0 Plugin] Building Revival Console Commands v2.0 [message #492030 is a reply to message #482927] |
Tue, 21 February 2017 23:28 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
![](http://renegadeforums.com/images/avatars/Viseroid.jpg) |
Gen_Blacky
Messages: 3250 Registered: September 2006
Karma: 1
|
General (3 Stars) |
|
|
Its a dup of Restore_Building with extra bits. I only use the function Revive_Building. We still want to set the building health. Turn the base power back on if it is a power plant. We want to apply damage to the building to force it to update. If you don't it will still look damaged until a player damage's the building.
Idk if their is a difference but Im still using 4.3 RC2 or what ever Revision 7103 is
// Restore building health
float max = Commands->Get_Max_Health(building);
Commands->Set_Health(building, max);
// Still do this to wake everything up.
// This is needed to update the state of a building from 'dead' to 'alive on the client
Commands->Apply_Damage(building, 1.0f, "Explosive", 0);
// If we're a Power Plant turn on base power
if (building->As_BuildingGameObj()->As_PowerPlantGameObj()) Power_Base(Team, true);
You want to do these 3 things still in addition to the scripts Restore_Building
![http://s18.postimage.org/jc6qbn4k9/bricks3.png](http://s18.postimage.org/jc6qbn4k9/bricks3.png)
[Updated on: Tue, 21 February 2017 23:38] Report message to a moderator
|
|
|
Re: [SSGM 4.0 Plugin] Building Revival Console Commands v2.0 [message #492031 is a reply to message #482927] |
Wed, 22 February 2017 03:15 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
|
I can tell you that in 4.3 (all versions) you just need to call Restore_Building or On_Revived or whatever. You don't need to make any of those other calls as On_Revived does it all (PowerPlantGameObj::On_Revived brings the power back online for all buildings btw)
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
|
|
|
Re: [SSGM 4.0 Plugin] Building Revival Console Commands v2.0 [message #492032 is a reply to message #482927] |
Wed, 22 February 2017 10:18 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
dblaney1
Messages: 358 Registered: March 2014 Location: United States
Karma: 0
|
Commander |
|
|
Make sure your restore building in engine_game reads as the following. It was changed between 4.1 and 4.2.
void SCRIPTS_API Restore_Building(GameObject* obj)
{
if (!obj) return;
BuildingGameObj *Building = obj->As_BuildingGameObj();
if (Building)
{
Building->On_Revived();
}
}
That should be the only thing you need for any version of 4.2 and newer. I believe that change was missed in the recent versions of DA for some odd reason. I had to update it on my end a while back.
You should also swap out all the Create_2D_WAV_Sound_Team with Create_2D_WAV_Sound_Team_Dialog so that it plays on the dialog volume instead of the sound effects volume setting in the plugin.
[Updated on: Wed, 22 February 2017 10:25] Report message to a moderator
|
|
|
|
Re: [SSGM 4.0 Plugin] Building Revival Console Commands v2.0 [message #492037 is a reply to message #492034] |
Wed, 22 February 2017 13:40 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
dblaney1
Messages: 358 Registered: March 2014 Location: United States
Karma: 0
|
Commander |
|
|
Gen_Blacky wrote on Wed, 22 February 2017 12:11 | Ah yea mine it out of date. Still doing it the old way Instead of calling On_Revived.
void SCRIPTS_API Restore_Building(GameObject* obj)
{
if (!obj) return;
BuildingGameObj* building = obj->As_BuildingGameObj();
if (!building || !building->Is_Destroyed())
return;
building->Set_Is_Destroyed(false);
BaseControllerClass* base = BaseControllerClass::Find_Base(Get_Object_Type(building));
if (base)
{
if (building->As_SoldierFactoryGameObj())
base->Set_Can_Generate_Soldiers(true);
if (building->As_VehicleFactoryGameObj())
base->Set_Can_Generate_Vehicles(true);
base->Set_Object_Dirty_Bit(NetworkObjectClass::BIT_RARE, true);
}
}
|
Post an updated one when you get a chance please. With the restore building fix and playing the sounds on the dialog channel.
|
|
|
Re: [SSGM 4.0 Plugin] Building Revival Console Commands v2.0 [message #492050 is a reply to message #482927] |
Fri, 24 February 2017 22:28 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
![](http://renegadeforums.com/images/avatars/Viseroid.jpg) |
Gen_Blacky
Messages: 3250 Registered: September 2006
Karma: 1
|
General (3 Stars) |
|
|
Added Helipad Repair Sounds
Added Repair Facility Repair Sounds
Do On_Revive if Scripts 4.2 RC1 (6983) and up
Play Create_2D_WAV_Sound_Team_Dialog if Scripts 4.3 RC2 (7455) and up
SSGM Log Message for Building Revived
Also these fds commands in DA.dll that already call On_Revive.
revivebuildingbyid <id> - Revives a building by object ID. Host only.
revivebuildingbyname <team> <name> - Revives all buildings whose translated or preset name matches the given wildcard. Host only.
revivebuildingbypreset <team> <preset name> - Revives all buildings with the given preset name. Host only.
revivebuildingbytype <team> <type> - Revives all buildings of the given type. Host only. (See BuildingConstants for types)
![http://s18.postimage.org/jc6qbn4k9/bricks3.png](http://s18.postimage.org/jc6qbn4k9/bricks3.png)
[Updated on: Sat, 25 February 2017 00:24] Report message to a moderator
|
|
|
|
|
|
|
|
|