KDScript

Quick start

  1. Put the KDScript.osm file in your mission's main folder. (If this is a T1/TG mission, use the version from KDScript's thief1 subfolder.)
  2. Put the ThiefLib.osl file in your mission's main folder as well.
  3. Open your mission in DromEd and run this command:
    script_load KDScript
  4. In your mission's readme file, include this text or something like it:
    This mission includes KDScript, copyright © 2012–2013 Kevin Daughtridge (kdau).
  5. Choose from these tasks to continue:

The following scripts are not documented in this section; see their individual sections for details:
KDGetInfo, KDQuestArrow, KDRenewable, KDStatMeter, KDSyncGlobalFog, KDToolSight, KDTrapEnvMap.

Have an AI drop what they are carrying

  1. The AI(s) should have the carried object(s) attached with Contains, CreatureAttachment, or ~DetailAttachement link(s).
  2. Add KDCarrier to the AI's or AI archetype's Scripts property.
  3. Add KDCarried to the carried object's or archetype's Scripts property.
  4. The object will be dropped if the AI is killed or knocked out. If you also want it to be dropped when the AI is alerted, add drop_on_alert=X; to the object's or archetype's Design Note property, where X is the minimum alert level (low, moderate, or high).
  5. If you don't want the object to be frobbable while the AI is carrying it, add inert_until_dropped=true; to the Design Note.

See the KDCarrier and KDCarried sections for more details.

Have a tool which Garrett must carry like junk

  1. Add KDJunkTool to the tool object's or archetype's Scripts property.
  2. Set the tool's Engine Features→FrobInfo property as follows:
  3. If the tool is heavy enough that Garrett should grunt and slow down when he picks it up, add junk_tool_lugged=true; to the tool's or archetype's Design Note property.
  4. If the tool is a key and Garrett should drop it after using it, add junk_tool_drop=true; to the Design Note.

See the KDJunkTool section for more details.

Change which mission will start after the current one

  1. Create a new TrapTrig fnord object.
  2. Add KDTrapNextMission to the object's Scripts property.
  3. Add next_mission_on=X; to the object's Design Note property, where X is the number of the new next mission.
  4. Create a ControlDevice link from some trigger(s) to the object.

Works with T2 (TMA) only. See the KDTrapNextMission section for more details.

Have an objective that is both optional and reverse

  1. Create a new Marker fnord object. (Only one object is needed to cover all your optional reverse objectives.)
  2. Add KDOptionalReverse to the object's Scripts property.
  3. Add your objective's description to the appropriate goals.str and create these quest variables, where X is the objective number:
  4. Do not make this objective reverse, give it a type, or set it in any QuestVarTrap.
  5. Instead, create a separate, invisible objective that will track the opposite of the first objective's state. Create these quest variables, where X is the real objective's number and Y is the invisible objective's number:
  6. Give this invisible objective whatever type, target, loot, etc. are needed for the opposite of the real objective. If using a QuestVarTrap, set goal_state_Y to 1 (complete) when you want the real objective to be failed.
  7. If the invisible objective is completed during the mission, the real objective will be failed (cancelled). If it has not been cancelled by the time the mission ends, it will appear completed in the debriefing screen.

See the KDOptionalReverse section for more details.

Keep all your short on-screen text in one file

  1. Create a file strings\short.str (or a language-specific version like strings\english\short.str) in your mission directory.
  2. For each short text message, add a line like this to the file:
    go_away: "KEEP OUT - NO SOLICITORS"
  3. Add KDShortText to the readable's or archetype's Scripts property.
  4. Check the Don't Inherit box on the same Scripts property (or delete StdBook/StdScroll if present).
  5. Set the readable's Book→Text property to name of the desired message in short.str (such as go_away for the message above).
  6. If you want the text to appear in a different color, add text_color=X; to the readable's Design Note property, where X is a color such as red, #66ff99, or (RGB) 255,128,255.

See the KDShortText section for more details.

Subtitle some of your AIs' and Garrett's speech

  1. Open the Creature archetype and add KDSubtitledAI to its Scripts property.
  2. Open the VOTrap archetype and add KDSubtitledVO to its Scripts property.
  3. Create a file strings\subtitles.str (or a language-specific version like strings\english\subtitles.str) in your mission directory.
  4. For each speech schema that you want to subtitle, add a line like this to the file (use the schema name as it appears in the schema files):
    no11103A: "That's the point, Margaret: now they will be happy."
  5. By default, subtitles are displayed like other text messages. If you want subtitles to appear in boxes in front of the AIs that are speaking, set the subtitles_use_hud quest variable to 1.
  6. If you want an AI or AI archetype to have subtitles in a specific color, add subtitle_color=X; to its Design Note property, where X is a color such as red, #66ff99, or (RGB) 255,128,255. For Garrett, add it on the Garrett archetype.

See the Subtitles section for more details.

Change the fog during the mission

  1. Create a new TrapTrig fnord object.
  2. Add KDTrapFog to the object's Scripts property.
  3. Add one or more of these parameters to the object's Design Note property, as desired:
    fog_color_on=X;
    where X is the fog's color, such as red, #66ff99, or (RGB) 255,128,255
    fog_dist_on=X;
    where X is the distance (thickness) of the fog, in feet
    fog_zone=X;
    where X is the fog zone you want to change, between 1 and 8
    (By default, the global fog is changed.)
  4. If you want to the fog to change gradually over time, add transition=X; to the Design Note, where X is a length of time such as 500 (milliseconds), 15s (seconds), or 5m (minutes).
  5. Create a ControlDevice link from some trigger(s) to the object.

See the KDTrapFog section for more details.

Change the weather (precipitation) during the mission

  1. Create a new TrapTrig fnord object.
  2. Add KDTrapWeather to the object's Scripts property.
  3. Add one or more of these parameters to the object's Design Note property, as desired:
    precip_freq_on=X;
    where X is how many new drops fall per second
    precip_speed_on=X;
    where X is how fast the drops fall, in feet per second
    precip_radius_on=X;
    where X is how large each drop is, in feet
    precip_opacity_on=X;
    where X is how opaque the drops are, from 0 (transparent) to 1 (opaque)
    precip_brightness_on=X;
    where X is how bright the drops are, from 0 (black) to 1 (very bright)
    precip_wind_on=X,Y,Z;
    where X,Y,Z is the speed and direction of the wind, such as -50,0,0 (fast to the north)
  4. If you want to the weather to change gradually over time, add transition=X; to the Design Note, where X is a length of time such as 500 (milliseconds), 15s (seconds), or 5m (minutes).
  5. Create a ControlDevice link from some trigger(s) to the object.

See the KDTrapWeather section for more details.

This documentation is part of the KDScript module. Copyright © 2012–2013 Kevin Daughtridge. See introduction for details.