Hello! I'm new here.
I'm working on a GZDoom gameplay mod inspired by the game Ikaruga. The player not only has different weapons, but can also change the color of the weapon to fire different types of projectiles to hurt different enemies, as well as shield themselves from projectiles of the same color.
With this in mind, I need the Weapon.AmmoType property to able to switch between the different color types via variable assignment, because I have 3 different ammo types, 1 for each color. I've been hitting my head against a wall trying to do this, so I could use some help. What would be the best way to achieve this?
Attached is a pk3 with all my code written so far. Please examine it at your leisure. Thanks!
Using a variable as an ammo type? Can it be done?
Moderator: GZDoom Developers
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
-
- Posts: 39
- Joined: Tue Jul 10, 2018 9:29 am
- Location: East Coast USA
Using a variable as an ammo type? Can it be done?
You do not have the required permissions to view the files attached to this post.
-
- Posts: 1458
- Joined: Tue Oct 20, 2015 12:50 pm
- Graphics Processor: nVidia with Vulkan support
- Location: Kozolupy, Bohemia
Re: Using a variable as an ammo type? Can it be done?
So, you have to make this a little bit differently.
So, the point is to make the wepon not use ammo defined in weapon.ammotype property. Just put zero there. Then, you can have multiple types of ammo, and the point is that drawing the ammo will be done during shooting, not by automatic process (you know, you can set ammo use at action special for shooting hitscan or projectile).
You just has to understand that the weapon itself doesnt use any ammo. You just has to make an impression that the ammo is used.
Here is small example:
This weapon has primary and altfire, but in order to use only one type of ammo, I set to use 0 ammo and the ammo drawing is done by action special, when the weapon shoots.
So, the point is to make the wepon not use ammo defined in weapon.ammotype property. Just put zero there. Then, you can have multiple types of ammo, and the point is that drawing the ammo will be done during shooting, not by automatic process (you know, you can set ammo use at action special for shooting hitscan or projectile).
You just has to understand that the weapon itself doesnt use any ammo. You just has to make an impression that the ammo is used.
Here is small example:
Code: Select all
mauler1fire:
BLSF A 5 Bright
{
A_FireZSCMauler1();
A_TakeInventory("energyPod", 15); //the ammo is removed here. You can remove any item, not only ammo.
A_AlertMonsters();
}
MAUL B 3 Bright A_Light1();
MAUL C 2 A_Light2();
MAUL DE 2;
MAUL A 7 A_Light0();
MAUL H 7;
MAUL G 7 A_CheckReload();
goto mauler1ready;
mauler2fire:
MAUL I 20 A_FireZSCMauler2Pre();
MAUL J 10 A_Light1;
BLSF A 10 Bright
{
A_FireZSCMauler2();
A_TakeInventory("energyPod", 30);
A_AlertMonsters();
}
MAUL B 10 Bright A_Light2();
MAUL C 2;
MAUL D 2 A_Light0();
MAUL E 2 A_ReFire();
goto mauler2ready;
-
- Posts: 39
- Joined: Tue Jul 10, 2018 9:29 am
- Location: East Coast USA
Re: Using a variable as an ammo type? Can it be done?
Cheers for pointing out the TakeInventory function, ramon.dexter! That was able to solve my problem.
Thanks man!
Thanks man!