User Tools

Site Tools


Making an AI Pick Up a Weapon


  • You are familiar with modifying the gamesys (including custom A/R Sources) and properties in general
  • You have armed and unarmed versions of an AI, or you’re familiar enough with a 3D object editing program that you can make your own.
  • You can use S&Rs


When the AI sees the player, an Alert Response makes it run to then frob a hammer object. This stims the frobber who reacts by setting properties that make it appear to have picked up a weapon.

Creating the AI Models

If the AI is armed, it’s easy to make the unarmed version. Ensure that the joint boxes and limit planes are well out of the way (Anim8or allows groups to be hidden, other programs should have similar features). Delete most of the weapon arm. It may be necessary to delete right up to the shoulder since the weapon arm on most AI seems to be bit shorter than the free arm. Reflect the free arm so that a copy exists were the weapon arm used to be. It seems that quite a lot of AI are placed a little off centre, so you’ll have to drag the new arm inwards until the gap is all but invisible. Make the body and the new arm part of the same mesh (in Anim8or: Join Solids), and weld/merge the points to truly close any gaps.

If you’re taking an unarmed AI and giving it a weapon, that’ll be a little harder if you want to make it look like the hand is actually surrounding the hilt/handle of the weapon. You’ll have to reshape the weapon hand a little to make it look more fist-shaped. You could try importing the hand from an armed AI and retexturing it.

Setting it up in Dromed

NOTEME This example is for an unarmed Hammerite, but the principle is the same for sword guards.

First, you should probably create a new Act/React Source (call it HammerStim). You can use an exiting source, but with a custom one you can be sure that nothing else can interfere with the system.

Next, create a new archetype (call it ArmedHammer). This will contain whatever properties are to be added to the AI after it’s picked up the weapon. To ArmedHammer, add ShapeModel Name and enter the armed model. As a precaution, also add the property AI → Ability Settings > Combat: Non-hostile and select Never. This is actually the default for an armed AI, and the reason for its use will be explained later.

There are three objects that need to be created, it is possible to work on custom archetypes as well as on concrete objects:

Create a Marker and call it SeenPlayer. Add the property Engine Features: FrobInfo: WorldAction: Delete
This will be needed later on.

Create a Hammer (e.g. a Warhammer object, not a Hammerite), and give it the following properties:
Engine Features → FrobInfo: WorldAction: Delete;[None];[None]
Inventory → Max Pick Distance: -12 (This prevents the player from frobbing it but doesn’t disable frobbing) Optionally (though recommended):
Physics → Model → Controls: Controls Active: Location,Rotation
Physics → Model → Type: OBB
Add the previously created HammerStim:
Add Act/React → Sources:
Stimulus: HammerStim
Propagator: Contact (a slightly misleading name as you will now see)
Intensity: 10 (or choose any value you want)
Click on Edit Shape and Deselect Collision and select Frob In World.
Call the concrete object SpareHammer1

Create a Hammerite:
Give him a Creature Attachment link to SeenPlayer. The data is unimportant.
Shape → Model Name: Type in the name of the unarmed model
AI → Ability Settings > Combat: Non-hostile: Always
The second property is needed to ensure the AI won’t try to attack you, because if it does, it’ll hit you with an invisible weapon. It could be argued that the AI should attack with its bare hands you get too close, but this is complex enough without getting into that as well.
AI → Alert Response:
Alert Level: 3
Priority: Very High

Step 1: RemoveLink
Arg 1: CreatureAttachment
Arg 2: SeenPlayer
(Arg 3 can be left blank so the owner of this property will be assumed to be the source)

Step 2: Goto Object
Arg 1: SpareHammer1
Arg 2: Very Fast
(Note the space is included in ‘Very Fast’)

Step 3: Frob Object
Arg 1: SpareHammer1

Step 4: Goto Object
Arg 1: SeenPlayer
Arg 2: Very Fast

Step 5: Frob Object Arg 1: SeenPlayer (this is why FrobInfo: Delete is needed, it destroys the object)

Finally you need to add two receptrons to respond to the stimulus that is being sent by frobbing the hammer:
Make sure the min and max intensities surround the value of the source instensity. Even with this direct method of sending the stimulus, it’s best to leave a little margin for error, e.g. min = 9, max = 11.
Effect: Set Property
Target Object: Me
Agent Object: ArmedHammer (i.e. the name of the object that has the properties you’ll be copying from)
Click on Edit Effect and type in ModelName (This is the internal name of the Shape → Model Name property)
Add another receptron, the same as the first, but for the effect, type AI_NonHst (the Combat: Non-hostile property)

The Sequence of Events

Just to sum up, this is what happens:

  • The AI sees the player, and goes to alert level 3
  • It lets go of SeenPlayer, which will then just hover in mid-air
  • It runs to the weapon and frobs it
  • The weapon sends a HammerStim to the AI
  • The AI responds by changing its model name and becoming hostile.
  • It runs back to SeenPlayer which is where it saw the player.
  • It then frobs SeenPlayer, which deletes it.
  • There is no chance of any of these steps being repeated, since there are no links to be removed, and every object mentioned gets destroyed after the first time.

Magus R Soul 2008/01/31

dromed/pickupweapon.txt · Last modified: 2008/02/01 01:08 by r_soul