PDA

View Full Version : Spawn Point Script 0


Troll2k
08-12-2011, 11:24 PM
What is Spawn Point Script 0?

What is it used for?

How do you use it?

ATAG_Bliss
08-13-2011, 08:24 PM
What is Spawn Point Script 0?

What is it used for?

How do you use it?

I think it actually means SpawnPoint ScriptOn (with the n cut off)

Basically this is to spawn AI (planes/tanks etc.) at different times from mission start. If you don't check the SpawnPoint ScriptOn that group of AI (regardless if you have them scripted in or not) will all spawn on mission startup. So you make a trigger with TTime (for time delay - as an example) and an action for that trigger (spawn air group - to spawn AI planes) and from that action you choose the airgroup (similar to setting a target with the FMB - the target recticle will show up and you can hover over the spawn point for w/e airgroup you want to spawn) and then you put the scripts in the scripts window. In that window you can also left click and "compile" to check to see your script is ok.

Here's a tidbit from Kodiac that taught me how it works:

You can also script a Mission with C#
for example to spawn the airgroup with a script
Make a trigger with name "SpawnAirgroup1" and a action "Airgroup1" and insert following code in the script window.


using System;
using maddox.game;
using maddox.game.world;


public class Mission : maddox.game.AMission
{

public override void OnTrigger(int missionNumber, string shortName, bool active)
{
base.OnTrigger(missionNumber, shortName, active);

if ("SpawnAirgroup1".Equals(shortName) && active)
{
AiAction action = GamePlay.gpGetAction("Airgroup1");
if (action != null)
{
action.Do();
}
GamePlay.gpHUDLogCenter("Spitfires near");
GamePlay.gpGetTrigger(shortName).Enable = false;
}
}
}


With scripts you are much more flexible.

I've made tutorials about scripting in german (my english is to bad :():
http://forum.sturmovik.de/index.php/topic,689.0.html
http://forum.sturmovik.de/index.php/topic,695.0.html
http://forum.sturmovik.de/index.php/topic,699.0.html
http://forum.sturmovik.de/index.php/topic,711.0.html
http://forum.sturmovik.de/index.php/topic,721.0.html
http://forum.sturmovik.de/index.php/topic,727.0.html
http://forum.sturmovik.de/index.php/topic,764.0.html

Lookaloft
08-20-2011, 03:49 PM
How can I insert scripts in scripts window?

FG28_Kodiak
08-20-2011, 04:25 PM
Copy the script with CTRL+C, click in the script window and paste it with CTRL+V.
You can also create a txt-file, paste the text, then save the txt under the same name as the mission with a .cs.
For example if you have a mission MyMission.mis then you must name the Script file MyMission.cs. The advantage of this method is that you can use better editors like Notepad++ or if you like MS Visual C# Express.

Lookaloft
08-21-2011, 10:49 AM
Thanks very much Kodiak for your help. Now I successfully launched an example mission from your Mission Editor “Scripting for Dummies”. Got the message: “Ziel erreicht” as four Emils did their job quite well.