Author Topic: The reprobator's fred noobsih question emporium  (Read 12427 times)

0 Members and 1 Guest are viewing this topic.

The reprobator's fred noobsih question emporium
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??

 
« Last Edit: July 16, 2009, 01:50:13 am by Reprobator »
$Formula: ( every-time
   ( has-time-elapsed "0" )
   ( Do-Nothing
   )
   ( send-message
      "#Dalek"
      "High"
      "Pro-crasti-nate"
   )
   )
)
+Name: Procratination
+Repeat Count: 99999999999
+Interval: 1

  

Offline Starman01

  • 213
  • Mechwarrior
    • Wing Commander Saga
Re: Player use ai/set object speed z
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 :)
MECHCOMMANDER OMNITECH

9 out of 10 voices in my head always tell me that I'm not insane. The 10th is only humming the melody of TETRIS.

 
Re: Player use ai/set object speed z
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
$Formula: ( every-time
   ( has-time-elapsed "0" )
   ( Do-Nothing
   )
   ( send-message
      "#Dalek"
      "High"
      "Pro-crasti-nate"
   )
   )
)
+Name: Procratination
+Repeat Count: 99999999999
+Interval: 1

 
Re: Player use ai/set object speed z
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
« Last Edit: July 13, 2009, 11:52:35 am by Reprobator »
$Formula: ( every-time
   ( has-time-elapsed "0" )
   ( Do-Nothing
   )
   ( send-message
      "#Dalek"
      "High"
      "Pro-crasti-nate"
   )
   )
)
+Name: Procratination
+Repeat Count: 99999999999
+Interval: 1

 

Offline Starman01

  • 213
  • Mechwarrior
    • Wing Commander Saga
Re: Player use ai/set object speed z
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 :)
MECHCOMMANDER OMNITECH

9 out of 10 voices in my head always tell me that I'm not insane. The 10th is only humming the melody of TETRIS.

 
Re: Player use ai/set object speed z
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
$Formula: ( every-time
   ( has-time-elapsed "0" )
   ( Do-Nothing
   )
   ( send-message
      "#Dalek"
      "High"
      "Pro-crasti-nate"
   )
   )
)
+Name: Procratination
+Repeat Count: 99999999999
+Interval: 1

 

Offline Starman01

  • 213
  • Mechwarrior
    • Wing Commander Saga
Re: Player use ai/set object speed z
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.
MECHCOMMANDER OMNITECH

9 out of 10 voices in my head always tell me that I'm not insane. The 10th is only humming the melody of TETRIS.

 
Re: Player use ai/set object speed z
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.
$Formula: ( every-time
   ( has-time-elapsed "0" )
   ( Do-Nothing
   )
   ( send-message
      "#Dalek"
      "High"
      "Pro-crasti-nate"
   )
   )
)
+Name: Procratination
+Repeat Count: 99999999999
+Interval: 1

 

Offline Starman01

  • 213
  • Mechwarrior
    • Wing Commander Saga
Re: Player use ai/set object speed z
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 :)
MECHCOMMANDER OMNITECH

9 out of 10 voices in my head always tell me that I'm not insane. The 10th is only humming the melody of TETRIS.

 
Re: Player use ai/set object speed z
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!
« Last Edit: July 13, 2009, 01:51:53 pm by Reprobator »
$Formula: ( every-time
   ( has-time-elapsed "0" )
   ( Do-Nothing
   )
   ( send-message
      "#Dalek"
      "High"
      "Pro-crasti-nate"
   )
   )
)
+Name: Procratination
+Repeat Count: 99999999999
+Interval: 1

 

Offline Starman01

  • 213
  • Mechwarrior
    • Wing Commander Saga
Re: Player use ai/set object speed z
I'm here to serve :)
MECHCOMMANDER OMNITECH

9 out of 10 voices in my head always tell me that I'm not insane. The 10th is only humming the melody of TETRIS.

 
Re: The reprobator's fred noobsih question emporium
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?
$Formula: ( every-time
   ( has-time-elapsed "0" )
   ( Do-Nothing
   )
   ( send-message
      "#Dalek"
      "High"
      "Pro-crasti-nate"
   )
   )
)
+Name: Procratination
+Repeat Count: 99999999999
+Interval: 1

 

Offline ReeNoiP

  • 27
  • I FRED
Re: The reprobator's fred noobsih question emporium
Start out with < rather than distance. You should then be able to use distance as an argument for <.

when
and
 - <
  distance
  x meters
Uncharted Territory is released. But I still need voice actors

 
Re: The reprobator's fred noobsih question emporium
oh cool i'll try that thanks !
$Formula: ( every-time
   ( has-time-elapsed "0" )
   ( Do-Nothing
   )
   ( send-message
      "#Dalek"
      "High"
      "Pro-crasti-nate"
   )
   )
)
+Name: Procratination
+Repeat Count: 99999999999
+Interval: 1

 

Offline Rodo

  • Custom tittle
  • 212
  • stargazer
    • Steam
Re: The reprobator's fred noobsih question emporium
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.
el hombre vicio...

 
Re: The reprobator's fred noobsih question emporium
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 :)

 
« Last Edit: July 16, 2009, 08:52:32 am by Reprobator »
$Formula: ( every-time
   ( has-time-elapsed "0" )
   ( Do-Nothing
   )
   ( send-message
      "#Dalek"
      "High"
      "Pro-crasti-nate"
   )
   )
)
+Name: Procratination
+Repeat Count: 99999999999
+Interval: 1

 

Offline ReeNoiP

  • 27
  • I FRED
Re: The reprobator's fred noobsih question emporium
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.
Uncharted Territory is released. But I still need voice actors

 
Re: The reprobator's fred noobsih question emporium
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?
$Formula: ( every-time
   ( has-time-elapsed "0" )
   ( Do-Nothing
   )
   ( send-message
      "#Dalek"
      "High"
      "Pro-crasti-nate"
   )
   )
)
+Name: Procratination
+Repeat Count: 99999999999
+Interval: 1

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Re: The reprobator's fred noobsih question emporium
Aren't the dock-related AI goals usually greyed out when attempting to assign them to the player ship, even under player-use-ai?

 
Re: The reprobator's fred noobsih question emporium
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...
$Formula: ( every-time
   ( has-time-elapsed "0" )
   ( Do-Nothing
   )
   ( send-message
      "#Dalek"
      "High"
      "Pro-crasti-nate"
   )
   )
)
+Name: Procratination
+Repeat Count: 99999999999
+Interval: 1