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)
-   -   Any Other Cool Features? (http://forum.fulqrumpublishing.com/showthread.php?t=26513)

Gerbil Maximus 09-27-2011 09:12 AM

Any Other Cool Features?
 
Hey all,

Been making a test mission for MP, and trying to add any thing that is cool to it.

So far I have the ambulance and airfield vehicles script.
I want Trains but they dont work sadly.

Does anyone else know of any other cool features i could add to my mission?

Also how do i add multiple scripts? I have the above script running but i also want to add the remove non ai aircraft when player leaves script from below:

Quote:

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

public class Mission : AMission
{
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).Destroy(); }
}

public override void OnPlaceLeave(Player player, AiActor actor, int placeIndex)
{
base.OnPlaceLeave(player, actor, placeIndex);
Timeout(1, () =>
{
_DespawnEmptyPlane(actor);
});
}
}
Thank you

The Gerbil

Ataros 09-27-2011 12:30 PM

Usually you can just add it inside brackets of the existing script

public class Mission : AMission
{
// all scripts here
}

But keep in mind that you can have only one instance of each method. E.g. if you already have the method OnPlaceLeave used in the old script you should add OnPlaceLeave part of the new script into this method of the old script.

Search the forum for missions by stillborn, hc_wolf, adonys, theenlightenedflorist, snafu, Kodiak and others for more ideas of cool scripts.

adonys 09-27-2011 12:37 PM

uhm.. not really.. I haven't really tried it, but I think you can use the cascaded inheritances of the same method.


Code:

public override void OnBattleStarted()
    {
        base.OnBattleStarted();
        ...
    }


Ataros 09-27-2011 12:43 PM

Quote:

Originally Posted by adonys (Post 341373)
the cascaded inheritances of the same method.


Code:

public override void OnBattleStarted()
    {
        base.OnBattleStarted();
        ...
    }


Sorry, I do not know what it means :) Maybe you can explain.

I had a script error when I tried to copy a second instance of some method (onTrigger or onActorCreated) to the same script placing it below the 1st one.

adonys 09-27-2011 02:50 PM

inheritance should only work in different scripts.

base MG script
Code:

public override void OnBattleStarted() {
    code1
}

main mission
Code:

public override void OnBattleStarted() {
    base.OnBattleStarted();
    code2
}

secondary loaded mission
Code:

public override void OnBattleStarted() {
    base.OnBattleStarted();
    code3
}

Theoretically, after loading the secondary mission and its cs file, calling the OnBattleStarted() function should execute code1, then code2, then code3


All times are GMT. The time now is 06:43 AM.

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