Hard Light Productions Forums
Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: Flipside on July 27, 2003, 01:01:41 pm
-
As an extension on the Return X,Y and Z co-ords now in the Sexp's, is it possible to have an area trigger sexp?
Basically all this would do is return true if the specified object is within a certain area of the mission? This way it could trigger certain events to only happen when a particular ship enters a particular area, it could read :-
enters-area
x-coord
y-coord
z-coord
x-length
y-length
z-length
ship
Also, if you had a 'takes damage' sexp you could implement things like radioactive fields, gravitic or particle damage etc by decreasing the targets hull by x each second? :)
Flipside.
-
You can replicate it by placing a waypoint in the middle of the desired area, then using the distance sexp to check if anyone is near enough to it. Something like this:
-[color=red]op[/color] when
-[color=red]op[/color] <
-#distance
-#waypoint 1
-#alpha 1
-#1000
-[color=red]op[/color] fix-warp
-#alpha 1
-
Thanks for the tip, that will actually come in handy somewhere else! LOL
The only problem with the distance trigger is the fact that it operates on a spherical area, one of the ideas I have involves an area that is far longer along one axis than it is along the other two. It also involves any ship entering the area to take damage and trigger an event. I'm thinking of something more along the lines of 'Trigger zones' in Unreal Tournament?
Flipside.
-
Ahh yes, misunderstood what you wanted. That definitely isn't doable with the distance sexp... well, it is, but not without gobs of events for just that one function, not at all feasible. I have a feeling it might not be too difficult, since area events are already there in the form of active asteroid fields.
-
It can still be done using the distance sexp
-[color=red]op[/color] when
-[color=red]op[/color] or
-[color=red]op[/color] <
-#distance
-#waypoint 1
-#alpha 1
-#1000
-[color=red]op[/color] <
-#distance
-#waypoint 2
-#alpha 1
-#1000
-[color=red]op[/color] <
-#distance
-#waypoint 3
-#alpha 1
-#1000
-[color=red]op[/color] fix-warp
-#alpha 1
-
Once again though, it's a wee bit indeterminate if you see what I mean, you end up with 'bubbles' of areas that you cannot enter, which is fine if you are dealing with nebulae etc, but can still cause a problem if you are trying to define an exact cubic area that is a trigger for an event. Still, if all else fails, I'll give that one a go :)
Anyway, I'd still need a sexp that works similar to Engine Wash for it to be effective ;)
Flipside :)
-
There's also the recently implemented get-object-x, get-object-y and get-object-z sexps, which can be used to achieve a similar effect. Do something like this, with a repeat count of 999 and an interval time of 10 seconds, for each ship you want to be affected:
-[color=red]op[/color] when
-[color=red]op[/color] and
-[color=red]op[/color] <
-#object-get-x
-#Alpha 1
-#1000
-[color=red]op[/color] >
-#object-get-x
-#Alpha 1
-#-1000
-[color=red]op[/color] <
-#object-get-y
-#Alpha 1
-#1000
-[color=red]op[/color] >
-#object-get-y
-#Alpha 1
-#-1000
-[color=red]op[/color] <
-#object-get-z
-#Alpha 1
-#4000
-[color=red]op[/color] >
-#object-get-z
-#Alpha 1
-#-4000
-[color=red]op[/color] sabotage-subsystem
-#Alpha 1
-#Hull
-#1
Result should be that Alpha 1 takes 1% hull damage damage every 10 seconds any time the ship is inside a box defined by these 8 points: (1000, 1000, 4000), (1000, 1000, -4000), (1000, -1000, 4000), (1000, -1000, -4000), (-1000, 1000, 4000), (-1000, 1000, -4000), (-1000, -1000, 4000), (-1000, -1000, -4000).
-
You, sir, are a Gem :)
And a bloody good Fredder at that :D
Thanks
Flipside :)
-
Also, if you want to be really tricky, detonate a small EMP blast on the offending ship to mimic the effects of radiation on the electronics etc. Extend the action of the last event I posted like so:
-[color=red]op[/color] all-the-other-stuff-above
-[color=red]op[/color] and
-[color=red]op[/color] sabotage-subsystem
#Alpha 1
#Hull
#1
-[color=red]op[/color] explosion-effect
-#object-get-x
-#Alpha 1
-#object-get-y
-#Alpha 1
-#object-get-z
-#Alpha 1
-#0 ;;damage
-#0 ;;size
-#10 ;;inner radius
-#50 ;;outer radius
-#0 ;;shockwave speed, 0 = none
-#0 ;;type, 0 = medium, 1 = large1, 2=large2
-#48 ;;sound tbl index, 48=static
-#20 ;;EMP intensity
-#2 ;;EMP duration
Modify values as needed to get the desired effect, of course, maybe add a random number to the coordinates to possibly offset the EMP some amount from the player so it might not affect him every time it goes off - more realistic feel if it can't be timed to hit every 10 seconds on the dot.
-
Flipside! - FREDder with no avatars and you didn't point him to TI (http://www.sectorgame.com/twistedinfinities)? Tut tut.
Err - interested in a Job, Ex? :D
:thepimp:
EDIT : Whoops. Link Fixed.
-
LOL Sorry BW, it was a late night ;)
< Switches on Acme Hypnotiser (tm) >
When you wake Exarch, you will feel an overpowering urge to volunteer to help TI with their Fredding.......
Flipside ;)
And errr... you might want to add the letter 'a' to the link in your post BW, it just comes up 'Not found' ;)
-
Originally posted by Exarch
...
You, sir, are the first non-SCP person I've run across who has actually sat down and read the help for the new sexps. And as a bonus, you know how to apply them to different situations. I'm impressed. Want to FRED for the TVWP*? :thepimp: We'll be ready to start inside of a week, and we'll be using the latest SCP build with all the new sexps. :)
* Most of the new sexps in the SCP I added because we needed them for the TVWP. ;)
-
I've actually found a problem with the area trigger I posted above when I decided to try it out in FRED - that one was merely something I'd thought up and not something I've used before. The get-object-x/y/z sexps do not work in conjunction with logical operators, so you can't have them as part of a less-than or greater-than check in the way I posted - I assume this is not on purpose though, and it will hopefully be repaired in a later build :)
But for now, this severely limits the use of those SEXPs. From my testing, they actually only work in conjunction with other SCP implemented SEXPs (explosion effect, set-ship-position etc.), and none of the original ones such as. This also seems to be the case with several of the other SCP SEXPs that deal with numbers - they can interact exclusively with other SCP SEXPs, making the use of rand, mod, +, *, /, and possibly more, impossible - And making the suggestion I made about randomized EMP blasts equally impossible.
For now, though, you can hack a half decent fix by using 3 extremely far away waypoints, WP1(0, 0, 500000), WP2(0, 500000, 0), WP3(500000, 0 0) in the following way:
-[color=red]op[/color] when
-[color=red]op[/color] and
-[color=red]op[/color] <
-#distance
-#Alpha 1
-#WP1
-#504000
-[color=red]op[/color] >
-#distance
-#Alpha 1
-#WP1
-#496000
-[color=red]op[/color] <
-#distance
-#Alpha 1
-#WP2
-#501000
-[color=red]op[/color] >
-#distance
-#Alpha 1
-#WP2
-#499000
-[color=red]op[/color] <
-#distance
-#Alpha 1
-#WP3
-#501000
-[color=red]op[/color] >
-#distance
-#Alpha 1
-#WP3
-#499000
-[color=red]op[/color] sabotage-subsystem
-#Alpha 1
-#Hull
-#1
The reason this works fairly well in creating the same box as earlier is the extreme distance to the 3 waypoints. I use sections of the spheres around them as the walls for the box, and since they are so far away, and the sphere consequently huge, the smaller sections are effectively planar. I prefer the other way more since it results in a true box, but since that doesn't work for the time being, this can be used until it's fixed. Of note is that this method also is not limited to the sides of the box being in the x, y and z directions, so if you need one placed in an awkward orientation this would be your only option.
-
Well bugger. That quite neatly screws up one of the applications I was hoping for for these sexps. Will this be being fixed SC Peeps?
-
Gah - I thought I had fixed that. :mad: The problem arises because of the weird way that Volition deals with signed and unsigned numbers in the sexps. Since an object location can have a negative number, you have to go through and make sure that every other sexp (such as the logical operator) can accept a negative number as an argument.
Unfortunately, I won't be able to take a look at this until at least three weeks from now. Someone else want to give it a try?
-
Well, at least it's good to know that someone is aware of the problem :) I had thought of the huge sphere thing, it might work as a final option, but I'll wait to see if this problem can be fixed first :)
Thanks for the help again!
Flipside :)
-
Check some advanced maths book that deals with co-ordinate geometrics.
You'll see that any kind of area could be defined using points as references.
So for a cube you should use 3 points and you've got a cube covered.
(The trick is to define all the 3 way relation between the points.
-
Actually any decent maths book will tell you that you only need one co-ordinate for a cube :ick hehehehehe
As for the rest, yes, you need the length of each side as x,y,z and origin as x,y,z.
Anybody who makes Freespace models is more than aware of the existance and innumerable pitfalls of points and vertices. But because of the way the Getx, Gety and Getz work, it has to be done for all 8 points. The problem is not so much with Geometry as Binary signed integers, which is a whole other monster, worse than Integers but oh so much better than Floating Point ;)
Flipside ;)
-
1 point is sufficent only if your cube can't be rotated, but is paralell to a pre set combination of axises.
-
LOL Well, I never did the higher level stuff, last time I did 3D modelling, Matrix Multiplication was the standard way of working out rotation, and for that, you needed to apply the function to every point in the model, though that was about 14 years ago on a BBC Micro :)
Flipside :)