Author Topic: How to get player ship damage and ammo to carry over to the next mission?  (Read 3272 times)

0 Members and 1 Guest are viewing this topic.

Offline HLD_Prophecy

  • PVD_Hope in a former life
  • 29
How to get player ship damage and ammo to carry over to the next mission?
I'm sure someone knows how to do this.

I have a chain of missions where the player shouldn't be able to repair or resupply. I tried making them all red alert missions but this didn't work. I'm not sure how to copy ship damage and ammo to a campaign persistent variable.

 

Offline Jackho

  • 26
  • Gnoti seauton ...
    • Downloads an al
Re: How to get player ship damage and ammo to carry over to the next mission?
Have you tried this ?
A+
Jack H. : "Well... There's much more to check than six..."

 

Offline HLD_Prophecy

  • PVD_Hope in a former life
  • 29
Re: How to get player ship damage and ammo to carry over to the next mission?
Have you tried this ?

No, I did not see that, thanks. But I have no idea how to use it. :confused:

 

Offline AdmiralRalwood

  • 211
  • The Cthulhu programmer himself!
    • Skype
    • Steam
    • Twitter
Re: How to get player ship damage and ammo to carry over to the next mission?
I tried making them all red alert missions but this didn't work.
...Why didn't it work?
Ph'nglui mglw'nafh Codethulhu GitHub wgah'nagl fhtagn.

schrödinbug (noun) - a bug that manifests itself in running software after a programmer notices that the code should never have worked in the first place.

When you gaze long into BMPMAN, BMPMAN also gazes into you.

"I am one of the best FREDders on Earth" -General Battuta

<Aesaar> literary criticism is vladimir putin

<MageKing17> "There's probably a reason the code is the way it is" is a very dangerous line of thought. :P
<MageKing17> Because the "reason" often turns out to be "nobody noticed it was wrong".
(the very next day)
<MageKing17> this ****ing code did it to me again
<MageKing17> "That doesn't really make sense to me, but I'll assume it was being done for a reason."
<MageKing17> **** ME
<MageKing17> THE REASON IS PEOPLE ARE STUPID
<MageKing17> ESPECIALLY ME

<MageKing17> God damn, I do not understand how this is breaking.
<MageKing17> Everything points to "this should work fine", and yet it's clearly not working.
<MjnMixael> 2 hours later... "God damn, how did this ever work at all?!"
(...)
<MageKing17> so
<MageKing17> more than two hours
<MageKing17> but once again we have reached the inevitable conclusion
<MageKing17> How did this code ever work in the first place!?

<@The_E> Welcome to OpenGL, where standards compliance is optional, and error reporting inconsistent

<MageKing17> It was all working perfectly until I actually tried it on an actual mission.

<IronWorks> I am useful for FSO stuff again. This is a red-letter day!
* z64555 erases "Thursday" and rewrites it in red ink

<MageKing17> TIL the entire homing code is held up by shoestrings and duct tape, basically.

 

Offline Black Wolf

  • Twisted Infinities
  • 212
  • Hey! You! Get off-a my cloud!
    • Visit the TI homepage!
Re: How to get player ship damage and ammo to carry over to the next mission?
Not to put words in anyone's mouth, but I'm going to suspect that maybe "red alert carry status", or whatever it's called, wasn't checked in the ship box. It's easy to forget.
TWISTED INFINITIES · SECTORGAME· FRONTLINES
Rarely Updated P3D.
Burn the heretic who killed F2S! Burn him, burn him!!- GalEmp

 

Offline 0rph3u5

  • 211
  • Oceans rise. Empires fall.
Re: How to get player ship damage and ammo to carry over to the next mission?
You have the Red Altert option already mentioned here ... however Red Alert has been prone to bugs in relations to mods Red Alert is bugfree, Praise the Coders

However with a little thinking you can emulate the system with events from one mission to another. But that requires a large number of events if you have a wide array of ships/weapons to cover because you will have to set event for every contingency - the recall can actually done with a single event.

What you need are around 12 variables (for ship class, hull value, primary weapon 1, primary weapon 2, primary 1 ammo, primary 2 ammo, secondary weapon 1, secondary weapon 2, secondary weapon 3, secondary 1 ammo, secondary 2 ammo, secondary 3 ammo), each of them has to be campaign persistent so carries over from mission to mission.

You can either code the varibles as numbers (e.g. 0 for Perseus, 1 for Myrmidon, 2 for Loki) or make the variables string-type, see below.

Here is how I would do it (note that a single example, you might have to repeat the event for all weapons and ships avalible, so the more you restrict loadouts the less work you have - another note, how that will work with ships that have a different number of weapons backs and therefor don't input data into the variables - I myself have sidesteped that when implimented that)

1. Save Ship-class:


2. Save a Primary:


3. Save a Secondary:


4. Save the Hull value:


5. Recall:
EDIT: The change-ship-class is wrong, the varible should be the first argument and the second argument the ship that needs to be changed


Note if you do this for more than one ship, you might hit the limit of variables...

EDIT:
ps. I forgot a screen capture of the variables-dialogue, sry...
« Last Edit: November 23, 2016, 01:37:38 am by 0rph3u5 »
"As you sought to steal a kingdom for yourself, so must you do again, a thousand times over. For a theft, a true theft, must be practiced to be earned." - The terms of Nyrissa's curse, Pathfinder: Kingmaker

==================

"I am Curiosity, and I've always wondered what would become of you, here at the end of the world." - The Guide/The Curious Other, Othercide

"When you work with water, you have to know and respect it. When you labour to subdue it, you have to understand that one day it may rise up and turn all your labours into nothing. For what is water, which seeks to make all things level, which has no taste or colour of its own, but a liquid form of Nothing?" - Graham Swift, Waterland

"...because they are not Dragons."

 

Offline HLD_Prophecy

  • PVD_Hope in a former life
  • 29
Re: How to get player ship damage and ammo to carry over to the next mission?
Not to put words in anyone's mouth, but I'm going to suspect that maybe "red alert carry status", or whatever it's called, wasn't checked in the ship box. It's easy to forget.

No, I didn't even know that was a thing!

Will try now!

Thanks for the help guys! :D

 

Offline HLD_Prophecy

  • PVD_Hope in a former life
  • 29
Re: How to get player ship damage and ammo to carry over to the next mission?
Okay, unfortunately the red alert carry status didn't do anything.

Honestly, Orpheus, that solution you suggested has my brains scrambled so badly that I'm not sure if it's worth all that work. I might just have to lampshade the regenerating health and ammo.

 

Offline Black Wolf

  • Twisted Infinities
  • 212
  • Hey! You! Get off-a my cloud!
    • Visit the TI homepage!
Re: How to get player ship damage and ammo to carry over to the next mission?
It definitely works, I've used it, retail uses it.

Did you check the box in both the mission before and after the red alert?
TWISTED INFINITIES · SECTORGAME· FRONTLINES
Rarely Updated P3D.
Burn the heretic who killed F2S! Burn him, burn him!!- GalEmp

 

Offline AdmiralRalwood

  • 211
  • The Cthulhu programmer himself!
    • Skype
    • Steam
    • Twitter
Re: How to get player ship damage and ammo to carry over to the next mission?
You have the Red Altert option already mentioned here ... however Red Alert has been prone to bugs in relations to mods
If there are currently any bugs with Red Alert, I'm unaware of them. If a feature is buggy, you're supposed to report the bugs so they get fixed, not tell people not to use the feature in the first place. ;)

(That being said, modern mission design philosophy shies away from Red Alert missions in favour of making a longer mission with a checkpoint system, but that might feel a little daunting for somebody who just wants to FRED something simple.)
Ph'nglui mglw'nafh Codethulhu GitHub wgah'nagl fhtagn.

schrödinbug (noun) - a bug that manifests itself in running software after a programmer notices that the code should never have worked in the first place.

When you gaze long into BMPMAN, BMPMAN also gazes into you.

"I am one of the best FREDders on Earth" -General Battuta

<Aesaar> literary criticism is vladimir putin

<MageKing17> "There's probably a reason the code is the way it is" is a very dangerous line of thought. :P
<MageKing17> Because the "reason" often turns out to be "nobody noticed it was wrong".
(the very next day)
<MageKing17> this ****ing code did it to me again
<MageKing17> "That doesn't really make sense to me, but I'll assume it was being done for a reason."
<MageKing17> **** ME
<MageKing17> THE REASON IS PEOPLE ARE STUPID
<MageKing17> ESPECIALLY ME

<MageKing17> God damn, I do not understand how this is breaking.
<MageKing17> Everything points to "this should work fine", and yet it's clearly not working.
<MjnMixael> 2 hours later... "God damn, how did this ever work at all?!"
(...)
<MageKing17> so
<MageKing17> more than two hours
<MageKing17> but once again we have reached the inevitable conclusion
<MageKing17> How did this code ever work in the first place!?

<@The_E> Welcome to OpenGL, where standards compliance is optional, and error reporting inconsistent

<MageKing17> It was all working perfectly until I actually tried it on an actual mission.

<IronWorks> I am useful for FSO stuff again. This is a red-letter day!
* z64555 erases "Thursday" and rewrites it in red ink

<MageKing17> TIL the entire homing code is held up by shoestrings and duct tape, basically.

 

Offline 0rph3u5

  • 211
  • Oceans rise. Empires fall.
Re: How to get player ship damage and ammo to carry over to the next mission?
Honestly, Orpheus, that solution you suggested has my brains scrambled so badly that I'm not sure if it's worth all that work. I might just have to lampshade the regenerating health and ammo.

That was not my intention, I am sorry.

To start easy, FRED has a function to introduce "variables", custom data-sets that you can fill with data via events. Variables are almost free-from, so you can use them for a lot of stuff - franken-engineering what Red Alert does, is only a single application.
I explain the basics about them here, here and here

My example above might be a bit too detailed but is actually not complicated but busywork (as I just noticed that you can collapse the save-events with some advanced knowledge); what I wanted to show as that you can save those data points in variables, the values of which (aka the data you saved in them) can be transfered from mission to mission if they appear in both missions (same name, same type, "campaign persitent"-flag checked) and then be used.
(I do so regualarly to transfer hull values of capital ships.)

You have the Red Altert option already mentioned here ... however Red Alert has been prone to bugs in relations to mods
If there are currently any bugs with Red Alert, I'm unaware of them. If a feature is buggy, you're supposed to report the bugs so they get fixed, not tell people not to use the feature in the first place. ;)

Doesn't Red Alert break if you use one pilot file across mods anymore? (it used to when it called data that was unavalible)
« Last Edit: November 22, 2016, 08:42:17 am by 0rph3u5 »
"As you sought to steal a kingdom for yourself, so must you do again, a thousand times over. For a theft, a true theft, must be practiced to be earned." - The terms of Nyrissa's curse, Pathfinder: Kingmaker

==================

"I am Curiosity, and I've always wondered what would become of you, here at the end of the world." - The Guide/The Curious Other, Othercide

"When you work with water, you have to know and respect it. When you labour to subdue it, you have to understand that one day it may rise up and turn all your labours into nothing. For what is water, which seeks to make all things level, which has no taste or colour of its own, but a liquid form of Nothing?" - Graham Swift, Waterland

"...because they are not Dragons."

 
Re: How to get player ship damage and ammo to carry over to the next mission?
Have you tried this ?

No, I did not see that, thanks. But I have no idea how to use it. :confused:
Well, the script does essentially what 0rph3u5 described and replaces all the variable saving/loading stuff with a simple one-line script call that saves data to a file. I made it originally to get around the back then horribly bugged red-alert which has probably been fixed.
So I guess in your case figuring out how to get red-alert to work properly is what I would do.
Here goes scripting and copy paste coding
Freespace RTS Mod
Checkpoint/Shipsaveload script

 
Re: How to get player ship damage and ammo to carry over to the next mission?
Doesn't Red Alert break if you use one pilot file across mods anymore? (it used to when it called data that was unavalible)

My understanding is that these issues were fixed with the new pilot code introduced with 3.7.0.

 

Offline HLD_Prophecy

  • PVD_Hope in a former life
  • 29
Re: How to get player ship damage and ammo to carry over to the next mission?
Honestly, Orpheus, that solution you suggested has my brains scrambled so badly that I'm not sure if it's worth all that work. I might just have to lampshade the regenerating health and ammo.

That was not my intention, I am sorry.

To start easy, FRED has a function to introduce "variables", custom data-sets that you can fill with data via events. Variables are almost free-from, so you can use them for a lot of stuff - franken-engineering what Red Alert does, is only a single application.
I explain the basics about them here, here and here

My example above might be a bit too detailed but is actually not complicated but busywork (as I just noticed that you can collapse the save-events with some advanced knowledge); what I wanted to show as that you can save those data points in variables, the values of which (aka the data you saved in them) can be transfered from mission to mission if they appear in both missions (same name, same type, "campaign persitent"-flag checked) and then be used.
(I do so regualarly to transfer hull values of capital ships.)





Okay, this breaks it down a bit, thanks. I'm kind of an amateur FREDer so variables are not something that I'm used to using.

I'll give it a shot. All I need to transfer is health and secondary 1 and 2 ammo, anyway, so I should only need 3 of those.

Sorry for my response at first, I guess it just seemed way over my head at first look and I have a bad habit of giving up too easily. :P

EDIT: And I should have realized before that you put that whole event list together for me. Thanks for doing that work...  :nod:
« Last Edit: November 22, 2016, 04:39:31 pm by PVD_Hope »

 

Offline HLD_Prophecy

  • PVD_Hope in a former life
  • 29
Re: How to get player ship damage and ammo to carry over to the next mission?
Okay, I'm trying to get this set up, but I'm not sure how to get the variable into the event in another mission.

Like in the set-subsystem-strength operator in "recall", I don't know how to get Alpha-1-Hull in there. How do I replace the simple number with a campaign-persistent variable?

 

Offline 0rph3u5

  • 211
  • Oceans rise. Empires fall.
Re: How to get player ship damage and ammo to carry over to the next mission?
You have to first set-up the variable via "Add Variable" in the right-click menu


Make sure it is set-up to be a "Number"-variable, like this - you may also want to check "campaign persistent" -:



And then simply use "Replace Variable" where you want it, like this:


ps. yes, I am shamelessly re-using stuff
"As you sought to steal a kingdom for yourself, so must you do again, a thousand times over. For a theft, a true theft, must be practiced to be earned." - The terms of Nyrissa's curse, Pathfinder: Kingmaker

==================

"I am Curiosity, and I've always wondered what would become of you, here at the end of the world." - The Guide/The Curious Other, Othercide

"When you work with water, you have to know and respect it. When you labour to subdue it, you have to understand that one day it may rise up and turn all your labours into nothing. For what is water, which seeks to make all things level, which has no taste or colour of its own, but a liquid form of Nothing?" - Graham Swift, Waterland

"...because they are not Dragons."

 

Offline HLD_Prophecy

  • PVD_Hope in a former life
  • 29
Re: How to get player ship damage and ammo to carry over to the next mission?
Thanks, I got that now.

I'll get the framework laid out and post here if it works.

« Last Edit: November 23, 2016, 12:42:53 pm by PVD_Hope »

 

Offline HLD_Prophecy

  • PVD_Hope in a former life
  • 29
Re: How to get player ship damage and ammo to carry over to the next mission?
Awesome, the system worked!

Thanks a ton, my mod is almost ready for release!  :D