Hard Light Productions Forums

Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: esarai on June 09, 2008, 04:56:33 pm

Title: Need help with Fredding "Accelerator Rings"
Post by: esarai on June 09, 2008, 04:56:33 pm
Hi,
I'm trying to do a new mission which involves accelerator rings. Now, why the hell would peeps need accelerator rings when they've got subspace drives? Well, this system is riddled with subspace anomalies, and long-ranged jumps cause ships to tear themselves to pieces. So, To get around that, people made Magnetic Accelerator Rings, or MARs. I need help in figuring out how to make anyone who approaches the ring get super-accelerated.

I already tried to do it with just alpha 1, writing a bunch of sexps where if pilot's distance to accelerator ring is less than 750, he gets flung out to kingdom come. This didn't work, and I have no idea why.

A copy of the sexps follows so people can tell me what I messed up:


(http://i279.photobucket.com/albums/kk124/esaraisaiea/MARSCoding.jpg)

thanks.
Title: Re: Need help with FRED2
Post by: Jeff Vader on June 09, 2008, 05:01:26 pm
Hi,
I'm trying to do a new mission which involves accelerator rings. Now, why the hell would peeps need accelerator rings when they've got subspace drives? Well, this system is riddled with subspace anomalies, and long-ranged jumps cause ships to tear themselves to pieces. So, To get around that, people made Magnetic Accelerator Rings, or MARs. I need help in figuring out how to make anyone who approaches the ring get super-accelerated.

I already tried to do it with just alpha 1, writing a bunch of sexps where if pilot's distance to accelerator ring is less than 750, he gets flung out to kingdom come. This didn't work, and I have no idea why.
Haven't FREDded ever, but I've heard that that FRED2_Open is fun.

Quote
how do you put in images into the post rather than making a link?
Code: [Select]
[img]http://i279.photobucket.com/albums/kk124/esaraisaiea/MARSCoding.jpg[/img] or with very wide pictures, [lvlshot]http://i279.photobucket.com/albums/kk124/esaraisaiea/MARSCoding.jpg[/lvlshot]
Title: Re: Need help with FRED2: Accelerator Rings
Post by: Backslash on June 10, 2008, 12:37:51 am
You're not doing anything wrong... it's due to the way the game physics treats the Z object acceleration.  The speed was applied, but it got instantly reset to 0.

Try setting $use_newtonian_dampening (http://www.hard-light.net/wiki/index.php/Ai_profiles.tbl#.24use_newtonian_dampening:) in ai_profiles.tbl to YES.  This should make your example work properly. :)
Title: Re: Need help with FRED2: Accelerator Rings
Post by: esarai on June 10, 2008, 01:14:36 am
Sweet. I'll try it next time I get near my FS2 computer. And using newtonian dampening should make it behave the way I want it to, too. I was trying to make the rings aligned in different paths so that the player must maneuver their craft in a very skilled manner, or else they get flung into dead-space or smashed to tiny bits.
Title: Re: Need help with FRED2: Accelerator Rings
Post by: FreeSpaceFreak on June 10, 2008, 03:42:09 am
Sweet. I'll try it next time I get near my FS2 computer. And using newtonian dampening should make it behave the way I want it to, too. I was trying to make the rings aligned in different paths so that the player must maneuver their craft in a very skilled manner, or else they get flung into dead-space or smashed to tiny bits.
Sounds horrible to a bad pilot like me :nervous:
Title: Re: Need help with FRED2: Accelerator Rings
Post by: Snail on June 10, 2008, 05:03:07 am
You're not doing anything wrong... it's due to the way the game physics treats the Z object acceleration.  The speed was applied, but it got instantly reset to 0.

Try setting $use_newtonian_dampening (http://www.hard-light.net/wiki/index.php/Ai_profiles.tbl#.24use_newtonian_dampening:) in ai_profiles.tbl to YES.  This should make your example work properly. :)
You're smart.
Title: Re: Need help with FRED2: Accelerator Rings
Post by: esarai on June 11, 2008, 12:28:54 am
Sweet. I'll try it next time I get near my FS2 computer. And using newtonian dampening should make it behave the way I want it to, too. I was trying to make the rings aligned in different paths so that the player must maneuver their craft in a very skilled manner, or else they get flung into dead-space or smashed to tiny bits.
Sounds horrible to a bad pilot like me :nervous:


Don't worry, It shouldn't be that bad... Just make sure you're pointed at the next ring and watch out for random debris strewn about.
Title: Re: Need help with FRED2: Accelerator Rings
Post by: Backslash on June 11, 2008, 12:34:37 am
You're smart.
Why, thank you ;)  Really, I only already knew why this was because I tried to do it myself last year.  It was sure frustrating tracking down the reason back then!

Using set-object-speed like this was the reason I looked into that last year.  It allows for so many possibilities like this -- accelerator rings, catapult launches, etc. ;7 To say nothing of the potential for cutscenes...

Actually I had done it so that this option was enabled by default (because it made almost everything about fighter movement more customizable as a result).  Unfortunately it turned out that it messed up retail FS2/FSPort missions, because capships kept too much momentum upon jumping in.  So Turey helped move it to a ai_profiles flag.  In my opinion, any mod that is not shackled to retail table data should use this flag :D

Looking forward to your missions, esarai...
Title: Re: Need help with FRED2: Accelerator Rings
Post by: esarai on June 11, 2008, 01:30:09 pm
woah, I can't believe you found out how to solve that. I can't even find the ai_profiles.tbl file. Man I feel stupid. Where exactly would it be?
Title: Re: Need help with FRED2: Accelerator Rings
Post by: Snail on June 11, 2008, 01:43:01 pm
woah, I can't believe you found out how to solve that. I can't even find the ai_profiles.tbl file. Man I feel stupid. Where exactly would it be?
It's an SCP added table, you'd have to make it yourself, it's not in retail FS2.
Title: Re: Need help with FRED2: Accelerator Rings
Post by: esarai on June 11, 2008, 01:45:36 pm
So, Just make ai_profiles.tbl and it's only content should be:

#Ai Profiles
$Profile name: Accelerator
$use_newtonian_dampening: YES
#End

Or wait... Do I have to include the definitions for the AI Classes?

And this doesn't seem to work. Hey Backslash, could you post the code that let you do the accelerator thingy, cause this one isn't working.
Title: Re: Need help with FRED2: Accelerator Rings
Post by: Backslash on June 11, 2008, 05:31:48 pm
Uh... maybe.  Sorry, I'm currently away from my gaming/coding computer so I can't test or give you the example mission yet, but I'll be back tomorrow.  Your event looks fine to me, though.

Try adding a +nocreate under the $Profile Name: line (and don't forget to capitalize Name), then name the file "something-aip.tbm" (you can change 'something' to whatever you want, but keep the -aip.tbm ).  If that doesn't work, scrap that and fill out a whole ai_profiles.tbl with the AI classes and all.  A simple copy paste from the sample in the wiki (http://www.hard-light.net/wiki/index.php/Ai_profiles.tbl#Sample_Entry) should be fine.

A way to test if the problem is in your ai_profiles table or not:  temporarily change the set-object-speed-z to set-object-speed-x (or y)... those directions should work no matter what.  (...unless your ship has a $Damp of 0.)
Title: Re: Need help with FRED2: Accelerator Rings
Post by: Flaming_Sword on June 11, 2008, 06:02:20 pm
Remember to have the actual AI profile set in your mission. I forgot to do that a couple of times...  :nervous:
Title: Re: Need help with FRED2: Accelerator Rings
Post by: esarai on June 11, 2008, 07:04:30 pm
Okay... I changed the acceleration direction, and it works both x and y, not z. It also does not last. You'll get a boost, but when you get out of range, you lose all your momentum, really fast. I'm going to try and make it work with booleans: If you've gotten close enough to the ring, then accelerated = true, and as long as accelerated = true you will have a velocity of 1400 or some such.  Means I need to make decelerator rings.

version 2:

speed : Integer Variable for defining speed
accelerated : boolean value to determine whether to apply speed or let pilot control his velocity.

If close to ring, add accelerator power to current velocity, save as speed variable.

speed variable is constantly applied while accelerated is true.

That brings me to another question... How do you make an event modify a variable? (making it behave kinda like "if A is true, then 350 + B = B")
Title: Re: Need help with FRED2: Accelerator Rings
Post by: Jake2447 on June 11, 2008, 07:52:53 pm
what are you using as the ring?
knossos or a new model?
Title: Re: Need help with FRED2: Accelerator Rings
Post by: esarai on June 11, 2008, 07:57:38 pm
I'm using an Arcadia, but I intend to make a specialized model soon.
Title: Re: Need help with FRED2: Accelerator Rings
Post by: Retsof on June 11, 2008, 08:58:25 pm
This mission sounds fun.  I hope it is a standalone so that I can play it when it's done.
Title: Re: Need help with FRED2: Accelerator Rings
Post by: Jake2447 on June 11, 2008, 10:06:25 pm
I'm using an Arcadia, but I intend to make a specialized model soon.

arcadia as a ring?
Title: Re: Need help with FRED2: Accelerator Rings
Post by: Droid803 on June 11, 2008, 10:08:51 pm
The Arcadia has a hole in it, do you forget? :P
Title: Re: Need help with FRED2: Accelerator Rings
Post by: griffon67 on June 12, 2008, 01:58:33 am
wouldn't it be cooler to use the construction rings ? (I forgot the name of these ring)
they are the one you don't see int he campaign but used in multiplayer
EDIT : wasn't it the ganymede ?
Title: Re: Need help with FRED2: Accelerator Rings
Post by: esarai on June 12, 2008, 03:11:09 am
Yeah, that's the one.

That would be... interesting. The Ganymedes all have those cords through their centers, and they're kinda hard to see, so that's why I chose the Arcadias, smaller hole, but nothing to get smashed up on. Still haven't figured out how to make the ship get accelerated in the forward direction; I can only go up, or to the sides, and the speed burst is very very very short-lived. Currently, at the speeds you have to go in order to travel the distances I have in mind, you're more teleporting than accelerating towards your destination.
Title: Re: Need help with FRED2: Accelerator Rings
Post by: Snail on June 12, 2008, 06:08:27 am
You can get rid of the tubes by destroying them in initial status subsystems.
Title: Re: Need help with FRED2: Accelerator Rings
Post by: Jake2447 on June 12, 2008, 07:17:53 am
The Arcadia has a hole in it, do you forget? :P

yes, but building an arcadia for every ring along the flight path would get really expensive over a however million mile system
not to mention, the hole is really small, and i dont think it would be very useful for anything larger than a fighter
also, if a ship was off course, it would still b going really fast, and would you really want it putting a hole in your million $ station, putting lives inside at risk?
Title: Re: Need help with FRED2: Accelerator Rings
Post by: griffon67 on June 12, 2008, 07:51:35 am
he said it was temporary and that he'll make some specialized model soon.......
Title: Need help with Fredding "Accelerator Rings"
Post by: esarai on June 12, 2008, 02:19:56 pm
Hi, I already posted this in FreeSpace Modding, but I seriously need some help on this.

I'm trying to do a new mission which involves accelerator rings. Now, why the hell would peeps need accelerator rings when they've got subspace drives? Well, this system is riddled with subspace anomalies, and long-ranged jumps cause ships to tear themselves to pieces. So, To get around that, people made Magnetic Accelerator Rings, or MARs. I need help in figuring out how to make anyone who approaches the ring get super-accelerated to kingdom come.

A few problems I've encountered so far are:

-Z-Axis acceleration doesn't work.
- "set-object-speed-z (or whatever axis)" only provides a very short lived burst of speed, and in order to travel the distances I have in mind on that speed burst, you more teleport than anything else.

Does anybody have any Ideas for how to make the "set-object-speed-z" sexp force a ship beyond their maximum z velocity?
Does anybody have any ideas for how to make the speed burst not end instantaneously, but rather gradually fall off?

And while I'm here, I might as well ask, how do you make an event modify a variable? like "if distance between Alpha 1 and Alpha 2 is less than 300, set Range to true."
Title: Re: Need help with Fredding "Accelerator Rings"
Post by: DarthWang on June 12, 2008, 02:23:18 pm
Well I remember a campaign that had a mass driver gun that accelerated cargo containers through Ganymede stations, and the author said it was a pain in the ass to script. I don't remember the name of the campaign, but if you can find it you could look at how he did it and maybe get some ideas.
Title: Re: Need help with Fredding "Accelerator Rings"
Post by: FUBAR-BDHR on June 12, 2008, 04:16:23 pm
Lets handle the variable thing first.  First thing to to create one by right clicking in the events editor and creating one.  Next when you want to modify it you use an event like this:

when
-->true
--->modify-variable
----><variable>
----> +
-------><variable>
-------> 1

Or whatever you want. 

I don't know about the AI profile stuff but if you are just doing a ship speeds up for a certain time then you could use time compression instead of speed. 
Title: Re: Need help with Fredding "Accelerator Rings"
Post by: Snail on June 12, 2008, 04:31:56 pm
Variables are fun, but the original FS2 team didn't use them for some reason.
Title: Re: Need help with Fredding "Accelerator Rings"
Post by: Polpolion on June 12, 2008, 04:50:08 pm
Redundant topics moved & merged. Thanks, snail. :)
Title: Re: Need help with Fredding "Accelerator Rings"
Post by: Snail on June 12, 2008, 04:54:23 pm
The moderators are actually working together!
Title: Re: Need help with Fredding "Accelerator Rings"
Post by: Droid803 on June 12, 2008, 05:20:27 pm
Ganymedes have these tubes in them. If you would like to run into a tube and get mangled, go ahead XD.
Title: Re: Need help with Fredding "Accelerator Rings"
Post by: Snail on June 12, 2008, 05:21:18 pm
As I said, you can destroy the tubes through initial status.
Title: Re: Need help with Fredding "Accelerator Rings"
Post by: Droid803 on June 12, 2008, 05:31:34 pm
Dang, didn't see a second pahe...:S. Then why not use TrashMan's Terran Knossos? Even bigger XD. A destroyer can safely pass through.
Title: Re: Need help with Fredding "Accelerator Rings"
Post by: esarai on June 13, 2008, 01:07:23 am
Lets handle the variable thing first.  First thing to to create one by right clicking in the events editor and creating one.  Next when you want to modify it you use an event like this:

when
-->true
--->modify-variable
----><variable>
----> +
-------><variable>
-------> 1

Or whatever you want. 

I don't know about the AI profile stuff but if you are just doing a ship speeds up for a certain time then you could use time compression instead of speed. 


One question, where exactly is the "modify-variable" operator? When I click on the only thing that says "modify variable" it brings up a window instead.
Title: Re: Need help with Fredding "Accelerator Rings"
Post by: Snail on June 13, 2008, 07:14:24 am
It's in change >> special I believe.
Title: Re: Need help with Fredding "Accelerator Rings"
Post by: FUBAR-BDHR on June 13, 2008, 12:16:22 pm
Snail is correct.  Modify variable on the main level allows you to modify the default value of an already defined variable.  The one to change the variable via an event is under the special category.   

So on the menu:

Add variable adds a new variable
Modify variable modifies the default value of a defined variable
Replace variable allows you to replace data with a variable that is already defined.
Change->special->modify-variable is the one used to change a variable.