Advertisement
Guest User

MTFunction.acs

a guest
Nov 5th, 2020
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 18.68 KB | None | 0 0
  1. #library "MTFunction"
  2. //#include "zcommon/gzdoom.acs"
  3. #include "MCom.acs"
  4.  
  5. //MP/Player constants
  6. #define PLAYER_TID_START 300
  7. //Aux
  8. #define AmmoType_HUD_ID 500
  9. //HUD Scale
  10. #define BIGFONT_HUDX 320
  11. #define BIGFONT_HUDY 640
  12.  
  13. int vehiclerotation;
  14. //Placeholder for the Pre-Morph health memory
  15. //So that morphing cannot be used for reseting the health
  16. //to spawn amount.
  17. int marineprevioushealth;
  18. int marinepreviousarmor;
  19. int vehicleprevioushealth;
  20. int vehiclepreviousarmor;
  21.  
  22. //PLAYER
  23. int player_velx = 0.0;
  24. int player_vely = 0.0;
  25. int player_velz = 0.0;
  26. //Player vertex height
  27. int player_vertex_B0;
  28. int player_vertex_B1;
  29. int player_vertex_A0;
  30. int player_vertex_A1;
  31.  
  32.  
  33. //Taunting.
  34. Script "cmd_taunt" (VOID) NET
  35. {
  36.  GiveInventory("cmd_taunt", 1);
  37. }
  38.  
  39. //Inbuilt search light
  40. script "MTACS_SearchLight" (void) NET
  41. {
  42.    
  43.     while(1)
  44.     {
  45.         //IF ON ITEM
  46.         if (CheckInventory("MT_Light_1") > 0)
  47.         {
  48.             GiveInventory("MT_SearchLight2",1);    
  49.         }
  50.         else
  51.         {
  52.             Terminate;
  53.         }
  54.        
  55.     //Adding more frames (6-7) to the light emitting bulletpuffs adds a way too
  56.     //long "motion blur" like effect to compensate for delay(2) so a delay of 1
  57.     //will be used instead.
  58.     delay(1);
  59.          
  60.     }
  61.  
  62. }
  63.  
  64. //Weapon related constants
  65. #Define Cannon_Ammo_MAX 4
  66.  
  67. //Ammunition upgrade
  68. str AmmoUpg[5]= {
  69. "MTU_APShot_2",
  70. "MTU_APShot_2",
  71. "MTU_HEShell_2",
  72. "MTU_ChemShell_2",
  73. "MTU_BuckShotShell_2",
  74. };
  75.  
  76.  
  77. /*
  78. [0][0][0] = Weapon Name
  79.     [0][1][0] = Weapon [Weapon Mode]
  80.     [0][1][1] = Weapon [Ammo Name]
  81.     [0][1][2] = Weapon [Ammo Actor]
  82.     [0][1][3] = Weapon [Ammo Upgrade 0]
  83.     [0][1][4] = Weapon [Ammo Upgrade 1]
  84.     [0][1][5] = Weapon [Ammo Upgrade 2]
  85. */
  86.  
  87. str AmmoType_Neo[4][6][6] = {
  88.     { {"MT_105mmCannon"},
  89.       {"MHT_BaseGun_AP", "APHE", "MT_75x500mmAP", "APAMA0", "APAMB0", "APAMC0"},
  90.       {"MHT_BaseGun_APCR", "U-APFSDS","MT_75x500mmAPCR" , "ACAMA0", "ACAMB0", "ACAMC0"},
  91.       {"MHT_BaseGun_HE","HEMP", "MT_75x500mmHE", "HEAMA0", "HEAMB0", "HEAMC0"},
  92.       {"MHT_BaseGun_Chem","Chem","MT_75x500mmChem", "CHAMA0", "CHAMB0", "CHAMC0"},
  93.       {"MHT_BaseGun_Bee","Bee","MT_75x500mmBee", "BHAMA0", "BHAMB0", "BHAMC0"}, },
  94.  
  95.     { {"MT_105mmCannonZS"},
  96.       {"MHT_BaseGun_AP", "APHE", "MT_75x500mmAP", "APAMA0", "APAMB0", "APAMC0"},
  97.       {"MHT_BaseGun_APCR", "U-APFSDS","MT_75x500mmAPCR" , "ACAMA0", "ACAMB0", "ACAMC0"},
  98.       {"MHT_BaseGun_HE","HEMP", "MT_75x500mmHE", "HEAMA0", "HEAMB0", "HEAMC0"},
  99.       {"MHT_BaseGun_Chem","Chem","MT_75x500mmChem", "CHAMA0", "CHAMB0", "CHAMC0"},
  100.       {"MHT_BaseGun_Bee","Bee","MT_75x500mmBee", "BHAMA0", "BHAMB0", "BHAMC0"}, },
  101.  
  102.     { {"Multi_Purpose_Device"},
  103.       {"MT_MultiPurposeDevice_Repair", "Repair", "MT_Spareparts", "MSPPA0", "MSPPA0", "MSPPA0"},
  104.       {"MT_MultiPurposeDevice_Reclaim", "Reclaim", "MT_Blankammo","RURMC0", "RURMC0", "RURMC0"}, },
  105.      
  106.     { {"MT_QuadMachineGun"},
  107.       {"MT_QuadMachineGun_APSelected", "FMJ", "A_7u62x54mmR", "HUBBA0", "HUBBA0", "HUBBA0"},
  108.       {"MT_QuadMachineGun_HESelected", "HE","MT_AMMO_7u62x54mmR_HE" , "HEAMA0", "HEAMA0", "HEAMA0"}, },
  109. };
  110.  
  111.  
  112. //Mags
  113. str WPN_Barrel[1] = {
  114. "MT_Heavy_Pepperpot_BarrelsLoad"};
  115.  
  116.  
  117. //Ammo type icon
  118. #Define MTHUD_CURAMMO_ICO_Y 105
  119. #Define MTHUD_CURAMMO_ICO_X 105
  120. //Current Ammo text
  121. #Define MTHUD_CURAMMO_STR_Y 800.0
  122. #Define MTHUD_CURAMMO_STR_X 950.0
  123. //Current Ammo amount
  124. #Define MTHUD_CURAMMO_Y 500.0
  125. #Define MTHUD_CURAMMO_X 300.0
  126. //Ammo max
  127. #Define MTHUD_CURAMMOMAX_Y 1090.0
  128. #Define MTHUD_CURAMMOMAX_X 958.0
  129. //Current mag size
  130. #Define MTHUD_CURMAG_Y 1083.0
  131. #Define MTHUD_CURMAG_X 958.0
  132. //HUDSize
  133. #Define MTHUD_SIZE_Y 800
  134. #Define MTHUD_SIZE_X 600
  135.  
  136.  
  137. //Ammo/Weapon mode display crap
  138. //-
  139. //-
  140. //-
  141. script "MTHUD_Ammo" ENTER
  142. {
  143.     //Weapon related
  144.     int current_weapon, current_ammo, current_ammosize, current_upgrade;
  145.     bool weapon_show;
  146.     weapon_show = false;
  147.     current_weapon = 0;
  148.     current_ammo = 0;
  149.     current_ammosize = 0;
  150.     current_upgrade = 0;
  151.    
  152.     //print(s: "Activator: ", d: PlayerNumber());
  153.     //TODO: Take account for hud_scale > 1.
  154.     //TODO: Take account for magazine,clips and chamber amount.
  155.     while(1)
  156.     {
  157.         //HUD related
  158.         //TODO: Move these 2 calls to somewhere else.
  159.         int resolution_x = GetScreenWidth();
  160.         int resolution_y = GetScreenHeight();
  161.  
  162.  
  163.         //First check selected weapon
  164.  
  165.         /*
  166.         //MANUAL TEST
  167.         if (CheckWeapon(AmmoType_Neo[0][0][0]))
  168.             {
  169.                 weapon_show = true;
  170.             }
  171.         else if (CheckWeapon(AmmoType_Neo[1][0][0]))
  172.             {
  173.                 weapon_show = true;
  174.             }
  175.         else
  176.                 weapon_show = false;
  177.                
  178.         log(s: "FIXED: ", d: weapon_show);
  179.         */
  180.        
  181.         //New working code
  182.         for (int b = 0; b < 3; b++)
  183.         {
  184.        
  185.             //log(s: "NUMBER: ", d: b);
  186.             if ( CheckWeapon(AmmoType_Neo[b][0][0]) )
  187.                 {
  188.                     current_weapon = b;
  189.                 }
  190.            
  191.             /*
  192.             if ( CheckWeapon(AmmoType_Neo[current_weapon][0][0]) )
  193.                 weapon_show = true;
  194.             else
  195.                 weapon_show = false;
  196.             */
  197.         }
  198.        
  199.         //log(s: "WEAPON SHOW: ", d: weapon_show, s: " ", s: AmmoType_Neo[current_weapon][0][0]);
  200.        
  201.  
  202.                                
  203.         if (CheckWeapon(AmmoType_Neo[current_weapon][0][0]))
  204.         {
  205.    
  206.             for (int i0 = 0; i0 < 3; i0++)
  207.             {
  208.                 if (CheckWeapon(AmmoType_Neo[i0][0][0]) == 1)
  209.                 {
  210.                     //log(s: "WEAPON SELECTED: ", s: AmmoType_Neo[current_weapon][0][0]);
  211.                 //current_weapon = i0;
  212.                
  213.                     for (int i1 = 1; i1 < 6; i1++)                 
  214.                         if (CheckInventory(AmmoType_Neo[current_weapon][i1][0]) == 1)
  215.                         {
  216.                             current_ammo = i1;
  217.                             //log(s: "WEAPON MODE:", s: AmmoType_Neo[current_weapon][i1][0]);
  218.                         }
  219.                
  220.                     /*
  221.                     for (int i2 = 0; i2 < 4; i2++)
  222.                         if (CheckInventory(AmmoType_Neo[current_weapon][i1][0]) == 1)
  223.                         {
  224.                             current_ammo = i1;
  225.                             //log(s: "WEAPON MODE:", s: AmmoType_Neo[current_weapon][i1][0]);
  226.                         }
  227.                     */
  228.                                        
  229.                 }
  230.  
  231.             }
  232.    
  233.             if (CheckInventory(AmmoUpg[current_ammo -1]) == 2)
  234.                     current_upgrade = 3;
  235.             else if (CheckInventory(AmmoUpg[current_ammo -1]) == 1 )
  236.                     current_upgrade = 2;   
  237.             else if (CheckInventory(AmmoUpg[current_ammo -1]) == 0 )
  238.                     current_upgrade = 1;
  239.             else
  240.                     current_upgrade = 1;
  241.        
  242.             //log(s: AmmoType_Neo[current_weapon][current_ammo][0], s: AmmoUpg[current_ammo -1], s: "upg ", d: current_ammo -1);
  243.    
  244.             //log(s: "WEAPON UPGRADE:", s: AmmoType_Neo[current_weapon][current_ammo][0], s: " - ",  s: AmmoType_Neo[current_weapon][current_ammo][2 + current_upgrade]);
  245.  
  246.             //Ammo Display
  247.             SetFont(AmmoType_Neo[current_weapon][current_ammo][2 + current_upgrade]);
  248.             ADVHudMessage(resolution_x - 105.0, resolution_y - 105.0, AmmoType_HUD_ID, StrParam(s:"A"), ALIGN_CENTER, ALIGN_RIGHT, FOREVER);       
  249.        
  250.             //Ammo Count
  251.             SetFont("BIGFONT2");
  252.             ADVHudMessage(resolution_x - 210.0, resolution_y - 130.0, AmmoType_HUD_ID+1, StrParam(d: CheckInventory(AmmoType_Neo[current_weapon][current_ammo][2])), ALIGN_CENTER, ALIGN_RIGHT, FOREVER);
  253.                
  254.             //Ammo Max Count
  255.             SetFont("BIGFONT2");
  256.             ADVHudMessage(resolution_x - 155.0, resolution_y - 130.0, AmmoType_HUD_ID+2, StrParam(d: GetMaxInventory(0, AmmoType_Neo[current_weapon][current_ammo][2])), ALIGN_CENTER, ALIGN_RIGHT, FOREVER);
  257.                
  258.             //Ammo Name
  259.             SetFont("BIGFONT");
  260.             HMUSRedux(resolution_x - 190.0, resolution_y - 100.0, StrParam(s:AmmoType_Neo[current_weapon][current_ammo][1]), ALIGN_CENTER, ALIGN_RIGHT, AmmoType_HUD_ID+3, FOREVER, 0);
  261.                        
  262.             //Ammo Size Count
  263.         }
  264.    
  265.         //If it doesn't use ammo/weapon mode then it shouldn't
  266.         //display anything.    
  267.        
  268.         else if ( (weapon_show = false) | (!CheckWeapon(AmmoType_Neo[current_weapon][0][0])) )
  269.         {
  270.             //log(s: "WEAPON SHOW: FALSE", d: weapon_show);
  271.             SetFont("");
  272.             HudMessage(s:"";HUDMSG_PLAIN, AmmoType_HUD_ID, CR_BLUE, 0, 0, 0);
  273.             SetFont("");
  274.             HudMessage(s:"";HUDMSG_PLAIN, AmmoType_HUD_ID+1, CR_BLUE, 0, 0, 0);
  275.             SetFont("");
  276.             HudMessage(s:"";HUDMSG_PLAIN, AmmoType_HUD_ID+2, CR_BLUE, 0, 0, 0);
  277.             SetFont("");
  278.             HudMessage(s:"";HUDMSG_PLAIN, AmmoType_HUD_ID+3, CR_BLUE, 0, 0, 0);
  279.             SetFont("");
  280.             HudMessage(s:"";HUDMSG_PLAIN, AmmoType_HUD_ID+4, CR_BLUE, 0, 0, 0);
  281.             SetFont("");
  282.             HudMessage(s:"";HUDMSG_PLAIN, AmmoType_HUD_ID+6, CR_BLUE, 0, 0, 0);
  283.         }
  284.  
  285.         Delay(2);
  286.     }
  287.  
  288. }
  289.  
  290.  
  291.  
  292. //Used to add firing delay for cannons so that players can use other
  293. //weapons in the meanwhile
  294. str delayer[4] = {
  295. //MBT Cannon
  296.  
  297. //MBT Weapon
  298.  
  299. //Heavy Cannon
  300. "I_75mmReloadTimer1", "I_75mmReloadTimer2",
  301. //Heavy Weapon
  302. "MT_Heavy_Pepperpot_ReloadTimer1", "MT_Heavy_Pepperpot_ReloadTimer2"};
  303.  
  304.  
  305. script "MT_Wfiring_delay" (int Item, int duration)
  306. {
  307.    
  308.     //print(s: "A ", s: delayer[0]);
  309.    
  310.     //GiveInventory(delayer[Item], 1);
  311.  
  312.     while(True)
  313.     {
  314.            
  315.         GiveInventory(delayer[Item], 1);
  316.        
  317.             if(CheckInventory(delayer[Item]) >= duration)
  318.             {
  319.                 GiveInventory("75mmReloaded", 1);
  320.                 TakeInventory(delayer[Item], 9999);
  321.                 Terminate;
  322.             }
  323.         Delay(1);
  324.     }
  325.  
  326. }
  327.  
  328.  
  329. script "MT_NewMap" OPEN
  330. {
  331. //ZANDRONUM
  332. //This is highly neccessary so movement buttons can be used for Menus
  333. //  ConsoleCommand("compat_clientssendfullbuttoninfo 1");
  334.     TakeInventory("MT_MorphVCrewToken",999);
  335.    
  336. //Remove a few unneccesary token on map change
  337.     TakeInventory("MT_FirstMorph", 999);
  338.  
  339. //When the player got the Menu open and enters a map
  340. //He gets stuck, this ACS removes this bug.
  341.     If(!CheckInventory("ImCrafting"))
  342.     {
  343.         TakeInventory("ImCrafting",1);
  344.         SetPlayerProperty(TRUE, FALSE, PROP_TOTALLYFROZEN);
  345.         SetPlayerProperty(TRUE, FALSE, PROP_FROZEN);
  346.     }
  347. //Sometimes Cannons get stuck at firing
  348.     for (int i = 0; i < 5; i++)
  349.     {
  350.         TakeInventory(delayer[i],999);
  351.     }
  352. }
  353.  
  354. //Ugly hack to fix the Morph To Marine health reset bug on map change
  355. //when the player is morphed
  356. //TODO: Fix the bug on changemap command
  357. script "MT_MorphFixer" UNLOADING
  358. {
  359.     //log(s: "AAAAAA");
  360.     if (CheckInventory("MT_MorphVCrewToken") == 1)
  361.         {
  362.             /*
  363.             log(s: "FUGGEN");
  364.             ACS_NamedExecuteWithResult("MT_MorphToMarine", 0);
  365.             */
  366.             //log(s: "FUGGEN");
  367.             SetActorProperty(PlayerNumber(), APROP_Health, vehicleprevioushealth);
  368.             TakeInventory("MT_MorphVCrewToken",999);
  369.         }
  370.     delay(5);
  371. }
  372.  
  373.  
  374.  
  375. //Script to force use a specific item
  376. script "MT_AmmoSwitch_Reverse" (VOID) NET
  377. {
  378.     UseActorInventory(0, "MT_AmmoSwitcher");
  379. }
  380.  
  381. //Script to force use a specific item
  382. script "MT_SubgunSwitch_Reverse" (VOID) NET
  383. {
  384.     UseActorInventory(0, "MT_SubgunSwitcher");
  385. }
  386.  
  387. //Script to check if a item is exactly one,
  388. //Zandronum doesn't support CountInv
  389. script "MT_IsItemOne" (int item)
  390. {
  391.         //str items[1];
  392.         str items[1] = {"MHT_BaseGun_AmmoSlot"};
  393.        
  394.         printbold(d: CheckInventory("MHT_BaseGun_AmmoSlot"));
  395.         if (CheckActorInventory(0, items[item]) == 1)
  396.         {
  397.             SetResultValue(1);
  398.             //Return True;
  399.         }
  400.         else
  401.             SetResultValue(0);
  402.  
  403. }
  404.  
  405.  
  406.  
  407. //Some fucking Multiplayer -.
  408. /*
  409. script "MT_MP1" ENTER
  410. {
  411.   Thing_ChangeTID(0,PLAYER_TID_START+PlayerNumber());
  412. }
  413.  
  414. script "MT_MP2" RESPAWN
  415. {
  416.   // Make sure our old dead body doesn't still have our tid
  417.   Thing_ChangeTID(PLAYER_TID_START+PlayerNumber(),0);
  418.   Thing_ChangeTID(0,PLAYER_TID_START+PlayerNumber());
  419. }
  420. */
  421.  
  422. //------------------------------------------------------------------------------
  423. //CVAR
  424. //------------------------------------------------------------------------------
  425. script "MT_CVAR_Things" (void)
  426. {
  427.     SetResultValue(GetCVar("mtcvar_creditstart"));
  428. }
  429.  
  430. script "MT_GiveMoni" ENTER
  431. {
  432.     If (CheckInventory("MT_ClassToken") == 1)
  433.     {
  434.         if(GetCVar("mtcvar_creditstart") > 0 )
  435.         {
  436.             GiveInventory("MT_Credits", GetCVar("mtcvar_creditstart"));
  437.         }
  438.         if(GetCVar("mtcvar_metalstart") > 0 )
  439.         {
  440.             GiveInventory("MT_Metal", GetCVar("mtcvar_metalstart"));
  441.         }  
  442.        
  443.         if( GetCvar("mtcvar_techwars") > 0 )
  444.         {
  445.             GiveInventory("MT_AllTech", 1);
  446.         }
  447.     }
  448.     GiveInventory("MT_ClassToken", 1);
  449.     Terminate;
  450. }
  451.  
  452.  
  453. //Morph to Marine function
  454. //Probably needs some more refining
  455. //TODO: Fix marine health going to 0 when switching next map
  456. //TODO: Multiplayer compat
  457. script "MT_MorphToMarine" (VOID) NET
  458. {
  459.  
  460.  
  461.     //Morph to marine
  462.      if (!CheckInventory("MT_MorphVCrewToken") & CheckInventory("MT_ClassToken") > 0)
  463.         {
  464.             vehicleprevioushealth = GetActorProperty(PlayerNumber(), APROP_Health);
  465.             vehiclepreviousarmor = CheckInventory("StoredArmorInsideVehicle");
  466.    
  467.             GiveInventory("MT_MorphVCrewToken", 1);
  468.            
  469.             delay(1);
  470.  
  471.             MorphActor(PlayerNumber(), "MT_MorphPlayer", "", 0xFFFFFF, 0, "", "");
  472.             GiveInventory("StoredArmorInsideVehicle", marinepreviousarmor);    
  473.    
  474.             if (!CheckInventory("MT_FirstMorph"))
  475.                 {
  476.                     //Initial morphing
  477.                     marineprevioushealth = 200;
  478.                     SetActorProperty(PlayerNumber(), APROP_Health, marineprevioushealth);
  479.                 }
  480.             else
  481.                 {
  482.                     //Guarantee at least 110 HP...
  483.                     if (marineprevioushealth < 110)
  484.                     {
  485.                         marineprevioushealth = 110;
  486.                     }
  487.                     SetActorProperty(PlayerNumber(), APROP_Health, marineprevioushealth);
  488.                 }
  489.             GiveInventory("MT_FirstMorph", 1);
  490.         }
  491.     //Morph to tank
  492.     else if (CheckInventory("MT_ClassToken") > 0)
  493.         {
  494.             //Health, Armor
  495.             vehiclepreviousarmor = CheckInventory("StoredArmorInsideVehicle");
  496.             //Angle
  497.             //int vehiclepreviousbaseangle = GetUserVariable(0, "user_chassisangle");
  498.             //int vehiclenewangle = GetActorAngle(0);
  499.             //log(s: "OLD ANGLE: ", d: vehiclenewangle);
  500.             //vehiclenewangle = vehiclenewangle / 182;
  501.             //log(s: "NEW ANGLE: ", d: vehiclenewangle);
  502.            
  503.             delay(1);
  504.             UnMorphActor(PlayerNumber(), 0);
  505.             //Health, Armor
  506.             SetActorProperty(PlayerNumber(), APROP_Health, vehicleprevioushealth);
  507.             GiveInventory("StoredArmorInsideVehicle", vehiclepreviousarmor);
  508.             //Angle
  509.             //ACS_NamedExecuteWithResult("MT_SetVehicleRotation", vehiclenewangle);
  510.             //SetUserVariable(0, "user_chassisangle", vehiclenewangle);
  511.             TakeInventory("MT_MorphVCrewToken", 999);
  512.         }
  513.        
  514.     else
  515.         {
  516.             HudMessage(s:"\cfOnly available for Micro Tank classes.";HUDMSG_FADEOUT,PlayerNumber(),CR_Blue,0.5,0.7,2.0,2.0);
  517.         }
  518.  
  519.  }
  520.  
  521. //Check max player health
  522. script "MT_CheckMaxHealth" (VOID)
  523. {
  524.     if (GetActorProperty(0, APROP_HEALTH) == GetActorProperty(0, APROP_SPAWNHEALTH))
  525.         {
  526.             SetResultValue(1);
  527.         }
  528.     else
  529.         {
  530.             SetResultValue(0);
  531.         }
  532. }
  533.  
  534. //Map Initzalization
  535. script "MTACS_RotationSpawn"
  536. {
  537.     SetResultValue(GetActorAngle(0));
  538. }
  539.  
  540. script "MT_SetVehicleRotation" (int degree)
  541. {
  542.     vehiclerotation = degree;
  543. }
  544.  
  545. script "MT_GetVehicleRotation" (VOID)
  546. {
  547.     SetResultValue(vehiclerotation);
  548. }
  549.  
  550. script "MT_ChangeTid" (int old_tid, int new_tid)
  551. {
  552.     Thing_ChangeTid(old_tid, new_tid);
  553. }
  554.  
  555. script "MT_ReturnHeight" (int tid)
  556. {
  557.     int z;
  558.     z = 0;
  559.     z = GetActorZ(tid) >> 16;
  560.     //log(s: "HEIGHT:", d: z);
  561.     SetResultValue(z); 
  562. }
  563.  
  564. //Vector Crap
  565. script "MT_GetVector_X" ()
  566. {
  567.     SetResultValue(player_velx);
  568. }
  569. script "MT_GetVector_Y" ()
  570. {
  571.     SetResultValue(player_vely);
  572. }
  573. script "MT_GetVector_Z" ()
  574. {
  575.     SetResultValue(player_velz);
  576. }
  577. script "MT_SetVector_X" (int X)
  578. {
  579.     player_velx = X;
  580. }
  581. script "MT_SetVector_Y" (int Y)
  582. {
  583.     player_vely = Y;
  584. }
  585. script "MT_SetVector_Z" (int Z)
  586. {
  587.     player_velz = Z;
  588. }
  589.  
  590. //Player Vertex Stuff
  591. script "MT_Set_Vertex_Height" (int cases, int height)
  592. {
  593.     switch (cases)
  594.     {
  595.         case 1:
  596.         player_vertex_B0 = height;
  597.         break;
  598.         case 2:
  599.         player_vertex_B1 = height;
  600.         break;
  601.         case 3:
  602.         player_vertex_A0 = height;
  603.         break;
  604.         case 4:
  605.         player_vertex_A1 = height;     
  606.         break;
  607.         default:
  608.         Log(s: "Invalid case.");
  609.         break;
  610.     }
  611. }
  612.  
  613. script "MT_Get_Vertex_Height" (int cases)
  614. {
  615.     switch (cases)
  616.     {
  617.         case 1:
  618.         SetResultValue(player_vertex_B0);
  619.         break;
  620.         case 2:
  621.         SetResultValue(player_vertex_B1);
  622.         break;
  623.         case 3:
  624.         SetResultValue(player_vertex_A0);
  625.         break;
  626.         case 4:
  627.         SetResultValue(player_vertex_A1);
  628.         break;
  629.         default:
  630.         Log(s: "Invalid case.");
  631.         break;
  632.     }
  633. }
  634.  
  635.  
  636. //This one causes the Player to morph back to tank with 0 health
  637. //but he can still move and rotate, maybe it can be used for something.
  638. /*
  639. //Morph to Marine function
  640. script "MT_MorphToMarine" (VOID) NET
  641. {
  642.  
  643.     //Morph player
  644.      if (!CheckInventory("MT_MorphVCrewToken") & CheckInventory("MT_ClassToken"))
  645.         {
  646.             delay(1);
  647.             delay(5);
  648.             SetActorAngle (0, GetActorAngle (261));
  649.             Thing_Move(0, 261, 1);
  650.             GiveInventory("MT_MorphVCrewToken", 1);
  651.  
  652.             vehicleprevioushealth = GetActorProperty(0, APROP_Health);
  653.             int vehiclepreviousbaseangle = GetUserVariable(0, "user_tankbasedirection");
  654.  
  655.             MorphActor(0, "MT_MorphPlayer", "", 0xFFFFFF, 0, "", "");
  656.  
  657.             int resetarmor = CheckInventory("StoredArmorInsideVehicle");
  658.             int resethealth = CheckInventory("StoredHealthInsideVehicle");
  659.             SetActorProperty(0, APROP_Health, resethealth);
  660.             GiveInventory("GiveArmor", resetarmor);
  661.             SetActorProperty(261, APROP_Health, vehicleprevioushealth);
  662.             SetActorProperty(261, APROP_Health, vehicleprevioushealth);
  663.             TakeInventory("StoredHealthInsideVehicle", 9999);
  664.             TakeInventory("StoredArmorInsideVehicle", 9999);
  665.         }
  666.     //Morph tank
  667.     else if (CheckInventory("MT_ClassToken"))
  668.         {
  669.             TakeInventory("MT_MorphVCrewToken", 999);
  670.  
  671.             SetActorAngle (0, GetActorAngle (261));
  672.             Thing_Move(0, 261, 1);
  673.             vehicleprevioushealth = GetActorProperty(261, APROP_Health);
  674.             GiveInventory("StoredArmorInsideVehicle", playerpreviousarmor);
  675.             GiveInventory("StoredHealthInsideVehicle", playerprevioushealth);
  676.             SetActorProperty(0, APROP_Health, vehicleprevioushealth);
  677.            
  678.  
  679.             UnMorphActor(0,1);     
  680.  
  681.  
  682.  
  683.             SetActorProperty(0, APROP_Health, vehicleprevioushealth);
  684.         }
  685.     else
  686.         {
  687.             HudMessage(s:"\cfOnly available for Micro Tank classes.";HUDMSG_FADEOUT,PlayerNumber(),CR_Blue,0.5,0.7,2.0,2.0);
  688.         }
  689.  
  690.  
  691.  
  692.  //vehicleprevioushealth = GetActorProperty(261, APROP_Health);
  693.  //GiveInventory("StoredArmorInsideVehicle", playerpreviousarmor);
  694.  //GiveInventory("StoredHealthInsideVehicle", playerprevioushealth);
  695.  //SetActorProperty(0, APROP_Health, vehicleprevioushealth);
  696.  //int thisgunmachinegunammo = CheckActorInventory(261, "HeavyMachinegunAmmo");
  697.  //int thistankammo = CheckActorInventory(261, "TankAmmo");
  698.  //int thisvehicleHelicopterRocketAmmo = CheckActorInventory(261, "HelicopterRocketAmmo");
  699.  //int thisvehicleMechMortarAmmo = CheckActorInventory(261, "MechMortarAmmo");
  700.  //int thisvehicleMechLaserAmmo = CheckActorInventory(261, "MechLaserAmmo");
  701.  //int thisvehicleMechRocketAmmo = CheckActorInventory(261, "MechRocketAmmo");
  702.  //int vehiclepreviousbaseangle = CheckActorInventory(261, "TankBaseDirection");
  703.  //GiveInventory("HeavyMachinegunAmmo", thisgunmachinegunammo);
  704.  //GiveInventory("TankAmmo", thistankammo);
  705.  //GiveInventory("HelicopterRocketAmmo", thisvehicleHelicopterRocketAmmo);
  706.  //GiveInventory("MechMortarAmmo", thisvehicleMechMortarAmmo);
  707.  //GiveInventory("MechLaserAmmo", thisvehicleMechLaserAmmo);
  708.  //GiveInventory("MechRocketAmmo", thisvehicleMechRocketAmmo);
  709.  //SetUserVariable(0, "user_tankbasedirection", vehiclepreviousbaseangle);
  710.  //delay(1);
  711. }
  712. */
  713.  
  714. //------------------------------------------------------------------------------
  715. ////Main script
  716. //It will initalize other scripts on start
  717. //------------------------------------------------------------------------------
  718. script "MT_Main" (VOID) NET
  719. {
  720.  
  721. }
  722.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement