Hard Light Productions Forums

Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: karajorma on July 11, 2004, 06:23:24 am

Title: Disabling Turrets
Post by: karajorma on July 11, 2004, 06:23:24 am
I'm writing a mission where I want something to happen once a certain number of turrets on a ship have been disabled. Only problem is that I can't think of any way to do it that doesn't involve a shed-load of SEXPs.

Am I having a brainfart or is there no easy way to have an event trigger after 5 turrets are dead?
Title: Disabling Turrets
Post by: Blaise Russel on July 11, 2004, 07:08:21 am
I think you're stuck with either one event with all the different combinations of turret destruction under one or SEXP, or one event for each turret's destruction incrementing a variable by one and triggering the event that does stuff when the variable is equal to five. The former may be more SEXP intensive than the latter, I'm not entirely sure and it may depend on number of turrets.
Title: Disabling Turrets
Post by: Hippo on July 11, 2004, 08:45:40 am
Only give the ship 5 turrets, and when they're all destroyed, it'll check with a ship-disabled thingamabob... Though, that doesn't really fit what you want though...
Title: Disabling Turrets
Post by: vyper on July 11, 2004, 09:46:42 am
Sorry Kara I suspect you're stuck with something like Blaise said, perhaps something the SCP team could tackle if they're short of SEXP's to add some day ;)
Title: Disabling Turrets
Post by: karajorma on July 11, 2004, 10:06:59 am
I was thinking about this again and I had an idea. What would be really nice would be a logic SEXP similar to or.

Any x

Unlike the Boolean SEXP's  this one takes an arguement which is the number of SEXP nodes below it that must evaluate to true before Any x itself evaluates to true.

You'd use it like this

when
-Any x  
--2
--Is subsystem destroyed-delay
---Ship Name
---Subsystem Name
---Delay
--Is subsystem destroyed-delay
---Ship Name
---Subsystem Name
---Delay
--Is subsystem destroyed-delay
---Ship Name
---Subsystem Name
---Delay
--Is subsystem destroyed-delay
---Ship Name
---Subsystem Name
---Delay

This event will become true when two subsystems are destroyed. Change the number and you can make it come true from a different number of subsystems.

I've had a look at the or SEXP (which this is basically an alteration of ) and it doesn't look like it would be very hard to code this (the or SEXP is only about 30 lines) but unfortunately I'm a Java programmer not a C one so I'm not 100% what would need changing if I were to try and make my own SEXPs.  :D

I'll play about a little bit though but if someone like Goober wants to code this feel free to do it as it will probably be weeks before I even figure out how to compile the source let alone add my own stuff to it :)
Title: Disabling Turrets
Post by: TopAce on July 11, 2004, 10:59:42 am
I would not think much on the solution, I would use a variable and tons of events.
This may be because I am a complicated spirit.
Title: Disabling Turrets
Post by: karajorma on July 11, 2004, 11:09:34 am
Quote
Originally posted by TopAce
I would not think much on the solution, I would use a variable and a lots of events.


I tell you what. I'll send you the mission and YOU FRED that part then. Bear in mind I was giving a simplified example in the original post though :D What I'm actually after is even more complicated :D

There has been a couple of other times I've wanted something similar to the any x SEXP though.
Title: Disabling Turrets
Post by: vyper on July 11, 2004, 11:38:22 am
[q]it doesn't look like it would be very hard to code[/q]

Famous. Last. Words.

Whatever happened to the great SEXP thread anyway?
Title: Disabling Turrets
Post by: TopAce on July 11, 2004, 11:40:53 am
It's in the FAQ forum.
Title: Disabling Turrets
Post by: vyper on July 11, 2004, 11:59:16 am
Kara, I posted about this in that sexp thread (linkin back here) because I'm actually quite interested in this being implemented. Hope you don't mind.
Title: Disabling Turrets
Post by: karajorma on July 11, 2004, 03:42:45 pm
No problem :)
Title: Disabling Turrets
Post by: Black Wolf on July 12, 2004, 02:57:24 am
Quote
Originally posted by Blaise Russel
I think you're stuck with either one event with all the different combinations of turret destruction under one or SEXP, or one event for each turret's destruction incrementing a variable by one and triggering the event that does stuff when the variable is equal to five. The former may be more SEXP intensive than the latter, I'm not entirely sure and it may depend on number of turrets.


The former will definitely be more sexp intensive, as you'd need one for each potential combination - and there'd probably be quite a few of those. This is the sort of situation the variable system was designed for...shame it's so buggy though.
Title: Disabling Turrets
Post by: TopAce on July 12, 2004, 03:15:27 am
The variable system? Buggy? :wtf:
It has always been working OK to me.
If the SEXP you are talking about will be implemented, your job will become far easier.
Title: Disabling Turrets
Post by: Black Wolf on July 12, 2004, 04:40:11 am
I've had problems with it fairly regularly (I've posted in Mantis if you want details) for years - others have as well -  but the problems very, very random. You may just have not run into it yet.
Title: Disabling Turrets
Post by: Goober5000 on July 12, 2004, 08:16:49 am
I've been noodling the idea of this kind of thing for a while... I think I even posted about it somewhere.  I can take a look, but it might take a while for me to get around to all these requests. :)
Title: Disabling Turrets
Post by: magatsu1 on July 14, 2004, 02:29:19 pm
Quote
Originally posted by Black Wolf


The former will definitely be more sexp intensive, as you'd need one for each potential combination - and there'd probably be quite a few of those. This is the sort of situation the variable system was designed for...shame it's so buggy though.


my first question in these forums was about a vari. bug.

And that was copying the shipyard.complete sexps