![]() |
|
#1
|
||||
|
||||
![]()
This will always result in FALSE. % gives you a remainder of division (Остаток от деления), so this operation will always give result greater or equal to 0 and less than divisor (assuming positive numbers).
Code:
if (Time.tickCounter() % 72000 == 0) Last edited by ZaltysZ; 04-27-2011 at 04:21 PM. |
#2
|
|||
|
|||
![]() Quote:
Code:
if (Time.tickCounter() % 72000 == 71999) |
#3
|
|||
|
|||
![]()
The % is the modulus operator in C# (C, C++ and others)
http://en.wikipedia.org/wiki/Modulo_operation Last edited by FG28_Kodiak; 04-27-2011 at 05:16 PM. |
#4
|
|||
|
|||
![]() Quote:
|
#5
|
||||
|
||||
![]()
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). |
#6
|
|||
|
|||
![]() Quote:
![]() please ![]() |
#7
|
||||
|
||||
![]() Quote:
Code:
if (Time.tickCounter() % A == B) A = 30 * amount second of seconds you want to repeat something B = 30 * amount second you want to offset (delay) from beginning of mission I suppose you want to delay something by 72000 and not by 71999 (although the difference is only 1/30s). So: Code:
if (Time.tickCounter() % 72000 == 0 && Time.tickCounter()-72000==0) |
#8
|
|||
|
|||
![]()
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(); }); } } |
#9
|
|||
|
|||
![]()
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. |
#10
|
|||
|
|||
![]()
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); } } |
![]() |
|
|