I need some assistance on how I should go about writing a codebase that essentially functions like Hotline Miami's combos.
Whenever you get a kill, I want it to display HUD images depending on how many kills you get, and disappear whenever you haven't killed anything in a period of time. What would be the best way to format it? I tried to find other WADs so I could reference and learn the code, but to no avail.
Implementing a combo system
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: 877
- Joined: Tue May 07, 2019 12:24 pm
- Graphics Processor: nVidia with Vulkan support
Re: Implementing a combo system
maybe look into buffs/debuffs
use enemy sprites or a counter as the display etc etc.
use enemy sprites or a counter as the display etc etc.
-
- Posts: 9
- Joined: Mon Dec 07, 2020 3:35 pm
Re: Implementing a combo system
I was moreso wanting something built into the HUD system.
-
- Posts: 877
- Joined: Tue May 07, 2019 12:24 pm
- Graphics Processor: nVidia with Vulkan support
Re: Implementing a combo system
yeah, usually buff/debuff mods show something on the screen. you could easily use a timed buff in the same way as a combo counter.
-
-
- Posts: 1805
- Joined: Sun Jul 21, 2019 8:54 am
Re: Implementing a combo system
I've made an ACS script like this:
Edit: Figured out a way to detect who killed the monster using ZScript.
Spoiler:However, it has no way of detecting what killed the monster, so if another monster kills it, it will add to the combo.
Edit: Figured out a way to detect who killed the monster using ZScript.
-
- Posts: 9
- Joined: Mon Dec 07, 2020 3:35 pm
Re: Implementing a combo system
I implemented and tested the code and it doesn't seem to count if you get a multi-kill. Is there anything that can make it possibly detect multiple kills in one go? Like a rocket killing a group of zombiemen.
-
-
- Posts: 1805
- Joined: Sun Jul 21, 2019 8:54 am
Re: Implementing a combo system
My bad.
In the ZScript file replace:
With:
In the ZScript file replace:
Code: Select all
e.Thing.ACS_NamedExecute("ComboGet",0,0,0,0);
Code: Select all
e.Thing.ACS_NamedExecuteAlways("ComboGet",0,0,0,0);
-
- Posts: 9
- Joined: Mon Dec 07, 2020 3:35 pm
Re: Implementing a combo system
Thanks a bunch, yo! I'll make sure to credit you when I complete my mod. I'm not very well versed in ACS/ZScript unless it has to do with mapping, so this is extremely useful.
-
- Posts: 684
- Joined: Fri Jan 13, 2017 9:08 pm
Re: Implementing a combo system
Tweaked the ACS a bit to display combo numbers past 10.
Code: Select all
#library "SCORE"
#include "zcommon.acs"
int combokills; //Amount of kills
int combotimer; //Timer before combo ends
Script "ComboSystem" ENTER
{
str combomessage;
While(true)
{
If(combokills>0)
{
SetFont("BIGFONT");
HudMessage(s:"\cf",i:combokills,s:"x"; HUDMSG_PLAIN, 100, 0, 0.5, 0.2, 0);
int time = Ceil(FixedDiv(combotimer<<16,35.0));
SetFont("SMALLFONT");
HudMessage(f:time; HUDMSG_PLAIN, 101, 0, 0.5, 0.22, 0);
If(combotimer<=0){combokills=0;} //When timer runs out, combo ends
Else{combotimer--;}
}
Else
{
HudMessage(s:" "; HUDMSG_PLAIN, 100, 0, 0.5, 0.2, 0);
HudMessage(s:" "; HUDMSG_PLAIN, 101, 0, 0.5, 0.2, 0);
}
Delay(1);
}
}
Script "ComboGet" (void)
{
combokills++; //Add to the counter
combotimer=175; //5 seconds
}
You do not have the required permissions to view the files attached to this post.