Hard Light Productions Forums

Hosted Projects - Non-FreeSpace => MechCommander OmniTech => Topic started by: Strikahr on November 10, 2012, 01:21:00 pm

Title: Editor Help
Post by: Strikahr on November 10, 2012, 01:21:00 pm
Greetings again!  Starman, your fix worked like a charm and now i am able to create missions.  So far i have 3 missions created and have tested them as a playable campaign and all seem to wok just fine.  The wierd thing is that inbetween the first and second mission of the campaign it will let me go to the mechlab screen and buy/sell mechs and weapons and such, but when i click next to go to the pilot selections screen it takes me to the mission select screen and gives me no option to go back.  from there if i click launch it will only launch with the mechs with pilots from the previous screen.  Now i have discovered that if i load the game to the "aftermission 'blah blah'" and load it, it will let me customize my mechs and select the pilots afterwards.  Did i miss a step somewhere?

Any other question is how do i get enemy units to attack/approach a location?  Also, i would like to have units spawn onto the map in almost a "wave" style at different points on the map and i was wondering how the heck i set up the map in the editor to do that.  i've toyed around with it alot and just cant seem to figure it out myself.

Best Regards,

Strikahr
Title: Re: Editor Help
Post by: Starman01 on November 10, 2012, 07:23:15 pm
for your mission problem, you have to create the conditions "invoke pre mission logististic screen" for EACH mission file. You have to set this in the campaign editor. I do not know from my mind where it is, I have to take a look tomorrow.

Well, moving mechs around is the key to mission design, and unfortunately, a bit challenging at first. Each mech / units needs a (c+) brainfile , which makes it "work" in a mission. These files are simply text edits, but can be challenging.
I will upload you a collection of "standard" files.

Also, you can do an extreme butt load of coding inside the mission files, also to control units, actions and triggers. I'm currently working on a document with the most important functions, so each user can copy the code from the document into his mission.

Units entering the map from the outside, must be placed in the blue fog outside the visible mission ground. When you move a unit there, you will notice 2 tiles "outside" Place the units there, and then it's a matter of the brian files and mission coding, when and how they will appear.

I go to sleep now, but i try to give you something tomorrow.
Title: Re: Editor Help
Post by: Strikahr on November 10, 2012, 10:12:53 pm
Odd, i have the "invoke premission logistics selected for that mission".  I'll try and play with it a little, maybe its just a small bug.

As for the mech control and "brain" stuff you are speaking of, all i really need right now is something to make the units pop up on the map and say.... head towards a friendly base or something like that.  All i can seem to do right now is have the enemy units pretty much "agro" my lance when i test the map.  I mean it works, but i would much prefer to have the players be rushed on the base, rather then them rushing the enemy.

But anyhow, i do appreciate your assistance and insight into this issue.  All this coding stuff is a little much for my simple mind.  Creating this campaign has been something i have been wanting to accomplish for a year now.  Already 4 missions in, but they all need some tweaking and fine tuning.
Title: Re: Editor Help
Post by: Strikahr on November 11, 2012, 12:48:20 pm
Another issue is the pilots. Even the green ones have specialization a already.  How do I change them so they are just the green, unskilled pilots, or like meat with the medium AC spec as regular?
Title: Re: Editor Help
Post by: ThorC on November 11, 2012, 01:34:30 pm
Look inside the Data/missions/warriors file. Inside you will find files with the letters PMP_meat and pmwhacksaw, those are the the files that have the settings for each pilot. PMP files are for solo missions, pmw files are for the campaign. From here you can edit pilot rank, skill, awards, and specialty skills. Replace 0 with 1 to add a specialty skill to your pilot.  :yes:

[General]
st Brain = "pbrain"
st Name =                                                  "Lynx"
l Rank =                                                    1
st Callsign =                                              "LYNX"
ul ID =                                                     80
l NameIndex =                                               29
l DescIndex =                      42028                     42003
ul HeadIcon =                                               0
l paintScheme =                                             31
st pilotAudio =                                            "Lynx"
st pilotVideo =                                            "Lynx"
l PictureIndex = 28


[PersonalityTraits]
c Professionalism =                                         50
c Decorum =                                                 50
c Aggressiveness =                                          50
c Courage =                                                 50

[Skills]
c Piloting =                                               50
c Sensors =                                                50
c Gunnery =                                                55
c Jumping =                                                45

[SpecialtySkills]
c LightMechSpecialist= 0
c MediumMechSpecialist= 0
c LaserSpecialist= 0
c LightACSpecialist= 0
c MediumACSpecialist= 0
c SRMSpecialist= 0
c SmallArmsSpecialist= 0
c ReconSpecialist= 0
c ToughnessSpecialist= 0
c HevayMechSpecialist= 0
c PulseLaserSpecialist= 0
c ERLaserSpecialist= 0
c LRMSpecialist= 0
c PPCSpecialist= 0
c Scout= 0
c LongJump= 0
c AssaultMechSpecialist= 0
c GaussSpecialist= 0
c HeavyACSpecialist= 0
c ShortRangeSpecialist= 0
c MediumRangeSpecialist= 0
c LongRangeSpecialist= 0
c Deadeye= 0
c SharpShooter = 0

[Awards]
c CampaignRibbon1 = 0
c CampaignRibbon1WithHonors = 0
c CampaignRibbon2 = 0
c CampaignRibbon2WithHonors = 0
c CampaignRibbon3 = 0
c CampaignRibbon3WithHonors = 0
c PurpleHeart = 0
c Valor = 0
c UncommonValor = 0

[Affinities]
c MechClass =                                               0
c MechType =                                                0
c WeaponClass =                                             0
uc[2] WeaponTypes =                                        0,0

[Status]
c Wounds =                                                  0

FITEnd

Title: Re: Editor Help
Post by: Strikahr on November 11, 2012, 03:14:47 pm
Thor, much appreciated sir!

that will aleviate one issue, gonna try and good what i can about BrainAI for the othre issue.
Title: Re: Editor Help
Post by: Starman01 on November 11, 2012, 04:35:58 pm
Sorry, I was too lazy today to search the stuff ;) I will check for the uploads tomorrow
Title: Re: Editor Help
Post by: Strikahr on November 13, 2012, 09:33:01 am
I did a little research and tried to do some scripting on one mission for the brains.  A pair of catapults sit off the edge of the map shut down.  I thought I scripted it to have them start up and head towards the base after the first objective was completed, but all they do is jump jet into the map when the friendly mechs get in range.   

There's another map where I would like some mechs to stay off map until the units get close, buy I just don't understand exactly how to script these brains to the map.

One more question, how do I change the names of the 3rd party mechs, i.e. like a neutral mech?  I got a few guys in my RP unit that want to be in the campaign and I want to list thier call signs under the mech name.
Title: Re: Editor Help
Post by: Starman01 on November 14, 2012, 02:57:26 am
So, here are some brain examples files. In the folder "data/missions/warriors" you can find more examples, these here are neutral shells.

Note the FSM ID at the beginning. it must be unique, you cannot have two brainfiles with the same ID inside your MCO installation. The files are easily edited in a text editor. Techically, it's just a matter of inserting the correct mission goal numbers, Squad Id's and X,Y Positions and maybe some ranges. Also note, that the goal numbers from the editor start counting with "0", not 1 (First goal is goal number 0)

To assign the brains, just insert the file name into the mission.fit file in your missions folder (when you create a mission called "test", then there will be a "test.fit" file. Search the Squad ID and replace the filenames, without the .abl extension.

http://omnitech.hard-light.net/team/starman/downloads/Brain_examples.rar

If you wish, I can give you my guide for "advanced mission programming". Currently, it's still WIP, and I forgot the newest version on my company laptop, which I cannot access the next 2 weeks. So the version I have here is lacking 2 chapters. But it's quite complicated for non-coders.

As for your campaign problem :

Open campaign editor, there you see the groups in the box , klick edit group, then you see the missions inside the group. Click on edit mission. There you can control wether logistic shall come up for each mission or not.

Note, the first campaign mission always starts without logistics.

Hope that helps.

Your catapults most certainly only perform a guard command. Give them a powerup move command.

Note sure what you mean with neutral mechs. You cannot change the mech descriptions ingame so easily. If you want to have a mech a special name, you have to give him a seperate variant in the mech object file.
Title: Re: Editor Help
Post by: Strikahr on November 14, 2012, 07:14:26 am
Starman, thanks again for your help. Sounds like I have a lot of coding/scripting ahead of me this weekend.

For the mech names, what I am trying to do is put the call signs under the mech names.  For example, in the first mission of the clan eagle campaign, you have to escort the general.  If you mouse over the general it reads "Atlas" and under that it reads "General Barnekey".  That's what I'm trying to figure out.  For example, one should read "Catapult" and then "Maj. Claw".
Title: Re: Editor Help
Post by: Starman01 on November 14, 2012, 07:19:38 am
Hm, only way I know for this (using it myself) is simply to create a new variant with a new name. Search the *.fit file for the mech located in the object folder, copy the variant you want to use for the general, change it's name, save.

After that, open the editor again (because only then it loads new changes in the files) and then you can change the variant for the object in the editor (double click the mech).... That way, you can have the name of the variant being displayed ingame.
Title: Re: Editor Help
Post by: Strikahr on November 14, 2012, 11:52:49 am
Ah, so that's how it's done.  I have a lot of variants to make then.  I have a full scout and a full fire support lance that have volunteered for this campaign lol.
Title: Re: Editor Help
Post by: Starman01 on November 14, 2012, 01:18:10 pm
Be sure to keep the snythax to the letter, and don't add new spaces or empty lines, otherwise editor/game might crash.... :)
Title: Re: Editor Help
Post by: magic on November 15, 2012, 05:06:51 am
Search the *.fit file for the mech located in the object folder, copy the variant you want to use for the general, change it's name, save.

Objects folder - .csv files. Use notepad for adding or editing.
And be careful - it can crush the game.

If you cant do it, post the mechs names and variants (weapons loadouts, etc.), we can help.
Title: Re: Editor Help
Post by: Starman01 on November 15, 2012, 06:59:37 am
Oh yes, my mistake..... Don't touch the *.fit files in the object folder..... sorry :)  The variants are in the "mechs".csv
Title: Re: Editor Help
Post by: Strikahr on November 15, 2012, 08:36:55 am
The famous Mr. Magic posted on my thread?! I'm honored!

The variants seem pretty straight forward if I understand it right.  From what I have read, I open the file of the variant I want and edit the varient name and save as the name I want, basically copying the file, minus the varient name.  Is that correct?
Title: Re: Editor Help
Post by: Starman01 on November 15, 2012, 09:18:21 am
I recommend to not change the existing variants. You might brake compatibilty that way. Simply copy a variant inside the same file, making a new variant inside the csv file (not a new file !)  with your wanted name in it.
Title: Re: Editor Help
Post by: Strikahr on November 15, 2012, 04:19:15 pm
did just as you said, found the files and i have the varients i need now, tested them in a test mission and it works just fine :).  now for the scripting of the missions :/
Title: Re: Editor Help
Post by: Strikahr on November 15, 2012, 05:40:25 pm
trying to get a handle on how this scripting stuff works, so i made a test map and tried to order a player 3 mech to go through a series of points.  I edited the x and y coords for the partol path and clicked save not changing anything other then that.  then i went to the *.fit file for the test mission and pasted the *.abl file name into the brain part where it read "DredAttack01" before hand, thinking thats how that particular unit got the brain function. i kept getting this error about halfway into loading the map.

Code: [Select]
STOP      : SYNTAX ERROR data\missions\warriors\test_patrol_truck.abl [line 158] - (type 13) Undefined identifier "order1"

Address   : 0x0058EDFF
Location  : MCOREL! (+0x18DDFF)

Call Stack
==========
0x0059BE5E MCOREL! (+0x19AE5E)             
0x0059E012 MCOREL! (+0x19D012)             
0x0059E246 MCOREL! (+0x19D246)             
0x0059E246 MCOREL! (+0x19D246)             
0x005857F7 MCOREL! (+0x1847F7)             
0x0059DCE9 MCOREL! (+0x19CCE9)             
0x005850FE MCOREL! (+0x1840FE)             
0x00482E2D MCOREL! (+0x81E2D)               
0x004DF2A9 MCOREL! (+0xDE2A9)               
0x004E0169 MCOREL! (+0xDF169)               
0x00403715 MCOREL! (+0x2715)               
0x005B4E84 MCOREL! (+0x1B3E84)             

Processor Registers EAX=0x00000000 EBX=0x00000000 ECX=0x00000000 EDX=0x00000000 Flags=0x00000000
=================== ESI=0x00000000 EDI=0x00000000 EBP=0x0018C0AC ESP=0x0018BB5C   EIP=0x0058EDFF
EIP (0x0058EDFF) A1 10 E5 6E 00 C6 00 00 A1 A0 CF 78 00 40 A3 A0 CF 78 00 83 F8 01 7E 1F 8D 8D FC FE FF FF 68 AC
ESP (0x0018BB5C) 0018BB9C 09B069F0 61AF6051 00000000 00000014 6F697272 65433372 5D326C6C
                 206C0A0D 0018C0BC 00000200 00000088 0BDD57F8 00000100 0000007C 0BDEFED0
                 00010000 000004EA 2F4653E0 30303030 0A0D0A0D 7261505B 0D5D3374 206C750A
[code]
Title: Re: Editor Help
Post by: magic on November 16, 2012, 12:39:03 am
Please post your brain file.
Title: Re: Editor Help
Post by: Strikahr on November 16, 2012, 03:56:20 pm
here it is, with the coordinate changes:

Code: [Select]
//****************************************************************************************//
//
// This Brain will patrol a defined patrol path
//****************************************************************************************//

//[EDIT]
fsm Test_Patrol_Truck; //EACH BRAIN MUST HAVE AN UNIQUE FSM ID..
//[EDIT END]


var

static WorldPosition startPosition;
static PatrolState PState;
static PatrolPath PPath;
static boolean willRequestHelp;
static real lastHelpRequestTime;
static real helpRequestFrequency;
static integer AttackStateHandle;
// static boolean poweredDown;
static integer scanRange;

//****************************************************************************************

function init;

    code


//[EDIT]
//********************************************************************
// Scan Ranges for Unit
scanRange = 500;


//********************************************************************
// Patrol STATE
PState[0] = 1;    // This is the Type of Patrol. 0 = Linear. 1 = Looping
//(Linear = Unit will move from 1 to 2 to 3, then 3 to 2 to 1) Assuming there are only 3 points to the Patrol
//(Looping = Unit will move from 1 to 2 to 3, then 1 to 2 to 3) Assuming there are only 3 points to the Patrol
PState[1] = 2;    //This is the Amount of Move Points there are listed below. Make sure you Count Patrol Point '0'
PState[2] = -1;    //This is How many Times the unit will perform the Patrol.. (-1 = Forever).


//********************************************************************
// Patrol Points below

//Enter the Coordinates of where you want the Unit to Patrol. It will do them in Order Start from 0 and ending at the Last Point
//Make sure you change the Index number (numbers in Brackets [0, 0] to match the correct Patrol Point.
//Also, the number of Mover Points MUST match the number you have entered in the Patrol State.

PPath[0, 0] = 490; //X coordinate found in the editor
PPath[0, 1] = 1941; //Y coordinate found in the editor
PPath[1, 0] = 390;
PPath[1, 1] = 1941;
// PPath[2, 0] = 290;
// PPath[2, 1] = 1941;

//[EDIT END]





//********************************************************************
// DO NOT EDIT BELOW THESE LINES
//||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

PState[3] = PATROL_DIRECTION_FORWARD;   
PState[4] = -1;    //reset cur point
PState[5] = -1;    //reset cur cycle
PState[6] = CONTACT_CRITERIA_ENEMY + CONTACT_CRITERIA_VISUAL_OR_SENSOR + CONTACT_CRITERIA_NOT_DISABLED;

//setDebugWindow(-1, -1);
//---------------------------
// Grab his start position...
getObjectPosition(-1, startPosition);
setTargetPriority(0, TARGET_PRIORITY_CURTARGET, -1, 0, CONTACT_CRITERIA_NONE);
setTargetPriority(1, TARGET_PRIORITY_MOVER, 0, 0, CONTACT_CRITERIA_NONE);
setTargetPriority(2, TARGET_PRIORITY_NONE, 0, 0, 0);
AttackStateHandle = getStateHandle("attack");
willRequestHelp = true; //?true or false
helpRequestFrequency = 20.0; //?in secs
lastHelpRequestTime = -100.0;

setWillHelp(False);

endfunction;

//----------------------------------------------------------------------------------------

function update : integer;

var

boolean processingPilotEvents;
// boolean thinking;
integer pilotEventID;
integer pilotState;
integer[20] pilotEventParams;
integer curTarget;
real curTime;
real[3] myPos;
real[3] attackerPos;
// real distanceToAttacker;
integer curStateHandle;
static integer numFunctionalWeapons;
static integer[20] weaponList;

code

curTime = getTime;
curStateHandle = getCurrentStateHandle;


//--------------------------------------------------
// Process the pilot events since the last update...
numFunctionalWeapons = getWeapons(weaponList, 1);
// if (numFunctionalWeapons == 0) then
// trans noWeapons;
// endif;

processingPilotEvents = TRUE;
while (processingPilotEvents) do
pilotEventID = getNextPilotEvent(pilotEventParams);
if (pilotEventID == PILOT_EVENT_NONE) then
processingPilotEvents = FALSE;
else
switch (pilotEventID)
case PILOT_EVENT_TARGETED:
curTarget = getTarget(-1);
if (lastHelpRequestTime < (curTime - helpRequestFrequency)) then
lastHelpRequestTime = curTime;
if (willRequestHelp) then
//distanceToAttacker = distanceToObject(-1, pilotEventParams[0]);
getObjectPosition(pilotEventParams[0], attackerPos);
getObjectPosition(-1, myPos);
requestHelp(pilotEventParams[0], myPos, 300.0, attackerPos, 300.0, 1);
endif;
endif;
endcase;
endswitch;
endif;
endwhile;

return(0);

endfunction;


//----------------------------------------------------------------------------------------

state start;

code

update;
if (order1) then
corePatrol(PState, PPath);
else
// if (order2) then
// coreRun = False;
//              corePatrol(PState1, PPath1);
// else
// coreRun = False;
//              corePatrol(PState2, PPath2);
// endif;
objectremove(-1);
endif;
resetOrders(1);
endstate;

//----------------------------------------------------------------------------------------

endfsm.

//****************************************************************************************
[code]
Title: Re: Editor Help
Post by: magic on November 20, 2012, 12:36:29 am
Order1 is global variable and must be defined in main mission.ABL file.

According to your brain it must be initialized to True or the unit will simply vanish.

You must set some condition in main mission ABL where Order1 should be set to false, in this case probably when that specific unit is near some point on the map.