Advertisement
Mjjstral

C&C3TW scripts.lua

Nov 7th, 2017
199
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --- define lua functions
  2. function NoOp(self, source)
  3. end
  4.  
  5.  
  6. function kill(self) -- Kill unit self.
  7.     ExecuteAction("NAMED_KILL", self);
  8. end
  9.  
  10. function RadiateUncontrollableFear( self )
  11.     ObjectBroadcastEventToEnemies( self, "BeUncontrollablyAfraid", 350 )
  12. end
  13.  
  14. function RadiateGateDamageFear(self)
  15.     ObjectBroadcastEventToAllies(self, "BeAfraidOfGateDamaged", 200)
  16. end
  17.  
  18. function OnNeutralGarrisonableBuildingCreated(self)
  19.     ObjectHideSubObjectPermanently( self, "ARMOR", true )
  20. end
  21.  
  22. function OnGDITechCenterCreated(self)
  23.     ObjectHideSubObjectPermanently( self, "UG_Boost", true )
  24.     ObjectHideSubObjectPermanently( self, "UG_Mortar", true )
  25.     ObjectHideSubObjectPermanently( self, "UG_Rail", true )
  26.     ObjectHideSubObjectPermanently( self, "UG_Scan", true )
  27. end
  28.  
  29. function OnGDIMedicalBayCreated(self)
  30.     ObjectHideSubObjectPermanently( self, "UG_Armor", true )
  31.     ObjectHideSubObjectPermanently( self, "UG_StealthDetector", true )
  32.     ObjectHideSubObjectPermanently( self, "UG_StealthDetector01", true )
  33.     ObjectHideSubObjectPermanently( self, "UG_Injector", true )
  34. end
  35.  
  36. function OnGDIPowerPlantCreated(self)
  37.     ObjectHideSubObjectPermanently( self, "Turbines", true )
  38.     ObjectHideSubObjectPermanently( self, "TurbineGlows", true )
  39. end
  40.  
  41. function OnGDIZoneTrooperCreated(self)
  42.     ObjectHideSubObjectPermanently( self, "UGSCANNER", true )
  43.     ObjectHideSubObjectPermanently( self, "UGJUMP", true )
  44.     ObjectHideSubObjectPermanently( self, "UGINJECTOR", true )
  45. end
  46.  
  47. function OnGDIPredatorCreated(self)
  48.     ObjectHideSubObjectPermanently( self, "UGRAIL_01", true )
  49. end
  50.  
  51. function OnGDIMammothCreated(self)
  52.     ObjectHideSubObjectPermanently( self, "UGRAIL_01", true )
  53.     ObjectHideSubObjectPermanently( self, "UGRAIL_02", true )
  54.     ObjectHideSubObjectPermanently( self, "MuzzleFlash_01", true )
  55.     ObjectHideSubObjectPermanently( self, "MuzzleFlash_02", true )
  56. end
  57.  
  58. function OnGDIJuggernaughtCreated(self)
  59.     ObjectHideSubObjectPermanently( self, "MuzzleFlash_01", true )
  60.     ObjectHideSubObjectPermanently( self, "MuzzleFlash_02", true )
  61.     ObjectHideSubObjectPermanently( self, "MuzzleFlash_03", true )
  62.    
  63. end
  64.  
  65. function OnGDIWatchTowerCreated(self)
  66.     ObjectHideSubObjectPermanently( self, "MuzzleFlash_01", true )
  67.     ObjectHideSubObjectPermanently( self, "MuzzleFlash_02", true )
  68. end
  69.  
  70. function OnGDIFirehawkCreated(self)
  71.     -- bomb load by default.
  72.     ObjectGrantUpgrade( self, "Upgrade_SelectLoad_02" )
  73.     ObjectHideSubObjectPermanently( self, "Plane04", true )
  74. end
  75.  
  76. function OnGDIPitbullCreated(self)
  77.     ObjectHideSubObjectPermanently( self, "MortorTube", true )
  78. end
  79.  
  80. function OnGDIOrcaCreated(self)
  81.     ObjectHideSubObjectPermanently( self, "UG_PROBE", true )
  82. end
  83.  
  84. function OnGDISniperSquadCreated(self)
  85.     ObjectSetObjectStatus( self, "CAN_SPOT_FOR_BOMBARD" )
  86. end
  87.  
  88. function OnGDIOrcaClipEmpty(self)
  89.     ObjectHideSubObjectPermanently( self, "MISSILE01", true )
  90. end
  91.  
  92. function OnGDIOrcaClipFull(self)
  93.     ObjectHideSubObjectPermanently( self, "MISSILE01", false )
  94. end
  95.  
  96. function OnGDIV35Ox_SummonedForVehicleCreated(self)
  97.     ObjectHideSubObjectPermanently( self, "LOADREF", true )
  98. end
  99.  
  100. function OnNODShredderCreated(self)
  101.  
  102. end
  103.  
  104. function OnNODRaiderTankCreated(self)
  105.     ObjectHideSubObjectPermanently( self, "Gun_Upgrade", true )
  106.     ObjectHideSubObjectPermanently( self, "Turret2_Gun", true )
  107.     ObjectHideSubObjectPermanently( self, "Turret2", true )
  108.     ObjectHideSubObjectPermanently( self, "MuzzleFlash_01", true )
  109.     ObjectHideSubObjectPermanently( self, "DOZERBLADE", true )
  110. end
  111.  
  112. function OnNODAvatarCreated(self)
  113.     ObjectHideSubObjectPermanently( self, "NUBEAM", true )
  114.     ObjectHideSubObjectPermanently( self, "FLAMETANK", true )
  115.     ObjectHideSubObjectPermanently( self, "S_DETECTOR", true )
  116.     ObjectHideSubObjectPermanently( self, "S_GENERATOR", true )
  117. end
  118.  
  119. function OnNODScorpionBuggyCreated(self)
  120.     ObjectHideSubObjectPermanently( self, "EMP", true )
  121. end
  122.  
  123. function OnNODVenomCreated(self)
  124.     ObjectHideSubObjectPermanently( self, "SigGen", true )
  125. end
  126.  
  127. function OnNODTechAssembleyPlantCreated(self)
  128.     ObjectHideSubObjectPermanently( self, "UG_EMP", true )
  129.     ObjectHideSubObjectPermanently( self, "UG_Lasers", true )
  130.     ObjectHideSubObjectPermanently( self, "UG_SigGen", true )
  131.     ObjectHideSubObjectPermanently( self, "UG_DozerBlades", true )
  132. end
  133.  
  134. function OnNODSecretShrineCreated(self)
  135.     ObjectHideSubObjectPermanently( self, "GLOWS", true )  
  136.     ObjectHideSubObjectPermanently( self, "ConfUpgrd", true )
  137. end
  138.  
  139. function OnNODSecretShrinePowerOutage(self)
  140.     if ObjectHasUpgrade( self, "Upgrade_NODConfessorUpgrade" ) == 1 then
  141.         ObjectHideSubObjectPermanently( self, "GLOWS", true )  
  142.     end
  143. end
  144.  
  145. function OnNODSecretShrinePowerRestored(self)        
  146.     if ObjectHasUpgrade( self, "Upgrade_NODConfessorUpgrade" ) == 1 then
  147.         ObjectHideSubObjectPermanently( self, "GLOWS", false ) 
  148.     end
  149. end
  150.  
  151. function onCreatedControlPointFunctions(self)
  152.     ObjectHideSubObjectPermanently( self, "TB_CP_ALN", true )
  153.     ObjectHideSubObjectPermanently( self, "TB_CP_GDI", true )
  154.     ObjectHideSubObjectPermanently( self, "TB_CP_NOD", true )
  155.     ObjectHideSubObjectPermanently( self, "LIGHTSF01", true )
  156.     ObjectHideSubObjectPermanently( self, "100", false)
  157.     ObjectHideSubObjectPermanently( self, "75", false)
  158.     ObjectHideSubObjectPermanently( self, "50", false)
  159.     ObjectHideSubObjectPermanently( self, "25", false )
  160. end
  161.  
  162. function onBuildingPowerOutage(self)
  163.     ObjectHideSubObjectPermanently( self, "LIGHTS", true )
  164.     ObjectHideSubObjectPermanently( self, "FXLIGHTS05", true )
  165.     ObjectHideSubObjectPermanently( self, "FXLIGHTS", true )
  166.     ObjectHideSubObjectPermanently( self, "FXGLOWS", true )
  167.     ObjectHideSubObjectPermanently( self, "FLASHINGLIGHTS", true )
  168.     ObjectHideSubObjectPermanently( self, "MESH01", true )
  169.     ObjectHideSubObjectPermanently( self, "POWERPLANTGLOWS", true )
  170.     ObjectHideSubObjectPermanently( self, "LIGHTL", true )
  171.     ObjectHideSubObjectPermanently( self, "LIGHTR", true )
  172.     ObjectHideSubObjectPermanently( self, "LIGHTS1", true )
  173.     ObjectHideSubObjectPermanently( self, "NBCHEMICALPTE1", true )
  174.     ObjectHideSubObjectPermanently( self, "LINKS", true )
  175.     ObjectHideSubObjectPermanently( self, "MESH28", true )
  176.     ObjectHideSubObjectPermanently( self, "TURBINEGLOWS", true )
  177.     ObjectHideSubObjectPermanently( self, "GLOWS", true )
  178. end
  179.  
  180. function onBuildingPowerRestored(self)
  181.     ObjectHideSubObjectPermanently( self, "LIGHTS", false )
  182.     ObjectHideSubObjectPermanently( self, "FXLIGHTS05", false )
  183.     ObjectHideSubObjectPermanently( self, "FXLIGHTS", false )
  184.     ObjectHideSubObjectPermanently( self, "FXGLOWS", false )
  185.     ObjectHideSubObjectPermanently( self, "FLASHINGLIGHTS", false )
  186.     ObjectHideSubObjectPermanently( self, "MESH01", false )
  187.     ObjectHideSubObjectPermanently( self, "POWERPLANTGLOWS", false )
  188.     ObjectHideSubObjectPermanently( self, "LIGHTL", false )
  189.     ObjectHideSubObjectPermanently( self, "LIGHTR", false )
  190.     ObjectHideSubObjectPermanently( self, "LIGHTS1", false )
  191.     ObjectHideSubObjectPermanently( self, "NBCHEMICALPTE1", false )
  192.     ObjectHideSubObjectPermanently( self, "LINKS", false )
  193.     ObjectHideSubObjectPermanently( self, "MESH28", false )
  194.     ObjectHideSubObjectPermanently( self, "TURBINEGLOWS", false )
  195.     ObjectHideSubObjectPermanently( self, "GLOWS", false )
  196. end
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204. function OnNeutralGarrisonableBuildingGenericEvent(self,data)
  205. end
  206.  
  207. function onCreatedGDIOrcaAirstrike(self)
  208.     ObjectForbidPlayerCommands( self, true )
  209. end
  210.  
  211. function onCreatedAlienMCVUnpacking(self)
  212.     ObjectForbidPlayerCommands( self, true )
  213. end
  214.  
  215. function GoIntoRampage(self)
  216.     ObjectEnterRampageState(self)
  217.        
  218.     --Broadcast fear to surrounding unit(if we actually rampaged)
  219.     if ObjectTestModelCondition(self, "WEAPONSET_RAMPAGE") then
  220.         ObjectBroadcastEventToUnits(self, "BeAfraidOfRampage", 250)
  221.     end
  222. end
  223.  
  224. function MakeMeAlert(self)
  225.     ObjectEnterAlertState(self)
  226. end
  227.  
  228. function BecomeUncontrollablyAfraid(self, other)
  229.     if not ObjectTestCanSufferFear(self) then
  230.         return
  231.     end
  232.  
  233.     ObjectEnterUncontrollableCowerState(self, other)
  234. end
  235.  
  236. function BecomeAfraidOfRampage(self, other)
  237.     if not ObjectTestCanSufferFear(self) then
  238.         return
  239.     end
  240.  
  241.     ObjectEnterCowerState(self, other)
  242. end
  243.  
  244. function RadiateTerror(self, other)
  245.     ObjectBroadcastEventToEnemies(self, "BeTerrified", 180)
  246. end
  247.    
  248. function RadiateTerrorEx(self, other, terrorRange)
  249.     ObjectBroadcastEventToEnemies(self, "BeTerrified", terrorRange)
  250. end
  251.    
  252.  
  253. function BecomeTerrified(self, other)
  254.     ObjectEnterRunAwayPanicState(self, other)
  255. end
  256.  
  257. function BecomeAfraidOfGateDamaged(self, other)
  258.     if not ObjectTestCanSufferFear(self) then
  259.         return
  260.     end
  261.  
  262.     ObjectEnterCowerState(self,other)
  263. end
  264.  
  265.  
  266. function ChantForUnit(self) -- Used by units to broadcast the chant event to their own side.
  267.     ObjectBroadcastEventToAllies(self, "BeginChanting", 9999)
  268. end
  269.  
  270. function StopChantForUnit(self) -- Used by units to stop the chant event to their own side.
  271.     ObjectBroadcastEventToAllies(self, "StopChanting", 9999)
  272. end
  273.  
  274. function SpyMoving(self, other)
  275.     print(ObjectDescription(self).." spying movement of "..ObjectDescription(other));
  276. end
  277.  
  278. function OnGarrisonableCreated(self)
  279.     ObjectHideSubObjectPermanently( self, "GARRISON01", true )
  280.     ObjectHideSubObjectPermanently( self, "GARRISON02", true )
  281. end
  282.  
  283. function OnRubbleDropshipCreated(self)
  284.     ObjectHideSubObjectPermanently( self, "Loadref", true )
  285. end
Advertisement
RAW Paste Data Copied
Advertisement