![]() |
#51
|
|||
|
|||
![]() Quote:
|
#52
|
||||
|
||||
![]()
Regarding ticks.
1) naryv (dev) said that 30 ticks are around 1 second. Because of that "around", you can get errors. ![]() 2) No one said that single tick always takes the same amount of time (if so, lag can screw your timing badly). |
#53
|
|||
|
|||
![]() Quote:
![]() please ![]() |
#54
|
|||
|
|||
![]()
30 ticks ~ 1 sec
Tested this. Works most of the time I think )) Thanks to all for scripts! Code:
using System; using maddox.game; using maddox.game.world; using System.Collections.Generic; public class Mission : AMission { // loads my sub-missions public override void OnTickGame() { if (Time.tickCounter() % 72000 == 18000) // 40-10 { GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/128BoF/128BoFsmGroundv1_0.mis"); GamePlay.gpHUDLogCenter("Protect friendly shipping in the channel near France!"); } if (Time.tickCounter() % 72000 == 71999) // 40-40 { GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/128BoF/128BoFsmBombersv1_0.mis"); GamePlay.gpHUDLogCenter("Intel: Enemy bombers are heading to blue airfields!"); } if (Time.tickCounter() % 72000 == 45000) // 40-25 { GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/128BoF/128BoFsmBombersv1_0a.mis"); GamePlay.gpHUDLogCenter("Intel: Enemy bombers are heading to red airfields in France!"); } } // destroys aircraft abandoned by a player public void _DespawnEmptyPlane(AiActor actor) { if (actor == null) { return; } Player[] Players = GamePlay.gpRemotePlayers(); bool PlaneIsEmpty = true; foreach (Player i in Players) { if ((i.Place() as AiAircraft) == (actor as AiAircraft)) { PlaneIsEmpty = false; break; } } if ((PlaneIsEmpty) && (actor as AiAircraft).IsAirborne()) { (actor as AiAircraft).hitNamed(part.NamedDamageTypes.ControlsElevatorDisabled); (actor as AiAircraft).hitNamed(part.NamedDamageTypes.ControlsAileronsDisabled); (actor as AiAircraft).hitNamed(part.NamedDamageTypes.ControlsRudderDisabled); (actor as AiAircraft).hitNamed(part.NamedDamageTypes.Eng0TotalFailure); //for 2mots (actor as AiAircraft).hitNamed(part.NamedDamageTypes.Eng1TotalFailure); //then wait 10min Timeout(600.0, () => { (actor as AiAircraft).Destroy(); }); } else if (PlaneIsEmpty) { (actor as AiAircraft).Destroy(); } } public override void OnPlaceLeave(Player player, AiActor actor, int placeIndex) { base.OnPlaceLeave(player, actor, placeIndex); _DespawnEmptyPlane(actor); } // destroys crushlanded aircraft in 10 minutes public override void OnAircraftCrashLanded(int missionNumber, string shortName, AiAircraft aircraft) { base.OnAircraftCrashLanded(missionNumber, shortName, aircraft); Timeout(600, () => { aircraft.Destroy(); }); } } |
#55
|
|||
|
|||
![]()
Valuable note from a developer here
Quote:
ATM we have some knowledge on the following: - triggers to check if mission objectives are complete - scripts to load new mission objectives into a current mission based on triggers - simple interface to give players new objectives GamePlay.gpHUDLogCenter Say if enemy tanks are destroyed in a mission, we can move frontline, change one airfield spawnpoint from blue to red and load next mission objectives. But a good interface mod would be extremely useful to show different briefings based on airfields selected, to allow relocating airgroups from airfield to airfield, manage fuel resources, routes of supply convoys, voting for a commander, etc. There is a great game-mode mod called "Warfare" in ArmA2. I hope we can create something similar and better. |
#56
|
|||
|
|||
![]()
This sample to use Time.current()
count in seconds from started battle. Code:
private double nextMsgTime = 0; public override void OnTickGame() { base.OnTickGame(); // Time. current() in seconds from Battle Start if ( Time.current() > nextMsgTime ) { nextMsgTime = Time.current() + 10.0; // 10 seconds to next message GamePlay.gpHUDLogCenter( "Time elapsed (in seconds) = " + Time.current() + ", next message will be at "+nextMsgTime); } } |
#57
|
|||
|
|||
![]()
These all are very useful posts, in fact I have borrowed a bit of the script for my own mission that I hope will appear on the Syndicate Server soon.
I have a few questions as I know nothing about these scripts 1) If I want the text that comes up with the 'GamePlay.gpHUDLogCenter' command to show to only one team, can this be done and if so how? 2) I have noriced that using these scripts with the spawn removal stops the in game action and trigger events working where it spawns an aircraft. Is there a way of using both? Keep up the good work, and thanks for your help in advance. |
#58
|
|||
|
|||
![]() Quote:
2) Did not quite get what you mean by "spawn removal" and "trigger events working where it spawns an aircraft". Could you clarify please. |
#59
|
|||
|
|||
![]()
New bits of code from devs.
Shows mission objectives to players depending on side and aircraft type (fighter/bomber). "hitler caput" lol Code:
public override void OnPlaceEnter(Player player, AiActor actor, int placeIndex) { base.OnPlaceEnter(player, actor, placeIndex); AiAircraft aircraft = actor as AiAircraft; if (aircraft != null) switch (aircraft.Army()) { case 1: if (aircraft.Type() == AircraftType.Bomber) { GamePlay.gpHUDLogCenter(new Player[] {player},"Red Bomber, Bomb it all, hitler caput"); } else { GamePlay.gpHUDLogCenter(new Player[] { player }, "Red Fighter, fight them all"); } break; case 2: if (aircraft.Type() == AircraftType.Bomber) { GamePlay.gpHUDLogCenter(new Player[] { player }, "Das bomber!"); } else { GamePlay.gpHUDLogCenter(new Player[] { player }, "Das jager!"); } break; } } public override void OnAircraftTookOff(int missionNumber, string shortName, AiAircraft aircraft) { base.OnAircraftTookOff(missionNumber, shortName, aircraft); if (GamePlay.gpPlayer().Place() != aircraft) return; switch (aircraft.Army()) { case 1: if (aircraft.Type() == AircraftType.Bomber) { GamePlay.gpHUDLogCenter(new Player[] { GamePlay.gpPlayer() }, "Red Bomber, Bomb it all, hitler caput"); } else { GamePlay.gpHUDLogCenter(new Player[] { GamePlay.gpPlayer() }, "Red Fighter, fight them all"); } break; case 2: if (aircraft.Type() == AircraftType.Bomber) { GamePlay.gpHUDLogCenter(new Player[] { GamePlay.gpPlayer() }, "Das bomber!"); } else { GamePlay.gpHUDLogCenter(new Player[] { GamePlay.gpPlayer() }, "Das jager!"); } break; } } Last edited by Ataros; 04-28-2011 at 05:03 PM. |
#60
|
|||
|
|||
![]()
Hi Ataros,
Hopefully I will be a little more clear this time! I used the in-game script system using a Trigger to cause an Action to happen. Eg in my missions if a plane I select is shot down, it triggers the spawn of another plane. EDIT>Script Trigger: Walrus 1= Target Group destroyed (Walrus flying boat selected) Action: Walrus 1= Air spawn group (second walrus selected) This system works in single player, so that when the first walrus is shot down a second spawns at a preselected place. However, when I include the scripts you guys have been developing to despawn empty aircraft (for use online) the ingame script above does not work in either single or multiplayer. Any ideas what i am doing wrong? |
![]() |
|
|