nicked on 3/11/2019 at 10:28
Goodness, this was waaay simpler than I thought. I think looking at Equilibrium in the first place was a mistake, as there's so much additional stuff in there for the Keeper Agent's behaviour that is not required for what I need.
For my purposes, I just want normal guards that can switch weapons. A simple proximity switch has done the trick. Here's the setup in the simplest possible form:
1. Create a single new Stim - GarrettProxStim
2. Create two new Metaproperties:
MultiWeaponBow
- AI > AI Core > AI: Human with bow
- Ranged Combat > Ranged Combat (Minimum Distance: 10 / Ideal Distance: 40 / Firing Delay: 1.15 / Cover Desire: High / Decay Speed: 0.01 / Fire While Moving: Never)
- Creature > Time Warp: 0.85
- Motions > ActorTagList: WithBow 0
- Shape > Model Name: (AI model with a bow)<archermodel>
MultiWeaponSword
- AI > AI Core > AI: Human with sword
- Ability Settings > HtoHCombat: Distances: X: 3.75 / Y: 6.00 / 10.00
- Motions > ActorTagList: WithSword 0
- Model Name: (AI model with a sword)
3. Create a new archetype NewGuard under Animal > Human:
- Speech > Voice: vguardmen
- Metaproperty: MultiWeaponSword
- Receptrons:
- 1. Stimulus: GarrettProxStim / Min Intensity: No Min / Max Intensity: 20 / Effect: Add MetaProperty / Target Object: Me / Agent Object: MultiWeaponBow
- 2. Stimulus: GarrettProxStim / Min Intensity: No Min / Max Intensity: 20 / Effect: Remove MetaProperty / Target Object: Me / Agent Object: MultiWeaponSword
- 3. Stimulus: GarrettProxStim / Min Intensity: 21 / Max Intensity: No Max / Effect: Add MetaProperty / Target Object: Me / Agent Object: MultiWeaponSword
- 4. Stimulus: GarrettProxStim / Min Intensity: 21 / Max Intensity: No Max / Effect: Remove MetaProperty / Target Object: Me / Agent Object: MultiWeaponBow
4. Edit the Garrett archetype.
- Add Act/React Source:
- 1. Stimulus: GarrettProxStim / Propagator: Radius / Intensity: 100 / Shape Data: (Radius: 30 / Flags: None / Dispersion: Linear) / Life Cycle: (Flags: No Max Firings / Period: 500 / Max Firings: 0 / Intensity Slope: 0)
How it works:
* Garrett gives off a GarrettProxStim with a linear falloff every half second.
* Guards react to the GarrettProxStim based on the falloff (tweak the numbers if you're not happy with the distance).
* If the guard receives less than 20 of the Stim (i.e. Garrett is far away), he'll add the Bow behaviour metaproperty to himself and remove the Sword behaviour metaproperty.
* If it's more than 20 (i.e. Garrett is nearby), he does the inverse - adds the Sword behaviour metaproperty and removes the Bow behaviour metaproperty.</archermodel>
nicked on 3/11/2019 at 11:55
Bit of work with Detailattachement links and the end result is pretty cool:
[video=youtube;8t_-O29dHJQ]https://www.youtube.com/watch?v=8t_-O29dHJQ[/video]
Yandros on 4/11/2019 at 17:36
That's awesome! Nice work both of you.
PinkDot on 4/11/2019 at 20:21
Looks pretty cool - like a very core feature of the combat system. It's really great, that you managed to do it with such a simple setup.
I wonder if it's technically possible to play animations before and after the state changes, to draw and put back the bow and swords respectively. The flipping is not that apparent (especially, when you runaway facing backwards), but still, it would be a nice touch.
Yandros on 4/11/2019 at 20:47
I agree, as long as the animations are very quick and don't slow down or interfere with the guard's pursuit of the player.
nicked on 23/2/2020 at 15:51
OK coming back to this a few months later - found a fatal flaw in my setup (post 11 above). If I knock a guy out, then get into bow range, the metaproperty gets added and the guard forgets he's supposed to be unconscious and starts walking around again (albeit very broken with no collision and able to be picked up). I'm guessing this is a side effect of essentially completely resetting the guy's AI.
The simplest solution would be to remove the receptron to GarrettProxStim, but is there any way to remove a receptron from something mid-game?
nicked on 23/2/2020 at 16:01
Solved my own problem as soon as I posted.
Get Knockout to add a new Metaproperty that Aborts GarrettProxStim, no min, no max.
Nameless Voice on 23/2/2020 at 23:15
I saw this thread, was looking at how you solved it, and wondering if switching the AI wouldn't interfere with unconscious (and possibly even dead) enemies... and there I get to the last two posts and it looks like it does indeed do that. The simple abort receptron should easily cover it, though.
It's a shame that there Thief doesn't have the "RangedMelee" AI behaviour from System Shock 2, as that would have made the whole setup trivial.
nicked on 24/2/2020 at 07:39
The only problem I have left is some janky visuals. I have the weapons as detailattachments, and they respond individually to GarrettProxStim. Therefore, you can sometimes be at exactly the right distance that half a guards' weapons have triggered their switch but the other half haven't, meaning you can see/not see both the sword in the hand and on the belt, and the bow in the hand and on the back at the same time. The weapons also happily keep swapping when a guard is dead/unconscious.
I haven't looked into it yet, but I guess I need the guard himself to act as a relay for the weapon visibility, but not sure how easy the references are going to be on the Archetype. If I have to manually set up four links per concrete guard, it's just getting added to the Known Issues list. :laff:
PinkDot on 24/2/2020 at 14:09
Quote:
If I have to manually set up four links per concrete guard, it's just getting added to the Known Issues list.
I wonder if this could be automated using dml files in Dromed. I mean, you could write a DML file, that creates the links required between your guard and his weapnos objects. Then use a Dromed command to load that DML file (dbmod_load).
Then, for the next guard, you would just make note of the concrete IDs of the guard and weapons, replace them in your DML file and load it again.
I know this is not a typical way of working with DML files, but it just may work.
Alternatively, there are Dromed commands to create links between objects. (link_objs and link_objs_ex), which can create links, but the first one does not set any link data and the other one just pops up the dialog, so data setting is interactive, but this may be a bit annoying way of doing it. Again - you'd run a command file - not type the commands manually for each link.
I wish Dromed had a proper scripting support like a Python API or something... :) It would make tasks like these trivial. Maybe one day... ;)