Members | Sign In
All Forums > Mission Scripting
avatar

Catch Confirm Jump event

posted Feb 11, 2013 17:37:42 by ZacharyDanielBringham
I'm writing a script for my Star Wars group, and I'm trying to catch when helm confirms a jump, so I can have the script erase the map and repopulate, but I can't figure out how to do that. Right now I'm using warpstate, but I think that's forcing the server to use warp instead of Jump drive, because even when I select Jump Drive from the menu, it still comes up with warp. Ideally I'd like to be able to catch and prevent a jump.
page   1 2 next last
16 replies
avatar
Mike_Substelny said Feb 11, 2013 22:05:21
A few month ago Thom and I had a discussion about allowing Mission Scripts to capture when Helm sets Jump coordinates off the map to do exactly what you are thinking. Thom likes the idea for a future release. Right now I don't know how you could do it using the built-in jump coordinate mechanic, but I can suggest something . . .

Program helm with a special keyboard command for jumping to the next sector. Only allow Helm to press that key under certain circumstances (enough energy onboard, close enough to the map edge, etc.). When Helm presses that key trigger a bunch of actions (including some special effects, sounds, energy expenditure, etc.) then draw your new sector. I recommend giving the new sector a different skybox so the players know they are now somewhere else.

You *might* even be able to have helm enter the coordinates on the keyboard using a series of get_client_key blocks. If helm enters a single digit wrong they end up somewhere very, very bad. Helm's number keys are normally reserved for selecting Warp Factors, but in Jump Drive mode you might be able to make that work.

Good luck!
"Damn the torpedoes! Four bells, Captain Drayton!"

(Likely actual words of Admiral David Farragut, USN, at the battle of Mobile Bay. Four bells was the signal for the engine room to make full steam ahead).
avatar
ZacharyDanielBringham said Feb 11, 2013 22:24:36
Thanks, I'll check that out. I noticed in the commands file there was a keyboard key label called UI_INPUT_OEM_JUMP, but I have no idea how to use that.
Also, do you have any idea why it's ignoring the client selection of Jump Drive?
[Last edited Feb 11, 2013 22:42:37]
avatar
bleep751 said Feb 11, 2013 23:29:00
Hey...if you guys want. I actually did already type up a script for jumping using key commands, that allows helms to manually enter coordinates and angles, and initiates the jump. Calculated it out so it has the exact same energy drain as the jump feature in invasion mode. It does rely on the helm performing some basic math, other wise, as Mike implied, they end up in the wrong location. If you want,I can post that for you?
avatar
ZacharyDanielBringham said Feb 12, 2013 00:29:03
Yeah, that'd be great, actually. Thanks!
avatar
bleep751 said Feb 12, 2013 00:38:38
Ok, here you go. I have it set so that the script will identify certain ships that can be chosen for Artemis, and will only use the jump if the ship matches some set parameters, that way I can control which ships have the jump feature. You can edit this so it will apply to any ship if you want, won't be too hard..Its set so that the jump has a maximum distance of 50K, similiar to the jump feature in the game, but once again, thats easy to edit if you need to.. I set it so that Helm controls jump distance with keys Q, A, and Z, and jump angle direction with W, S, and X. Currently, direction is based on the map, not the orientation of the ship, although if you want,I did think of a fix for that, potentially, just haven't gotten around to writing it up. If you have any issues with it, let me know. I've tested it pretty thoroughly, and everything seems to work without issue.

<!-- Identify if the ship is a jump ship-->
<event>
<if_exists name="Artemis"/>
<if_variable name="Artjump" comparator="=" value="0"/>
<if_object_property name="Artemis" property="topSpeed" comparator="=" value="0.08"/>
<if_object_property name="Artemis" property="shieldMaxStateFront" comparator="=" value="500" />
<if_object_property name="Artemis" property="shieldMaxStateBack" comparator="=" value="500"/>
<set_variable name="Artjumpdir" value="0"/>
<set_variable name="Artjumpdist" value="0"/>
<start_getting_keypresses_from consoles="H"/>
<set_variable name="Artjump" value="1"/>
</event>
<event>
<if_exists name="Artemis"/>
<if_variable name="Artjump" comparator="=" value="0"/>
<if_object_property name="Artemis" property="topSpeed" comparator="=" value="0.08"/>
<if_object_property name="Artemis" property="shieldStateMaxFront" comparator="=" value="500"/>
<if_object_property name="Artemis" property="shieldStateMaxBack" comparator="=" value="500"/>
<set_variable name="Artjumpdir" value="0"/>
<set_variable name="Artjumpdist" value="0"/>
<start_getting_keypresses_from consoles="H"/>
<set_variable name="Artjump" value="1"/>
</event>
<event>
<if_exists name="Artemis"/>
<if_variable name="Artjump" comparator="=" value="0"/>
<if_object_property name="Artemis" property="topSpeed" comparator="=" value="0.1"/>
<if_object_property name="Artemis" property="shieldStateMaxFront" comparator="=" value="500"/>
<if_object_property name="Artemis" property="shieldStateMaxBack" comparator="=" value="500"/>
<set_variable name="Artjumpdir" value="0"/>
<set_variable name="Artjumpdist" value="0"/>
<start_getting_keypresses_from consoles="H"/>
<set_variable name="Artjump" value="1"/>
</event>

<!-- Math -->
<!-- Distance -->
<event>
<if_exists name="Artemis"/>
<if_variable name="Artjump" comparator="=" value="1"/>
<if_client_key keyText="Q"/>
<set_variable name="Artjumpdist" value="Artjumpdist+1000"/>
<warning_popup_message message="Jump Distance Set + 1000" consoles="H"/>
</event>
<event>
<if_exists name="Artemis"/>
<if_variable name="Artjump" comparator="=" value="1"/>
<if_client_key keyText="A"/>
<set_variable name="Artjumpdist" value="Artjumpdist+10000"/>
<warning_popup_message message="Jump Distance Set + 10000" consoles="H"/>
</event>
<event>
<if_exists name="Artemis"/>
<if_variable name="Artjump" comparator="=" value="1"/>
<if_client_key keyText="Z"/>
<set_variable name="Artjumpdist" value="0"/>
<warning_popup_message message="Jump Distance Set to 0" consoles="H"/>
</event>
<!-- Direction -->
<event>
<if_exists name="Artemis"/>
<if_variable name="Artjump" comparator="1"/>
<if_client_key keyText="X"/>
<set_variable name="Artjumpdir" value="0"/>
<warning_popup_message message="Jump Direction Set set to 0" consoles="H"/>
</event>
<event>
<if_exists name="Artemis"/>
<if_variable name="Artjump" comparator="=" value="1"/>
<if_client_key keyText="W"/>
<set_variable name="Artjumpdir" value="Artjumpdir+10"/>
<warning_popup_message message="Jump Direction Set + 10" consoles="H"/>
</event>
<event>
<if_exists name="Artemis"/>
<if_variable name="Artjump" comparator="=" value="1"/>
<if_client_key keyText="S"/>
<set_variable name="Artjumpdir" value="Artjumpdir+100"/>
<warning_popup_message message="Jump Direction Set + 100" consoles="H"/>
</event>

<!-- the jump itself, plus energy drain -->
<event>
<if_exists name="Artemis"/>
<if_variable name="Artjump" comparator="=" value="1"/>
<if_variable name="Artjumpdir" comparator="GREATER" value="0"/>
<if_variable name="Artjumpdist" comparator="GREATER" vale="0"/>
<if_object_property name="Artemis" property="energy" comparator="GREATER" value="Artjumpdist * 0.00576"/>
<if_client_key keyText="J"/>
<create type="genericMesh" x="0" y="500" z="0" meshFileName="dat/mine.dxs" textureFileName="dat/greenCrossHatch.png" name="_"/>
<set_relative_position name1="Artemis" name2="_" angle="Artjumpdir" distance="Artjumpdist"/>
<set_variable name="_real" value="1"/>
</event>
<event>
<if_exists name="Artemis"/>
<if_variable name="Artjump" comparator="=" value="1"/>
<if_variable name="Artjumpdir" comparator="GREATER" value="0"/>
<if_variable name="Artjumpdist" comparator="GREATER" vale="0"/>
<if_object_property name="Artemis" property="energy" comparator="LESS" value="Artjumpdist * 0.00576"/>
<if_client_key keyText="J"/>
<warning_popup_message message="Not Enough Energy to Perform Jump" consoles="C"/>
<set_variable name="_real" value="1"/>
</event>

<event>
<if_exists name="Artemis"/>
<if_variable name="Artjump" comparator="=" value="1"/>
<if_variable name="_real" comparator="=" value="1"/>
<copy_object_property name1="_" name2="Artemis" property="positionX"/>
<copy_object_property name1="_" name2="Artemis" property="positionZ"/>
<destroy name="_"/>
<addto_object_property name="Artemis" property="energy" value="Artjumpdist * 0.00576 * -1"/>
<set_variable name="_real" value="0"/>
</event>

<!-- set max distance and direction -->
<event>
<if_exists name="Artemis"/>
<if_variable name="Artjump" comparator="=" value="1"/>
<if_variable name="Artjumpdist" comparator=">" value="50000"/>
<set_variable name="Artjumpdist" value="50000"/>
</event>
<event>
<if_exists name="Artemis"/>
<if_variable name="Artjump" comparator="=" value="1"/>
<if_variable name="Artjumpdir" comparator=">" value="359"/>
<set_variable name="Artjumpdir" value="0"/>
</event>
<!-- END OF JUMP SETTINGS -->
avatar
ZacharyDanielBringham said Feb 12, 2013 01:29:35
Awesome. One question: does this only catch the jump event if the Helmsman presses J? or does it catch pressing the "Initiate" button on the helm UI?
avatar
bleep751 said Feb 12, 2013 02:24:55
It will only catch the jump event from Helmsman pressing J. I've found issues using normal Jump on missions, so I created this. I use custom ships that are forced to be very, very slow, even on full warp.
avatar
ZacharyDanielBringham said Feb 12, 2013 19:44:18
Hmmm. I may have to disable warp altogether and use a hotkey with a timer and messages for the hyperdrive. Is there a better way to disable the warp drive than just catching warpstate>0 and setting it back to 0?
avatar
ZacharyDanielBringham said Feb 12, 2013 21:53:06
Also, concept I'm working on for this jumpdrive idea, but I'm not sure how to implement: Is there a way to script in something like the COMMs menu, with a series of nested menus? Ideally for the hyperdrive I would have a series of menus once the helmsman activated the navicomputer (by pressing a hotkey). The menus would go Region-Sector-System-Planet, so as not to have too many options on the screen. So, for example, to get to Yavin 4, you would select Outer Rim-Gordian Reach-Yavin System-Yavin Prime. Then a table is referenced to get a calculation time for the navicomputer. Once that timer is done, Helm gets a message saying the Hyperdrive is ready, and a keypress activates the jump procedure. The script destroys everything on screen and generates the new system, as well as moving the player's ship to a default location on the screen.
Obviously this will require creating events that generate maps for every possible location, but the real trick is the menu
As far as I can tell, there is no way of nesting events. Ideally there would be the one Hyperdrive event that would start with the hotkey. Then it would prompt for a selection at each level and wait for the user input, then bring up the appropriate sub-menu, and repeat.
If I understand correctly, I have to use variables to flag which menus have been displayed and then create events with the proper conditions.
Is there a better way to do this than the method I've described?
Thanks

Edit: I just realized that calculating the timer length for jumps between Regions or Sectors would require separate events for each possible combination.
[Last edited Feb 12, 2013 22:50:14]
avatar
Mike_Substelny said Feb 13, 2013 15:44:21
The current scripting system will not allow you to create anthing graphical like the Comms menu. Nevertheless you COULD build a series of nested menus using if_client_key events and warning_popup messages.

I think you could also script a special effect that would look like the Star Wars hyperdrive. All you need is some white 3-D rods that move quickly past the player's ship during the jump plus a sound effect. I suggest that you penalize the players if Helm attempts to maneuver during a hyperjump, perhaps by destroyig the ship.

The time/energy needed for each jump might be accomplished using the new equation evaluator. I'm not sure about this since I have had limited success with it myself, but I bet you could make it work.
"Damn the torpedoes! Four bells, Captain Drayton!"

(Likely actual words of Admiral David Farragut, USN, at the battle of Mobile Bay. Four bells was the signal for the engine room to make full steam ahead).
avatar
ZacharyDanielBringham said Feb 13, 2013 17:24:38
Right right. Is there a way to set the energy states of systems? I think it'd be good to basically set all the energy of the systems to zero so they physically can't maneuver, speed up, etc. Science wouldn't have anything on the screens. I suppose I could always set the ship's total energy to 0. I still can't figure out a way to permanently disable warp.
Also, is there a way to make a ring that only science can see? One of the concepts in this first mission script is that the ship gets pulled out of hyperspace by an Interdictor cruiser and I'd like science to be able to see the edge of the gravity well. Right now it's set up so that if Science does a second scan on the Interdictor, the info will mention the diameter of the gravity well, but it'd be cool if it were visible
avatar
Mike_Substelny said Feb 13, 2013 18:40:40
You can not affect or detect the Engineer's energy settings. Yes, you can set total energy to zero during the jump then recharge the ship at the end of the jump. This would essentially make the jump a cut scene during which the players have nothing to do but conduct jedi training against remotes. :-)

You can disable steering by temporarily destroying the maneuvering systems then repairing them when the jump is done. It's inelegant but effective. You *can* permanently disable warp simply by destroying it. Keep the warp engines destroyed and the ship can't warp. But if the Damcon teams go there they might be trapped forever.

The easiest way to make the ring is to use a Black Hole and declare the gravity well has that exact diameter. Create the Black hole at the same X,Z coordinates as the Interdictor but put it thousands of units above the Y plane. It will appear on Long Range Scan but they won't see it on the forward viewer. It will freak out the players to see the Interdictor appears to be in the center of a Black Hole!

Otherwise you could easily make a ring of invisible Generic Objects. They would appear on the Science Scan but they would also be visible on Long Range Scan.

A more elegant solution would be to make a ring of Elite enemies with their engines disabled but their Elite Ability bits set to "invisible to tactical" and "invisible to main screen." If you make the ring out of 12 such Elites you could program their text fields to reveal 12 different tidbits of information about the Interdictor, giving Science something critical to do.
[Last edited Feb 14, 2013 03:09:16]
"Damn the torpedoes! Four bells, Captain Drayton!"

(Likely actual words of Admiral David Farragut, USN, at the battle of Mobile Bay. Four bells was the signal for the engine room to make full steam ahead).
avatar
ZacharyDanielBringham said Feb 13, 2013 19:13:28
Good ideas. I'll look into them. Thank you.
avatar
ZacharyDanielBringham said Feb 14, 2013 23:54:48
I tried to put in new skyboxes so that I could use the "light tunnel" image for my hyperdrive animation, but even though I named the new files exactly the same as the old files, Artemis crashed on load until I put the old files back. Is there something that I'm missing?
avatar
Mike_Substelny said Feb 17, 2013 18:05:55
I don't know what you can do to add new skyboxes. But switching between the old pre-loaded skyboxes does work well for special effects.
"Damn the torpedoes! Four bells, Captain Drayton!"

(Likely actual words of Admiral David Farragut, USN, at the battle of Mobile Bay. Four bells was the signal for the engine room to make full steam ahead).
Login below to reply: