TTLG|Jukebox|Thief|Bioshock|System Shock|Deus Ex|Mobile
Results 1 to 2 of 2

Thread: Getting arrows to bounce off specific textures

  1. #1
    Member
    Registered: Jan 2001
    Location: 27430 Cells

    Getting arrows to bounce off specific textures

    This started off as a question but has become a tutorial!

    I'm making a forest, and for the canopy I'm using solid brushes with a leaves texture. I want there to be plenty of gaps so the sky can be seen. With the leaves clearly being a vegetation material, most players will expect to be able to use a rope arrow to climb up and explore. I'm generally fine with people exploring like this but there have to be limits.

    The following will make it possible to prevent climbing, without resorting to invisible walls, and without the player losing the the arrow and having to reload if they want to get it back.

    This gist of this to remove the arrow-sticking feature and add a stim to the texture which causes the arrow to appear to stop and fall down.

    [Note: custom gamesys required, or use a .cow file]

    • Create a new stim (this much more reliable than using any existing stim). Object Hierarchy, select the 'Act/React...' item at the top, go to Add and choose a name. Call it BouncyLeavesStim.
    • Go to the Textures Hiearchy and find the archetype for the desired texture. Add the property Physics > Terrain > Can attach. Deselect everything
    • Give the texture an Act/React source: For the Stimulus, select BouncyLeavesStim. For Propagator, select Contact, Intensity: 1 (any value will do).
    • Edit the broadhead archetype: Add a receptron for BouncyLeavesStim, No min, No max, Effect: Create Object. The Target should be 'broadhead' (no quotes). For Agent, select 'Me'.

      The reason for the above is that with the texture's 'can attach' values being empty, the arrow will be slain on impact, but it will now receive the BouncyLeavesStim from the texture, and the receptron will create a new broadhead, which will fall to the ground.

      The next thing is to set up the rope arrows. You can repeat the above steps using the RopeArrow instead, but if it falls onto soft ground a little rope will appear and it'll look odd. The following will create a dummy rope arrow which also falls down like a broadhead, and which then gives you a real rope arrow when frobbed:
    • Create an archetype called BouncyRopeArrow, inside the 'broadhead' archetype.
    • Add Engine Features: FrobInfo, deselect all existing values and for WorldAction, select 'Script'. This allows it to be frobbed and not go into the player's inventory.
    • Add the S > Scripts property. In the first field type in 'GiveRealRopeArrow' (no quotes). Note that this script doesn't yet exist but with Squirrel that's easily rectified...
    • In your FM's folder create a folder called sq_scripts (unless you already have it). Paste the following into a new file with a .nut extension:
      Code:
      class GiveRealRopeArrow extends SqRootScript
      {
      	function OnFrobWorldEnd()
      	{
      		local ropeArrowID = Object.Create("RopeArrow");
      		Container.Add(ropeArrowID, "Player");
      		Object.Destroy(self);
      	}
      }
    • In DromEd, use the command script_load squirrel (unless it's already loaded).
    • Edit the RopeArrow archetype: Add a receptron for BouncyLeavesStim. No min, No max, Effect: Create Object. The Target should be 'BouncyRopeArrow' (no quotes). For Agent, select 'Me'.
    • The setup is now complete. Note that for the new script to work, you may have to go into game mode then return to the editor to make sure it's loaded the most up-to date squirrel files. Have fun getting your arrows back from that texture.


    Further expansion

    I developed the above with a forest in mind, with lots of soft surfaces for arrows to safely fall down to. If there are lots of hard surfaces like rocks, or you're applying the above in a city, etc, you could set the BouncyRopeArrow to not be slain on impact, and you could tweak the broadhead setup so that it creates its own dummy archetype with similar behavour. The script could be modifed to choose which real arrow to give the player by scanning its archetype name, or reading it from a Design Note parameter.

  2. #2
    Member
    Registered: May 2002
    Location: Texas
    Great tutorial. This should be useful in my next FM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •