Author Topic: Variables, Events, and Explosive Charges  (Read 1783 times)

0 Members and 1 Guest are viewing this topic.

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Chopped liver
    • Steam
    • Twitter
Variables, Events, and Explosive Charges
Ok, so I've set up an 'Explosive Charge' system where the player has 5 charges to use at their discretion. Mostly 1 charge near a turret or subsystem means that subsystem will be destroyed. However, in a couple instances I want it to require 3 charges to destroy that subsystem. Easy peesy, or so I thought..

One such subsystem is the Fighterbay. First, there is a check when a charge is dropped and if it is near the Fighterbay, the variable FBayCheck goes up by 1. Now, the player chooses to detonate the charges. If FBayCheck >= 3, things are looking good right? Well, part of the check is if ANY OF {list of Charges} have been destroyed. Yes, it works just like it should.

Now here's the hard part. The player can drop a charge, detonate.. drop another, detonate again... Etc. So the Argument for the Fighterbay is such that if the player has already detonated at least 1 charge and THEN they drop 3 charges near the fighterbay.. the fighterbay is destroyed even though the player didn't detonate the 3 new charges. With me? So I created a couple other events to check how many Charges were still live. When one arrives, the variable LiveMine goes +1. When one is destroyed the variable LiveMine goes -1. I added a check so that it must be FBayCheck >= 3 & LiveMine = 0 & ANY OF {list of Charges} has been destroyed... still no go....

After all that explanation, here are the events in question. Suggestions?


Quote from: From IRC
<Scotty> Has anyone here seen X-Men: First Class, and is it very good?
<MjnMixael> I rather enjoyed it
<MjnMixael> what I do not enjoy is FRED events and variable manipulation at 1:30am..
<MjnMixael> I shall sleep in hopes that the answer comes to me in a dream
.........
............
................
<MjnMixael|AWAY> The answer came to me in a dream....
<MjnMixael|AWAY> my problem is now solved
« Last Edit: June 15, 2011, 08:36:51 am 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.

 

Offline 0rph3u5

  • 211
  • Oceans rise. Empires fall.
Re: Variables, Events, and Explosive Charges
How should this exactly be tiggered?
Key-Pressed? Cargo-Known-Subsystem? or....?

1) Then assign every target a value of charges to be used...
2) Now set-up one variable for the charges remaining (@chargesremaining)... (or for the charges placed, @chargesplaced)
3) Go to each event when a charge is to be used and add a "modify-variable" for @chargesremaining which makes the counter decrease by the points value assinged above... (increase if you are using the @chargesplaced-variant)
4) Make each tigger event dependent via "and" on @chargesremaining being >0... (or <5 with the other variant)

EDIT: Don't limit yourself to a count of 1-5 ... It might help if you use different values
"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 mjn.mixael

  • Cutscene Master
  • 212
  • Chopped liver
    • Steam
    • Twitter
Re: Variables, Events, and Explosive Charges
That system would work, though it uses more variables than I actually need with how the charges system is set up.

Regardless, I wasn't kidding when I said the solution came to me in a dream. I woke up this morning and fixed the issue. It was more a matter of 'Order of Operations' than invalid checks and triggers.
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.

  

Offline Snail

  • SC 5
  • 214
  • Posts: ☂
Re: Variables, Events, and Explosive Charges
See? Sleeping is productive!

 

Offline 0rph3u5

  • 211
  • Oceans rise. Empires fall.
Re: Variables, Events, and Explosive Charges
That system would work, though it uses more variables than I actually need with how the charges system is set up.

You use less than one?

the system I proposed above is just a variation of event system I use for bomber strikes against groups of capital ships... which works with exactly one variable in FRED
"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 mjn.mixael

  • Cutscene Master
  • 212
  • Chopped liver
    • Steam
    • Twitter
Re: Variables, Events, and Explosive Charges
I don't think you accurately understand what I'm trying to do. Your suggestion doesn't account for the distance the charge is from the target and really only accounts for how many charges are live, which I already had at the time of the original post. Turns out I didn't even need to count how many charges were 'live' for everything to work properly. I just needed the event to properly invalidate a charge that has been destroyed as an option for later targets.

So the event works more like..

When-Argument (trigger = number of charges total)
-Any of
---List of Charges
-is argument destroyed
-if then else
---number of charges near target sufficient
---destroy target
-invalidate argument

Instead of

When-Argument (trigger = number of charges total)
-Any of
---List of Charges
-and
---is argument destroyed
---number of charges near target sufficient
-destroy target
-invalidate argument
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.