Sign up Calendar Latest Topics
 
 
 


Reply
  Author   Comment  
Richard

Registered:
Posts: 127
Reply with quote  #1 
Hi,
I need a little script to make the player ship come to a full stop (set warp and impulse to zero for a few seconds and prevent the player to make any move). How can I do it?

I don't want to damage systems nor to mess with any attributes of the ship, just want to make it stop.

Thanks.
Arrew

Avatar / Picture

Registered:
Posts: 2,737
Reply with quote  #2 
Set the ship to a specific location continuously does the trick. But it's not so flexible, in as much as you have to say where it stops.
Xavier Wise

Registered:
Posts: 1,141
Reply with quote  #3 
Instead, I believe you can set the ships warp speed and impulse speed to zero continuously. I used such a trick to limit ships to sub-warp speeds in a BvB script I made a while ago. I can look up the code when I'm home later of you need.
__________________
Fleet Captain Xavier Wise - TSN Sabre
Link to TSN RP Community website
Richard

Registered:
Posts: 127
Reply with quote  #4 
Quote:
Originally Posted by Arrew
Set the ship to a specific location continuously does the trick. But it's not so flexible, in as much as you have to say where it stops.


Hi Arrew,
Thanks, but what I want is to make a full stop wherever the ship is. Your solution is good, but it isn't what I'm looking for.
Richard

Registered:
Posts: 127
Reply with quote  #5 
Quote:
Originally Posted by Xavier Wise
Instead, I believe you can set the ships warp speed and impulse speed to zero continuously.


Hi Xavier,

That was exactly what I did, but it doesn't work. I set a timer to continuously bring warp and throttle to zero, but the level of impulse and warp in the helm console goes up and down, up and down (moving from the original speed to zero successively).
As result the ship players doesn't stop.

If you have a script that makes it work, I would be glad to see it.
Thanks.
Xavier Wise

Registered:
Posts: 1,141
Reply with quote  #6 
Hmm.... I'll see what I can figure out.
__________________
Fleet Captain Xavier Wise - TSN Sabre
Link to TSN RP Community website
ryleyra

Registered:
Posts: 3,007
Reply with quote  #7 
One workaround is to constantly keep track of the position of the ship behind the scenes. Define an "x" and a "z" variable, and every cycle, compare it to the player's position. If it is less than the player's X or Z, add 10 to it, if it is greater than the player's X or Z subtract 10. You can also add 50 or 100 if the granularity of the position isn't important, but you want it to be able to keep up with warp or jump. (Conversely, you can just make the number change by a larger amount when the ship is further away. I'll have to try that...)

When you want to stop the ship, then, set its location to the X and Z last stored. This is a technique I used for two ships in a mission I'm working on. I wouldn't recommend it for a lot of ships, though.

A better way to implement a "wall" is to put it at an absolute position, so when the player runs into it, it stops. But if you want to be able to stop the player anywhere, that's really the only way you can do it.

I know that changing the position of the maneuvering slider ("steering") overrides the player's setting, at least until he sets it again. I'm not sure if the Impulse slider ("throttle") does the same, but if it keeps jumping back to the location the player last set it, just set "topspeed" to 0 instead. That will bring the ship to a complete stop and make Impulse inoperative.

Unfortunately, I know the Warp slider ("warpState") will not override the player's setting when you set it, so it will jump right back to where the player has it. As an experiment, I wrote a mission that kept resetting back to Warp 1 on a slider, in order to emulate what the game would be like if it took a longer amount of time to get to Warp 4.

The only way to kill Warp drive is to set "topspeed" to 0, like above, or destroy the warp engines with set_player_grid_damage. Yes, topspeed effects both Impulse and Warp.
Richard

Registered:
Posts: 127
Reply with quote  #8 
I 'll try to set topspeed to zero.
Thanks
Mike Substelny

Avatar / Picture

Administrator
Registered:
Posts: 2,404
Reply with quote  #9 
Make an invisible generic object and use set_relative_position to force it to stay with the moving player ship (for example object 180 degrees behind the player at range 100). Then, when the conditions are met for stopping the player, reverse the set_relative_position to force the player to remain in position (continuing example player 0 degrees in front of object at range 100).

This will definitely work.

If the players try to engage warp drive their ship will seem to shake and jump but it won't go anywhere. On the Science client it may appear to move but trust me, it won't be moving.

__________________
"The Admiralty had demanded six ships; the economists offered four; and we finally compromised on eight."
- Winston Churchill
Richard

Registered:
Posts: 127
Reply with quote  #10 
Quote:
Originally Posted by Mike Substelny
Make an invisible generic object and use set_relative_position to force it to stay with the moving player ship (for example object 180 degrees behind the player at range 100). Then, when the conditions are met for stopping the player, reverse the set_relative_position to force the player to remain in position (continuing example player 0 degrees in front of object at range 100).


That seems to be a good way to do it... but to place an object outside the boundaries has potential make the game crash? 

I´m kind of busy and i'll be able to make some scripts only next weekend. I´m anxious to see the results!

Thanks.

Richard

Registered:
Posts: 127
Reply with quote  #11 
Hi,

I´ve managed to write a "full stop script", a little addition to the great Sandbox v4.1. Thanks to all of you that shared info and wisdom!

Probably someone can do it in a more elegant way, but here is my code:

 <event name_arme="1   Full Stop" id_arme="057a9671-8a54-484d-a1b7-39372501ede8" parent_id_arme="7a00be79-c126-4680-8975-92e59f8f5b5d">
    <if_gm_key keyText="1" />
    <if_variable name="stop" comparator="EQUALS" value="0.0" />
    <!---->
    <create type="genericMesh" x="100000" y="100.0" z="100000" angle="0.0" name="parada" meshFileName="tsn\box.dxs" textureFileName="dat\trans-blue.png" colorRed="0.0" colorGreen="0.0" colorBlue="0.0" />
    <copy_object_property property="positionX" name1="Artemis" name2="parada" />
    <copy_object_property property="positionZ" name1="Artemis" name2="parada" />
    <copy_object_property property="positionX" name1="posicao" name2="Artemis" />
    <copy_object_property property="positionZ" name1="posicao" name2="Artemis" />
    <set_object_property property="warpState" value="0.0" name="Artemis" />
    <set_object_property property="throttle" value="0.0" name="Artemis" />
    <set_variable name="stop" value="1.0" />
    <!---->
  </event>
  <event name_arme="Full Stop active" id_arme="68537194-a821-41db-828d-beb9efe0b5cc" parent_id_arme="7a00be79-c126-4680-8975-92e59f8f5b5d">
    <if_variable name="stop" comparator="EQUALS" value="1.0" />
    <!---->
    <copy_object_property property="positionX" name1="posicao" name2="Artemis" />
    <copy_object_property property="positionZ" name1="posicao" name2="Artemis" />
    <set_object_property property="warpState" value="0.0" name="Artemis" />
    <set_object_property property="throttle" value="0.0" name="Artemis" />
    <!---->
    <!---->
      </event>
  <event name_arme="1  Full Stop off" id_arme="0ccc7f97-0637-415a-a1a9-f015b6f645ea" parent_id_arme="7a00be79-c126-4680-8975-92e59f8f5b5d">
    <if_gm_key keyText="1" />
    <if_variable name="stop" comparator="EQUALS" value="1.0" />
    <set_variable name="stop" value="0.0" />
    <destroy name="parada" />
    <!---->
  </event>



ps.: "parada" means stoped in portuguese.
ps2: If I want to write a script without the editor, is there a way to set the id_arme and parent_id_arme values?


Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.