Hard Light Productions Forums
Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: haloboy100 on June 01, 2009, 06:27:20 pm
-
Is it possible to create something, such as a warp affect, in front of the player a set distance, regardless of his position? I'm creating a little mission and I want to generate a warp affect in front of the player regardless of where he is, just in front of him. I don't want it to follow his orientation around, just be generated in front of him at a certain moment. I'm looking at the get-object-x/y/z SEXP, but I'm not entirely sure how it works...any suggestions?
I suppose I could use the AI to control his ship and then generate something in front of the player using a static coordinates, but I was hoping for a dynamic coordinate that solely depended on the direction he is facing so that I could put the affect in front of his face.
-
I'm pretty certain you need to do some scripting for that. There are functions in there that allow you to draw models.
-
I'm aware of that, but I can't seem to find a way to draw a model in front of the player ship regardless of his orientation or position.
For example, an argument that returns the coordinates of a position X amount of meters away from and in front of the player's ship.
-
I don't know this for sure, but I believe this would be something like
-Get the player's ship position
-Get the player's current orientation (This would be expressed as a vector, I believe)
-Generate the coordinates where you would draw the effect by taking the players' coordinates, adding the vector and a distance.
-
How would you get the orientation? Realize that my knowledge i confined strictly to FRED, as I know nothing about table hacking or anything like that.
-
Right now I don't think it's possible. I believe there is a mantis report open on the problem. Basically there are optional arguments that should allow you to do it but they don't return the correct values.
I have thought of one way to do it but it would involve editing both the .pof and the table for the ship. Basically put a special point in front of the model, make it an untargetable subsystem, and then use get object position x y and z of the dummy subsystem.
-
Hmm. That seems possible, though I'll stick with using A.I. control for now.
Thanks anyways. :)
-
Well if you are using AI control it doesn't even need to be a static point. All you have to do is get the ship turned so it is aligned with the Z axis. Then you can use the get-object x y and z and just add a value to z. You can achieve this with a waypoint way off on the Z axis and doing a waypoint goal.
-
Well, if I'm using A.I. control, I may as well go all the way by directing the player to move to a static spawn anyway, right?
It would make a decent excuse as an autopilot.
-
What about a cutscene working in tandem with relative coordinates? :)
-
Well I'm trying to make it work dynamically in real time, so that the player can trigger it via an event no matter where he is.
-
Yeah? What I said doesn't imply that you can't get the effect you want. :)
-
Well, I could use what I want to do to make a cutscene, but it's not exactly what I'm looking for. ;)
Though, I'm not sure I know what you're talking about...you're saying using a cutscene to get what I want?
-
Yeah, a cutscene with camera settings that make use of relative positions.
-
I doubt you can do the cutscene either. The problem is relative coordinates don't work correctly. See http://scp.indiegames.us/mantis/view.php?id=1923
If they did his effect would be simple.
-
I remember them working fine the last time I checked...
-
What are the get-object x/y/z SEXPs supposed to do anyway? I know they get the coordinates of an object in a certain axis, but what do the relative arguments do?
-
Modify those coordinates, I believe?
I've used them to make torpedoes come flying in from off-screen during a cinematic. Create the torpedoes at relative coordinates to the target.
-
so the arguments add or subtract to the coordinates the SEXP returns?
-
The problem is that while the relative values will be returned the functions do not take into account the direction the ship is facing so they are basically useless. True relative position would align the Z axis with the direction the ship is facing.
-
It is possible. If you have any idea of maths and if the player is flying in one direction without steering around too much.
create 3 variables : X_old, y_old and z_old
Then :
event STORE PLAYER COORDS
when
has time elapsed
12345
modify-variable
x_old
getobject_x
Alpha 1
modify-variable
y_old
getobject_y
Alpha 1
modify-variable
z_old
getobject_z
Alpha 1
event CREATE JUMP VORTEX
when
is event true delay
STORE PLAYER COORDS
1
warp_effect ( only first 6 entries stated here .... )
(1) +
getobject_x
Alpha 1
*
-
getobject_x
Alpha 1
x_old
8
(2) +
getobject_y
Alpha 1
*
-
getobject_y
Alpha 1
y_old
8
(3) +
getobject_z
Alpha 1
*
-
getobject_z
Alpha 1
z_old
8
(4) getobject_x
Alpha 1
(5) getobject_y
Alpha 1
(6) getobject_z
Alpha 1
So, this means : if players continues with present speed and course , he will be at the center of the hyperspace vortex in 8 seconds. You can play around with this number , as well as with size of vortex ( other entries of warp-effect SEXP )
Entries (4),(5) and (6) mean that vortex points in players direction.
-
Well It's a good try but I can shoot a couple of holes in that theory right now. First one you already did you don't know if the player will be flying in a straight line. Then there is always the possibility the player is in glide mode so the ship is traveling in a different direction then the ship is pointing.
BTW you can do the same thing using the position of 2 subsystems on the ship if you know what ship the player will be flying. Been there tried that.
-
I haven't read this thread too thoroughly, but my suggestion would be to first create a very small model with invisible textures and a no-collide flag in its table entry. Then using the arrival cues in FRED, tell it to arrive in front of the player ship without any warp effect. Then use the get-coordinates sexps to acquire the dummy-model's position and use them to place the warp vortex. You may also be able to use a second set of get-coordinates sexps to acquire the player's position at that time, and ensure that the warp-effect trigger is pointing at the player's position.
-
You're all overthinking it.
Have an invisible object with no-collide on warp in in front of the player. There's a setting in the ship editor to do just that (They pull down menu from "hyperspace, same one you set the arrival from docking bays from). Or, if you want some other animation than the standard warp, do the same thing with no-warp-effect checked, and then use the explosion sexp and get-object-x/y/z to define the location.
[EDIT]Doh, should have read the whole thread :p
[EDIT2] For slightly different scenarios than seem to be the case here, there's also the "Facing" sexp in the training menu, though as I said, that's less applicable here because it limits the dynamic part quite a bit.