[Solved] How to dissociate direct hit and AOE?

You can talk about ManiaScript for ManiaPlanet here

Moderator: English Moderator

User avatar
fleo
Posts: 304
Joined: 02 Sep 2011, 12:56

[Solved] How to dissociate direct hit and AOE?

Post 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. :roll:

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!
Last edited by fleo on 20 May 2014, 15:25, edited 1 time in total.
Follow me on my maniaflash. Try the new elitealternative! Feedbacks on this post. :thumbsup:

♫ I need αεяø. I'm holding out for αεяø 'til the end of the night. ♫
User avatar
Cerovan
Posts: 2007
Joined: 11 Jul 2011, 11:27
Location: France
Contact:

Re: How to dissociate direct hit and AOE?

Post 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 :thumbsup:
Online Programmer & Meme Master ヾ(⌐■_■)ノ

Access to your Player Page

You have troubles, please contact the Ubisoft Support

Maniaplanet Documentation (Editors, Scripting, Title Pack, etc...)
User avatar
fleo
Posts: 304
Joined: 02 Sep 2011, 12:56

Re: How to dissociate direct hit and AOE?

Post by fleo »

Ok thanks :thumbsup: 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 :D

Is there a way to open the storm weapons in the editor? Or at least to get the same crosshairs?
Follow me on my maniaflash. Try the new elitealternative! Feedbacks on this post. :thumbsup:

♫ I need αεяø. I'm holding out for αεяø 'til the end of the night. ♫
User avatar
Cerovan
Posts: 2007
Joined: 11 Jul 2011, 11:27
Location: France
Contact:

Re: How to dissociate direct hit and AOE?

Post by Cerovan »

fleo wrote:Ok thanks :thumbsup: 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 :D

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 :)
Online Programmer & Meme Master ヾ(⌐■_■)ノ

Access to your Player Page

You have troubles, please contact the Ubisoft Support

Maniaplanet Documentation (Editors, Scripting, Title Pack, etc...)
User avatar
fleo
Posts: 304
Joined: 02 Sep 2011, 12:56

Re: How to dissociate direct hit and AOE?

Post 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...
Follow me on my maniaflash. Try the new elitealternative! Feedbacks on this post. :thumbsup:

♫ I need αεяø. I'm holding out for αεяø 'til the end of the night. ♫
User avatar
Cerovan
Posts: 2007
Joined: 11 Jul 2011, 11:27
Location: France
Contact:

Re: How to dissociate direct hit and AOE?

Post 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();
}
Online Programmer & Meme Master ヾ(⌐■_■)ノ

Access to your Player Page

You have troubles, please contact the Ubisoft Support

Maniaplanet Documentation (Editors, Scripting, Title Pack, etc...)
User avatar
fleo
Posts: 304
Joined: 02 Sep 2011, 12:56

Re: [Solved] How to dissociate direct hit and AOE?

Post 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 :thumbsup: ) 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 :yes:
Follow me on my maniaflash. Try the new elitealternative! Feedbacks on this post. :thumbsup:

♫ I need αεяø. I'm holding out for αεяø 'til the end of the night. ♫
User avatar
phil13hebert
Posts: 564
Joined: 29 Oct 2011, 14:11
Location: Québec

Re: [Solved] How to dissociate direct hit and AOE?

Post 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 :D
OS: Windows 7 64 bit
CPU: Intel Core i7 3770 @ 3.40Ghz
RAM: 8GB DDR3 798MHz
GPU: Nvidia GeForce GTX 660 1536MB
Motherboard: Intel 0KM92T
Sound: 7.1
Peripherals: Logitech G510, SteelSeries sensei raw, Corsair vengeance 1500
User avatar
steeffeen
Translator
Translator
Posts: 2463
Joined: 14 Oct 2012, 16:22
Location: Germany

Re: [Solved] How to dissociate direct hit and AOE?

Post 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 -
    Game Mode and Title Pack Creator, Developer, ShootMania-Player & more

    ManiaControl, FancyManiaLinks
    User avatar
    Cerovan
    Posts: 2007
    Joined: 11 Jul 2011, 11:27
    Location: France
    Contact:

    Re: [Solved] How to dissociate direct hit and AOE?

    Post 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 :thumbsup: ) 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 :yes:
    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.
    Online Programmer & Meme Master ヾ(⌐■_■)ノ

    Access to your Player Page

    You have troubles, please contact the Ubisoft Support

    Maniaplanet Documentation (Editors, Scripting, Title Pack, etc...)
    Post Reply

    Return to “ManiaScript”

    Who is online

    Users browsing this forum: No registered users and 3 guests