Hard Light Productions Forums

Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: Reprobator on July 13, 2009, 06:30:08 am

Title: The reprobator's fred noobsih question emporium
Post by: Reprobator on July 13, 2009, 06:30:08 am
Hello,
i'm playing around with fred nowadays, i'm just trying to disable (i mean prevent the player from moving the ships) and then kick the ship at certains speed.
Well first i made a sexp like this :

Event: disabling ship :

-When
  +has time elapsed : 1
  +player use ai
   +change ai class : none/alpha 1

Event : Kicking player's ship

-When
 +has time elapsed : 2
 +Set object speed z /alpha1 /1000

Event : Giving back the control to player :

-When
+Has time elapsed : 3
+Player not use ai


--------
I've switch the controle to ai because it looks like you can't give a arbitrary speed to the player's ship via sexp (it looks completely ignored.
Ok  the only problem i have for now is the first part of the sexp :
When the control switch from player to ai , the ai move... even with a none ai class.
Is there a way to prevent that??

 
Title: Re: Player use ai/set object speed z
Post by: Starman01 on July 13, 2009, 06:45:28 am
When you are doing that right on the mission start, make sure  Alpha 1 is set to zero speed (in Fred, Misc Editor) and immediately after "player-set-Ai" give the "play dead" order via Sexp- "Add Goal", that's how I did it ealier :)
Title: Re: Player use ai/set object speed z
Post by: Reprobator on July 13, 2009, 07:01:25 am
ah tanks you that should fix my problem, anyway that was quite funny to kick ai's ship into a wall at 1000 m/s
Title: Re: Player use ai/set object speed z
Post by: Reprobator on July 13, 2009, 10:50:27 am
Ok now i've give the ai order play dead to alpha1, the set object speed do not occur  anymore and the ai does'nt give me back all of the ship's control...  :nervous:
Ok so after many test, it looks like the set object speed will only work if the object's ai has no goal at all
Title: Re: Player use ai/set object speed z
Post by: Starman01 on July 13, 2009, 12:34:19 pm
How do you move the player-ship ? Have you created one or more waypoints for him ? I have checked back my old mission, I didn't use set-object-speed, but instead I used "cap-waypoint-speed" (don't mind the cap, it works for fighters too).  This works well, but AFAIK it requires a waypoint to move (and of course you need to give the AI-Goal  "waypoint once") so that it starts moving.

use in that line of order :

- player use ai
- AI-Goal "play dead"
- AI-Goal "waypoint once"
- cap-waypoint-speed xx

Try that, it should work :)
Title: Re: Player use ai/set object speed z
Post by: Reprobator on July 13, 2009, 12:39:50 pm
i tried that, that work but it has limitation for what i m looking for :

My ship's top speed is something like 120 m/s
But for the kick effect, i try to make it go to the 500 or more m/s
that work if i doesn't give any order to ai then use the z set object speed no matter what is my ship's top speed :)
but doing that make the ai doesn't face the z axis  when the kick arrive :p
Title: Re: Player use ai/set object speed z
Post by: Starman01 on July 13, 2009, 12:53:41 pm
Now I understand what you are trying to do. :) However I'm currently not sure how to achive it then when set-object-speed isn't working. But here are a lot of people that can better Fred than me, so i'm sure someone could take my place :) But AFAIK it's not possible to go above the max speed from the table at all.
Title: Re: Player use ai/set object speed z
Post by: Reprobator on July 13, 2009, 01:15:08 pm
Wel thanks you very much!
Well as i said as long as the set object speed work, it can bypass the ships max speed ;)
The only matter is that "set z object speed" do not work when you give any order to the ai councerned :)
I hope it can be bypassed.

My idea about it would be to disable the ship instead of disabling ai before the kick happen.
Didn't find sexp to disable ship.
Title: Re: Player use ai/set object speed z
Post by: Starman01 on July 13, 2009, 01:34:56 pm
Well, I don't know any Fred solution so far, but if it is really not possible to exceed the max table value, you could use a hack I once used. :)

Copy the ships.tbl entry of the vessel you want, and give the copy the new highspeed value as max velocity.

Then use the version I posted above, and either before the add waypoint goal or before the "cap-waypoint-speed" use the "change-ship-class" (located in "model and textures") and switch the playership to the copied entry. That should work, just don't forget to switch back when the player receive control again)

Improvision is your friend :)
Title: Re: Player use ai/set object speed z
Post by: Reprobator on July 13, 2009, 01:44:27 pm
That works like a charm, the only bad side is that fs2 do not load the cockpit pof when changing the ship class with sexp  :nervous:

That almost work however  :shaking:
Ok fixed
i ve set the initial player ship the new special ships that'll be kicked, then wait to give back control to player to give him the right ship.

It seems perfect for now i think !
Thank you very much!
Title: Re: Player use ai/set object speed z
Post by: Starman01 on July 13, 2009, 01:57:11 pm
I'm here to serve :)
Title: Re: The reprobator's fred noobsih question emporium
Post by: Reprobator on July 16, 2009, 02:00:51 am
Ok, now, i'm still playing with the player use ai sexp (quite interesting sexp  :p )
So what i tried first was :

When
-has time elapsed : 5
 -player use ai ship
  -ai add goal
    dock
     alpha 1
       Name of ship to dock with
        docking point name (do not remember)

Fred did not accept to show me the dock order for the ai so i did it with notepad.
fred does complain when i load up the mission, but not freespace2 it self and it worked perfectly has intended (the ai control the players ship and dock with the ship). (Is it a big deal or not? )

Anyway my idea was :

       When
    and
 -distance < x meters
  alpha1
   name of ship to dock with
-key pressed
  "D"

-Player use ai
-add ai goal
 -dock
 alpha1
 name of ship to dock with
 etc...

My problem is that when i use "when" distance sexp looks grey...
What is wrong with my sequence?
Title: Re: The reprobator's fred noobsih question emporium
Post by: ReeNoiP on July 16, 2009, 04:45:36 am
Start out with < rather than distance. You should then be able to use distance as an argument for <.

when
and
 - <
  distance
  x meters
Title: Re: The reprobator's fred noobsih question emporium
Post by: Reprobator on July 16, 2009, 07:10:28 am
oh cool i'll try that thanks !
Title: Re: The reprobator's fred noobsih question emporium
Post by: Rodo on July 16, 2009, 08:10:16 am
hey... nice sexp you got there!

I've been thinking for a while now about making a player able to dock with a ship... I want to build a rearm and repair ship (like the ones in homeworld) but I had no idea on how to make the player able to dock with it.. now I have an idea of how it might go.

I ask you something, have you thought about how to make the player able to cancel the docking process? I mean like if the player was under fire.. I would like to be able to regain control of the ship again and also how to manage the priorities so that the IA does not try to fly away while under attack in the docking process.
I guess you can break the process when pressing a designated key or something, but about making the IA not trying to escape.... well that goes beyond me.
Title: Re: The reprobator's fred noobsih question emporium
Post by: Reprobator on July 16, 2009, 08:37:24 am
i was thinking about something like :

event name : ai override
When
-key pressed "U" or what ever you want

  -player not use ai

That seem simple
The limitation with my docking sexp is that you can only dock with one ship at a mission.
i think we can improve to get automaticly via sexp the name and the docking point to the closest ship around the player
Maybe making event base on distance close enough by ship you can dock with can work but i don't know how perfomance impact it would have...
Experimented fredders can tell that better than me :)



Anyway, i won't be able to try that this evening,
can you try it and give me feedback :)

 
Title: Re: The reprobator's fred noobsih question emporium
Post by: ReeNoiP on July 16, 2009, 09:08:38 am
Well you can return control to the player with player-not-use-ai and key pressed.

In order to make this work you could set up a system with a variable changing between 0 and 1. Add the condition "0=variable" (start with = and add variable with start value 0) to the docking sexp and have it change the variable to 1 once it becomes true (modify-variable). Also have it reset the key you want to use for returning control to the player

Set up another sexp:

When
 and
   key-pressed
    =
    variable
    1
player-not-use-ai
modify-variable
 variable
 0
 reset-key (the one used to start docking)

Give both of these a repeat count of 999999, this should allow you to initiate and cancel docking as much as you want. I have not tested this, but I used this method to achieve a similar effect.
Title: Re: The reprobator's fred noobsih question emporium
Post by: Reprobator on July 16, 2009, 01:58:09 pm
I've done that :

 
Code: [Select]
$Formula: ( when
   ( and
      ( <
         ( distance "GTT Argo 2" "alpha 1" )
         500
      )
      ( key-pressed "d" )
   )
   ( change-ship-class
      "Tf-Litebdock"
      "alpha 1"
   )
   ( player-use-ai )
   ( add-goal
      "alpha 1"
      ( ai-dock
         "GTT Argo 2"
         "Docking Point"
         "front docking bay"
         89
      )
   )
   ( modify-variable @Dockvariable[0] 1 )
   ( key-reset "u" )
)
+Name: Dock
+Repeat Count: 999999
+Interval: 1
+Team: 0

$Formula: ( when
   ( and
      ( key-pressed "u" )
      ( = @Dockvariable[0] 1 )
   )
   ( player-not-use-ai )
   ( modify-variable @Dockvariable[0] 0 )
   ( key-reset "d" )
   ( change-ship-class
      "Tf-Litebringermk2"
      "alpha 1"
   )
)
+Name: Undock
+Repeat Count: 999999
+Interval: 1
+Team: 0


Well nothing happen when i press "d" at less than 500 meters from the argo
i ve unbind the d and u key in the freespace option.
I don't know where i'm wrong maybe a missuse of key pressed?
Title: Re: The reprobator's fred noobsih question emporium
Post by: General Battuta on July 16, 2009, 02:02:02 pm
Aren't the dock-related AI goals usually greyed out when attempting to assign them to the player ship, even under player-use-ai?
Title: Re: The reprobator's fred noobsih question emporium
Post by: Reprobator on July 16, 2009, 02:06:18 pm
sure it is  :nervous:
Anyway as i said, i try first with a simple
when has time elapsed :
player use AI
ad AI goal
dock  player dummy (an invisible ship in my Fred scene) with the ship to dock with

i opened it with notepad and replace player dummy by alpha1 in the formula and voilĂ ... that worked perfectly.

But maybe that was the limit of my hack...
Title: Re: The reprobator's fred noobsih question emporium
Post by: Rodo on July 16, 2009, 02:12:20 pm
I'll try thinking about something for the last part and get back if something comes up ^^
Title: Re: The reprobator's fred noobsih question emporium
Post by: karajorma on July 16, 2009, 03:08:33 pm
Quote
Key-reset (Training operator)
Marks the specified default key as having not been pressed, so key-pressed will be false until the player presses it again.  See key-pressed help for more information about what a default key is.
Note that this sexp will not work properly in repeating events.  Use key-reset-multiple if this is to be called multiple times in one event.

I would at the very least start there. :p
Title: Re: The reprobator's fred noobsih question emporium
Post by: Reprobator on July 16, 2009, 03:16:03 pm
Thanks you i have at least one mistake less in my sexp!  :nod:

But after correction, nothing happen when i press 'd' and within 500 m with the ship :)
Title: Re: The reprobator's fred noobsih question emporium
Post by: General Battuta on July 16, 2009, 03:24:48 pm
I'm still fairly certain that the player ship can't be told to dock even under AI control.
Title: Re: The reprobator's fred noobsih question emporium
Post by: Reprobator on July 16, 2009, 03:39:10 pm
Code: [Select]
#Events ;! 1 total

$Formula: ( when
   ( has-time-elapsed 5 )
   ( change-ship-class
      "Tf-Litebdock"
      "alpha 1"
   )
   ( player-use-ai )
   ( add-goal
      "alpha 1"
      ( ai-dock
         "GTT Argo 2"
         "Docking Point"
         "front docking bay"
         89
      )
   )
)
+Name: Dock
+Repeat Count: 1
+Interval: 1
+Team: 0

That worked this way (after 5 seconds the AI take control of the ship and dock with the desired docking point of the friendly ship named Argo)
Don't bother the dockpoint name as "Gtt argo2" is in fact a orion ship .
I change the ship class to load a copy of the originals player ship for this mission that have special entry to allow it to dock.

The part that do not work in my sexp is the distance + key pressed trigger, i have try with just key pressed without checking distance and that did not worked either.
Title: Re: The reprobator's fred noobsih question emporium
Post by: karajorma on July 16, 2009, 05:29:05 pm
Actually I see at least two other possible causes for this

1) Don't use U and D. IIRC they don't actually do anything ingame. Which means they won't do anything for key pressed/key reset either.
2) Repeating key-pressed/key-reset-multiple are one of the very rare occasions where use of every-time instead of repeating when may be warranted. It's been a long time since I tested it but last time I did I found that the results of using the two were very, very different depending on which key I mapped them too.
Title: Re: The reprobator's fred noobsih question emporium
Post by: Reprobator on July 16, 2009, 05:38:42 pm
 :yes: i'll try that tomorrow evening, it's getting late here, but thanks for your help!
so may bind those key to function rarely used in freespace2 option?
Title: Re: The reprobator's fred noobsih question emporium
Post by: Dragon on July 16, 2009, 05:45:14 pm
As I recall "U" is used to target next unscanned target.
As for unused keys, I use backward target cycling keys, of course if I cannot use "1", "2", "3" and "4" keys, which are useless in singleplayer (they are used for controlling messages in multi).
Title: Re: The reprobator's fred noobsih question emporium
Post by: Reprobator on July 16, 2009, 05:57:14 pm
Ok i made the change :
Every time instead of when and "n" to dock and "j" to undock
For now, it dock without problem (when the ai do not try to pass through the hull of the ship to dock with.... ai...  :lol:
but that work, i think by adding a subsystem at the dock point location to the ships were you want to dock would allow closer distance and allow to use distance subsystem.

In the other hand the second part of the script didn't work, when i press "j" the ai do not give me back my ship  :nervous:

I guess i ll have to find another key.
This time it"s time to sleep thank you all!


 
Title: Re: The reprobator's fred noobsih question emporium
Post by: Rodo on July 16, 2009, 08:56:52 pm
In the other hand the second part of the script didn't work, when i press "j" the ai do not give me back my ship  :nervous:

I just did a simple sexp to release the control using key "1" to engage IA control and "3" to disengage and it worked perfectly... when did you press the release IA control key? when your fighter was already docked with the orion or while in flight? cause that might be the problem.
Title: Re: The reprobator's fred noobsih question emporium
Post by: Reprobator on July 17, 2009, 12:17:26 am
while in flight , i was wondering too :
Why do we have to use 2 key?
I mean if we use the same key, that should work either as the conditions is : distance/variable the key could work like a switch?
Title: Re: The reprobator's fred noobsih question emporium
Post by: Rodo on July 17, 2009, 06:06:13 am
while in flight , i was wondering too :
Why do we have to use 2 key?
I mean if we use the same key, that should work either as the conditions is : distance/variable the key could work like a switch?
Only the switching variable would be needed to know what to do.
The distance does only restrict the sexp from firing anywere accidentally, you can polish this even more giving a message while docking or while approaching docking distance and all those blings that might make it look like a more complex feature.
Title: Re: The reprobator's fred noobsih question emporium
Post by: Reprobator on July 17, 2009, 06:41:14 am
that's sure, but I'll debug it and keep it rather simple to use it as a template for other missions  ;)
That Give me the idea that having a sort of sexp sequence library we could feed on the wiki  :confused:
may be quite usefull for fredders win time while making they're mission and help the community to have more varied custom mission/campaign (note that i do not complain on the quality level of campaign and mission , i never missed one and mostly love them all  ;7 )
Title: Re: The reprobator's fred noobsih question emporium
Post by: Dragon on July 17, 2009, 07:07:48 am
I have WIP cloaknig system (nearly done) based on SEXPs and working capship piloting SEXP set, I can share them if you want.
Title: Re: The reprobator's fred noobsih question emporium
Post by: Reprobator on July 17, 2009, 07:13:18 am
i will polish the docking sexp and share it too  :)
the idea would be that if someone find a way to improve the sexp he can modify the article of the sexp (would require some sort of validation anyway)
Title: Re: The reprobator's fred noobsih question emporium
Post by: Rodo on July 17, 2009, 07:41:04 am
good idea... like a wiki article with the most commonly used (and hard to come up with) sexps, go and post this on the wiki section of the forum, it will most likely be supported by most of the members.
Title: Re: The reprobator's fred noobsih question emporium
Post by: Reprobator on July 17, 2009, 08:07:46 am
Ok , well i won't be able to post now as i must get back to work  :(

I'm gonna write the post tomorrow morning

Edit :
Just posted here :
http://www.hard-light.net/forums/index.php/topic,64473.0.html
Title: Re: The reprobator's fred noobsih question emporium
Post by: karajorma on July 17, 2009, 09:58:46 am
good idea... like a wiki article with the most commonly used (and hard to come up with) sexps, go and post this on the wiki section of the forum, it will most likely be supported by most of the members.

Sounds a bit like my cookbook (http://homepage.ntlworld.com/karajorma/FAQ/fredcookbook.html). If someone wants to nick that and expand it on the wiki, be my guest.
Title: Re: The reprobator's fred noobsih question emporium
Post by: Reprobator on July 17, 2009, 10:48:42 am
agree it'll fit well the idea with few adaptation  :)
Title: Re: The reprobator's fred noobsih question emporium
Post by: Reprobator on August 03, 2009, 12:52:39 pm
Hi, i've been away a while cause i"ve been sick (anyway that s not the right place to talk about my life  :nervous: )
I"ve give up with the key that give back control to the player, i change my sexp with a "has docked delay" and player not use ai
it result like , u press button to dock, once you have docked, you keep docked as long as you don't touch control, if you do so, you'll have full control of the ship, i prefer that way it feel more natural. the ai do what you asked and then get back to sleep.

I'm actually on another thing, i m playing with cinematics, i'm making a mission where you see a carrier jumping in, then i d like to show some fighter taking off that carrier, i have no problem when the carrier is already there at the beginning of the mission, fighters take off with no problem, but i won't if the carrier has jumped in at the beginning.
I rade sometime ago there use to have solution for that but i can't find that; so if someone have it in his mind or a link in his bookmark, it'll make me more than happy  :)
Title: Re: The reprobator's fred noobsih question emporium
Post by: Rodo on August 03, 2009, 01:27:36 pm
I suppose you are using the set-camera-target or set-camera-facing-object, not sure about this but I0m thinking the first one will not work if the ship is not already in game when the sexp is activated, just place the camera a couple of meters in front of the carrier jumpoint and make it face x/y/z coordinates, then make another sexp that triggers when the carrier arrives and use the set-camera-target or whatever fits you better.
Title: Re: The reprobator's fred noobsih question emporium
Post by: Reprobator on August 03, 2009, 03:16:37 pm
i didn"t explain well, sorry my english is not very good.
my problem is about that :
When you set in the wing editor the fighterbay of a carrier (let say an orion) as arrival location you end with :

If the orion is present from the time 0 of the mission (present from the begining) the fighter will arriver by the orion's fighter bay without problem.
Now if the orion arrive after 2/3 seconds after the mission begin, the fighter won't appear anymore.
Title: Re: The reprobator's fred noobsih question emporium
Post by: General Battuta on August 03, 2009, 03:25:58 pm
You need to set the wing's arrival cue to something that will trigger after the Orion arrives, naturally.
Title: Re: The reprobator's fred noobsih question emporium
Post by: Reprobator on August 03, 2009, 04:55:12 pm
That work like a charm.
The only complain is that when the carrier warpout it s fast like 200 m/s and need about 10 sec to slowdown if my fighter get out during those 10 sec they'll simply pass through the hull of the carrier, however nevermind.
Title: Re: The reprobator's fred noobsih question emporium
Post by: Rodo on August 03, 2009, 05:13:24 pm
That work like a charm.
The only complain is that when the carrier warpout it s fast like 200 m/s and need about 10 sec to slowdown if my fighter get out during those 10 sec they'll simply pass through the hull of the carrier, however nevermind.


never tried this before but have you changed the arrival velocity value for the wing? it might help something, though I'm not so sure.
Title: Re: The reprobator's fred noobsih question emporium
Post by: Reprobator on August 03, 2009, 05:36:15 pm
Well i don't know yet where to find that option, but that sound very interesting.  ;7
i ll look for it tomorrow as its quite late here.
Title: Re: The reprobator's fred noobsih question emporium
Post by: karajorma on August 04, 2009, 04:27:43 am
Ship Editor -> Initial Status.
Title: Re: The reprobator's fred noobsih question emporium
Post by: Reprobator on August 04, 2009, 07:11:13 am
Thank you i just find it, well it do not overide the ship's table max speed so i got two solution :
-1 I wait 3/4 minutes after the carrier jump to give him time to slowdown (well that's not good for the dramatic effect)
-2 I set lower  Forward decel value for my carrier

Title: Re: The reprobator's fred noobsih question emporium
Post by: Reprobator on October 01, 2009, 02:11:10 am
Well, finally i changed the decel time for the carrier, now it works greatly.
Now here something else, i don't know if anything can be done for that :
I'd like to prevent the player to move his ship in the first seconds of the mission,
It works well... after the first second, it seems that when i have my thruster not at 0 on my stick, the ship will move untill fred trat the sexp.
My actual solution is to swap player's ship with a copy  with a set  max speed of 0 and that works, but i would like to find a cleaner solution as fighter room's in the tables are not unlimited.
Title: Re: The reprobator's fred noobsih question emporium
Post by: ReeNoiP on October 01, 2009, 03:25:20 am
Well, finally i changed the decel time for the carrier, now it works greatly.
Now here something else, i don't know if anything can be done for that :
I'd like to prevent the player to move his ship in the first seconds of the mission,
It works well... after the first second, it seems that when i have my thruster not at 0 on my stick, the ship will move untill fred trat the sexp.
My actual solution is to swap player's ship with a copy  with a set  max speed of 0 and that works, but i would like to find a cleaner solution as fighter room's in the tables are not unlimited.

You could just use "player-use-ai" and "play dead". Then set up another event with "player-not-use-ai" with the delay you want.
Title: Re: The reprobator's fred noobsih question emporium
Post by: Reprobator on October 01, 2009, 03:26:45 am
That was done, but it looks like 0 seconds happens after 1 seconds for freespace2.
Title: Re: The reprobator's fred noobsih question emporium
Post by: karajorma on October 01, 2009, 04:45:30 am
There is a tickbox in the Mission Notes editor to start the player under AI control.
Title: Re: The reprobator's fred noobsih question emporium
Post by: Reprobator on October 01, 2009, 09:07:52 am
Oh that's great then,  i'll look for it tonight!
Title: Re: The reprobator's fred noobsih question emporium
Post by: Reprobator on October 02, 2009, 01:15:50 am
After trying yesterday the player start under AI control things yesterday, i got worst, the AI take the control form the beginning that's OK but even with an AI order triggered by when has time elapsed 0, the AI will do what it want for the first second and then apply the sexp.
So from that, i decided to sacrifice one ship entry by creating a copy of the player"s ship with a max speed of 0 but when i swap the player's model with the change ship class, the cockpit simply disappear, they have both the same cockpit, and it doesn't disappear when the ship is under player's control  :nervous:
So i may have been beyond what those sexp are designed for?  ;)
Title: Re: The reprobator's fred noobsih question emporium
Post by: FUBAR-BDHR on October 02, 2009, 01:22:40 am
OK do you have the following done:

Player start under AI control checked
Initial player speed 0
Initial player order play dead

If you do and the ship is still moving try an event with a repeat of 9999999 and delay of 0 with set object facing object (add a waypoint where the ship should face) and set object speed 0
Title: Re: The reprobator's fred noobsih question emporium
Post by: Reprobator on October 02, 2009, 01:24:47 am
Ok i will try that, if i can save table entry (as i'll have to repeat it for each playable ships) that's perfect.
I'll try this after my job's time.  ;)
Title: Re: The reprobator's fred noobsih question emporium
Post by: karajorma on October 02, 2009, 05:32:02 am
After trying yesterday the player start under AI control things yesterday, i got worst, the AI take the control form the beginning that's OK but even with an AI order triggered by when has time elapsed 0, the AI will do what it want for the first second and then apply the sexp.

I think I'm going to have a look at that tickbox then. If it can't avoid that happening I don't see much point in it.
Title: Re: The reprobator's fred noobsih question emporium
Post by: Reprobator on October 02, 2009, 06:06:00 am
Well the point is the very very firt seconds as when the sexp are executed, it s respected (following waypoint at a speed of 1)
the sexp is trigered by ime elapsed 0 but i guess for fs2 open : 0 seconds  =init 1 seconds=0 .
I will try to break the ship's legs so it will not run far away the first seconds.

Edit :
I m getting closer to it, so i broke his leg (set engines integrity to 0 in the ship editor)
Now i got to set it back @ 100% later, the new issue with that is that set subsystem strengh sexp invoke a support ship and is not something transparent.
i m looking for something else to fix transparetly the engines in fred
Title: Re: The reprobator's fred noobsih question emporium
Post by: Reprobator on October 02, 2009, 06:19:32 am
Too bad i can't sabotage a subsystem with negative value  :p
Title: Re: The reprobator's fred noobsih question emporium
Post by: karajorma on October 02, 2009, 06:46:56 am
Yeah I know, what I said is that if the tickbox can't prevent that from happening it's basically worthless.
Title: Re: The reprobator's fred noobsih question emporium
Post by: Reprobator on October 02, 2009, 07:00:41 am
I see, something that disturb me a bit is the presence of both repair subsystem and set sbsystem strengh i mean : if the repair subsystem call for a support ship, why does "set subsystem strengh" act exactly the same? i don't see the difference between them.
If set subsystem strengh simply set directly the new subsystem strengh value that would make sense no?
Title: Re: The reprobator's fred noobsih question emporium
Post by: Reprobator on January 11, 2010, 09:08:39 am
Those sexp now work as intended , that's perfect,
Title: Re: The reprobator's fred noobsih question emporium
Post by: Reprobator on February 01, 2010, 03:48:39 am
OK,
Hi again everyone,
I'm actually working on a sexp sequence that allow the player to reload it's weapon without support ship (we have no support ship yet, and planned that fighter and bomber have to come back to the closest carrier to reload.)
It's working for now, but I'm looking for a way to improve it,
For now it check the distance to a given subsystem
"evertime
<
 distance to ship subsystem
50
etc..."

What is bad right now with this, it's that you just have to run to the hangar bay at full speed and you get instantly reloaded.
I'd like to check more things in order to trigger the rearm thing :
So I've added a speed checking , but what i'm looking for to finish it, is a time check,
Basically from what i understood "has time elapsed" is based on mission time,
I d like to create a sequence that check :
when alpha 1 is Under a distance of 40 m
and alpha 1 speed under 30
those two condition where true for 5 second
then rearm.
The first two condition are checked already, but the last one, i did not find solution yet , Any idea?


Title: Re: The reprobator's fred noobsih question emporium
Post by: FUBAR-BDHR on February 01, 2010, 04:46:14 am
Well it's 5:30am so this may not come out too well.

You probably need 3 events and a variable (call it rearm)

First one:
When
->or
-->distance to ship subsystem alpha 1 > 39
-->current speed alpha 1 > 29
->modify variable rearm 0
repeating 99999999 delay 1

second
when
->and
-->distance to ship subsystem alpha 1 < 40
-->current speed alpha 1 < 30
->modify variable rearm rearm + 1
repeating 9999999 delay 1

third
when
->rearm > 4
-> do your rearming

Title: Re: The reprobator's fred noobsih question emporium
Post by: Reprobator on February 01, 2010, 07:18:58 am
That Seems a clever way to adress the issue.

Is there a limit of sexp that can be stored in a signle mission?

right now i ve a lot of sexp in my mission's template and yeet nothing happen in those mission :p
Title: Re: The reprobator's fred noobsih question emporium
Post by: Reprobator on February 03, 2010, 11:02:12 am
I'm doing it right now, what i don't get is wich sexp to use to check a variable value (i mean for the last part
Oh i think i got it!
Title: Re: The reprobator's fred noobsih question emporium
Post by: The E on February 03, 2010, 11:05:08 am
Variables can be checked using the same operators you would use for fixed numbers or strings.
Title: Re: The reprobator's fred noobsih question emporium
Post by: Thaeris on February 03, 2010, 04:01:36 pm
This sounds like something Diaspora would benefit from...
Title: Re: The reprobator's fred noobsih question emporium
Post by: The E on February 03, 2010, 04:04:19 pm
Given that FUBAR and Karajorma are on that team, I'd say they know about this already.
Title: Re: The reprobator's fred noobsih question emporium
Post by: Reprobator on August 22, 2011, 05:03:34 pm
Resurecting this thread from ashes,  key pressed does not work in multiplayer coop.
I was  working on a sexp sequence that increment a variable by +1 each time the player press the key ,  each number from  1 to 5 is used to "select a ship class " then when you fill some given  condition your own ship get swapped by the one you selected, when the variable get to 6 the the sequence reinitialise it to 1

Is there another way to achieve that kind of stuff with using something else that key pressed, i mean is there any possibility to use some sort of communication menu instead ?

I may create 6 special  subsystem in a ship's fighterbay and check distance for the selection but i'd prefer a more civilised solution.
Title: Re: The reprobator's fred noobsih question emporium
Post by: Lester on August 22, 2011, 05:17:45 pm
Can you post the actual event here in code tags?

Also, key-press will only work for the host in multiplayer, as other players just cant send any sexp information back to the host.
Title: Re: The reprobator's fred noobsih question emporium
Post by: Reprobator on August 22, 2011, 05:32:38 pm
Well it works fine in solo, the same doesn't work in the multiplayer version of the mission
everytime
->key press "B"
  ->modify variable
        "ship select"
        +1
 ->Send message
 Command blah
 blah
 Fighter selected

then  i have
When is event true delay (event abobe with delay 1)
key reset B

all with repeat count of 20000
The problem is that i do not even receive the message in multiplayer, so it seems to me that the key pressed sexp do not work in coop mission.
Title: Re: The reprobator's fred noobsih question emporium
Post by: Lester on August 22, 2011, 05:35:44 pm
That's because the variable you're using isn't a network variable. Edit the variable and choose the "Network-Variable" option. It should work that way. If it still doesn't, either open the mission file with notepad and paste the event in question here or upload the whole mission as an attachment.
Title: Re: The reprobator's fred noobsih question emporium
Post by: Reprobator on August 22, 2011, 05:49:09 pm
The network variable is ticked already ;)
But normally even if the variable is problematic, the way the sequence is done, i should receive the message no?
As it is for a total conversion sending the mission would be frustating ^^
Anyway here it is :
(http://tof.canardpc.com/preview/7247c5c9-d846-4888-87ed-1ebd034df6a1.jpg) (http://tof.canardpc.com/view/7247c5c9-d846-4888-87ed-1ebd034df6a1.jpg)

The variable itself
(http://tof.canardpc.com/preview/5c94b69e-6d43-4d7f-a24d-45609cbf159a.jpg) (http://tof.canardpc.com/view/5c94b69e-6d43-4d7f-a24d-45609cbf159a.jpg)
Title: Re: The reprobator's fred noobsih question emporium
Post by: Lester on August 22, 2011, 05:58:54 pm
You don't need that second event, just dump that key-reset in the same every-time. You'll also need to use key-reset-multiple, as it's designed specifically for events which get called multiple times.
Title: Re: The reprobator's fred noobsih question emporium
Post by: Reprobator on August 22, 2011, 06:14:57 pm
It use to be in the same everytime at the beginning but when i tryed the first time i moved it away to ensure the problem do not come from there :)
But it s part of the same everytime right now.
Title: Re: The reprobator's fred noobsih question emporium
Post by: Lester on August 22, 2011, 06:18:00 pm
Can you please post the mission? If you don't like showing your content to the public, feel free to PM me with it. There's only so much I can do without looking at the mission file.
Title: Re: The reprobator's fred noobsih question emporium
Post by: Reprobator on August 22, 2011, 06:20:27 pm
No problem :D

[attachment deleted by ninja]
Title: Re: The reprobator's fred noobsih question emporium
Post by: Lester on August 22, 2011, 06:42:35 pm
I have no idea what's causing this. I even turned the thing into a when with a large trigger count, switched the variable to a non-network, and even mapped it to some other key. Nothing worked.

We'll see what someone more experienced will have to say on this.
Title: Re: The reprobator's fred noobsih question emporium
Post by: Reprobator on August 22, 2011, 06:45:20 pm
^^ Did you managed to use keypressed in coop mission to work before?
Title: Re: The reprobator's fred noobsih question emporium
Post by: karajorma on August 22, 2011, 07:57:26 pm
The key-pressed SEXP has never worked and possibly may never work in multiplayer. The problem is the whole server/client issue again. All SEXPs run on the server, the client never even enters that section of the code at all. When a SEXP is fixed to work in multiplayer it means that the server sends a notification to the client telling it that the server has done something and that the client should do the same thing too. So as you can see everything SEXP related is basically a case of the server telling the client what to do.

This is an issue with key-pressed as the server doesn't have the information needed in order for key-pressed to work. It only knows which keys have been pressed on the server. If the host is running the server that means only the player on the server's keys are processed. In the case of a standalone-server it means nobody gets their keys processed, not even the host.

In order for key-pressed to work in multiplayer the server needs to have all the information it needs already present when the SEXP is checked. Now I could simply fix it so that the players send all their data to the server every key-press but I'm worried about the sheer amount of data that would involve sending. As a matter of fact, I was looking into a solution yesterday of having the server notify the clients which key-presses it is interested in and having them send information back only if one of those particular keys is pressed.

While I might be able to code that, I'm currently busy with Diaspora stuff now and it will be a week or two at the very least before I have time to look at it again.
Title: Re: The reprobator's fred noobsih question emporium
Post by: Reprobator on August 23, 2011, 01:13:43 am
I see, well that's really nice from you to fixed that, we do not plan to release anything before 6 mounth at least anyway so you do what you have to do, i have no problem with that :)
However one more question , if i understand what you said, it should have worked, when i made my test i host the server (player/Server ie not dedicated ) and played as alpha1, or i guess the game by default do not treat key pressed in multiplayer.

For those kind of script i wonder if a comm like menu (done in lua? ) called by a common key would not be better than waiting for a key to be pressed (as most of key is binded by default) i mean it bugs me a little to "override" an existing key, if i wanted to make for exemple a script that transofrm my target to an electric sheep (why e sheep i do not know :p ) by pressing b for exemple well...
Anyway it is certainly not a real issue as most fredders untill now could do it with key pressed.