Talk:Gravity Gun/@comment-4697956-20120501234440/@comment-1365289-20120502235322

That and its a mountain of fucking code.

//-- // Trigger: Gravity Gun Pull //-- bool gt_GravityGunPull_Func (bool testConds, bool runActions) { // Variable Declarations point lv_gravityCenterPoint; unit lv_gravTarget; int lv_gravGunOwner; unit lv_gravGunUser;

// Variable Initialization lv_gravityCenterPoint = null; lv_gravTarget = EventUnitTargetUnit; lv_gravGunOwner = gf_NOTDOwnerofUnit(EventUnit); lv_gravGunUser = EventUnit;

// Actions if (!runActions) { return true; }

if ((gv_gravityGunPull[lv_gravGunOwner] == false) && (UnitGetType(lv_gravTarget) != "DrBergmann") && (UnitGetType(lv_gravTarget) != "DrTanaka") && (UnitGetType(lv_gravTarget) != "DrGunjan") && (UnitGetType(lv_gravTarget) != "Egg") && (UnitGetType(lv_gravTarget) != "LargeZombieCocoon") && (UnitGetType(lv_gravTarget) != "InfestedCocoon") && (UnitGetType(lv_gravTarget) != "Ultralisk") && (UnitGetType(lv_gravTarget) != "UltraliskBurrowed") && (UnitGetType(lv_gravTarget) != "TruckSemiUnit") && (UnitGetType(lv_gravTarget) != "UGCDropship") && (UnitGetType(lv_gravTarget) != "Medivac") && (UnitGetType(lv_gravTarget) != "Devastator") && (UnitGetType(lv_gravTarget) != "InactiveDevastator") && (UnitGetType(lv_gravTarget) != "Ivax") && (UnitGetType(lv_gravTarget) != "IncompleteIvax") && (UnitGetType(lv_gravTarget) != "HerculesLander") && (UnitGetType(lv_gravTarget) != "HerculesLanderFlying") && (UnitGroupHasUnit(UnitGroup(null, 14, RegionEntireMap, UnitFilter((1 << c_targetFilterHeroic), 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0), lv_gravTarget) == false) && (UnitGroupHasUnit(UnitGroup(null, 13, RegionEntireMap, UnitFilter((1 << c_targetFilterHeroic), 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0), lv_gravTarget) == false)) { UnitAbilityEnable(lv_gravGunUser, "attack", false); TechTreeAbilityAllow(lv_gravGunOwner, AbilityCommand("CancelGravityGun", 0), true); TechTreeAbilityAllow(lv_gravGunOwner, AbilityCommand("ThrowGravityGun", 0), true); TechTreeAbilityAllow(lv_gravGunOwner, AbilityCommand("ShootGravityGun", 0), false); gv_gravityGunPull[lv_gravGunOwner] = true; gv_gravityGunTarget[lv_gravGunOwner] = lv_gravTarget; Wait(0.01, c_timeGame); if ((UnitHasBehavior(lv_gravTarget, "GravityGunTarget") == true)) { gv_gravityGunTargetOriginalOwner[lv_gravGunOwner] = UnitGetOwner(lv_gravTarget); if (((UnitGetOwner(lv_gravTarget) == 13) || (UnitGetOwner(lv_gravTarget) == 14))) { UnitSetOwner(lv_gravTarget, 12, false); }           else { }           while (true) { if ((gv_gravityGunPull[lv_gravGunOwner] == true)) { lv_gravityCenterPoint = libNtve_gf_PointFromXYZ((PointGetX(UnitGetPosition(lv_gravGunUser)) + (2.0 * Cos(UnitGetFacing(lv_gravGunUser)))), (PointGetY(UnitGetPosition(lv_gravGunUser)) + (Sin(UnitGetFacing(lv_gravGunUser)) * 2.0)), (UnitGetHeight(lv_gravGunUser) + 1.6)); if ((UnitIsAlive(lv_gravGunUser) == true)) { UnitSetPosition(lv_gravTarget, lv_gravityCenterPoint, true); }                   else { }                   Wait(0.05, c_timeGame); }               else { break; }               if ((UnitIsAlive(lv_gravTarget) == false)) { gv_gravityGunPull[lv_gravGunOwner] = false; TechTreeAbilityAllow(lv_gravGunOwner, AbilityCommand("CancelGravityGun", 0), false); TechTreeAbilityAllow(lv_gravGunOwner, AbilityCommand("ThrowGravityGun", 0), false); TechTreeAbilityAllow(lv_gravGunOwner, AbilityCommand("ShootGravityGun", 0), true); UnitBehaviorRemove(lv_gravGunUser, "GravityGunThrowActive", 1); }               else { }           }        }        else { }   }    else { UnitBehaviorRemove(lv_gravTarget, "GravityGunTarget", 1); UnitBehaviorRemove(lv_gravGunUser, "GravityGunThrowActive", 1); }   return true; }

//-- void gt_GravityGunPull_Init { gt_GravityGunPull = TriggerCreate("gt_GravityGunPull_Func"); TriggerAddEventUnitAbility(gt_GravityGunPull, null, AbilityCommand("PullGravityGun", 0), c_unitAbilStageComplete, false); }

//-- // Trigger: Gravity Gun Drop //-- bool gt_GravityGunDrop_Func (bool testConds, bool runActions) { // Variable Declarations unit lv_gravGunUser; int lv_gravGunOwner;

// Variable Initialization lv_gravGunUser = EventUnit; lv_gravGunOwner = gf_NOTDOwnerofUnit(lv_gravGunUser);

// Actions if (!runActions) { return true; }

gv_gravityGunPull[lv_gravGunOwner] = false; TechTreeAbilityAllow(lv_gravGunOwner, AbilityCommand("CancelGravityGun", 0), false); TechTreeAbilityAllow(lv_gravGunOwner, AbilityCommand("ThrowGravityGun", 0), false); TechTreeAbilityAllow(lv_gravGunOwner, AbilityCommand("ShootGravityGun", 0), true); UnitBehaviorRemove(gv_gravityGunTarget[lv_gravGunOwner], "GravityGunTarget", 1); if (((UnitGetOwner(gv_gravityGunTarget[lv_gravGunOwner]) == 0) || (UnitGetOwner(gv_gravityGunTarget[lv_gravGunOwner]) >= 9))) { UnitSetOwner(gv_gravityGunTarget[lv_gravGunOwner], gv_gravityGunTargetOriginalOwner[lv_gravGunOwner], false); }   else if ((UnitGroupHasUnit(gv_marines, gv_gravityGunTarget[lv_gravGunOwner]) == true)) { UnitSetPosition(gv_gravityGunTarget[lv_gravGunOwner], UnitGetPosition(lv_gravGunUser), true); }   if ((UnitTypeTestFlag(UnitGetType(gv_gravityGunTarget[lv_gravGunOwner]), c_unitFlagDestructible) == true)) { UnitSetOwner(gv_gravityGunTarget[lv_gravGunOwner], 9, false); }   else { }   return true; }

//-- void gt_GravityGunDrop_Init { gt_GravityGunDrop = TriggerCreate("gt_GravityGunDrop_Func"); TriggerAddEventUnitAbility(gt_GravityGunDrop, null, AbilityCommand("CancelGravityGun", 0), c_unitAbilStageComplete, false); }

//-- // Trigger: Gravity Gun Throw //-- bool gt_GravityGunThrow_Func (bool testConds, bool runActions) { // Variable Declarations unit lv_gravGunUser; int lv_gravGunOwner; point lv_gravGunTargetPoint;

// Variable Initialization lv_gravGunUser = EventUnit; lv_gravGunOwner = gf_NOTDOwnerofUnit(lv_gravGunUser); lv_gravGunTargetPoint = EventUnitTargetPoint;

// Conditions if (testConds) { if (!((gv_gravityGunPull[lv_gravGunOwner] == true))) { return false; }   }

// Actions if (!runActions) { return true; }

gv_gravityGunPull[lv_gravGunOwner] = false; TechTreeAbilityAllow(lv_gravGunOwner, AbilityCommand("CancelGravityGun", 0), false); TechTreeAbilityAllow(lv_gravGunOwner, AbilityCommand("ThrowGravityGun", 0), false); TechTreeAbilityAllow(lv_gravGunOwner, AbilityCommand("ShootGravityGun", 0), true); if ((DistanceBetweenPoints(UnitGetPosition(lv_gravGunUser), lv_gravGunTargetPoint) <= 5.0)) { CatalogFieldValueSet(c_gameCatalogEffect, "GravityGunThrowDamage", "Amount", lv_gravGunOwner, "50"); }   else if ((DistanceBetweenPoints(UnitGetPosition(lv_gravGunUser), lv_gravGunTargetPoint) <= 9.0)) { CatalogFieldValueSet(c_gameCatalogEffect, "GravityGunThrowDamage", "Amount", lv_gravGunOwner, "100"); }   else if (true) { CatalogFieldValueSet(c_gameCatalogEffect, "GravityGunThrowDamage", "Amount", lv_gravGunOwner, "200"); }   if ((UnitGroupHasUnit(gv_marines, gv_gravityGunTarget[lv_gravGunOwner]) == true)) { UnitBehaviorRemove(gv_gravityGunTarget[lv_gravGunOwner], "GravityGunTarget", 1); UnitSetPosition(gv_gravityGunTarget[lv_gravGunOwner], UnitGetPosition(lv_gravGunUser), true); }   else if (true) { UnitSetPosition(gv_gravityGunTarget[lv_gravGunOwner], lv_gravGunTargetPoint, true); Wait(0.2, c_timeGame); if (((UnitGetType(gv_gravityGunTarget[lv_gravGunOwner]) == "ExplodingBarrelLarge") || (UnitGetType(gv_gravityGunTarget[lv_gravGunOwner]) == "Baneling") || (UnitGetType(gv_gravityGunTarget[lv_gravGunOwner]) == "Beastling"))) { UnitKill(gv_gravityGunTarget[lv_gravGunOwner]); }       else { }       UnitBehaviorRemove(gv_gravityGunTarget[lv_gravGunOwner], "GravityGunTarget", 1); UnitCreateEffectPoint(lv_gravGunUser, "GravityGunThrowInitialSet", lv_gravGunTargetPoint); Wait(0.2, c_timeGame); if ((UnitGetOwner(gv_gravityGunTarget[lv_gravGunOwner]) != gv_gravityGunTargetOriginalOwner[lv_gravGunOwner])) { UnitSetOwner(gv_gravityGunTarget[lv_gravGunOwner], gv_gravityGunTargetOriginalOwner[lv_gravGunOwner], false); }       else { }   }    if ((UnitTypeTestFlag(UnitGetType(gv_gravityGunTarget[lv_gravGunOwner]), c_unitFlagDestructible) == true)) { UnitSetOwner(gv_gravityGunTarget[lv_gravGunOwner], 9, false); }   else { }   return true; }

//-- void gt_GravityGunThrow_Init { gt_GravityGunThrow = TriggerCreate("gt_GravityGunThrow_Func"); TriggerAddEventUnitAbility(gt_GravityGunThrow, null, AbilityCommand("ThrowGravityGun", 0), c_unitAbilStageComplete, false); }

Edit: That looks like total shit in wikiscript, but you get the idea,