Hi everybody,
in my game that im currently working on im looking for a way to have different weapons use different types of ammunition, ie bows will use arrows and crossbows will use bolts.
I'm presuming that there would be a way to do it with common events, but i'm pretty stuck on this.
Thanks
I think it will be hard to do with CE... but I think I've seen a script for this somewhere here...
You can do this by common events, but that would either require complex coding for the case that there is no ammo (skill is already selected and you can't replace it, only force a subsitute), or the player would loose the action if there is no ammo.
Another variant would be a common parallel process that adds the skill only when ammo is available - but that would place the skill outside regular learning processes.
Best option is to go to the master script list (it's linked in the tutorial in my signature and on the script forums) and look for one of the skill cost scripts. Those scripts allow you to define items as a cost for using a skill.
I was thinking about something like this. Here was my experimental idea. I never tested it though. It just floated in my head in..,ridiculous detail:
Make a variable and call it ammo capacity. Make two skills and call one shoot, the other shoot(check). (If you need to specify what the ammo is for then make a bunch of variables for the different ammunition)
Now make a Common Event with the conditional branch:
If ammo is = 0
"I'm empty!"
Else
force action Shoot Target=Random
Control Variable Ammo - 1
Branch end.
Give the character shoot(check)
Now in game, on the very turn that the character gets the weapon, during the event creation where character either buys the gun or finds it or whatever, put in:
Control Variable Ammo capacity Set 14 (For 14 shots)
There is of course one glaring issue with this:
"How can I have better control over who gets shot?"
If you put in the damage in the skill formula, Empty or not,, the damage portion will still go through. So you can't use the formula box. And if you do it this way, you can get the process working but will have no control over who you are targeting.
And as Andar hinted, there is no way to tell how much ammo you have from the skill so there is a high chance of players constantly hitting an empty ammo. Unless you make another thing for ammo check. There is lots to weave together.
If you want actual ammo just make an item called ammo with consume YES and set it so that using the item Sets the AmmoCapacity variable back to 14.
Oh yeah i should mention but you probably can guess already, that the shoot skill being called by force action is where the damage formula will be placed. And you can just call that one Shoot(check) or whatever, that name wont be seen. It is just shoot that you want shown so yeah, adjust the names as needed.