The RPG Merchant + AI scripts are designed to be quick and easy to add to your games.
Add civilians! Add guards who will deal with you appropriately if you commit crime! Add merchants who can sell you weapons, ammo, meds or food, even shout random greetings when you are close enough! If you want, you can kill the merchant and loot his goods! Includes cash display and bounty level.
Setting up the Merchants.
Firstly add an entity for the stats display script. Ensure it is dynamic and not static (scripts need dynamic entities to run). It can be any entity, but best to choose a low polygon model to help speed, an overlay is ideal. Make sure it is always active.
In it's properties panel select the script option and find ai_medieval_cashdisplay.lua. Select that. That's set up the system to display info and set up some things ready for other scripts.
Next, add another object you want to use for merchants (not the character, a nearby item of furniture is required for this). Do the same as above, but you can leave the always active off here. Use ai_medieval_merchantsetup.lua for this.
Add your merchant character (This was designed to work with the medieval characters and not for any other npc's, others may work, but it is unlikely without tweaking). Set as always active and select ai_medieval_merchant.lua as it's script. Make sure the merchant character is fairly close to your merchantsetup object, as it works by range and all your objects depend on it.
Place a table or some object to place your item or items on, again fairly close to the merchantsetup object. The default range limit is 250 so keep that in mind or adjust accordingly. You don't need the table as such, but by default the distance is very low on the sale items, objects on the floor will need you to crouch by them, unless you increase the range in the scripts.
Now load a medieval weapon in. Whichever one you choose, there is a script for it. Select the appropriate one eg. daggerforsale_medieval.lua for the dagger etc. You can do the same for medkits or food items. At the moment the script relys on the built in options with GameGuru med and food items, so for any custom (medieval looking) item you would need to make sure the fpe for it is correct. I was really only concerned with weapons, I added these as a bonus.
That's the merchant set up to go. You should be able to extract and basically copy the items to have several merchants. Ensure you do not put them too close together (the range may conflict). You only need to clone the merchantsetup and merchant objects, the cashdisplay script is only needed once.
Setting up the AI
Same drill mostly for the AI. Add your medieval character of choice. Add the ai_civilian or ai_guard scripts to them. Add a waypoint and at least one child waypoint so the character will walk along it. That's it!
Here is a video setup guide link if you want to see it done, or as well as read about it.
You should now have a working game with merchants to sell you wares, civilians who don't attack you for no good reason and guards that will chase you when you commit a crime. If you can afford it they will ask you to pay a fine or if not they will just lay into you. Civilians will sometimes aggro you when you have committed a crime or not, they may just want to walk on by. If you decide to attack the merchant themselves, you will be able to steal their wares. Commiting crime results in a bounty level, the higher it gets the more expensive it is to trade and of course, will aggro nearby AI more often than not.
Also included is a basic transport script which you can use to enter or leave an area. Use the "if used" option on the zone you add either script to. You can find this in the objects properties panel. Enter the name of the object you want to transport to in there. A simple script, but again you may find it more useful than the default one included with Gameguru.
22 Scripts included: