Artemis-mapping

Aus KIF

Codefragmente, Ideenaustausch etc.


Drey: baut an Admininterfaces


TRACTOR BEAM by Vorus

This is a code snippet that must be added to a mission script.

"Here's a piece of code that will allow you to "tractor" another object around. This was first used by Mike, as far as I know, so I didn't invent the idea. Anyway, you'd need something to trigger the "tractorRdy" variable, and a trigger to turn it off, like when you get to a destination, but this will do the basic job."

<event> <if_variable name="tractorRdy" comparator="=" value="1"/> <if_variable name="tractoring" comparator="!=" value="1"/> <if_distance name1="OBJECT" name2="player" comparator="<=" value="220"/> <warning_popup_message message="Tractor beam locked on" consoles="W"/> <set_variable name="tractoring" value="1"/> </event>

<event> <if_variable name="tractoring" comparator="=" value="1"/> <if_distance name1="OBJECT" name2="player" comparator=">" value="220"/> <set_relative_position name1="player" name2="OBJECT" angle="180" distance="220"/> </event>


TRACKING SCORE by Vorus

This is a code snippet that must be added to a mission script.

Probably a lot of scripters have their own way of keeping track of players' scores through the mission, but here's how I do it. Create an enemy Elite in one corner of the map, I used the upper-right in this example. Make this enemy invisible to LRS, the main screen, and SCI. That way he can only be seen if the player is RIGHT on top of him. This is step one, as seen here:

<create type ="enemy" x="0" y="0" z="0" name="Score" hulltype="30" fleetnumber="99" angle="90" elite="1"/> <set_object_property name="Score" property="elite" value="1"/> <set_object_property name="Score" property="eliteAIType" value="0"/> <set_object_property name="Score" property="eliteAbilityBits" value="7"/>

Next, make sure he can't move, turn or be killed:

<event> <if_exists name="Score"/> <set_object_property name="Score" property="topSpeed" value="0.00001"/> <set_object_property name="Score" property="turnRate" value="0.00001"/> <set_object_property name="Score" property="shieldStateFront" value="100"/> <set_object_property name="Score" property="shieldStateBack" value="100"/> </event>

If you are really concerned about the fourth wall, you could even create a zone around him that the player can't enter, like this maybe:

<if_inside_sphere name="Artemis" centerX="0" centerY="0" centerZ="0" radius="2000"/> <set_object_property name="Artemis" property="positionX" value="2500"/> <set_object_property name="Artemis" property="positionZ" value="2500"/>

But for scoring purposes, you just put in a line like this when the player accomplishes something good:

<addto_object_property name="Score" property="positionY" value="100"/>

Use a value of 100 because even though you set the ship to never move, it will wiggle a bit, so real fine values like single digits won't work. (You might be able to get away with 10s, but I went with 100s to be safe.) Since you are using the Y axis, the ship should not move much on the map.

You could also have things that detract from the score by just adding a -100.

At the end of the game, you can find out the score, and let the player know how they did like so:

<event> <if_variable name="endMission" comparator="=" value="1"/> <if_variable name="gameOver" comparator="!=" value="1"/> <if_object_property name="Score" property="positionY" comparator="<" value="50"/> <big_message title="Mission Complete" subtitle1="Score 0/10" subtitle2="You didn't accomplish anything"/> <set_timer name="endMissionTimer" seconds="20"/> <set_variable name="gameOver" value="1"/> <set_variable name="gameScore" value="0"/> </event>

For each 100 that you move the ship, they get 1 point. You check the value of "positionX" from the 50s instead of even 100s to account for the wiggling I mentioned earlier. So a score of 1 would have the lines:

<if_object_property name="Score" property="positionY" comparator=">" value="50"/> <if_object_property name="Score" property="positionY" comparator="<=" value="150"/>

and so on. That's pretty much all you need, just create a separate event to check for each point value, up to your max, and display the appropriate info to the player.