Hard Light Productions Forums
Modding, Mission Design, and Coding => The Modding Workshop => Topic started by: LoneKnight on August 08, 2011, 01:20:19 pm
-
Hey guys, I'm making a mission where a large enemy ship is hunting you and your comrades in a nebula using sonar. I created three different types of sonar: High, Mid, and Low.
Low means they don't have a fix on your position.
Mid means they have a fix on your general area.
High means they know your coordinates.
I am basing the rating of High, Mid, and Low on the Player's speed. If the Player is rushing through an area, he will get picked up very quickly and the enemy ship will send missiles at the Player. There are Nav Buoys spread throughout the Nebula that act as signal dampers. When the Player gets close to them, the enemy signal is totally lost, so if they had a fix, it is lost. I am having some difficulty with some of these things, however. Here is the basic script I have right now. It works like a charm:
#Events ;! 3 total
$Formula: ( when
( or
( < ( current-speed "Alpha 1" ) 1 )
( = ( current-speed "Alpha 1" ) 1 )
)
( play-sound-from-file "Sonar_Low" )
)
+Name: Low
+Repeat Count: 1
+Trigger Count: 9999999
+Interval: 4
+Team: 0
$Formula: ( when
( and
( > ( current-speed "Alpha 1" ) 1 )
( < ( current-speed "Alpha 1" ) 50 )
)
( play-sound-from-file "Sonar_Mid" )
)
+Name: Mid
+Repeat Count: 1
+Trigger Count: 9999999
+Interval: 4
+Team: 0
$Formula: ( when
( or
( > ( current-speed "Alpha 1" ) 50 )
( = ( current-speed "Alpha 1" ) 50 )
)
( play-sound-from-file "Sonar_High" )
)
+Name: High
+Repeat Count: 1
+Trigger Count: 9999999
+Interval: 4
+Team: 0
I'm not 100% sure if there's a way of making the Trigger Count infinite. I would like to add a delay before each trigger may happen (ie if High or Mid has been triggered, I'd like to have a 4 second delay before Low gets triggered if it does. This issue I'm having is that I am moving below 50, and then when I break 50 the two sound effects may overlap.
My other issue is that how do you track a trigger happening 3 times in a row? I'd like to make it so that when High happens 3 times in a row, the enemy ship launches missiles, but only when it happens 3 times in a row. It would stop after the Player slows down or loses the target.
Any ideas?
-
My other issue is that how do you track a trigger happening 3 times in a row? I'd like to make it so that when High happens 3 times in a row, the enemy ship launches missiles, but only when it happens 3 times in a row. It would stop after the Player slows down or loses the target.
Variables.
Have the "high" event add 1 to the variable, and the "low" event reset the variable to zero. When it reaches 3, launch missiles and reset it.
This mission is an interesting idea, though calling it "sonar" in space is a bad idea, replace it with some technobabble based sensors, that just happen to work like sonar.
BTW, I think that this belongs in FRED board.
-
Alright, cool. Any idea on how I'd add a 4 second delay that always happens between the events so sounds never overlap?
-
Got it basically working:
#Events ;! 4 total
$Formula: ( when
( or
( < ( current-speed "Alpha 1" ) 1 )
( = ( current-speed "Alpha 1" ) 1 )
)
( play-sound-from-file "Sonar_Low" )
( modify-variable @High_Rate[0] 0 )
)
+Name: Low
+Repeat Count: 1
+Trigger Count: 9999999
+Interval: 4
+Team: 0
$Formula: ( when
( and
( > ( current-speed "Alpha 1" ) 1 )
( < ( current-speed "Alpha 1" ) 50 )
)
( play-sound-from-file "Sonar_Mid" )
( modify-variable @High_Rate[0] 0 )
)
+Name: Mid
+Repeat Count: 1
+Trigger Count: 9999999
+Interval: 3
+Team: 0
$Formula: ( when
( or
( > ( current-speed "Alpha 1" ) 50 )
( = ( current-speed "Alpha 1" ) 50 )
)
( play-sound-from-file "Sonar_High" )
( modify-variable
@High_Rate[0]
( + @High_Rate[0] 1 )
)
)
+Name: High
+Repeat Count: 1
+Trigger Count: 9999999
+Interval: 2
+Team: 0
$Formula: ( when
( = @High_Rate[0] 3 )
( explosion-effect
( + ( get-object-x "Alpha 1" ) 50 )
( + ( get-object-y "Alpha 1" ) 50 )
( + ( get-object-z "Alpha 1" ) 50 )
200
200
100
50
100
0
2
7
)
( modify-variable @High_Rate[0] 2 )
)
+Name: Depth
+Repeat Count: 1
+Trigger Count: 9999999
+Interval: 2
+Team: 0