![]() |
|
|
|
#1
|
|||
|
|||
|
Quote:
I have noticed that the time counter isnt 100% accurate - the planes appears a couple of minutes soon than what they should... bug? Ross |
|
#2
|
|||
|
|||
|
Destroys crashlanded aircraft in 5 seconds ))
Code:
public override void OnAircraftCrashLanded(int missionNumber, string shortName, AiAircraft aircraft)
{
base.OnAircraftCrashLanded(missionNumber, shortName, aircraft);
Timeout(5, () =>
{
aircraft.Destroy();
});
}
Just notes for myself on timing. Not processed by program. if (Time.tickCounter() % 72000 == 72000) is wrong probably. Last edited by Ataros; 04-27-2011 at 04:34 PM. |
|
#3
|
|||
|
|||
|
someone help me here :S
Main map starts at 05:00 - like the rest of the "sub" maps Code:
using System;
using maddox.game;
using maddox.game.world;
using System.Collections.Generic;
public class Mission : AMission
{
public override void OnTickGame()
{
if (Time.tickCounter() % 54000 == 18000)
{
GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/Ross/OnlineBOBb1.mis");
GamePlay.gpHUDLogCenter("Intel: 4x He115's, Heading for Convoy!");
}
if (Time.tickCounter() % 99000 == 36000)
{
GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/Ross/OnlineBOBb2.mis");
GamePlay.gpHUDLogCenter("Intel: 8x He111's, Heading for Lympne!");
}
if (Time.tickCounter() % 108000 == 27000)
{
GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/Ross/OnlineBOBr1.mis");
GamePlay.gpHUDLogCenter("Intel: 12xBlenheim, Heading for Calais Marck!");
}
}
public override void OnPlaceLeave(Player player, AiActor actor, int placeIndex)
{
base.OnPlaceLeave(player, actor, placeIndex);
Timeout(1, () =>
{
AiAircraft CurAircraft = player.Place() as AiAircraft;
AiAircraft PrevAircraft = actor as AiAircraft;
if (CurAircraft != PrevAircraft)
{ (actor as AiAircraft).Destroy(); }
});
}
}
He 115 starts at 05:09 - 1 min fast Blenheim starts at 05:13 - 7 min fast!! He 111 starts at 05:18 - 3 min late?! Whats going on :S :S :S |
|
#4
|
|||
|
|||
|
Check attachment...
Is the last comment for me or :S Last edited by mcler002; 04-27-2011 at 05:40 PM. Reason: Noticed a mistake from human error :D |
|
#5
|
||||
|
||||
|
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 05:21 PM. |
|
#6
|
|||
|
|||
|
Quote:
Code:
if (Time.tickCounter() % 72000 == 71999) |
|
#7
|
|||
|
|||
|
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 06:16 PM. |
|
#8
|
|||
|
|||
|
Quote:
|
|
#9
|
||||
|
||||
|
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). |
|
#10
|
||||
|
||||
|
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) |
![]() |
|
|