Author Topic: Ship Health at 100 = bonus goal  (Read 6302 times)

0 Members and 1 Guest are viewing this topic.

Ship Health at 100 = bonus goal
Hey Guys I'm trying to make a bonus goal for a mission: If a ship reaches a Waypoint and jumps out with its hull at 100, then the bonus goal should be achieved... But I just can't find a way to do it? Do I have to set a variable?

Sorry, I hope you get what I'm traing to say :)

 
Re: Ship Health at 100 = bonus goal
No need to use a variable for that, just setting the goal cue to has-departed and hits left = 100 should do the trick, unless I'm missing something.

 
Re: Ship Health at 100 = bonus goal
Sorry thats not working for me (or I just can't get it right): The Point "has departed delay" can be chosen, but "damage" stays grey, can't use ist. Haven't been able to understand why, if I'm honest. Can you give me a hint?



 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Re: Ship Health at 100 = bonus goal
You need to select the equals sign under the list of arithmetic operators. Then one of the fields under equals can be the ship's hits-left.

It should be something like

and
—has-departed-delay (ship name) 0
— =
       — hits-left (ship name)
       — 100

 
Re: Ship Health at 100 = bonus goal
If i build this I have to put two numeric arguments under the "="-sign like this:

and
—has-departed-delay (ship name) 0
— =
       — 0
       — 0

I can add anouther operator like "hits-left" under these like this:

and
—has-departed-delay (ship name) 0
— =
       — 0
       — 0
      op hits-left
            SHIPNAME

But this doesn't work in the game. I can change the 0s to 100, but nothing happens...

 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Chopped liver
    • Steam
    • Twitter
Re: Ship Health at 100 = bonus goal
OK, so it would help to have a quick bit of of information here. The arguments in FRED can only ever return numbers or TRUE/FALSE. So as you get more familiar with FRED, you'll learn which SEXPs return which types. That governs which SEXPs are greyed out or not.

"Goal is true when hits left" doesn't make sense to the computer, you need the operator to say something more like "Goal is true when hits left equals 100". I hope that makes sense.. if not, it will become more clear as you use FRED, I promise!

In your particular case you need to do basically what General Battuta said. But now you know that "Hits-Left (shipname)" returns a number. You can probably figure out what's going on.

Code: [Select]
and
--has-departed-delay (shipname) 0
--=
-----hits-left (shipname)
-----100

"hits-left (shipname) gets translated to exactly that.. the percent damage remaining on the specified ship (AKA, a Number!). Then if that equals the second number you listed, it marks "Equals" portaion of the SEXP as True. If the "Has departed" also gets marked true, then the "And" overarching SEXP becomes true and the goal is achieved.
« Last Edit: October 13, 2016, 03:14:43 pm by mjn.mixael »
Cutscene Upgrade Project - Mainhall Remakes - Between the Ashes
Youtube Channel - P3D Model Box
Between the Ashes is looking for committed testers, PM me for details.
Freespace Upgrade Project See what's happening.

 
Re: Ship Health at 100 = bonus goal
I'm slowly starting to understand  :lol: , thx for the patience by the way!
What I learned now is:
1. The ship's hull that is refered to is the one already defined in the "has departed delay" part. (is that correct?)
2. I should put all of this in the Goals-Editor, not the Events-Editor....  :lol:

But I still got a problem: Tested the mission, now the "Bonus objective complete" message is displayed if the ship reaches its destination and jumps out, but regardless if the hull is at 100 or not (I shot it down to 95 in one test and in the other one I let if fly away)...
Any ideas?

  

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Chopped liver
    • Steam
    • Twitter
Re: Ship Health at 100 = bonus goal
The ship's hull in hits-left is simply the ship you want to check. For your purposes, the answer is yes. However, I want you to be aware that it doesn't have to be if you want to do something different for a new mission.

If you put this in the events editor, you would simply put something like "is-event-true-delay" in the goals editor to turn it into a goal. Doesn't really matter here.

To debug that problem I'd like to see a screen of your event.
Cutscene Upgrade Project - Mainhall Remakes - Between the Ashes
Youtube Channel - P3D Model Box
Between the Ashes is looking for committed testers, PM me for details.
Freespace Upgrade Project See what's happening.

 
Re: Ship Health at 100 = bonus goal
Well, I don't know anymore what I did... The attachment is my little "creation" under "Mission objectives"...
No it's not working anymore: Ship starts, with 100, ship departs with 100, no Message...
Now I'm confused...  :mad:

[attachment deleted by admin]

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Re: Ship Health at 100 = bonus goal
Sure you got the Canberra's name right? Sure it hasn't taken ANY damage whatsoever? That looks at first glance like it should work.

 
Re: Ship Health at 100 = bonus goal
For the sake of debugging, try setting it to >= 1 hits left. See if that executes.

 

Offline Spoon

  • 212
  • ヾ(´︶`♡)ノ
Re: Ship Health at 100 = bonus goal
I've tested this out of curiosity

bomb3rman's screenshot should work, but it straight up doesn't. If this is used with a primary objective it returns as failed.
So I tried doing several cases of < > <= >= with various hit left values etc and they all failed.

But you know what does works?

????
Urutorahappī!!

[02:42] <@Axem> spoon somethings wrong
[02:42] <@Axem> critically wrong
[02:42] <@Axem> im happy with these missions now
[02:44] <@Axem> well
[02:44] <@Axem> with 2 of them

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Re: Ship Health at 100 = bonus goal
Lmao what the ****

 

Offline 0rph3u5

  • 211
  • Oceans rise. Empires fall.
Re: Ship Health at 100 = bonus goal
May be take two steps approach:



the condition of the 2nd event should of course be the condition of the bonus goal
"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 AdmiralRalwood

  • 211
  • The Cthulhu programmer himself!
    • Skype
    • Steam
    • Twitter
Re: Ship Health at 100 = bonus goal
Hrm... I think I see the problem. If a ship has departed, hits-left decides it can't evaluate and returns SEXP_NAN_FOREVER. When run through a comparison operator (like = or <), this becomes SEXP_KNOWN_FALSE. This causes the "and" to fail, but "not" turns SEXP_KNOWN_FALSE into SEXP_KNOWN_TRUE, so that's why that works.

What you really need to do is find a way to check the hull immediately before it departs, but that's slightly more involved (would take at least two events, off the top of my head).

And Orph3u5 posted while I was typing this, but that approach should probably work too (although I don't recommend the overhead of using every-time).
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 Axem

  • 211
Re: Ship Health at 100 = bonus goal
AdmiralRalwood has it. This is what you get for an equivalent event in the event log.

Code: [Select]
Event: hits left at mission time 19 seconds (19984 milliseconds)
when returned ALWAYS FALSE
and returned ALWAYS FALSE
= returned ALWAYS FALSE
hits-left returned -32763

Honestly what I would do is just have an event that triggers if HP goes below 100 (and has not departed) check to make sure it never fired.

 
Re: Ship Health at 100 = bonus goal
Hey guys, thx for all the answers, though I can't follow anymore.

I tried to build the events 0rph3u5 showed here, but I just can't do it. I can't put this "White paper thing called hits left" in the first event. What do I have to do? For me it was only possible to create this "hits-left" thing by inserting an operator, then there was no red "op" but a white paper sign like this. But can't do it anymore, because I can't change the operator before that.

How do I change the one in the red circle whit the (variable?) like 0rph3u5 did?
Do I have to define all variables before creating the events?
Is there a good (and probably easy, self-explanatory) tutorial for the work with variables? I did the fredzone tutorial but it wasn't so much help for these problems....

Sorry for all the stupid questions, just trying to learn  :)
And sorry for the time-delay, I'm living in Germany, the Time-Zone makes the direct communication difficult :)

[attachment deleted by admin]

 

Offline 0rph3u5

  • 211
  • Oceans rise. Empires fall.
Re: Ship Health at 100 = bonus goal
And Orph3u5 posted while I was typing this, but that approach should probably work too (although I don't recommend the overhead of using every-time).

Well, it was 2 am ...

But yeah here is the correct way to do it:


I added the additional condition to only check between when the ship clears its waypoints and the when it actually departs, to cut down on the number of repeats for the event; so instead checking every x-milliseconds in the mission (or every frame in case of every-time) the event only checks when it really needs to.

EDIT: Silly question, but is it an oversight on my part that Trigger Count does not match the Repeat Count in this case? - I am always on the fence about that...
« Last Edit: October 14, 2016, 07:53:00 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 0rph3u5

  • 211
  • Oceans rise. Empires fall.
Re: Ship Health at 100 = bonus goal
I tried to build the events 0rph3u5 showed here, but I just can't do it. I can't put this "White paper thing called hits left" in the first event. What do I have to do? For me it was only possible to create this "hits-left" thing by inserting an operator, then there was no red "op" but a white paper sign like this. But can't do it anymore, because I can't change the operator before that.

How do I change the one in the red circle whit the (variable?) like 0rph3u5 did?
Do I have to define all variables before creating the events?

Yes, you have to define any variable before you can input it. Simply use "Add variable" in the Event Editor right-click menu:


Once you have defined it (Number will suffice for your use, name is a formality & for your purpose the value should be 100), you can add it in place of any data like this:


Works in the Mission Goals Editor too...
"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: Ship Health at 100 = bonus goal
Yes but how can I put the

             "hits-left"
                 SHIPNAME
?

I don't know how to create this "hits-left" variable (or is this not a variable but an operator?) and the step below....