CarryOver Mechanics ?

Modders can post their questions on scripting and more.

Moderators: Slitherine Core, BA Moderators

Post Reply
Merr
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 903
Joined: Mon Aug 16, 2010 2:00 pm

CarryOver Mechanics ?

Post by Merr »

Pip,

Is there a way to carryover data from one scenario to the next other than just units? If so, can you provide an example?

I'm looking at starting a script for the random missions and I want to carryover the players victory results that will modify the next scenario parameter's.

Thanks in advance!
pipfromslitherine
Site Admin
Site Admin
Posts: 9937
Joined: Wed Mar 23, 2005 10:35 pm

Post by pipfromslitherine »

There is a system (though I will confess it's not been given a robust workout because we don't make use of it yet...). There are things called Campaign Variables which can be set and got using the script commands Get/SetCampaignVar. Each var is actually any 8 entry array. You can have a maximum of 64 of them (so 512 values in total, if you used them all).

They are loaded and saved along with all the other data. They are designed to do exactly what you are thinking of if I understand you correctly.

So give them a try, but feel free to let me know if you don't think it's working, as I say - it's not something we have made use of yet, so it could easily have broken since I wrote it way back when!

Cheers

Pip
Merr
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 903
Joined: Mon Aug 16, 2010 2:00 pm

Post by Merr »

hmmm ... sounds good.

I'm not at my cpu now ... I hope it's in the autodocs to explain. I'll holler back if I can't find it later.

Thanks!
pipfromslitherine
Site Admin
Site Admin
Posts: 9937
Joined: Wed Mar 23, 2005 10:35 pm

Post by pipfromslitherine »

It's all there - the autodocs are there to remove from me the chance to forget to document various script functions :)

Cheers

Pip
Merr
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 903
Joined: Mon Aug 16, 2010 2:00 pm

Post by Merr »

Pip,

Whats the TAG parameter?

Code: Select all

//return the value of the campaign var, if index is not provided 0 is used.  index must be [0, 8]
GetCampaignVar(tag, [index])

//set the value of the campaign var, if index is not provided 0 is used.  index must be [0, 8]
SetCampaignVar(tag, value, [index])
pipfromslitherine
Site Admin
Site Admin
Posts: 9937
Joined: Wed Mar 23, 2005 10:35 pm

Post by pipfromslitherine »

It's simply the name you want to give the variable.

Cheers

Pip
Merr
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 903
Joined: Mon Aug 16, 2010 2:00 pm

Post by Merr »

Pip,

I'm back to fiddling with this and I came across a roadblock and I was wondering if there was something on your end that could be added. I know that you are problably not in the neighborhood of the carryover scripts but I figured I'd throw something at you and see if it's on your "to-do" list.

Ok ... I was wondering if it's possible to add a (universal) function that can add a parameter to a unit so it can be carried over.

Currently, I figured out that you can only CarryOver a unit's status and the number of men. I peaked at the CURRENT.CSF and the part that was interesting is as follows ;

Code: Select all

[BONUS]

[CAMPAIGN]
C_N0000000 M4
C_S0000000 1
C_M0000000 1
First of all, I can see (best guess), the unit name (C_N), status (C_S) and number of men (C_M).
Would it be possible to add the functionality where we can add another parameter to this carryover list?

For example, lets say that we wanted to carryover a medal that was awarded to a unit during the scenario. So, a function example would look like this ;

SetCarryoverUnitData (tag,missionindex, index, value)

Also, I see the [BONUS] section in the CSF .... Is this functional and what can be saved here? I was thinking I could create a bonus that contained scripts for extra stuff and use the [BONUS] section to carryover the extra garbage :wink:

Anyway, I'm just throwing stuff at you ... I'm more curious on any ideas you have in the future about carryover.
pipfromslitherine
Site Admin
Site Admin
Posts: 9937
Joined: Wed Mar 23, 2005 10:35 pm

Post by pipfromslitherine »

It's a great idea. Ideally I would make it so you could tag any attribute to be carried over from a mission to the next one. I will definitely add it to my todo list :)

Cheers

Pip
Merr
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 903
Joined: Mon Aug 16, 2010 2:00 pm

Post by Merr »

pipfromslitherine wrote:It's a great idea. Ideally I would make it so you could tag any attribute to be carried over from a mission to the next one. I will definitely add it to my todo list :)

Cheers

Pip
Yes, that's a much better idea (tagging attributes) .... This way, all I need to do is either (AddAttrib in script) or add it to the squads file.

Thank you!
Post Reply

Return to “Battle Academy : Modders Corner ”