Chaos Project

RPG Maker => RPG Maker Scripts => Script Requests => Topic started by: Subsonic_Noise on January 23, 2011, 11:07:14 am

Title: [XP] Auto-use Ammo / Reload for BlizzABS
Post by: Subsonic_Noise on January 23, 2011, 11:07:14 am
So, this is actually not complicated at all. My game is averagely realistic and futuristic, so I'll have guns as the main weapons, and those guns will all only support one type of ammunition - none of that enchanted / exploding / anti-werewolf / anti-whatevethefuckpeoplecomeupwith bullets, just plain normal ammunition. So, the whole equip system is unneeded and seriously would get really annoying for the player, especially if he wants to quickly switch between a normal item (let's say, a grenade) and a gun, but he can't because he forgot to re-equip the ammunition and therefore dies and is slowly eaten by mutants.
Well, I myself wouldn't want that as a gamer, but just getting rid of that would make it a bit... not challenging. Therefore, I thought: if I'm going for a more realistic feel, why not include reloading?

So, my request is:

- Weapons that require ammunition will automatically use it, based on what I configured in the script
- It can only hold a certain amount of ammo though. If the ammo it holds reaches 0, shooting is impossible. The amount of holdable ammo is configured in the script, too.
- Reloading is executed by a configurable button and needs a different amount of time for every weapon. During that time, the player is set to auto-sneak.
- ...It also plays a soundeffect and an animation... blah blah configurable.
- Wherever the weapon icon is shown, it has a small number on it indicating the amount of ammo it can hold and the amount of ammo it is currently holding.

I hope this was easy to understand and ellaborate enough. Would be awesome if anyone could do this! :D
Title: Re: [XP] Auto-use Ammo / Reload for BlizzABS
Post by: The Niche on January 23, 2011, 01:51:37 pm
Hmm...I think this could be doable with the combo system. Just a second...*checks configuration*...ok, it is if you know the script call for reducing items. Or here's another idea, using common events:

Weapon: Gun.
Type: Bow.

Common event: Ammo
Type: Parallel. Condition switch: I hope I don't need to tell you this!
Conditional branch: Player has item[ammo] in inventory
Conditional branch: Player has [gun] equipped
Conditional branch: Variable [ammo in clip] > 0
Conditional branch: Input::Attack
Control variables [ammo in clip] - 1
Control items [ammo] - 1
Branch end
Else:
Conditional branch: Input::key['<Reload button>']
Set move route: Change movement speed, change actor graphic, play SE, play animation [player]
Wait (# of frames for your weapon)
Else:
(Repeat above, changing frames depending on the weapon)
Branch end
Brandh end

Tadaaaa...
Title: Re: [XP] Auto-use Ammo / Reload for BlizzABS
Post by: Subsonic_Noise on January 23, 2011, 04:45:30 pm
Yes, nearly everything is doable in events, but I'd like a script, though - I've got a fuckload of guns and that would be a hell to configure let alone it would waste alot of variables. Thanks for the effort, though.
Title: Re: [XP] Auto-use Ammo / Reload for BlizzABS
Post by: The Niche on January 23, 2011, 05:05:13 pm
Are you aware you can reuse variables? For this, you'd only need as many variables as you have gun users. Plus, once you have the first one down, all you need to do is copy, past and change the wait time.
Title: Re: [XP] Auto-use Ammo / Reload for BlizzABS
Post by: Blizzard on January 23, 2011, 05:18:34 pm
I think a script here might be a wise choice. Sure, it can be done with eventing, but it seems to me that it's not something that should be done with events. As soon as you get something like "you need one variable/switch for every X in the database of your game", you are better off with a script than an event system.
Title: Re: [XP] Auto-use Ammo / Reload for BlizzABS
Post by: winkio on January 23, 2011, 07:33:16 pm
Get a script if you want, but it's a two-action combo per weapon that you can copy paste and just change the number for the item id:

Action 1:
Condition: Script: $game_party.item_number(id) > 1
Go To Action: 2

Action 2:
Attack
Script: $game_party.lose_item(id, 1)


This makes it so it doesn't use the attack unless at least 1 of the item is possessed, and then if the item is possessed, it decreases it's count by 1.  use it with a no ammo bow weapon, and it should work perfectly.
Title: Re: [XP] Auto-use Ammo / Reload for BlizzABS
Post by: RoseSkye on January 23, 2011, 11:00:19 pm
Pfft, I am surprised he is not using clips/ clip sizes.
Title: Re: [XP] Auto-use Ammo / Reload for BlizzABS
Post by: Subsonic_Noise on January 23, 2011, 11:39:17 pm
@winkio: That's only one of the featuresI requested - the others are what makes it reasonable to make it a script.
@Rose: Remind me - what's that?
Title: Re: [XP] Auto-use Ammo / Reload for BlizzABS
Post by: RoseSkye on January 24, 2011, 12:38:14 am
Clips are basically the amount of bullets a gun can hold. You may know them as 'rounds'.
Title: Re: [XP] Auto-use Ammo / Reload for BlizzABS
Post by: Blizzard on January 24, 2011, 02:58:07 am
You know, a Magnum can hold 6 bullets, a .38 has 18 bullet-clips, a .50 has 12 bullet-clips, an uzi has 30 bullet-clips, etc.
Title: Re: [XP] Auto-use Ammo / Reload for BlizzABS
Post by: Subsonic_Noise on March 02, 2011, 04:53:42 am
Quote from: Blizzard on January 24, 2011, 02:58:07 am
You know, a Magnum can hold 6 bullets, a .38 has 18 bullet-clips, a .50 has 12 bullet-clips, an uzi has 30 bullet-clips, etc.

Ah, yes! That's what I was referring to.. and Winkios combo doesn't do that, sooo.. this is still relevant. I'd appreciate it if anyone could give it a try.
Title: Re: [XP] Auto-use Ammo / Reload for BlizzABS
Post by: Blizzard on March 02, 2011, 05:24:47 am
Check this out: http://forum.chaos-project.com/index.php/topic,8770.msg135627.html#msg135627
Title: Re: [XP] Auto-use Ammo / Reload for BlizzABS
Post by: AliveDrive on March 02, 2011, 06:54:21 am
Quote from: Blizzard on January 23, 2011, 05:18:34 pm
I think a script here might be a wise choice. Sure, it can be done with eventing, but it seems to me that it's not something that should be done with events. As soon as you get something like "you need one variable/switch for every X in the database of your game", you are better off with a script than an event system.


Eventing is near and dear to my heart, but Blizz is right.

and also, I totally saw the other thread and not this one, my bad. :/