Members | Sign In
All Forums > Mission Scripting
avatar

shieldStateFront condition

posted Jun 03, 2013 14:48:49 by matt.schillinger
I am trying to get a condition to trigger when an enemy ship's shields are below 30. The enemy ship is a Kralien Light Cruiser, with max shields of 40. I can verify through scanning that the ship when hit goes well below 30 shields.

There is a timer that resets as long as the variable KR1_Fervor_Chance = 0.0

I have an event with the condition if shieldStateFront < 30 , then perform actions. That is never being triggered, but I can't figure out why. The action if that condition were triggered would set KR1_Fervor_Chance to a value greater than 0, this stopping the timer.

Here is the test code I have in place. Any help would be greatly appreciated!

<mission_data version="1.7" background_id_arme="">
<!--when a ship goes into retreat mode, it should choose a direction, a speed, a rearshield state, and a maneuverability value-->
<start name_arme="Start">
<create type="player" x="32524.0" y="0.0" z="30000.0" angle="344.6" name="Artemis" />
<set_difficulty_level value="1" />
<set_timer name="Kralien_Fervor_Timer" seconds="5" />
<set_timer name="KR1_Action_Timer" seconds="5" />
<create type="enemy" x="20000.0" y="0.0" z="26000.0" angle="123.0" name="KR1" raceKeys="Kralien enemy" hullKeys="Light Cruiser small" fleetnumber="0" />
<set_variable name="KR1_Fervor_Chance" value="0.0" />
</start>
<folder_arme name_arme=" Kralien Fervor System " id_arme="831fb39e-54ad-4f73-b725-36ba7d5a7b39" expanded_arme="" />
<event name_arme="Fervor_timer_Reset" id_arme="d4716f8a-e4b1-41ca-81ae-f71ad66a6643" parent_id_arme="831fb39e-54ad-4f73-b725-36ba7d5a7b39">
<if_timer_finished name="Kralien_Fervor_Timer" />
<if_variable name="KR1_Fervor_Chance" comparator="EQUALS" value="0.0" />
<set_timer name="Kralien_Fervor_Timer" seconds="5" />
</event>
<event name_arme="KR1 Damage" id_arme="23c5acbb-5cd2-4d0a-8873-30d7999422a2" parent_id_arme="831fb39e-54ad-4f73-b725-36ba7d5a7b39">
<if_timer_finished name="Kralien_Fervor_Timer" />
<!--<if_object_property property="systemDamageBeam" name="KR1" comparator="GREATER" value="30.0" />-->
<if_object_property property="shieldStateFront" name="KR1" comparator="LESS" value="30.0" />
<if_variable name="KR1_Light_DMG" comparator="NOT" value="1.0" />
<set_variable name="KR1_Fervor_Chance" value="85.0" />
<big_message title="KR1 DAMAGED!" subtitle1="" subtitle2="" />
<set_variable name="KR1_Light_DMG" value="1.0" />
</event>
<folder_arme name_arme="Action Checks" id_arme="48f6fada-4c1e-41e1-be29-c88175a95791" parent_id_arme="831fb39e-54ad-4f73-b725-36ba7d5a7b39" expanded_arme="" />
<event name_arme="KR1_Fervor_Action" id_arme="e3d76470-68bc-4466-b22d-53d8aef854c5" parent_id_arme="48f6fada-4c1e-41e1-be29-c88175a95791">
<if_timer_finished name="KR1_Action_Timer" />
<if_variable name="KR1_Fervor_Chance" comparator="GREATER_EQUAL" value="80.0" />
<if_variable name="KR1_Fervor_Executed" comparator="NOT" value="1.0" />
<set_variable name="KR1_Action" value="20.0" />
<set_variable name="KR1_Fervor_Executed" value="1.0" />
<!--if morale timer is finished, and 1 ship is gone from the 5 ship fleet, and this event hasn't already triggered ->-->
<!--then run the condition to see if ships retreat, reset the morale_timer, and set variable to prevent event from reoccuring.-->
</event>
<folder_arme name_arme="Actions" id_arme="5ec22022-1ea6-4959-ab6b-7513583ff50d" parent_id_arme="48f6fada-4c1e-41e1-be29-c88175a95791" expanded_arme="" />
<event name_arme="KR1_Kamikaze" id_arme="44955997-3c7f-423b-a4c6-3e60661110aa" parent_id_arme="5ec22022-1ea6-4959-ab6b-7513583ff50d">
<if_variable name="KR1_Fervor_Chance" comparator="GREATER_EQUAL" value="80.0" />
<if_variable name="KR1_Action" comparator="GREATER" value="40.0" />
<if_variable name="KR1_Fervor_Executed" comparator="EQUALS" value="1.0" />
<set_variable name="KR1_Action" randomIntLow="1" randomIntHigh="100" />
<set_variable name="KR1_Fervor_Executed" value="1.0" />
<!--Ship will target_throttle toward player ship. When within 600, create mine, and destroy the ship.-->
<big_message title="KAMIKAZE!" subtitle1="" subtitle2="" />
</event>
<event name_arme="KR1_Suicide" id_arme="38a6e053-7a59-46e5-80ac-a6df644ec90c" parent_id_arme="5ec22022-1ea6-4959-ab6b-7513583ff50d">
<if_variable name="KR1_Fervor_Chance" comparator="GREATER_EQUAL" value="80.0" />
<if_variable name="KR1_Action" comparator="LESS_EQUAL" value="40.0" />
<if_variable name="KR1_Fervor_Executed" comparator="EQUALS" value="1.0" />
<big_message title="KR1 Suicide!" subtitle1="" subtitle2="" />
<set_object_property property="systemDamageBeam" value="1.0" name="KR1" />
<set_object_property property="systemDamageTactical" value="1.0" name="KR1" />
<set_object_property property="systemDamageTurning" value="1.0" name="KR1" />
<set_object_property property="systemDamageImpulse" value="1.0" name="KR1" />
<set_object_property property="systemDamageWarp" value="1.0" name="KR1" />
<set_object_property property="systemDamageFrontShield" value="1.0" name="KR1" />
<set_object_property property="systemDamageBackShield" value="1.0" name="KR1" />
<set_object_property property="systemDamageTorpedo" value="1.0" name="KR1" />
<set_object_property property="roll" value="1.0" name="KR1" />
<copy_object_property property="targetPointX" name1="KR1_Fervor_Executed" />
<!--Create a mine very close to the ship, detonate, and destroy the ship.-->
</event>
</mission_data>
[Last edited Jun 03, 2013 14:49:36]
page   1
9 replies
avatar
badgeguy said Jun 04, 2013 01:26:03
Matt,
You're resetting the timer before the event ever gets a chance to fire. Move this event to the end of your code:

<event name_arme="Fervor_timer_Reset" id_arme="d4716f8a-e4b1-41ca-81ae-f71ad66a6643" parent_id_arme="831fb39e-54ad-4f73-b725-36ba7d5a7b39">
<if_timer_finished name="Kralien_Fervor_Timer" />
<if_variable name="KR1_Fervor_Chance" comparator="EQUALS" value="0.0" />
<set_timer name="Kralien_Fervor_Timer" seconds="5" />
</event>

I have been able to get the variable to fire once it is moved.

Good luck.

Rusty
avatar
matt.schillinger said Jun 04, 2013 01:32:13
Thanks so much!
avatar
matt.schillinger said Jun 04, 2013 03:14:28
Tested, and it's working! Awesome.

My next challenge, is that I want the ship to either Kamikaze (fly toward player ship and detonate itself or a mine or something, and if needed 'destroy the enemy ship' via scripting).

OR

Ship commits suicide by blowing itself up.

I don't see a good way to do this with a mine, as you can't set the coordinates relative to an object, but only relative to a point. I can't figure out a way to get the live coordinates of the ship (KR1) into variables so that i could set a mine with the appropriate coordinates.

Any ideas?
avatar
JSpaced said Jun 04, 2013 08:51:58
Welcome to the sticking point of the scripting for the current version of Artemis. Thom has promised that in 2.0 you can spectacularly explode ships by script. Until then, sometimes you have to move objects to a place where you put a mine, rather than move the mine to your object.

Unless there's a way that the Object_Property X,Y and Z coordinates can be entered as a variable?

J
"We should give him the send-off he deserves. He died saving us all. Prepare a Rocket-Shed for immediate launch."
avatar
lucas99801 said Jun 04, 2013 09:32:29
I don't know about entering coords as a variable, but you could always spawn a mine at a far corner of the map then use the "Copy property ________ from ______ to ______" to move the mine on top of the enemy ship. Just make sure you copy X, Y, and Z in the same event or you could hit an innocent bystander.
Hosting a Mumble (Murmur) server @ tsnfenrir.no-ip.org
Having trouble connecting to the TeamSpeak channel: http://tsnfenrir.no-ip.org/ts3
Helm Script for Numerical heading input: https://dl.dropbox.com/u/10193809/ArtemisHelmFSW.zip
Twitter: @lucas99801
Facebook: /lucastarnold
avatar
matt.schillinger said Jun 04, 2013 13:06:52
I appreciate the ideas!

Unfortunately, what I was hoping for is a visual explosion of an enemy ship. In the case of a suicide, the main screen may show the ship explode. For a kamikaze run, I was hoping that the ship could take the kind of jarring damage that causes a visual (DMX/screen) and auditory effect. Unfortunately, for kamikaze, it looks like the best I can currently do is set damage properties and alert engineering. It's a little dissatisfying, but I guess it will have to do until i can come up with a better option.

I wish that the scripting had a method to copy a property out to a variable. Perhaps i could produce a mine at the appropriate coordinate to create the necessary effect. Maybe 2.0 will offer that.

Until then, I will code on.
avatar
Mike_Substelny said Jun 04, 2013 18:09:06
Good luck with your main screen special effects. I have dabbled in these and found that it is nearly impossible to impress players with them. The reason is that most crews keep the main view screen set to Long Range Scan 95% of the time. Very few players ever see the awesome visual stuff I plan for them.

Nevertheless, you could augment your explosion special effect by creating a bunch of "debris" generic objects that burst out of the exploding ship. This happens if you destroy the Hive in "Party Crashers" and it looks pretty good . . . if anyone ever sees it.

If you are inclined to 3-D art maybe you could make something for the community that I've always wanted: build a big sphere and paint the INSIDE pure white. That way, when you need a spectacular explosion just create the sphere as a generic object surrounding the players. After about one second destroy the object. The main viewer will appear to show a blinding white flash. Some players may even shade their eyes.
"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
JSpaced said Jun 07, 2013 09:15:29
And now, we can present to you:
Rusty's tracking the position as a variable snippet

Use this to track your Kamikaze ship and at the appropriate moment FILL it with Mines. KABABABOOM!
I, personally, am going to use it to try and simulate a warp-core eject and detonate option.

J
"We should give him the send-off he deserves. He died saving us all. Prepare a Rocket-Shed for immediate launch."
avatar
matt.schillinger said Jun 07, 2013 13:06:53
I've already added it Need to run it through the paces still. Mostly need to test my code than Rusty's. :)
Login below to reply: