Author Topic: Ditecting hull integrity of ships in FRED2 SCP  (Read 1822 times)

0 Members and 1 Guest are viewing this topic.

Offline bigchunk1

  • bigchunk1 = Awesome²
  • 29
  • ...and by awesome I mean Jerk!
Ditecting hull integrity of ships in FRED2 SCP
This probably has a simple answer, but I am unable to use the hits-left sexp in freed 2. I tried making a simple sexp with a when command in the events manager eg

 when
    -true               <-(want to change to hits-left)
    -do nothing

I click on "true", click replace operator then click status and then when I mouse over hits-left it is greyed out. Why won't the program let me use the sexp? I even looked up an old article http://www.rainbowsedge.net/FreeSpace/faqs.html which reads as follows.

Q: How can I set up a ship to depart after it's hull is down to say, 20%?
A: Use "hits-left" in a "when" event.

I don't think I am trying to do anything abnormal. All i want to be able to do is detect when a capitol ship is under a certain percentage of health so that I can trigger an event. I would prefer not to use time to try and "guess" when the ship will be low on health. I have been at this for a fiew hours now and this is my first post. My plea to slove my problem. Any help would me much appreciated so I can complete the mission I am working on. I am using FRED2_OPEN 3.6.10
BP Multi
The Antagonist
Zacam: Uh. No, using an effect is okay. But you are literally using the TECHROOM ani as the weapon effect.

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Ditecting hull integrity of ships in FRED2 SCP
Hits-left returns the percentage of hitpoints the ship has left.

This means

when
-hits-left
--Ship Name

means nothing. It simply returns the hitpoints % the ship has. At the start of the mission this will be 100%. So you're basically saying

When
-100

Which as you can see means nothing at all.

What you need to do use the Less Than (<), Greater Than (>) or Equals (=) operators (use this one with care!*) first so that the game knows whether you want the hitpoints to be more or less than the value you enter.

when
- <
--hits-left
--- Ship-Name
--20

That example comes true when the ship has less than 20% hull.

*you should not use = with hits-left in most cases. Certain weapons damage the ship instantly from 22% to 19% which means you never actually hit 20%. <21% is the same as =20% for almost everything you'd want to do.
« Last Edit: April 23, 2010, 11:05:30 pm by karajorma »
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline Droid803

  • Trusted poster of legit stuff
  • 213
  • /人 ◕ ‿‿ ◕ 人\ Do you want to be a Magical Girl?
    • Skype
    • Steam
Re: Ditecting hull integrity of ships in FRED2 SCP
I wouldn't use = though, since stuff sometimes take damage too fast and skip % altogether.
(´・ω・`)
=============================================================

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Ditecting hull integrity of ships in FRED2 SCP
Yeah. I corrected it to add that. :) For other SEXPs which return a number value you can use = though.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Re: Ditecting hull integrity of ships in FRED2 SCP
These are under the 'arithmetic' menu, by the way.

 

Offline bigchunk1

  • bigchunk1 = Awesome²
  • 29
  • ...and by awesome I mean Jerk!
Re: Ditecting hull integrity of ships in FRED2 SCP
That explains why it was greyed out.

Thanks, I'm amazed how quickly the forums here move.
BP Multi
The Antagonist
Zacam: Uh. No, using an effect is okay. But you are literally using the TECHROOM ani as the weapon effect.