MapFix Plugin [message #492305] |
Thu, 27 April 2017 18:39 |
|
Gen_Blacky
Messages: 3250 Registered: September 2006
Karma: 1
|
General (3 Stars) |
|
|
I have not worked on this in a while, thought I would post it. It still needs some work before public use. I Hope this is helpful to someone else. This can be useful if your server has custom stock maps. You can apply the zone fixes Iran added to stock maps long ago.
Also if you want to use the pure stock maps you can still apply the zones fixes or replace the existing zones. You can disable/enable each zone individually. Specify the Zone, Add your own script to the zone and send parameters. Create a custom zone.
As well as adding my attempt to fix the missing nod refinery aggregate.
Readme Info
Toggle Spoiler
; Add Settings to main da.ini
; Enable the MapFix Dragonade Gamefeature
EnableMapFix=1
; Generate The Main mapfixes.ini settings by game over on every stock map that is shipped with TT.
; When CreateINI is enabled reading of mapfixes.ini is disabled.
; Generates a list of zones iran added to all the maps.
; Be Careful using this setting it will overwrite mapfixes.ini
CreateINI=0
; Gameover every map in the rotation if CreateINI is enabled.
EntireRotationGameover=1
; Don't allow deletion or changes to the ZoneList in memory.
StaticZoneList=1
; ///////////////////////////////////////////
; /// Per Map Settings
; //////////////////////////////////////////
; If for some reason you do not want use Irans Script Zone Fixes for this map we can destroy them.
; Destroy The Defined zones in mapfix.ini.
; DestroyZones=0
; Create Zones defined in mapfixes.ini for specified map
; CreateZones= 0
; Destroy The Defined laserwalls in mapfix.ini "Simple_Sydney_SandM_Wall".
; Only map that has the laser walls is complex , maps that come with tt.
; DisableLaserWalls=0
; Turn vehicle death zones into actual blockers.
; Not actually implemented yet.
; VehicleBlocker=0
; Enable the nod refinery mctfix for maps missing the aggregate 'mnref_ag_3_n'
; I have created 4 damage stages for the mct named mctfix1 mctfix2 mctfix3, mctfix4
; For this feature to work you would need to ship the mctfix files.
; Enable_MCTFix=0
; Either get the mctfix position from the map or read from the ini.
; MCT_ReadINI=1
; MCT_Position_X=-74.803
; MCT_Position_Y=-128.895
; MCT_Position_Z=1.486
; MCT_Facing=90.0
; Ingame Test Commands
; !createzones
; !destroyzones
; !showzones
; !hidezones
; !displayzones
; !destroymct
; !createmct
; !movemct <axis/facing/reset/save/read> <position>
; !fly
Add settings to da.ini
Toggle Spoiler
EnableMapFix=1
CreateINI=0
EntireRotationGameover=1
StaticZoneList=1
Example mapfix.ini
Toggle Spoiler
[C&C_Canyon.mix]
DestroyZones=0
DestroyLaserWalls=0
CreateZones=0
VehicleBlocker=0
Enable_MCTFix=0
MCT_ReadINI=1
MCT_Position_X=-74.803001
MCT_Position_Y=-128.895004
MCT_Position_Z=1.486000
MCT_Facing=90.000000
;Not Near a Building Dist 350.377533
ZoneEnabled1=1
Zone1=Script_Zone_Star
ZoneObjectID1=100009
ZoneScript1=Iran_Star_Kill_Zone
ZoneScriptParameter1=0.000000
ZonePosition1_X=-78.904999
ZonePosition1_Y=99.402000
ZonePosition1_Z=12.932000
ZoneSize1_X=4.690796
ZoneSize1_Y=5.242168
ZoneSize1_Z=0.500000
ZoneFacing1=0.000000
;Not Near a Building Dist 171.578232
ZoneEnabled2=1
Zone2=Script_Zone_Star
ZoneObjectID2=100011
ZoneScript2=Iran_Star_Kill_Zone
ZoneScriptParameter2=0.000000
ZonePosition2_X=-92.522476
ZonePosition2_Y=-114.839104
ZonePosition2_Z=15.428951
ZoneSize2_X=3.918198
ZoneSize2_Y=5.302055
ZoneSize2_Z=0.499998
ZoneFacing2=0.000000
;Not Near a Building Dist 1555.596802
ZoneEnabled3=1
Zone3=Script_Zone_All
ZoneObjectID3=100012
ZoneScript3=Iran_All_Kill_Zone
ZoneScriptParameter3=0.000000
ZonePosition3_X=-70.477882
ZonePosition3_Y=-34.132519
ZonePosition3_Z=16.326799
ZoneSize3_X=6.139868
ZoneSize3_Y=5.746578
ZoneSize3_Z=4.155959
ZoneFacing3=0.000000
;Not Near a Building Dist 4343.922852
ZoneEnabled4=1
Zone4=Script_Zone_All
ZoneObjectID4=100014
ZoneScript4=Iran_All_Kill_Zone
ZoneScriptParameter4=0.000000
ZonePosition4_X=-71.569542
ZonePosition4_Y=30.918436
ZonePosition4_Z=20.914524
ZoneSize4_X=2.920769
ZoneSize4_Y=7.226213
ZoneSize4_Z=3.547709
ZoneFacing4=0.000000
;Not Near a Building Dist 716.453186
ZoneEnabled5=1
Zone5=Script_Zone_Star
ZoneObjectID5=100015
ZoneScript5=Iran_Star_Kill_Zone
ZoneScriptParameter5=0.000000
ZonePosition5_X=-106.361008
ZonePosition5_Y=-99.273270
ZonePosition5_Z=17.272171
ZoneSize5_X=1.530464
ZoneSize5_Y=15.263409
ZoneSize5_Z=1.328834
ZoneFacing5=0.000000
;Not Near a Building Dist 358.784424
ZoneEnabled6=1
Zone6=Script_Zone_Star
ZoneObjectID6=100017
ZoneScript6=Iran_Star_Kill_Zone
ZoneScriptParameter6=0.000000
ZonePosition6_X=-98.226387
ZonePosition6_Y=-98.343063
ZonePosition6_Z=14.347655
ZoneSize6_X=1.000389
ZoneSize6_Y=14.166935
ZoneSize6_Z=1.141780
ZoneFacing6=0.000000
;Not Near a Building Dist 80.553398
ZoneEnabled7=1
Zone7=Script_Zone_Star
ZoneObjectID7=100019
ZoneScript7=Iran_Beaconing_Prevention_Zone
ZoneScriptParameter7=0.000000
ZonePosition7_X=13.091612
ZonePosition7_Y=-122.508400
ZonePosition7_Z=-6.509744
ZoneSize7_X=37.635979
ZoneSize7_Y=27.193150
ZoneSize7_Z=4.685836
ZoneFacing7=0.000000
;Near The GDI Tiberium Refinery Dist 3.626637
ZoneEnabled8=1
Zone8=Script_Zone_All
ZoneObjectID8=100021
ZoneScript8=Iran_Vehicle_Ground_Kill_Zone
ZoneScriptParameter8=0.000000
ZonePosition8_X=-59.240692
ZonePosition8_Y=101.867401
ZonePosition8_Z=2.016421
ZoneSize8_X=2.924685
ZoneSize8_Y=2.669300
ZoneSize8_Z=2.155551
ZoneFacing8=0.000000
;Near The GDI Tiberium Refinery Dist 1.306266
ZoneEnabled9=1
Zone9=Script_Zone_All
ZoneObjectID9=100023
ZoneScript9=Iran_Vehicle_Ground_Kill_Zone
ZoneScriptParameter9=0.000000
ZonePosition9_X=-49.908581
ZonePosition9_Y=121.562996
ZonePosition9_Z=0.868832
ZoneSize9_X=2.924685
ZoneSize9_Y=2.669300
ZoneSize9_Z=2.155551
ZoneFacing9=0.000000
;Near The Hand of Nod Dist 1.307199
ZoneEnabled10=1
Zone10=Script_Zone_All
ZoneObjectID10=100024
ZoneScript10=Iran_Vehicle_Ground_Kill_Zone
ZoneScriptParameter10=0.000000
ZonePosition10_X=-11.145071
ZonePosition10_Y=-57.059917
ZonePosition10_Z=5.981561
ZoneSize10_X=2.924685
ZoneSize10_Y=2.669300
ZoneSize10_Z=2.155551
ZoneFacing10=0.000000
;Near The Hand of Nod Dist 2.816014
ZoneEnabled11=1
Zone11=Script_Zone_All
ZoneObjectID11=100025
ZoneScript11=Iran_Vehicle_Ground_Kill_Zone
ZoneScriptParameter11=0.000000
ZonePosition11_X=-33.687183
ZonePosition11_Y=-56.333420
ZonePosition11_Z=2.011322
ZoneSize11_X=2.924685
ZoneSize11_Y=2.669300
ZoneSize11_Z=2.155551
ZoneFacing11=0.000000
;Near The Nod Tiberium Refinery Dist 2.294207
ZoneEnabled12=1
Zone12=Script_Zone_All
ZoneObjectID12=100026
ZoneScript12=Iran_Vehicle_Ground_Kill_Zone
ZoneScriptParameter12=0.000000
ZonePosition12_X=-65.362587
ZonePosition12_Y=-118.551346
ZonePosition12_Z=1.441849
ZoneSize12_X=2.894119
ZoneSize12_Y=2.644215
ZoneSize12_Z=1.743683
ZoneFacing12=0.000000
;Near The Nod Tiberium Refinery Dist 4.840147
ZoneEnabled13=1
Zone13=Script_Zone_All
ZoneObjectID13=100027
ZoneScript13=Iran_Vehicle_Ground_Kill_Zone
ZoneScriptParameter13=0.000000
ZonePosition13_X=-74.531708
ZonePosition13_Y=-137.493851
ZonePosition13_Z=2.010274
ZoneSize13_X=2.924685
ZoneSize13_Y=2.669300
ZoneSize13_Z=2.155551
ZoneFacing13=0.000000
;Not Near a Building Dist 870.504761
ZoneEnabled14=1
Zone14=Script_Zone_Star
ZoneObjectID14=100028
ZoneScript14=Iran_Star_Kill_Zone
ZoneScriptParameter14=0.000000
ZonePosition14_X=61.223892
ZonePosition14_Y=-125.947906
ZonePosition14_Z=6.180079
ZoneSize14_X=18.169924
ZoneSize14_Y=7.317970
ZoneSize14_Z=3.296914
ZoneFacing14=0.000000
;Not Near a Building Dist 648.881775
ZoneEnabled15=1
Zone15=Script_Zone_Star
ZoneObjectID15=100031
ZoneScript15=Iran_Star_Kill_Zone
ZoneScriptParameter15=0.000000
ZonePosition15_X=68.736290
ZonePosition15_Y=62.825275
ZonePosition15_Z=6.216810
ZoneSize15_X=18.185072
ZoneSize15_Y=5.976784
ZoneSize15_Z=3.799726
ZoneFacing15=0.000000
;Not Near a Building Dist 4021.570313
ZoneEnabled16=1
Zone16=Script_Zone_Star
ZoneObjectID16=100032
ZoneScript16=Iran_Star_Kill_Zone
ZoneScriptParameter16=0.000000
ZonePosition16_X=74.164871
ZonePosition16_Y=-26.605309
ZonePosition16_Z=7.049681
ZoneSize16_X=1.129448
ZoneSize16_Y=6.288007
ZoneSize16_Z=1.298234
ZoneFacing16=0.000000
;Near The Nod Airstrip Dist 2.883826
ZoneEnabled17=1
Zone17=Script_Zone_All
ZoneObjectID17=100034
ZoneScript17=Iran_Vehicle_Ground_Kill_Zone
ZoneScriptParameter17=0.000000
ZonePosition17_X=4.120920
ZonePosition17_Y=-117.859589
ZonePosition17_Z=1.462548
ZoneSize17_X=2.924747
ZoneSize17_Y=2.669350
ZoneSize17_Z=1.834388
ZoneFacing17=0.000000
;Near The Nod Tiberium Refinery Dist 0.574838
ZoneEnabled18=1
Zone18=Script_Zone_Star
ZoneObjectID18=100036
ZoneScript18=Iran_Star_Kill_Zone
ZoneScriptParameter18=0.000000
ZonePosition18_X=-63.340157
ZonePosition18_Y=-118.214645
ZonePosition18_Z=4.137299
ZoneSize18_X=1.060354
ZoneSize18_Y=3.331989
ZoneSize18_Z=1.079697
ZoneFacing18=0.000000
;Near The Nod Tiberium Refinery Dist 0.886095
ZoneEnabled19=1
Zone19=Script_Zone_Star
ZoneObjectID19=100037
ZoneScript19=Iran_Star_Kill_Zone
ZoneScriptParameter19=0.000000
ZonePosition19_X=-69.739655
ZonePosition19_Y=-136.252945
ZonePosition19_Z=6.652291
ZoneSize19_X=8.244457
ZoneSize19_Y=5.698776
ZoneSize19_Z=1.988887
ZoneFacing19=0.000000
;Near The GDI Tiberium Refinery Dist 2.519238
ZoneEnabled20=1
Zone20=Script_Zone_Star
ZoneObjectID20=100040
ZoneScript20=Iran_Star_Kill_Zone
ZoneScriptParameter20=0.000000
ZonePosition20_X=-55.292583
ZonePosition20_Y=104.256035
ZonePosition20_Z=6.924762
ZoneSize20_X=8.244457
ZoneSize20_Y=5.698776
ZoneSize20_Z=1.988887
ZoneFacing20=0.000000
;Near The GDI Tiberium Refinery Dist 0.517989
ZoneEnabled21=1
Zone21=Script_Zone_Star
ZoneObjectID21=100042
ZoneScript21=Iran_Star_Kill_Zone
ZoneScriptParameter21=0.000000
ZonePosition21_X=-48.008701
ZonePosition21_Y=122.066109
ZonePosition21_Z=4.121421
ZoneSize21_X=1.060354
ZoneSize21_Y=3.331989
ZoneSize21_Z=1.079697
ZoneFacing21=0.000000
|
|
|
|
Re: MapFix Plugin [message #492310 is a reply to message #492307] |
Thu, 27 April 2017 23:56 |
|
Gen_Blacky
Messages: 3250 Registered: September 2006
Karma: 1
|
General (3 Stars) |
|
|
iRANian wrote on Fri, 28 April 2017 00:12 | Can't you just get the MCT position based on Refinery position and rotation/facing?
I'll see about adding support for b2b prevention.
|
Yea but its not exact. Has an offset for some reason. If you check it out disable MCT_ReadINI and you will see what I mean.
[Updated on: Fri, 28 April 2017 00:03] Report message to a moderator
|
|
|
|
|
Re: MapFix Plugin [message #492314 is a reply to message #492305] |
Fri, 28 April 2017 05:41 |
|
If you want to find the exact position/facing of, say, the Nod Refinery MCT (that is, the physics object that counts as the MCT and will take the extra MCT damage when hit), do this:
#include "buildingaggregateclass.h"
#include "buildinggameobj.h"
#include "matrix3d.h"
//somewhere in your code
BuildingGameObj *obj = Find_Refinery(0);
BuildingAggregateClass *ba = obj->Find_MCT();
Matrix3D tm = ba->Get_Transform();
Vector3 position = tm.Get_Translation();
float rotation = RAD2DEG(tm.Get_Z_Rotation());
Change the first line of code as appropriate to find the MCT for different buildings.
The position/rotation values you just obtained can be passed to Commands->Set_Position and Commands->Set_Facing as appropriate.
The values you get here should match exactly to what you would see if you opened up the .lvl file in LevelEdit and double clicked on the MCT object.
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: MapFix Plugin [message #492337 is a reply to message #492314] |
Sun, 30 April 2017 12:47 |
|
Gen_Blacky
Messages: 3250 Registered: September 2006
Karma: 1
|
General (3 Stars) |
|
|
jonwil wrote on Fri, 28 April 2017 06:41 | If you want to find the exact position/facing of, say, the Nod Refinery MCT (that is, the physics object that counts as the MCT and will take the extra MCT damage when hit), do this:
#include "buildingaggregateclass.h"
#include "buildinggameobj.h"
#include "matrix3d.h"
//somewhere in your code
BuildingGameObj *obj = Find_Refinery(0);
BuildingAggregateClass *ba = obj->Find_MCT();
Matrix3D tm = ba->Get_Transform();
Vector3 position = tm.Get_Translation();
float rotation = RAD2DEG(tm.Get_Z_Rotation());
Change the first line of code as appropriate to find the MCT for different buildings.
The position/rotation values you just obtained can be passed to Commands->Set_Position and Commands->Set_Facing as appropriate.
The values you get here should match exactly to what you would see if you opened up the .lvl file in LevelEdit and double clicked on the MCT object.
|
Toggle Spoiler
void MapFix::Mct_Fix()
{
MCTOBJ = 0;
GameObject *obj = Find_Refinery(0);
BuildingAggregateClass *REFMCT = obj->As_BuildingGameObj()->Find_MCT();
Matrix3D tm = REFMCT->Get_Transform();
Vector3 position = tm.Get_Translation();
float rotation = RAD2DEG(tm.Get_Z_Rotation());
if (REFMCT) {
Debug(3, 2, "Create mnref_ag_3_n\n");
Vector3 Defualt(0.0f, 0.0f, 0.0f);
Vector3 Position;
bool ReadINI = DASettingsManager::Get_Bool(The_Game()->Get_Map_Name(), "MCT_ReadINI", false);
DASettingsManager::Get_Vector3(Position, The_Game()->Get_Map_Name(), "MCT_Position", Defualt);
float Facing = DASettingsManager::Get_Float(The_Game()->Get_Map_Name(), "MCT_Facing", 90.0f);
Vector3 MCTPos = position;
//Read from INI instead of getting position from MCT
if (ReadINI) {
MCTPos = Position;
}
else
Facing = rotation;
Console_Output("Position %f %f %f Rotation %f Facing %f\n", position.X, position.Y, position.Z, rotation, Facing);
PhysicalGameObj *c = Create_Object("Invisible_Object", MCTPos);
Commands->Set_Facing(c, Facing);
Commands->Set_Model(c, "mctfix");
Commands->Set_Is_Visible(c, true);
MCTOBJ = c;
MCTPOS = MCTPos;
obj->Add_Observer(new MCTObserverClass(c));
}
}
The Position I get from Find_MCT on canyon.
I cant get the facing it is always 0.
Position -74.823540 -128.861725 1.024454 Rotation 0.000000 Facing 0.000000
Do you know if this is something that could be fixed by editing the mctfix w3dfiles. The mct is centered 0.0.0 in the gmax file.
The correct position for canyon
MCT_Position_X=-74.803001
MCT_Position_Y=-128.895004
MCT_Position_Z=1.486000
MCT_Facing=90.000000
Correcting the facing and position in game.
[Updated on: Sun, 30 April 2017 12:51] Report message to a moderator
|
|
|