#1
|
||||
|
||||
Posting commonly used scripts in one area
Hey Guys!
Would it be possible to start a thread where we could post the most commonly used scripts... and a quick tutorial on how to and where to install them to get them to work. I am getting the hang of using triggers, but not sure where to start to get scripts to run with in the game. I know where the script tab is in the FMB, but it wont let me copy and paste in the window. I have seen at least 3-4 people in these forums that are able to either write C# scripts...or take existing scripts and manipulate them to get them to do what they need to do. I realize not every script is tailored to every mission builders situation... but with maybe a quick tutorial on what we would need to(simply change and reword these existing scripts).. some of us that are setting on the sidelines watching and waiting.. could contribute to the over all goal of creating some interesting missions that this game so dearly needs. I'm trying to create an on going single Or multi player battle that just keeps going till I feel like quitting. Moving front lines , and Armor battles going on down below. I love flying online, but i live in North America, and the time difference doesn't bode well to find populated servers when I can play. Some simple "generic scripts that users that aren't fluid in C# could use.. in a convenient thread, I believe would really help some of us that are struggling a little. Examples would be .. 1 Delayed start script 2 repeating fighter or bomber spawning script These are just a couple off my head. Feel free to add to the list.. I'm sure I will think of more soon. I realize that there might be some of these scripts floating around somewhere with in these Forums...but it all seems to be a little scattered and kinda confusing...at least to me.. Ribbs
__________________
352ndRibbs Windows 7 Home Premium 64-bit/AMD Phenom(tm) II X4 B50 Processor (4 CPUs), ~3.3GHz/NVIDIA GeForce GTX 460 2gig/8gigs of RipJaw 1600 |
#2
|
|||
|
|||
Removes abandoned planes.
Below is a small script that will load random missions at a specified interval. Change the strings "DEMissionPath" and "UKMissionPath" to wherever you're keeping your missions, then add the names of the missions to the List below that. Change the int below that to the interval you want them to be loaded in minutes. Right now, the strings and Lists are populated with the values I'm using in my mission. You will have to change them Code:
using System; using System.Collections; using maddox.game; using maddox.game.world; using System.Collections.Generic; using System.Diagnostics; public class Mission : AMission { //paths to missions string DEMissionPath = "missions/Multi/Dogfight/OpDynamo/DEMissions/"; string UKMissionPath = "missions/Multi/Dogfight/OpDynamo/UKMissions/"; //missions to randomly select from List<string> DEMissions = new List<string> { "110_1.mis", "111_1.mis", "111_2.mis", "111_3.mis", "88_1.mis", "88_2.mis", "88_3.mis"}; List<string> UKMissions = new List<string> { "Hurri_1.mis", "Defiant_1.mis", "Hurri_2.mis" }; //interval to load random missions. In minutes. int randInterval = 30; //timers for missions Stopwatch randTimer = new Stopwatch(); public override void OnTickGame() { base.OnTickGame(); //check mission timers if (randTimer.Elapsed.Minutes >= randInterval) { randTimer.Restart(); Random rand = new Random(); if (DEMissions.Count > 0) GamePlay.gpPostMissionLoad(DEMissionPath + DEMissions[rand.Next(0, DEMissions.Count)]); if (UKMissions.Count > 0) Timeout(5, () => { GamePlay.gpPostMissionLoad(UKMissionPath + UKMissions[rand.Next(0, UKMissions.Count)]); }); } } } |
#3
|
||||
|
||||
Thanks EF!
I will give it a shot. Are you using any triggers along with the scripts? I noticed that in some missions there were triggers..but no actions??.... I thought for a trigger to work it needed a "trigger and "action" both with the same name..could be wrong tho. Also what does compile do..when you right click in the script tab box? In one of my missions I have a Small battle going on in which I have like 4 different "triggers" with 4 different "actions. Now do the triggers have to happen in "order?, or can this be used as a random occurrence ? IE ..2 110's take off to bomb an RAF airfield. if they ar successful in eliminating the target..(AAA and a Bedford) then a flight of 109's spawn and join the battle. if the player shoots down both 110's before they get the AAA then a flight of Hurri's spawn. In the example above the 110's spawning the other 110.s is above the Spits spawning the Hurri's. My question is to you , if the spits shoot the 110's first..will they spawn the Hurri's or will it not happen because the first Trigger in line was not "triggered" so to speak.. I hope I didnt lose you on the example...heh Ribbs
__________________
352ndRibbs Windows 7 Home Premium 64-bit/AMD Phenom(tm) II X4 B50 Processor (4 CPUs), ~3.3GHz/NVIDIA GeForce GTX 460 2gig/8gigs of RipJaw 1600 |
#4
|
|||
|
|||
Quote:
An elegant way to process triggers can be found in this script from the devs http://forum.1cpublishing.eu/showthread.php?t=23493 The only action available in the game now is creating a group of aircraft. It can be also achieved by just loading a submission with this group of aircraft. Furthermore you can spawn ground and sea units this way. You may read this thread for some basics on scripting http://forum.1cpublishing.eu/showthread.php?t=21518 This is where it all started. Last edited by Ataros; 06-13-2011 at 07:38 AM. |
#5
|
||||
|
||||
Quote:
It would also be nice if we could have a central refrence spot in the forums where you guys that know how to write these script could maybe somehow catgorize them so that when we are building missions .. We could find a script that best fits our needs. Does this sound like something that is feezable.. Or are the scripts too obscure to catagorize? Ribbs
__________________
352ndRibbs Windows 7 Home Premium 64-bit/AMD Phenom(tm) II X4 B50 Processor (4 CPUs), ~3.3GHz/NVIDIA GeForce GTX 460 2gig/8gigs of RipJaw 1600 |
#6
|
|||
|
|||
Quote:
To use multiple scripts in the same mission you should copy them into one script file. The problem is that to do this correctly you have to understand more or less what each line of the script is doing, i.e be able to read the C# language plus know some basics like class/object/methods/namespaces definitions and differences. The easiest approach would be: 1) Buy one 200-page book titled smth like Introduction/beginners/dummies course/guide to C#. Or download a similar free online course. 2) Read all the scripts posted in this forum sections using the book as a dictionary to look up everything that you do not understand in a particular script. 3) Check this site for further information if the book does not help http://msdn.microsoft.com/en-US/vcsharp/aa336766.aspx 4) Ask questions on scripts you are reading if you do not understand something from the above sources. And there is nothing to categorize yet as most of available scripts are mentioned in this thread already. A couple of others can be found in missions posted in this forum section and in Multiplayer section. Last edited by Ataros; 06-13-2011 at 06:53 PM. |
#7
|
||||
|
||||
Thanks so much for your help Ataros and EnlightenedFlorist. I will definately check out the link in your reply, I'm realy intrested in learning the in's and out's of the C# language...lots to learn I see.. S!
Ribbs
__________________
352ndRibbs Windows 7 Home Premium 64-bit/AMD Phenom(tm) II X4 B50 Processor (4 CPUs), ~3.3GHz/NVIDIA GeForce GTX 460 2gig/8gigs of RipJaw 1600 |
#8
|
|||
|
|||
Quote:
When a trigger is triggered, all it does is call a certain method. In that method, you can determine what trigger was called and what, if anything, to do about it. In the examples you've seen, when a trigger was triggered, an action was called. Technically, they don't have to have the same name, it just makes the coding a bit easier. It doesn't always have to work that way, though. When a trigger is triggered, I could do anything I want like loading a mission, sending a message to players, or destroying an aircraft. Likewise, an action can be called at any time like after a certain amount of time, a certain player joins, or a certain type of aircraft is spawned. Triggers don't have to happen in any sort of order. If you have a trigger for when a certain group of aircraft is destroyed, it will be triggered whenever those aircraft are destroyed. It depends on nothing else. Unfortunately, I've found that triggers aren't always reliable. At least in the two instances I was using them for in Operation Dynamo. I'm sure in time they will be improved, but for now I've managed to work around them. |
#9
|
|||
|
|||
Quote:
Army 1 = red Army 2 = blue in the beginning if the mission file. Otherwise I can agree that triggers are not reliable as it is hard to make sure an event happens. Therefore they can be used only as a supplementary tool not as the core of mission logics. |
#10
|
|||
|
|||
Quote:
I also wanted a trigger that would fire when a train was destroyed, but I could never get it to fire. |
|
|