/// <summary> /// Task SupportHeli gunners to rappel down to the ground (and become ground crew). /// </summary> /// <param name="role">Ground crew role; weapons are assigned based on role</param> /// <returns>Array of <c>Ped</c> rappeling</returns> public Ped[] groundCrewRappelDown(GroundCrewRole role, GroundCrewSettings crewSettings) { // make sure there are gunners in the crew seats Ped[] newGroundCrew = new Ped[] { spawnCrewGunner( seatSelection[seatIndex % seatSelection.Length], CrewHandler.weaponsOfRoles[role], getRandomPedModel(crewSettings)), //spawnCrewGunner(VehicleSeat.RightRear, CrewHandler.weaponsOfRoles[role]), }; seatIndex++; // apply settings to each gunner, instruct each gunner to rappel, and add to player's PedGroup foreach (Ped crew in newGroundCrew) { crewSettings.applySettingsToPed(crew); crew.Task.RappelFromHelicopter(); bool res; int i = 0; do { res = configureGroundCrew(crew); i++; } // if unsuccessful, do again until it does succeed while (!res && i < maxConfigureAttempts); } GTA.UI.Notification.Show("Active Ground Crew: " + leaderPedGroup.MemberCount); return(newGroundCrew); }
/// <summary> /// Read settings from INI file and instantiate necessary data structures with the settings. /// </summary> private void readSettings(bool verbose = false) { // init ScriptSettings ScriptSettings ss = base.Settings; // read in general settings string sec = "General"; activateKey = ss.GetValue <Keys>(sec, "activate", activateKey); // read in settings for Attack Heli sec = "AttackHeli"; attackHeli = new Attackheli( ss.GetValue <string>(sec, "HeliModel", "Akula"), ss.GetValue <float>(sec, "height", 20f), ss.GetValue <float>(sec, "radius", 20f), ss.GetValue <bool>(sec, "bulletproof", true), ss.GetValue <bool>(sec, "spawnFarAway", false) ); RelationshipGroup heliRg = attackHeli._rg; // read in settings for Support Heli sec = "SupportHeli"; supportHeli = new SupportHeli( ss.GetValue <string>(sec, "HeliModel", "Polmav"), ss.GetValue <float>(sec, "height", 20f), ss.GetValue <float>(sec, "radius", 20f), ss.GetValue <bool>(sec, "bulletproof", true), ss.GetValue <bool>(sec, "spawnFarAway", false) ); supportHeli._rg = heliRg; // read in settings for Strafe Run sec = "JetStrafeRun"; strafeRunActivateKey = ss.GetValue <Keys>(sec, "activateKey", strafeRunActivateKey); strafeRun = new StrafeRun( ss.GetValue <float>(sec, "spawnRadius", 375f), ss.GetValue <float>(sec, "spawnHeight", 275f), ss.GetValue <float>(sec, "targetRadius", 50f), ss.GetValue <int>(sec, "bombsPerPlane", 2), ss.GetValue <bool>(sec, "cinematic", true) ); // read in settings for ground crew crewSettings = new GroundCrewSettings(ss); // manipulate heliRg Helper.makeRelationshipGroupHate(heliRg, Helper.defaultHateGroups); }
/// <summary> /// Spawn and task 2 ground crew NPCs to rappel down from the SupportHeli. If no <c>GroundCrewRole</c> /// is specified, one will be chosen at random. /// </summary> /// <returns>Array of <c>Ped</c></returns> public Ped[] groundCrewRappelDown(GroundCrewSettings crewSettings) { Array roles = Enum.GetValues(typeof(GroundCrewRole)); return(groundCrewRappelDown((GroundCrewRole)roles.GetValue(rng.Next(0, roles.Length)), crewSettings)); }
/// <summary> /// Select a random ground crew model from <c>GroundCrewSettings</c> /// </summary> /// <param name="crewSettings">instance of <c>GroundCrewSettings</c></param> /// <returns><c>Model</c></returns> protected Model getRandomPedModel(GroundCrewSettings crewSettings) { int modelIndex = rng.Next(0, crewSettings.modelArray.Length); return(crewSettings.modelArray[modelIndex]); }