View Full Version : Scripts collection
Ataros
09-27-2011, 07:25 PM
As some found the previous collection useful I added some recent missions including Repka ones, sorted files and translated some filenames into English.
The collection contains script examples and missions posted in the FMB forum section on 1C forum http://forum.1cpublishing.eu/forumdisplay.php?f=203 and on sukhoi.ru forum http://sukhoi.ru/forum/forumdisplay.php?f=192
I am not the author of the scripts or missions.
Hope the files can be helpful to beginners starting to learn C#. Some useful links are listed in my sig. More advanced help can be always found on the above mentioned forums.
Sorry, I did not save names of all the authors of the scripts and missions. Please let me know if you want your name to be included. If your mission or script is not included in the archive please post it below in the thread to keep it up-to-date for new C# learners.
If you have questions on some particular scripts or a request for a new script please do not post them in this thread but start a separate thread with a question/request if you can not find a solution using forum search function. Let's keep this thread for publishing learning material only to make it easier to find script samples.
upd. Please discuss in this thread http://forum.1cpublishing.eu/showthread.php?t=26527
EDIT: Important coop scripts:
COOP script by naryv
http://forum.1cpublishing.eu/showthread.php?p=354537#post354537
COOP script by 41Sqn_Banks
http://forum.1cpublishing.eu/showthread.php?t=28559
NEW version: http://forum.1cpublishing.eu/showthread.php?p=469603&posted=1#post469603
Ataros
09-27-2011, 07:56 PM
RESOURCES
Scripting tutorials
by FG28_Kodiak
http://translate.google.com/translate?hl=en&sl=de&tl=en&u=http%3A%2F%2Fforum.sturmovik.de%2Findex.php%2Fbo ard%2C17.0.html
FMB forums
@ airwarfare.com http://www.airwarfare.com/sow/index.php?option=com_kunena&func=showcat&catid=43&Itemid=54
@ sukhoi.ru http://translate.google.com/translate?hl=en&sl=ru&tl=en&u=http%3A%2F%2Fwww.sukhoi.ru%2Fforum%2Fforumdispla y.php%3Ff%3D234 naryv (a member of the dev team) can be contacted there in English e.g. in Questions thread
IL2 CoD Scripting evaluation
by adonys
http://forum.1cpublishing.eu/showthread.php?t=23959
FMB templates
http://forum.1cpublishing.eu/showpost.php?p=395523&postcount=22
http://forum.1cpublishing.eu/showthread.php?p=395523#post395523
Ataros
09-27-2011, 08:22 PM
More samples
SayToGroup messages script
by FG28_Kodiak
http://forum.1cpublishing.eu/showthread.php?t=26245&highlight=saytogroup
Script to Remove AI
by TheEnlightenedFlorist
http://www.airwarfare.com/sow/index.php?option=com_kunena&func=view&catid=43&id=539&Itemid=54
Start Airgroup Engines
by FG28_Kodiak
http://forum.1cpublishing.eu/showpost.php?p=341002&postcount=4
Custom ingame Mission Menu
by naryv
http://forum.1cpublishing.eu/showthread.php?t=25941
Mission Menu and Ambulance
by fearlessfrog
http://forum.1cpublishing.eu/showthread.php?t=26112
Death/ESC-Ban / Prison Camp Script
by FG28_Kodiak
http://forum.1cpublishing.eu/showpost.php?p=333766&postcount=7
Basic beginners script with comments
http://forum.1cpublishing.eu/showpost.php?p=279416&postcount=95
For complete beginners
how the 1st Repka mission was created
http://forum.1cpublishing.eu/showthread.php?t=21518
@ authors
If you post a script sample or a scripted mission somewhere please crosslink from this thread for learning purposes as I did above.
Many thanks from grateful students!
ATAG_Bliss
09-27-2011, 08:24 PM
Wow Ataros,
Very nice of you to gather up this collection.
Thank you!
Blackdog_kt
09-27-2011, 11:09 PM
Great job. I know you're the kind of person who will try to keep this updated, so here's a sticky for you ;)
Ataros
09-28-2011, 07:12 AM
Great job. I know you're the kind of person who will try to keep this updated, so here's a sticky for you ;)
Thank you!
I hope others help me as I can miss some valuable examples from this forum. On my side I will try to make sure everything worth mentioning that appears on sukhoi.ru is available here.
If you post a script example please link it from this thread. But please keep discussion of each specific script in separate threads.
upd. Please feel free to discuss in this thread http://forum.1cpublishing.eu/showthread.php?t=26527
_79_dev
09-28-2011, 11:00 PM
~S~
Very nice... Thanks Ataros...
Ataros
09-30-2011, 10:38 AM
Dynamic Mission Menu
- include building a list of available airgroups, etc.
- and how to combine several mission menus from various scripts into one
http://forum.1cpublishing.eu/showthread.php?t=26531
Read Flight Parameters by a Script
for creation of instrument panels, devicelink, etc.
http://forum.1cpublishing.eu/showthread.php?p=342338#post342338
Ataros
10-06-2011, 09:57 AM
IL2DCE: A dynamic campaign engine
http://forum.1cpublishing.eu/showthread.php?t=25076
Source code http://code.google.com/p/il2dce/source/browse/#svn%2Ftrunk%2FIL2DCE
Messages Scripts
http://forum.1cpublishing.eu/showthread.php?t=26444
http://forum.1cpublishing.eu/showthread.php?t=26623
http://forum.1cpublishing.eu/showpost.php?p=345082&postcount=2
Checking Offline Campaign Success Criteria scripts
http://forum.1cpublishing.eu/showthread.php?t=26617
Limiting Aircraft Types for Balance
http://forum.1cpublishing.eu/showthread.php?p=345076#post345076
Ataros
10-18-2011, 08:44 AM
Using Triggers to Spawn Airgroups
http://forum.1cpublishing.eu/showthread.php?t=26515
Using Stopwatch() in missions
http://forum.1cpublishing.eu/showpost.php?p=350672&postcount=45
Changing Airplanes via the Mission Menu
http://forum.1cpublishing.eu/showthread.php?t=26531
FMB hints
Attach trailers to vehicles? http://forum.1cpublishing.eu/showthread.php?t=26983
Setting Battle Area (Grid) http://forum.1cpublishing.eu/showthread.php?t=27025
Spawn Area and Spawn Points http://forum.1cpublishing.eu/showthread.php?t=26925 (search for more threads on the topic)
Ataros
10-20-2011, 09:47 PM
Make sure your code works on a localized game version.
Example: http://forum.1cpublishing.eu/showpost.php?p=352104&postcount=67
Ataros
10-26-2011, 08:55 AM
COOP script by naryv
http://forum.1cpublishing.eu/showthread.php?p=354537#post354537
COOP script by 41Sqn_Banks
http://forum.1cpublishing.eu/showthread.php?t=28559
Ataros
11-02-2011, 08:18 AM
Use OnTickTime to re-evaluate AI air group waypoints
http://forum.1cpublishing.eu/showthread.php?t=27533
Local weather sample mission
http://forum.1cpublishing.eu/showthread.php?t=27097
Randomising missions
http://forum.1cpublishing.eu/showthread.php?t=28207
Mission Loader - load missions from the ingame Mission Menu
http://forum.1cpublishing.eu/showthread.php?t=28056
Destroy all aircraft
http://forum.1cpublishing.eu/showthread.php?t=28533
Getting the actor type
http://forum.1cpublishing.eu/showthread.php?t=28611
Ataros
12-26-2011, 09:23 AM
Excellent mission sample by SNAFU featuring:
-Mission-Menu for missions, informations, support requests
-Team scoring system
-Supply system
-ESC and Death-Penalty System
-Planeset depending on team scores
- etc., etc.
DL http://airwarfare.com/sow/index.php?option=com_jdownloads&Itemid=53&task=view.download&catid=6&cid=200
Discussion http://forum.1cpublishing.eu/showthread.php?t=25064
Ataros
12-26-2011, 12:44 PM
Tracking player score from various submissions
http://www.sukhoi.ru/forum/showthread.php?t=68629&page=20&p=1758641&viewfull=1#post1758641
Connecting an external piece of code to your script. by Small_Bee
See an attachment.
BridgeMission.cs - mission script
RepkaBridge.cs - external code the above script uses
Ataros
01-05-2012, 08:19 AM
Ship oil fire effect script
http://forum.1cpublishing.eu/showthread.php?t=28889
Buildings fire
http://forum.1cpublishing.eu/showthread.php?t=28894
Ataros
01-08-2012, 10:16 AM
Language Manager Class by Small_Bee
http://forum.1cpublishing.eu/showpost.php?p=377349&postcount=6
----------------------
1st version of Operation Sealion by Small_Bee
The mission includes 3500+ lines script with many functions including vulching protection, moving frontlines, dynamic creation of spawns, economics/resource management, etc. The mission is provided for educational purposes only. Please contact the author for a permission to run it on a public server.
Search the script for PATH to change paths according to your system to run it. Known issues - memory leak due to extreme number of submissions loaded, will be fixed in a new version.
Ataros
01-13-2012, 11:24 AM
Simple HUD timer test script
http://forum.1cpublishing.eu/showthread.php?t=29045
How to use repeat programming in scripts
http://forum.1cpublishing.eu/showpost.php?p=378784&postcount=6
Sample http://forum.1cpublishing.eu/showpost.php?p=378791&postcount=7
Ataros
01-30-2012, 09:24 AM
Sending server console commands from script
Kick example
if (GamePlay is GameServerDef)
{
GameServerDef gameServer = (GameServerDef)GamePlay;
gameServer.consoleInput("kick player_name");
}
Therefore it is possible to automatically kick, ban, unban, save/load banlist and execute any other server commands from a script.
Thanks to Small_Bee for sharing.
Ataros
02-27-2012, 07:13 AM
Campaign Creation For Dummies
http://forum.1cpublishing.eu/showthread.php?t=30017
Smokeynz
02-27-2012, 07:17 PM
Method for mission listing within script
Method for Random selection of missions
Method for Triggered missions for Player
Method for Objective mission loading for Player
http://forum.1cpublishing.eu/showthread.php?t=30033
Ataros
04-24-2012, 09:50 AM
Radar script http://forum.1cpublishing.eu/showpost.php?p=411824&postcount=83
Gunnery practice mission http://forum.1cpublishing.eu/showthread.php?t=31460
_79_dev
12-22-2013, 12:05 AM
I found very useful lately IPlayer interface with all its goodies....
Here is example script to execute chat info in good old style
check available commands:
<stats , <guns, <kills, <stats<all, <tl, <te...etc
That is just simple examples but You can convert lot of things from game to it....
If Any one is interested to give it a go on servers let me know if You experience any troubles with it... There is some delay on data read and some things are not working or are just not activated maybe :)
Enjoy...
//$reference parts/core/Strategy.dll
//$reference parts/core/MySql.Data.dll
//$reference parts/core/System.Data.dll
//$reference parts/core/gamePlay.dll
#region timer
long Tick_Mission_Time { get; set; }// Sets the Mission Clock for Time Remaining in Mission.
Random random = new Random();//Function for Randomising events
Stopwatch stopWatch = new Stopwatch();
public string GetTimeElapsed()
{
string StringToReturn = "";
StringToReturn = "";
TimeSpan ts = stopWatch.Elapsed;
// Format and display the TimeSpan value.
string elapsedTime = String.Format("{0:00}h:{1:00}m:{2:00}s", ts.Hours, ts.Minutes, ts.Seconds);
StringToReturn = StringToReturn + elapsedTime;
return StringToReturn;
}
#endregion
#region Iplayer stats
public string GetDictionary<T>(Dictionary<string, T> ds)
{
StringBuilder sb = new StringBuilder();
foreach (string key in ds.Keys)
{
T d = ds[key];
if (sb.Length != 0)
{
sb.Append(", ");
}
//sb.AppnedFormat("[{0}]={1}", key, d);
sb.AppendFormat("[{0}]={1}", key, d);
}
return sb.ToString();
}
public string WritePlayerStatBase(Player player)
{
string Stats = "";
if (player is IPlayer)
{
IPlayerStat st = (player as IPlayer).GetBattleStat();
Stats = (String.Format("Take Offs: [{0}]; " + "Landings: [{1}]; " + "Deaths: [{2}]; " + "Bails: [{3}]; ",
st.takeoffs, st.landings, st.deaths, st.bails));
}
return Stats;
}
public string WritePlayerStatsGunnery(Player player)
{
string Stats = "";
if (player is IPlayer)
{
IPlayerStat st = (player as IPlayer).GetBattleStat();
if (st.bulletsFire != 0)
{
double accuracy = ((st.bulletsHit) / (st.bulletsFire)) * 100;
Stats = (String.Format("Accuracy: " + accuracy + " %;" + " Bullets Fired: [{0}]; " + "Bullets Hits: [{1}]; " + "Bullets Air Hits: [{2}]; ",
st.bulletsFire, st.bulletsHit, st.bulletsHitAir));
}
}
return Stats;
}
public string WritePlayerStatsKills(Player player)
{
string Stats = "";
if (player is IPlayer)
{
IPlayerStat st = (player as IPlayer).GetBattleStat();
Stats = (String.Format("Plane Kill Types: \"{0}\"; Planes Flown Types: \"{1}\";",
st.kills, GetDictionary(st.killsTypes), GetDictionary(st.tTotalTypes)));
}
return Stats;
}
public string WritePlayerStatsBombs(Player player)
{
string Stats = "";
if (player is IPlayer)
{
IPlayerStat st = (player as IPlayer).GetBattleStat();
Stats = (String.Format("Bombs Fired : [{0}]; " + "Bombs Hit : [{1}]; " + "Bombs Weight : [{2}]; " + "g kills: {3}; ",
st.bombsFire, st.bombsHit, st.bombsWeight, st.gkills[0]));
}
return Stats;
}
#endregion
#region Time Left
public string WriteTime_Remaining(Player player)
{
string Time_Remaining = "";
Tick_Mission_Time = ((32 * 60) * 240) - Time.tickCounter();
var Mission_Time = Tick_Mission_Time / 2000;
TimeSpan Convert_Ticks = TimeSpan.FromMinutes(Mission_Time);
Time_Remaining = string.Format("{0:D2}h:{1:D2}m:{2:D2}s", Convert_Ticks.Hours, Convert_Ticks.Minutes, Convert_Ticks.Seconds);
return Time_Remaining;
}
public string WriteTime_Elapsed(Player player)
{
string Time_Remaining = GetTimeElapsed();
return Time_Remaining;
}
#endregion
#region objectives
public string WriteRedObjectives(Player player)
{
string Objectives = Objective_Total_Red; ;
return Objectives;
}
public string WriteBlueObjectives(Player player)
{
string Objectives = Objective_Total_Blue;
return Objectives;
}
#endregion
#region chat
public void Chat(string line, Player player)
{
if (GamePlay is GameDef)
{
(GamePlay as GameDef).gameInterface.CmdExec("chat " + line + " TO " + player.Name());
}
}
void Mission_EventChat(IPlayer from, string msg)
{
if (msg.StartsWith("<obj"))
{
Chat("Red Triggers: " + WriteRedObjectives(from as Player), from);
//GamePlay.gpHUDLogCenter(new Player[] { from as Player }, "Time Elapsed is " + WriteObjectives(from as Player));
Chat("Blue Triggers: " + WriteBlueObjectives(from as Player), from);
//GamePlay.gpHUDLogCenter(new Player[] { from as Player }, "Time Elapsed is " + WriteObjectives(from as Player));
}
if (msg.StartsWith("<te"))
{
//Chat(Time_Elapsed(from as Player), from);
GamePlay.gpHUDLogCenter(new Player[] { from as Player }, "Time Elapsed is " + WriteTime_Elapsed(from as Player));
}
if (msg.StartsWith("<tl"))
{
GamePlay.gpHUDLogCenter(new Player[] { from as Player }, "Time Remaining is " + WriteTime_Remaining(from as Player));
}
if (msg.StartsWith("<timeleft"))
{
GamePlay.gpHUDLogCenter(new Player[] { from as Player }, "Time Remaining is " + WriteTime_Remaining(from as Player));
}
if (msg.StartsWith("<stats"))
{
GamePlay.gpHUDLogCenter(new Player[] { from as Player }, WritePlayerStatBase(from as Player));
}
if (msg.StartsWith("<guns"))
{
GamePlay.gpHUDLogCenter(new Player[] { from as Player }, WritePlayerStatsGunnery(from as Player));
}
if (msg.StartsWith("<kills"))
{
GamePlay.gpHUDLogCenter(new Player[] { from as Player }, WritePlayerStatsKills(from as Player));
}
if (msg.StartsWith("<bombs"))
{
GamePlay.gpHUDLogCenter(new Player[] { from as Player }, WritePlayerStatsBombs(from as Player));
}
if (msg.StartsWith("<stats<all"))
{
Timeout(1, () =>
{ GamePlay.gpHUDLogCenter(new Player[] { from as Player }, WritePlayerStatBase(from as Player)); }
);
Timeout(6, () =>
{ GamePlay.gpHUDLogCenter(new Player[] { from as Player }, WritePlayerStatsGunnery(from as Player)); }
);
Timeout(10, () =>
{ GamePlay.gpHUDLogCenter(new Player[] { from as Player }, WritePlayerStatsKills(from as Player)); }
);
Timeout(15, () =>
{ GamePlay.gpHUDLogCenter(new Player[] { from as Player }, WritePlayerStatsBombs(from as Player)); }
);
}
}
#endregion
vBulletin® v3.8.4, Copyright ©2000-2024, Jelsoft Enterprises Ltd.