Official Fulqrum Publishing forum

Official Fulqrum Publishing forum (http://forum.fulqrumpublishing.com/index.php)
-   FMB, Mission & Campaign builder Discussions (http://forum.fulqrumpublishing.com/forumdisplay.php?f=203)
-   -   Online War - FMB scripting (http://forum.fulqrumpublishing.com/showthread.php?t=21518)

klem 05-20-2011 09:57 AM

Quote:

Originally Posted by TheEnlightenedFlorist (Post 285993)
Hi klem, I think the best way to accomplish that would be to use a trigger, action, and a script..................

Thanks! I think I even understand that. Simpler than I expected :)

I've set up the Trigger, Action and Script, just got to add the rest of the waypoints. I'll finish it tonight and try it out.

Cheers

SYN_Flashman 05-20-2011 10:16 AM

I have just had a thought about scripts that start submissions.... can the submissions themselves have scripts? I think they can: when first testing the submission script i accidentally left a script in one of the submissions and it took ages for me to work out what the hell was going on!

Im at work so I can't test this but here is an idea to allow a mission to repeat every 2 hours or so. A few posts up I related how im having trouble doing this with the repeat part of the script but an alternative method might be this:

MAIN MISSION SCRIPT: Spawn bombergroup1 submission after 15 mins server time. NO repeats

15 mins main server time > bombergroup1 submission starts. It has a script itself which says: Spawn bombergroup 1 after 2 hours (i.e. it starts itself again)

2hr 15 min main server time> bombergroup1 submission starts again...

If this works correctly then so long as the server is running every two hours the bombergroup1 submission will spawn.

the bombergroup1 submission will last approx 90 mins plus however long it takes to despawn the landed/crashed planes (using Atatos et als script..which works well!). In other words it should finish and the aircraft despawn BEFORE it starts again.

Questions:

1) has anyone tried this? (I will later... damn I hate work!!)

2) when the submission starts, does it start its own tickcount from its creation, or does it 'read' the master mission tick count?

This is important because if it starts its own tickcount then the second time the bomber group spawns it will be 2 hours after the first. If however it uses the master mission tickcount it might start after 2 hours server time, but this is only 1 hr 45 after the first submission starts. This might mean that the next subsequent submission will not start at all.

3) Am i making any sense whatsoever?

PS I know that the tickcount isn't truly accurate with regards to time, but its close enough for my needs.

ZaltysZ 05-20-2011 10:26 AM

Quote:

Originally Posted by SYN_Flashman (Post 286039)
1) has anyone tried this? (I will later... damn I hate work!!)

Yes.

Quote:

Originally Posted by SYN_Flashman (Post 286039)
2) when the submission starts, does it start its own tickcount from its creation, or does it 'read' the master mission tick count?

I am at work too, so not sure, but I think Time comes from Battle and not from Mission. Basically Battle has its own OnTickGame() which iterates through all missions and calls their OnTickGame().


Quote:

Originally Posted by SYN_Flashman (Post 286039)
I3) Am i making any sense whatsoever?

Depends on what you want to do. :)

Ataros 05-20-2011 12:18 PM

Quote:

Originally Posted by Flashman (Post 285979)
its this part that doesn't seem to work:
if (Time.tickCounter() % 216000 == 27000)

Try reducing timings for testing purposes setting e.g. 3 min repeat 1 min delay and see what happens.

SYN_Flashman 05-20-2011 12:31 PM

Quote:

Originally Posted by Ataros (Post 286098)
Try reducing timings for testing purposes setting e.g. 3 min repeat 1 min delay and see what happens.

Should have mentioned this earlier.... I did test it with lower fihures and it worked.

probably should have mentioned that...

Ataros 05-20-2011 12:42 PM

Than it should work with bigger figures if you set the 1st figure greater than the 2nd in all cases. Try showing the complete code maybe someone finds a mistake in another part that influences this part. It helped me 2 times at least.

klem 05-21-2011 07:38 AM

I am using the following script to send an immediate message to the player when he enters the cockpit (picked up earlier from this thread):

Quote:

//SEND MESSAGE TO PLAYER WHEN THEY ENTER THE COCKPIT

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},"Get Organised! Attack briefed targets. Get escorts where possible!"); }
else
{ GamePlay.gpHUDLogCenter(new Player[] { player }, "Get Organised! Watch for Radar Controller information, plan your tactics and meet the enemy! Provide escort for bombers where possible."); }
break;
case 2:
if (aircraft.Type() == AircraftType.Bomber)
{ GamePlay.gpHUDLogCenter(new Player[] { player }, "Get Organised! Attack briefed targets. Get escorts where possible!"); }
else
{ GamePlay.gpHUDLogCenter(new Player[] { player }, "Get Organised! Escort our Bombers or locate and engage enemy fighters in Frei Jagd"); }
break;
}
}
}
Will all players see that or only the new player? If all will see it and I only want the new player to see it do I fit in something like the following?......

if (aircraft.Name (). Equals (GamePlay.gpPlayer (). Place (). Name ()))

edit:
And sorry to be so dumb but I want to get a carriage return/line feed into the longer messages. I tried:
{ GamePlay.gpHUDLogCenter(new Player[] { player }, "Get Organised! Watch for Radar Controller information. \r\n Plan your tactics and meet the enemy! Provide escort for bombers where possible."); }
but it doesn't like it. Any ideas?

Ataros 05-21-2011 10:34 AM

I think you should add Divebomber type to this script as stated here
http://forum.1cpublishing.eu/showpos...1&postcount=63

Can not answer other questions.

klem 05-21-2011 03:06 PM

Quote:

Originally Posted by Ataros (Post 286756)
I think you should add Divebomber type to this script as stated here
http://forum.1cpublishing.eu/showpos...1&postcount=63

Can not answer other questions.

Thanks, I have done that :)

Flashman 05-23-2011 06:12 PM

Im trying different things with these scripts by picking through other peoples. I have been trying various methods to ensure missions repeat, though so far they only repeat once for some reason.

Anyway instead of using the tick counter i have been looking at the init time settings people have been using. If i understand it correctly this allows a certaqin number of seconds to pass before carrying out whatever command you set.

This is a test script I am having problems with:

PHP Code:

 using System;
using maddox.game;
using maddox.game.world;
using System.Collections.Generic;

public class 
Mission AMission
{
     public 
override void OnTickGame() 
    {
     
double initTime 0.0;

      
Timeout(initTime += 60, () =>
    
            {    
GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/Channelv1/BM2/sb1d.mis");    
                
GamePlay.gpHUDLogCenter("Intel: Stuka raid 1XXX inbound at Angels 13, heading W"); 
            });

        }


The purpose of the script is to run this mission (sb1d) 60 seconds after the script starts. It also has to only run the mission once. In this case the mission consists of a single AI stuka spawning, flying and then landing. Like I say, a simple test mission.

However when I test the mission, endless stukas spawn and blow each other up, in other words far more than 1!!!!

I have no idea about scripts, I have been picking bits out of other peoples, inserting them, hitting 'compile' and then testing the effects in game. I would be grateful if anyone can have a look and see where I am going wrong.


All times are GMT. The time now is 04:49 PM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2007 Fulqrum Publishing. All rights reserved.