private static void nukeAftermathEffect() { //OnNotify("spawning_intermission" Entity aftermathEnt = GSCFunctions.GetEnt("mp_global_intermission", "classname"); Vector3 up = GSCFunctions.AnglesToUp(aftermathEnt.Angles); Vector3 right = GSCFunctions.AnglesToRight(aftermathEnt.Angles); GSCFunctions.PlayFX(effects[2], aftermathEnt.Origin, up, right); }
private static IEnumerator testFunc() { yield return(Wait(.5f)); Entity testEnt = GSCFunctions.GetEnt("water", "script_noteworthy"); if (testEnt == null) { Utilities.PrintToConsole("No ents found"); yield break; } Utilities.PrintToConsole("Found entity " + testEnt.EntRef); }
public ball() { string gametype = GSCFunctions.GetDvar("g_gametype"); if (gametype != "ctf") { Log.Write(LogLevel.Info, "Gametype must be set to CTF for Uplink. Restarting..."); GSCFunctions.SetDvar("g_gametype", "ctf"); Utilities.ExecuteCommand("map_restart"); return; } GSCFunctions.PreCacheItem(ballWeapon); GSCFunctions.PreCacheShader("waypoint_defend"); GSCFunctions.PreCacheShader("waypoint_target"); GSCFunctions.PreCacheShader("waypoint_kill"); GSCFunctions.PreCacheShader("waypoint_targetneutral"); GSCFunctions.PreCacheShader("equipment_emp_grenade"); ballGlow = GSCFunctions.LoadFX("misc/aircraft_light_wingtip_green"); ballSiteFX = GSCFunctions.LoadFX("misc/ui_flagbase_gold"); alliesSiteFX = GSCFunctions.LoadFX("misc/ui_flagbase_red"); axisSiteFX = GSCFunctions.LoadFX("misc/ui_flagbase_silver"); ballContrail = GSCFunctions.LoadFX("misc/light_semtex_geotrail"); ballExplodeFX = GSCFunctions.LoadFX("explosions/emp_grenade"); GSCFunctions.SetDevDvarIfUninitialized("scr_ball_scorelimit", 10); //GSCFunctions.SetDevDvarIfUninitialized("scr_ball_halftime", 0); //GSCFunctions.SetDevDvarIfUninitialized("scr_ball_overtime", 0); StartAsync(setGameScoreLimit()); StartAsync(setGameHalftimeSetting()); Log.Debug(isHalftime.ToString()); //Delete flags Entity obj = GSCFunctions.GetEnt("ctf_zone_axis", "targetname"); axisSite = obj.Origin; //obj.Delete(); axisFlagBase = Entity.GetEntity(obj.EntRef); Entity flag = GSCFunctions.GetEnt("ctf_flag_axis", "targetname"); //flag.Delete(); axisFlag = Entity.GetEntity(flag.EntRef); Entity trig = GSCFunctions.GetEnt("ctf_trig_axis", "targetname"); axisFlagTrig = Entity.GetEntity(trig.EntRef); obj = GSCFunctions.GetEnt("ctf_zone_allies", "targetname"); alliesSite = obj.Origin; //obj.Delete(); alliesFlagBase = Entity.GetEntity(obj.EntRef); flag = GSCFunctions.GetEnt("ctf_flag_allies", "targetname"); //flag.Delete(); alliesFlag = Entity.GetEntity(flag.EntRef); trig = GSCFunctions.GetEnt("ctf_trig_allies", "targetname"); alliesFlagTrig = Entity.GetEntity(trig.EntRef); StartAsync(getFlagTriggers()); //Teleport flags under map and hide them axisFlagBase.Origin -= new Vector3(0, 0, 1000); axisFlagBase.Hide(); axisFlag.Origin -= new Vector3(0, 0, 1000); axisFlag.Hide(); axisFlagTrig.Origin -= new Vector3(0, 0, 1000); alliesFlagBase.Origin -= new Vector3(0, 0, 1000); alliesFlagBase.Hide(); alliesFlag.Origin -= new Vector3(0, 0, 1000); alliesFlag.Hide(); alliesFlagTrig.Origin -= new Vector3(0, 0, 1000); //Init stations and ball locations site = GSCFunctions.GetEnt("sab_bomb", "targetname").Origin; spawnBall(site); StartAsync(spawnStations(alliesSite, axisSite)); OnNotify("game_ended", (reason) => { gameEnded = true; if ((int)GSCFunctions.GetMatchData("alliesScore") == 1) { //GSCFunctions.SetDvar("scr_ball_halftime", 0);//Reset dvar if it's set GSCFunctions.SetMatchData("alliesScore", 0); } if ((string)reason == "halftime") { //GSCFunctions.SetDvar("scr_ball_halftime", 1); GSCFunctions.SetMatchData("alliesScore", 1); } }); OnNotify("prematch_over", () => prematchOver = true); //Set ball throw time GSCFunctions.SetDvar("perk_weapRateMultiplier", 0.3f); PlayerConnected += onPlayerConnect; Notified += onNotify; StartAsync(initGameHud()); }
public static void buildElevator(Vector3 location, Vector3 angles, int floors) { //if (GSCFunctions.GetDvar("mapname") == "mp_alpha") { //======================================================== //Create the neccessary ents to enable GSC to actually run //======================================================== Entity elevator_group = GSCFunctions.Spawn("trigger_radius", location, 0, 64, 128 * floors); //The trigger used to encapsule the entire elevator as a group Entity elevator_housing = GSCFunctions.GetEnt("script_brushmodel", "classname"); //The entire room of the elevator. We just grab any old script_brushmodel and then build upon that using script_models and LinkTo. Must be a script_brushmodel to function!! Entity elevator_doorsets = GSCFunctions.Spawn("script_origin", location); //A 'container' entity pointing to the left door of the elevator //=========================================================== //Build the elevator housing(Cheating by using script_models) //=========================================================== Entity inner_leftdoor = GSCFunctions.Spawn("script_model", elevator_housing.Origin); //Inside left door, moves with the elevator //Make the housing target this door, then script chains them inner_leftdoor.TargetName = "elev_inner_leftdoor"; //Name this door elevator_housing.Target = inner_leftdoor.TargetName; //Target the door Entity inner_rightdoor = GSCFunctions.Spawn("script_model", elevator_housing.Origin); //Make the left door target this door inner_rightdoor.TargetName = "elev_inner_rightdoor"; inner_leftdoor.Target = inner_rightdoor.TargetName; //Closed position is calculated by GSC Entity door_trigger = GSCFunctions.Spawn("trigger_radius", elevator_housing.Origin, 0, 8, 24);//Using a radius makes coords not precise so we size them as best as possible //Make the right door target this trigger door_trigger.TargetName = "elev_door_trigger"; inner_rightdoor.Target = door_trigger.TargetName; Entity inside_trigger = GSCFunctions.Spawn("trigger_radius", elevator_housing.Origin, 0, 36, 48); //Make the door trigger target this trigger inside_trigger.TargetName = "elev_door_trigger"; door_trigger.Target = door_trigger.TargetName; //Motion trigger is spawned by GSC //===================================================================================== //Build the elevator outer doors. Note the closed position is one origin for both doors //===================================================================================== Entity leftdoor = GSCFunctions.Spawn("script_model", elevator_doorsets.Origin); //Make the doorset target this door leftdoor.TargetName = "elev_leftdoor"; elevator_doorsets.Target = leftdoor.TargetName; Entity rightdoor = GSCFunctions.Spawn("script_model", elevator_doorsets.Origin); //Make the left door target this door rightdoor.TargetName = "elev_rightdoor"; leftdoor.Target = rightdoor.TargetName; //====================================== //Build the call button trigger & visual //====================================== Entity elevator_callbutton = GSCFunctions.Spawn("trigger_radius", elevator_housing.Origin, 0, 12, 12); Entity elevator_callbutton_model = GSCFunctions.Spawn("script_model", elevator_callbutton.Origin); //elevator_callbutton_model.SetModel(""); //====================================================================== //Properly set up the base ents to be seen and used by GSC & link models //====================================================================== elevator_group.TargetName = "elevator_group"; //elevator_doorsets.TargetName = "elevator_doorset"; //elevator_housing.TargetName = "elevator_housing"; //Disabled atm for debugging } }
public Class1() { Utilities.PrintToConsole(string.Format("Plugin loaded at {0}", GSCFunctions.GetTime())); //GSCFunctions.PreCacheString("Test String"); //GSCFunctions.PreCacheStatusIcon("cardicon_iwlogo"); //GSCFunctions.PreCacheMenu("kickplayer"); //GSCFunctions.PreCacheMenu("elevator_floor_selector"); //GSCFunctions.PreCacheShader("faction_128_gign"); //Marshal.WriteInt32(new IntPtr(0x0585AE0C), 24); //Marshal.WriteInt32(new IntPtr(0x0585AE1C), 24); //working guns GSCFunctions.PreCacheItem("at4_mp"); GSCFunctions.PreCacheItem("airdrop_mega_marker_mp"); GSCFunctions.PreCacheItem("throwingknife_rhand_mp"); GSCFunctions.PreCacheItem("iw5_mk12spr_mp"); GSCFunctions.PreCacheItem("lightstick_mp"); GSCFunctions.PreCacheItem("killstreak_double_uav_mp"); GSCFunctions.PreCacheItem("strike_marker_mp"); GSCFunctions.PreCacheItem("killstreak_helicopter_minigun_mp"); GSCFunctions.PreCacheItem("airdrop_juggernaut_def_mp"); GSCFunctions.PreCacheItem("uav_strike_missile_mp"); GSCFunctions.PreCacheItem("uav_strike_projectile_mp"); GSCFunctions.PreCacheItem("iw5_xm25_mp"); GSCFunctions.PreCacheItem("iw5_riotshield_mp"); GSCFunctions.PreCacheItem("harrier_missile_mp"); //turret-only GSCFunctions.PreCacheTurret("manned_minigun_turret_mp"); GSCFunctions.PreCacheTurret("manned_gl_turret_mp"); GSCFunctions.PreCacheItem("remote_uav_weapon_mp"); GSCFunctions.PreCacheItem("aamissile_projectile_mp"); //Hacking in all fx //smoke /* * string[] smoke_fx; * smoke_fx = Directory.GetFiles(@"H:\USBFORMAT\MW3 GSCs\devraw\fx\smoke"); * for (int i = 0; i < smoke_fx.Length; i++) * { * GSCFunctions.LoadFX("smoke/" + smoke_fx[i].Split('\\')[6].Replace(".FXE", "")); * } * string[] prop_fx; * prop_fx = Directory.GetFiles(@"H:\USBFORMAT\MW3 GSCs\devraw\fx\props"); * for (int i = 0; i < prop_fx.Length; i++) * { * GSCFunctions.LoadFX("props/" + prop_fx[i].Split('\\')[6].Replace(".FXE", "")); * } * string[] dust_fx; * dust_fx = Directory.GetFiles(@"H:\USBFORMAT\MW3 GSCs\devraw\fx\dust"); * for (int i = 0; i < dust_fx.Length; i++) * { * GSCFunctions.LoadFX("dust/" + dust_fx[i].Split('\\')[6].Replace(".FXE", "")); * } * string[] exp_fx; * exp_fx = Directory.GetFiles(@"H:\USBFORMAT\MW3 GSCs\devraw\fx\explosions"); * for (int i = 0; i < exp_fx.Length; i++) * { * GSCFunctions.LoadFX("explosions/" + exp_fx[i].Split('\\')[6].Replace(".FXE", "")); * } * string[] impact_fx; * impact_fx = Directory.GetFiles(@"H:\USBFORMAT\MW3 GSCs\devraw\fx\impacts"); * for (int i = 0; i < 100; i++) * { * GSCFunctions.LoadFX("impacts/" + impact_fx[i].Split('\\')[6].Replace(".FXE", "")); * } * string[] shellejects_fx; * shellejects_fx = Directory.GetFiles(@"H:\USBFORMAT\MW3 GSCs\devraw\fx\shellejects"); * for (int i = 0; i < shellejects_fx.Length; i++) * { * GSCFunctions.LoadFX("shellejects/" + shellejects_fx[i].Split('\\')[6].Replace(".FXE", "")); * } * string[] fire_fx; * fire_fx = Directory.GetFiles(@"H:\USBFORMAT\MW3 GSCs\devraw\fx\fire"); * for (int i = 0; i < fire_fx.Length; i++) * { * GSCFunctions.LoadFX("fire/" + fire_fx[i].Split('\\')[6].Replace(".FXE", "")); * } */ GSCFunctions.LoadFX("fire/jet_afterburner_harrier"); GSCFunctions.LoadFX("smoke/jet_contrail"); GSCFunctions.LoadFX("misc/aircraft_light_red_blink"); GSCFunctions.LoadFX("misc/aircraft_light_wingtip_red"); GSCFunctions.LoadFX("misc/aircraft_light_wingtip_green"); _airdropCollision = GSCFunctions.GetEnt("care_package", "targetname"); _airdropCollision = GSCFunctions.GetEnt(_airdropCollision.Target, "targetname"); GSCFunctions.PreCacheMpAnim("viewmodel_airdrop_marker_sprint_loop"); //GSCFunctions.PreCacheMpAnim("viewmodel_claymore_idle"); string[] testAnims = new string[] { "pb_crouch_grenade_idle", "pb_crouch_stickgrenade_idle", "pb_crouch_grenade_pullpin", "pb_crouch_alert", "pb_crouch_ads", "pb_crouch_alert_pistol", "pb_crouch_ads_pistol", "pb_crouch_alert_unarmed", "pb_crouch_alert_akimbo", "pb_crouch_alert_shield", "pb_chicken_dance", "pb_chicken_dance_crouch", "pb_crouch_bombplant", "pb_crouch_remotecontroller", "pb_hold_idle", "pb_crouch_hold_idle", "pb_crouch_alert_RPG", "pb_crouch_ads_RPG" }; //foreach (string anim in testAnims) //GSCFunctions.PreCacheMpAnim(anim); fx_eyes = GSCFunctions.LoadFX("misc/aircraft_light_wingtip_red"); PlayerConnected += OnPlayerConnected; //GSCFunctions.SetDvar("scr_diehard", 2); GSCFunctions.SetDevDvar("developer", 2); GSCFunctions.SetDevDvar("developer_script", 1); GSCFunctions.SetDvarIfUninitialized("scr_showNotifyMessages", 1); GSCFunctions.SetDvar("scr_game_playerwaittime", 0); GSCFunctions.SetDvar("scr_game_matchstarttime", 0); Notified += new Action <int, string, Parameter[]>((ent, message, parameters) => { //if (message == "trigger") return; if (GSCFunctions.GetDvarInt("scr_showNotifyMessages") == 0) { return; } if (parameters.Length > 0) { foreach (string p in parameters) { Utilities.PrintToConsole(ent.ToString() + ": " + message + ":" + p); } } else { Utilities.PrintToConsole(string.Format("{0} Notified " + message, ent)); } }); level = Entity.GetEntity(2046); /* * GSCFunctions.SetSunlight(new Vector3(0, 0, 1)); * GSCFunctions.VisionSetNaked("cobra_sunset3"); * for (int i = 18; i < 2000; i++) * { * Entity ent = GSCFunctions.GetEntByNum(i); * if (ent == null) continue; * string entModel = ent.Model; * * if (entModel == "vehicle_hummer_destructible") * ent.SetModel("com_satellite_dish_big"); * else if (ent.TargetName == "explodable_barrel") * { * Entity col = GSCFunctions.GetEnt(ent.Target, "targetname"); * if (col != null) col.Delete(); * ent.Delete(); * } * else if (ent.TargetName == "animated_model") * { * ent.ScriptModelClearAnim(); * ent.Delete(); * Entity placeholder = GSCFunctions.Spawn("script_model", Vector3.Zero); * } * } */ //StartAsync(testFunc()); //StartAsync(dumpHud()); }
public static Entity GetBombTarget(Entity bomb) => GSCFunctions.GetEnt(bomb.Target, "targetname");
public static Entity GetBombs(string name) => GSCFunctions.GetEnt(name, "targetname");