Page 1 of 3
[Solved] How to dissociate direct hit and AOE?
Posted: 20 May 2014, 11:02
by fleo
Hi folks, I'm developing an alternative mode of elite including more weapons. The attacker can fire with the Arrow and I'd like to make a +1 when he hits a defender in the AOE and a +2 when he hits the player directly on his hitbo...hum let's say body.
I've already modify the onHit event to modify the behaviour of the Nucleus: +2 on short range, no effect on long range and +1 between these two. So I was thinking about something like this, but I don't know if we can get this kind of value (PlayerHitByAOE) somewhere:
Code: Select all
if (Event.Type == CSmModeEvent::EType::OnHit) {
if (Event.Shooter != Null && Event.Victim != Null && Event.Shooter.CurrentClan != Event.Victim.CurrentClan) {
...
switch (Event.WeaponNum) {
...
case 5: { // Hit by the arrow
if (!PlayerHitByAOE) { // Not by AOE but directly on his body
EventDamage += 100;
Event.ShooterPoints += 1;
}
}
}
}
}
Any idea about how to know when a player is hit because of the AOE or when he's hit directly?
Also, I'm using custom versions of Elite and ModeSport Scripts.
Thanks!
Re: How to dissociate direct hit and AOE?
Posted: 20 May 2014, 13:00
by Cerovan
I'm not sure that you can do it with the Storm weapons.
Nevertheless, with a custom-created weapon, you can specify the damage done by a direct hit and those within an AoE (
http://maniaplanet.github.io/documentat ... eapon.html).
Look at the values "Damage Radius" and "Damage Radius Attenuation" in the Gameplay explosion tab of the bullet

Re: How to dissociate direct hit and AOE?
Posted: 20 May 2014, 13:37
by fleo
Ok thanks

I may use a custom weapon in that case.
I was hesitant to replace the nucleus by a custom shotgun, I think I'm gonna create two weapons now
Is there a way to open the storm weapons in the editor? Or at least to get the same crosshairs?
Re: How to dissociate direct hit and AOE?
Posted: 20 May 2014, 15:03
by Cerovan
fleo wrote:Ok thanks

I may use a custom weapon in that case.
I was hesitant to replace the nucleus by a custom shotgun, I think I'm gonna create two weapons now
Is there a way to open the storm weapons in the editor? Or at least to get the same crosshairs?
You can't open the Storm weapons in the editor but there is a little trick to use the crosshairs.
You just need to spawn the player with the weapon of the crosshair you want to use and then you assign him the custom weapon. Should be good that way

Re: How to dissociate direct hit and AOE?
Posted: 20 May 2014, 15:24
by fleo
Thanks again, that's tricky, but that should do the work ^^
As I understood, if I use custom weapons, I'll have to handle the +1 animation myself? Can we have the original script which display it? Or again at least an hint about how to create it because I have to admit I have no idea about how to do that...
Re: How to dissociate direct hit and AOE?
Posted: 20 May 2014, 15:33
by Cerovan
fleo wrote:Thanks again, that's tricky, but that should do the work ^^
As I understood, if I use custom weapons, I'll have to handle the +1 animation myself? Can we have the original script which display it? Or again at least an hint about how to create it because I have to admit I have no idea about how to do that...
Unfortunately, there is no way to do it easily, the +1 is handled by the client directly (it's hard-coded for the moment), so you'll have to find a way to create a feedback to tell the player that he has hit another player
For example i did this in one of my script:
Code: Select all
declare netwrite Integer Net_ShooterHit for UI;
...
else if(Event.Param1 == "damage" && Event.Shooter != Null && Event.Victim != Null && Event.Victim != Event.Shooter) {
if(!Event.Shooter.IsBot) {
declare UI_Shooter <=> UIManager.GetUI(Event.Shooter);
declare netwrite Integer Net_ShooterHit for UI_Shooter;
Net_ShooterHit = Now + 250;
}
In the manialink, player side:
Code: Select all
<quad posn="-9.4 9.6 100" sizen="19 19" id="CrosshairHit" opacity="1" image="{{{MyImgBaseDir}}}UI_images/hit_crosshair.dds" />
...
declare netread Integer Net_ShooterHit for UI;
...
if(Net_ShooterHit >= ArenaNow){
CrosshairHit.Show();
CrosshairHit.Colorize = <1., 0., 0.10>;
} else {
CrosshairHit.Colorize = <1., 1., 1.>;
CrosshairHit.Hide();
}
Re: [Solved] How to dissociate direct hit and AOE?
Posted: 20 May 2014, 15:55
by fleo
Ok I'll try that when I'll have enough time. So the +1 is an image (and the +2, +3 and so on)? Do you have it (them)?
And is the sound really handled automatically now? Because I made a test (thanks to your tuto about how to use custom weapons in a script

) and nothing was triggered, I had to remove armor, play sound and display +1 by myself. Do I have to play with Event.ShooterPoints? Because I tried but it always stayed at 0 (because OnHit is not triggered I guess).
During my test I also noticed that autoswitch weapon is disable with custom weapon (ie: I keep my shotgun on a railpad). Is it possible to enable it?
Thanks again for you time and your quick answers! I'll tell you when the mode is finished

Re: [Solved] How to dissociate direct hit and AOE?
Posted: 23 May 2014, 02:41
by phil13hebert
fleo wrote:Ok I'll try that when I'll have enough time. So the +1 is an image (and the +2, +3 and so on)? Do you have it (them)?
I'm interested by having these images too for my gamemode

Re: [Solved] How to dissociate direct hit and AOE?
Posted: 23 May 2014, 07:38
by steeffeen
pretty sure the numbers aren't images, do you expect them to have 4 billion image files for all the possible integer values? i kinda doubt they are composing them with images for 0-9 and + and -
Re: [Solved] How to dissociate direct hit and AOE?
Posted: 23 May 2014, 09:47
by Cerovan
fleo wrote:Ok I'll try that when I'll have enough time. So the +1 is an image (and the +2, +3 and so on)? Do you have it (them)?
And is the sound really handled automatically now? Because I made a test (thanks to your tuto about how to use custom weapons in a script

) and nothing was triggered, I had to remove armor, play sound and display +1 by myself. Do I have to play with Event.ShooterPoints? Because I tried but it always stayed at 0 (because OnHit is not triggered I guess).
During my test I also noticed that autoswitch weapon is disable with custom weapon (ie: I keep my shotgun on a railpad). Is it possible to enable it?
Thanks again for you time and your quick answers! I'll tell you when the mode is finished

The +1 are hard-coded in the Storm weapon for the moment and aren't images (just text), we just use a "cross" image that we put above the crosshair to show a hit.
For the hit sound it should be automatic so i don't know why it's not played for you
Can you share the code that you do when you hit someone please?
About the autoswitch, it doesn't work with custom weapons (intended). You should check if a player is on one of the pad (check CSmPlayer attributes) to deactivate the custom weapon.