September 29, 2024, 00:56:36

Author Topic: Campaign Scripting  (Read 18115 times)

Offline Mularac

  • Lieutenant
  • ***
  • Posts: 531
  • Karma: 11
    • View Profile
Campaign Scripting
« on: December 22, 2009, 19:11:55 »
hey, I'm having a bit of an issue here. How the hell do you make the game show the pre-mission screen? the one with the ship configuration option and such. I couldn't find anything in any of the campaign folders I have (Original and new conflicts), in my campaign the game just skips that part and plays the 1° mission, as determined in the RULE event MissionEnter.
Anyone?

Offline Arparso

  • Administrator
  • Lieutenant
  • *****
  • Posts: 558
  • Karma: 14
  • I can see you...
    • View Profile
    • http://arparso.de/nexus
(No subject)
« Reply #1 on: December 22, 2009, 19:53:24 »
I did some experiments and it seems, the mission screen will be skipped, when there's no briefing to show. Just include something like that in your rules file for that particular mission:

Code: [Select]
RULE event MissionPlayBriefing
condition ActEpisode=1&ActMission=1&E.index=1
:action
uPlayBriefing("[i]myBriefingName[/i]", 0);
:end
END

... and make sure you actually have a valid briefing file with that name. If that's the case, the player won't jump directly into your first mission but will be able to alter fleet loadouts and look at your pretty star system ;)

Offline Mularac

  • Lieutenant
  • ***
  • Posts: 531
  • Karma: 11
    • View Profile
(No subject)
« Reply #2 on: December 22, 2009, 21:29:42 »
oh... that explains a lot, thanks!

Offline Mularac

  • Lieutenant
  • ***
  • Posts: 531
  • Karma: 11
    • View Profile
(No subject)
« Reply #3 on: December 26, 2009, 18:52:38 »
I have an other issue. When I click on the fleet loadout icon I get a ctd just when I'm about to enter it, and I think it's related to the game not knowing which ships should it load out... how does the game know which ships should appear in the fleet loadout screen?

Offline The Old Dragon

  • Ensign
  • ***
  • Posts: 362
  • Karma: 6
    • View Profile
    • http://
(No subject)
« Reply #4 on: December 26, 2009, 20:11:57 »
I had this issue too on my previous attempts at this, didn't manage to fix it back then I'm afraid and haven't got back to it yet.

But as for 'how the game knows'...

I'll hazard a guess that it's to do with the "uSetParent" command. Here's the example from the first original mission...

Code: [Select]
Stiletto := uGet("ship_Stiletto");
Stiletto:uSetParent(uGetPlayersFleet());
Better to look the fool by asking, then prove them right with ignorance.

Offline Mularac

  • Lieutenant
  • ***
  • Posts: 531
  • Karma: 11
    • View Profile
(No subject)
« Reply #5 on: December 26, 2009, 21:21:29 »
yeah, I've figured that out by now... the universal conflicts mod turned out to be quite useful for that, but I still couldn't sort the problem out. It's driving me nuts (although I managed a similar crash when removing the ships that were supposed to be on the loadout from the player_fleet.sobj, so I guess nexus doesn't like an empty screen for the loadout, however, it didn't help me... after I fixed that on my campaign (adding the corresponding ship to the player_fleet.sobj file) the crash continued to exist... it's pretty annoying...)

Offline Arparso

  • Administrator
  • Lieutenant
  • *****
  • Posts: 558
  • Karma: 14
  • I can see you...
    • View Profile
    • http://arparso.de/nexus
(No subject)
« Reply #6 on: December 27, 2009, 01:12:08 »
The uSetParent command seems just to assign certain objects to a certain parent object. Think of it as a file-folder structure, where each file and folder has a parent folder it resides in. This way you can move NPCs from one ship to another or assign ships to a fleet simply by setting their parent object accordingly. For example:

Code: [Select]
Stiletto:uSetParent(uGetPlayersFleet());
This takes the object referenced by the "Stiletto" variable and assigns it to the player's fleet. uGetPlayersFleet() actually returns a reference to the current fleet the player controls... it doesn't matter, what ships are listed in the "player_fleet.sobj" file - the file name is meaningless for the game and just follows the developer's personal naming convention. A ship only becomes part of the player's fleet when adding it to the player's fleet manually using :uSetParent(uGetPlayersFleet())

uSetParent() can be used for all sorts of parent-child relations like, for example:

Code: [Select]
// moves the player character to the ship Stiletto
uGetNPC(#NPC_Player):uSetParent(C.Stiletto);

// moves the player's fleet to Michelangelo station
uGetPlayersFleet():uSetParent(uGet("stat_Michelangelo"));

I don't know the cause of your crash, but at least you should confirm you've got actual ships in the player's fleet. Adding those ships to the right .sobj file doesn't cut it - you'll need to use uSetParent() as well.

Offline Mularac

  • Lieutenant
  • ***
  • Posts: 531
  • Karma: 11
    • View Profile
(No subject)
« Reply #7 on: December 27, 2009, 01:57:20 »
yes, I've been using that from day 1, otherwise the ships in the missions would have never showed up.

Old Dragon, could you send me a copy of your episode_1.rules? I'd like to take a look at it, see if there's something in common with mine, to see if I can pinpoint that crash, I'm confident that the bug is there.

Offline Mularac

  • Lieutenant
  • ***
  • Posts: 531
  • Karma: 11
    • View Profile
(No subject)
« Reply #8 on: January 01, 2010, 19:30:50 »
Ok... Found the bloody bugger. Actually, bugger"s" :P
the first bug I found was that there was no written reference to my ships' npc's on the gsflt_npcdesc.ini file in the textstexts folder. I found that one out by replacing my tacticstypes.ini with the one of the original campaign, however, when I put back my own tactics, the blasted thing won't work. I got a crash, again. So, I went back to the original tactics and started to brutally mutilate it, leaving only one shiptype and the corresponding shipclass, plus the asteroids, of course (thanks Old Dragon for the tip). I tried it and it worked. So, it was now time for the big test. I replaced the shipclass (cls_frigate) with one of my own (Ship_Hatak), however, once I gave it a shot, I got a crash. So, making this short, I found an other issue. There's, somewhere, a .ini files that links the names of the shipclass (not the shipclass.ini, I checked...) to something else, and it would only present an issue on the fleet loadout screen. The thing is, I can't seem to locate such file. Going back to my example, the shipclass cls_frigate, when I opened the fleet loadout screen, there's a label on the upper screen reading "type: frigate". My first assumption was that it had something to do with the shipclass.ini, but when i deleted the cls_frigate entry from it, the label would remain there unchanged. Same with the gsflt_scinfos.ini file. So, my question is this: do you know of any other file that would make reference to the, for instance, cls_frigate entry? (I also tested it with the universe_conflicts mod, setting one of the ships that mod had added as a configurable ship. I got the same crash, so it must be something closely related to the vanilla ships)

Offline Mularac

  • Lieutenant
  • ***
  • Posts: 531
  • Karma: 11
    • View Profile
(No subject)
« Reply #9 on: January 02, 2010, 21:01:58 »
Found an other thing, the ship's icon on the loadout screen is the one of the vanilla ship, the one the name makes reference to (cls_frigate) despite the fact that in the tacticstypes.ini the incon is labeled as something else (and the icon that appears on the screen it's not on any of the game folders, I personally deleted)

EDIT: Gotcha!!! It turns out that the loadout tactic screen was using an icon not from the texturesicons folder but from the texturesGUIFLEETSHIPICONS, where each icon is supposed to carry the same name of the given class.

Offline The Old Dragon

  • Ensign
  • ***
  • Posts: 362
  • Karma: 6
    • View Profile
    • http://
(No subject)
« Reply #10 on: January 04, 2010, 12:05:57 »
Incase you have't located it yet, there's also a 'shiptypes.ini' file which controls what goes in the uper center of the loadout screen (think that's the one you mean, yes?).

But great work on figuring this out so far,  helped me so much in N:TAA :)
Better to look the fool by asking, then prove them right with ignorance.

Offline Keldane

  • Specialist
  • *
  • Posts: 73
  • Karma: 0
    • View Profile
    • http://
(No subject)
« Reply #11 on: January 13, 2010, 02:32:43 »
Perhaps this is a bit of a foolish question, and is there a way to include briefings/pre-mission loadout screen in one off missions?

Offline The Old Dragon

  • Ensign
  • ***
  • Posts: 362
  • Karma: 6
    • View Profile
    • http://
(No subject)
« Reply #12 on: January 13, 2010, 08:45:10 »
Only if you want to write a one mission campaign, I'm afraid.

'Mod_missions'  don't have access to the required 'Story' folder which has the all the rules and briefing files.
Better to look the fool by asking, then prove them right with ignorance.

Offline Mularac

  • Lieutenant
  • ***
  • Posts: 531
  • Karma: 11
    • View Profile
(No subject)
« Reply #13 on: January 18, 2010, 01:15:24 »
Ok, while doing some exploring with the "SETS" of a weapon and a shipclass I've reached a conclusion: Somehow, the game links one of these main sets numbers (in weapons the fourth and in flaks the third, havent got into shields and other devices yet)  to certain labels, for example:

Set 31 would be normal weapons, 32 heavy ones and 34 and (at least) 39 special weapons, however, 34 is used for somehow "unusual" weapons and 39 is used mostly (or only) for flaks.
However, I don't have a clue how the game "links" those numbers, and that if is possible to add more "labels" (The Special Weapons label, for example is the text script of the line: fltcap_devcat_special_weapon as seen in the gsflt_captions.ini file in the textsSYSTEXTS folder).

I fear this might be a hardcored setting of the game, but it never hurts to ask.

Offline Arparso

  • Administrator
  • Lieutenant
  • *****
  • Posts: 558
  • Karma: 14
  • I can see you...
    • View Profile
    • http://arparso.de/nexus
(No subject)
« Reply #14 on: January 18, 2010, 10:05:19 »
I believe those are hardcoded. The only slot- or set-related setting I was able to find was in tacticsbase.ini:

Quote
DEVICESLOTS
    1  8   -   90   31 32 34 35 ;         // normal weapon
    9  9   -   110   33 ;            // siege weapon
   10 13   -   100   39 ;            // flak
   14 14   -   90   41 42 43 ;         // shield
   15 15   -   90   51 52 ;            // main engine
   16 16   -   90   53 ;            // aux engine
   17 18   -   120   54 55 56 ;         // special engine
   20 22   M   90   61 62 63 64 65 66 67 81 ;   // support devices except weapon generators, and IP drive
   23 23   M   60   71 72 73 ;         // weapon generator
   24 24   M   90   38 ;            // mechanoid emitter
DEVICESLOTS

According to the modding manual this just links set numbers to the actual #slots# and #angles# defined in the 3d model itself: for example the first line enforces, that every weapon put into one of the eight regular weapon slots (#slot 1-8#) has to belong to at least one of the sets 31, 32, 34 or 35. I believe those are directly translated to the four ingame categories like that:

31 - normal weapons
32 - heavy weapons
33 - siege weapons
34 - special weapons
35 - special weapons (scanner)
39 - special weapons (flak)

Every weapon belongs to at least one of these sets. There are lots of other weapon sets, however, and some of them are even being used by ingame command or AI scripts. For example the game might use this to get all artillery missiles:

Code: [Select]
S.weapon & S.working & InSet(S.this, 2) & InSet(S.this, 5) & S.count!=0
It checks for working weapons with some ammunition left, which belong to set 2 (hull destroying weapons) and set 5 (missile weapons). Sadly this kind of set grouping isn't documented anywhere. When creating your own custom weapons and devices, you basically have to guess to which sets you should add your device... if you miss an important set, certain commands or AI routines might ignore your custom device altogether. For example you could forget to add your custom artillery missile to set 5, which would result in the artillery command not firing your missile, although the weapon works perfectly in manual control mode.

I've attached a spreadsheet about the default sets Nexus' uses (at least according to my own knowlegde). Maybe that'll be helpful.

Offline Mularac

  • Lieutenant
  • ***
  • Posts: 531
  • Karma: 11
    • View Profile
(No subject)
« Reply #15 on: February 21, 2010, 22:01:21 »
On a different aspect of campaign scripting, does any of you have any practice and expertise on writing the briefings parts? 'cause I'm a bit at a lost here...
The other I was trying to code a simple briefing for the campaign, featuring a close up on the system, a dialog, then a circle linked to a box with  a ship, a close-up to an other nav-point of the system, an other dialog with an other circle or triangule linked to an other box with an other ship and finall a zoom on the 1° location.
This is what I wrote, however, it doesn't work properly at all, it just ends before the first box with the ship appears.... I've also tried it with different coding, but I always got it wrong at some point... if anyone has any idea what the commands are or some useful advice, I'm all ears, I'm flying blind here...

Code: [Select]
Mission 1 1 //4
System "Middle of Nowhere"

////////////////////////////////////////////////////////////////////////////////
// briefing items

HideLoc "fleet_Player"

: midNowhere

CamMove
dur 0
Target "Middle of Nowhere" 10.0  -60.8459 14.7765 35.9832
END

resp
wait 1

BOX
DurText
Pos 50 50
From 50 50
To 350 350
ColorPreset 1
EfxBlinkIn
EfxFadeOut
Title "104_title_1"
Pic "..NPC26still"
Text "104_brief_1"
END

resp
wait 6

BOX
DurText
Pos 100 100
From 120 120
To 390 390
ColorPreset 1
EfxBlinkIn
EfxFadeOut
Title "104_title_2"
Pic "..NPC10still"
Text "104_brief_2"
END

WaitText
wait 1

wait 1

CAMMOVE
Dur 2
Target "nav_Middle of Nowhere" 1.7712  -29.796 50.661 130.5329
END

resp
wait 3

close midNowhere

: firObj

wait 1

GRAPH
Shape 10
Pos 544 373
Size 41
ColorPreset 1
EfxZoomIn
EfxFadeOut
END

BOX
DurText
Pos 50 50
From 50 50
To 350 350
ColorPreset 1
EfxBlinkIn
EfxFadeOut
Title "104_title_1"
Pic "..NPC26still"
Text "104_brief_3"
END

Resp
Wait 1

BOX
dur 5
Pos 647 414
To 921 554
ColorPreset 1
EfxBlinkIn
EfxFadeOut
From 547 374
Title "104_title_4"
ShipClass #Ship_Battlestation
MeshCamDist 2572
END

waittext
wait 5
close firObj

: secObj
resp
wait 2

CAMMOVE
Dur 4
Target "astfld_nav_Middle of Nowhere III" 28.7712  69.796 -65.661 13.5329
END

resp
WaitText
Wait 1

BOX
DurText
Pos 50 50
From 50 50
To 350 350
ColorPreset 1
EfxBlinkIn
EfxFadeOut
Title "104_title_1"
Pic "..NPC26still"
Text "104_brief_4"
END

resp
wait 1

GRAPH
Shape 10
Pos 544 373
Size 41
ColorPreset 1
EfxZoomIn
EfxFadeOut
END

Resp
Wait 1
BOX
Pos 647 414
To 921 554
ColorPreset 1
EfxBlinkIn
EfxFadeOut
From 547 374
Title "104_title_4"
ShipClass #Base_hatak_dock
MeshCamDist 2572
END

wait 10
Close secObj

: getBack
CAMMOVE
Dur 2
Target "nav_Middle of Nowhere" 28.7712  129.796 65.661 13.5329
END

wait 2
close getBack

for example, to what does the command "resp" refer to? Why does the "target" command needs 4 numerical entries? To what aspect does the "pos", "to", "from" commands of the box make reference to in the screen?

Offline The Old Dragon

  • Ensign
  • ***
  • Posts: 362
  • Karma: 6
    • View Profile
    • http://
(No subject)
« Reply #16 on: February 23, 2010, 14:40:16 »
Hi there Mularac,

The only thing I can think of at the moment for why it's crashing is that the game can't find the required class or tex file. Maybe it's something similar to the loadout screen? That always crashed on me untill you discovered that it needed a certain tex file to link to. Other than that, it's the blind leading the blind I'm afraid.

As for your other questions...

Resp:  
Don't really know, but briefings tend to have problems if it's not included..

Four numerical values for 'Target' command:
Three are positional data, while the fourth is the distance from target. Don't know which is which, you'll just have to experiment.

Relevance of the 'Pos', 'From' & 'To':

   Pos = This is the location of the upper left corner of the box. Kind of like a 'locator'.

   From = Looking through a New Conflicts briefing, all the 'From' data is the same as the 'Pos' data. Don't know if this is coincidence or requirement (more experimenting), but this command effectively says "start the box here" .Again, it refers to the upper left corner.
   To = While this one refers to the lower right corner saying "end the box here".

Don't quote me on this as it's quite a bit of supposition and theory... but it sounds good.  :D
Better to look the fool by asking, then prove them right with ignorance.

Offline Mularac

  • Lieutenant
  • ***
  • Posts: 531
  • Karma: 11
    • View Profile
(No subject)
« Reply #17 on: February 23, 2010, 15:35:15 »
Uhm, sorry, I think you misunderstood me, the briefing is not crashing, it's just ending.

Offline The Old Dragon

  • Ensign
  • ***
  • Posts: 362
  • Karma: 6
    • View Profile
    • http://
(No subject)
« Reply #18 on: February 23, 2010, 23:47:34 »
Oh, my apologies. In that case I've got absolutely no idea.
Unfortunately, much of the campaign scripting is still a mystery  :(
Better to look the fool by asking, then prove them right with ignorance.

Offline Mularac

  • Lieutenant
  • ***
  • Posts: 531
  • Karma: 11
    • View Profile
(No subject)
« Reply #19 on: February 24, 2010, 21:02:03 »
yeah, the resp thing was the bugger. I just added it in between of every box, graph and pretty much any single action I wrote... it works like a charm now.