Hard Light Productions Forums
Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: mjn.mixael on June 15, 2011, 01:21:55 am
-
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?
<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
-
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
-
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.
-
See? Sleeping is productive!
-
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
-
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