Page 1 of 2

[Tuto] To correctly handle custom weapon hit

Posted: 01 Jun 2014, 11:59
by Dommy
There is just few lines of code to paste in events loop. It handles automatically +1 effect and sends unknown weapon hit notice :3

Everything can be found here:
http://github.com/domino54/title-packs/ ... stomHit.md

Thanks to Mewin and TM-Jinzo :thumbsup:

Re: To correctly handle custom weapon hit

Posted: 01 Jun 2014, 13:23
by djhubertus
So, AddPlayerArmor() is a solution? Time to check :yes:

Re: To correctly handle custom weapon hit

Posted: 01 Jun 2014, 18:02
by phil13hebert
I can confirm that it works :yes:
Thank you for this ! I was needing this so much !

Re: To correctly handle custom weapon hit

Posted: 01 Jun 2014, 19:40
by NJin
phil13hebert wrote:I can confirm that it works :yes:
Thank you for this ! I was needing this so much !
No Problem ;)

Re: To correctly handle custom weapon hit

Posted: 02 Jun 2014, 14:15
by fleo
Ahah I guess that'll work better with AddPlayerArmor() than armor -= damage :lol:

Thanks :thx:

Re: To correctly handle custom weapon hit

Posted: 02 Jun 2014, 23:56
by fleo
Just few questions because I'm curious and not home so I can't try :P

What exactly the AddPlayerArmor function does?
-Does it display the +1 orange/yellow message?
-If two consecutives +1 occur, does it make a +2 and so on?
-Does it trigger a hit sound?
-Does it display "player1 hit player2" on the side?
-Does it round Points to integer and Damage to hundred? (for instance if a weapon makes 182 damages, does it remove 1, 2 or 1.82 armors?)
-Does the victim get this strange orange filter on the border of the screen that indicates he's been hit?
-And finally, what do you mean by "it sends unknown weapon hit notice"?

I'll give answers if you don't know as soon as I'm home.

Re: To correctly handle custom weapon hit

Posted: 03 Jun 2014, 04:34
by phil13hebert
fleo wrote:What exactly the AddPlayerArmor function does?
It adds 1 or many armor to the player. If you put a negative number, it removes armor.
fleo wrote:-Does it display the +1 orange/yellow message?
Yes. Orange when you hit and yellow when you kill (or the inverse).
fleo wrote:-If two consecutives +1 occur, does it make a +2 and so on?
Yes :D
fleo wrote:-Does it trigger a hit sound?
Yes
fleo wrote:-Does it display "player1 hit player2" on the side?
Yes
fleo wrote:-Does it round Points to integer and Damage to hundred? (for instance if a weapon makes 182 damages, does it remove 1, 2 or 1.82 armors?)
I don't know. I didn't test.
fleo wrote:-Does the victim get this strange orange filter on the border of the screen that indicates he's been hit?
I dind't test either.
fleo wrote:-And finally, what do you mean by "it sends unknown weapon hit notice"?
He means that with the AddPlayerArmor, the notices (to the left of the screen and +1, +2, etc.) are working with custom weapons.
ShooterPoints is only working for normal weapons for the moment so this workaround is realy useful. :D

Re: To correctly handle custom weapon hit

Posted: 03 Jun 2014, 09:08
by fleo
You're awesome! :thx:

Do you know a way to handle energy of the weapon? To create a fast reload for a hit or to pause the reload etc. Has it to be done in the weapon script?

Same question about timers. Can we modify for instance the energy cost during a game?

Re: To correctly handle custom weapon hit

Posted: 03 Jun 2014, 09:42
by Dommy
We didn't found any way to customize amount of ammo, only one thing possible is change the reload and damage. If we found working solution I'll create a new topic with how-to. :)

About ammo removing with damage example 50: shooter gets no notice on first hit and (I'm not sure) when victim gets damage that removes armor through round amount (ex. 200) it shows +1. Also victim has natural armor regen (normal, no replenish), so he/she will heal 100 hp in 2.5 seconds.

Re: To correctly handle custom weapon hit

Posted: 05 Jun 2014, 09:44
by fleo
I used your method in my script and it works fine! Links are in my signature if you want to test :D

As you said 182 damages makes a +1 and the 82 left are automatically recovered. However if a second shot of 50 damages occurs right after, the +1 becomes a +2.