Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

FPSC Classic Scripts / Headshot Script-- 1 Shot Kill To the Head

Author
Message
Armageddon Games
15
Years of Service
User Offline
Joined: 29th Apr 2009
Location: Im In my Little bubble, Find your own...
Posted: 25th May 2009 15:26 Edited at: 25th May 2009 15:28



Entity Shoots At Player and chases-- Normal Damage To Entity everywhere but head-- Killshot To Entity Head

Script By Dj Collateral

From The Staff Of Armageddon Games (C)

http://www.soundclick.com/DjCollateral
djmaster
User Banned
Posted: 25th May 2009 15:36
The enemy doesent chase the player since theres no movement command.

A.K.A. chargerbandit
[href]http://chargedstudios.ultimatefpsc.com/[href]
Armageddon Games
15
Years of Service
User Offline
Joined: 29th Apr 2009
Location: Im In my Little bubble, Find your own...
Posted: 25th May 2009 15:42 Edited at: 25th May 2009 15:42
did you even try it?

i did and he chased me and shot at me --

you have to add the script to the entities "main"

under entity AI Script when you right click on it

From The Staff Of Armageddon Games (C)

http://www.soundclick.com/DjCollateral
Dar13
16
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 25th May 2009 16:20
The reason he chased you is because the 'shootplr' command uses the fpi script in the 'shoot' properties of the entity. So if you have a script that has the entity follow and shoot you in the 'shoot' property, that's what will get run when shootplr is used.

Here is a script that does what you want(note: I did this for a concept not actual script):


Armageddon Games
15
Years of Service
User Offline
Joined: 29th Apr 2009
Location: Im In my Little bubble, Find your own...
Posted: 25th May 2009 16:28
ahh right -- thankyou Dar13-- lol wow i missed it

From The Staff Of Armageddon Games (C)

http://www.soundclick.com/DjCollateral
Dar13
16
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 25th May 2009 17:16
No problem, Armageddon Games.

The Fps Creator rocks!
16
Years of Service
User Offline
Joined: 24th Oct 2008
Location: Sneaking down your chimney.
Posted: 4th Jun 2009 02:42
Lol.

I want a new computer!
Black Profductions
16
Years of Service
User Offline
Joined: 15th Sep 2008
Location: Argentina
Posted: 11th Jun 2009 00:24
How can i make it work, i mean where do i have to attach it for multiplayer?
Also can you make it play a sound when it has been done?

Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 11th Jun 2009 06:45 Edited at: 11th Jun 2009 06:48
Quote: "Also can you make it play a sound when it has been done? "

There might be a way to detect headshots to a degree, but it wouldn't work right on the last shot.

Its just an idea I have, which is too complicated to explain here in detail, but I might be able to get it to work.

No promises of success, but I'll play with the idea and see what I can come up with.

Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 11th Jun 2009 09:26
Headshots deal a lot of immediate damage. Why not find out just how much damage the headshot does, then have the "shotdamage" command check for a damage amount a little below that? If the shotdamage returns true, then a headshot must have occured (or you shot them with an unusually powerful weapon )


The one and only,


Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 11th Jun 2009 09:48 Edited at: 11th Jun 2009 10:25
Quote: "Why not find out just how much damage the headshot does, then have the "shotdamage" command check for a damage amount a little below that? If the shotdamage returns true, then a headshot must have occured (or you shot them with an unusually powerful weapon )"


I tried playing a sound for shotdamage=25, and nothing happened.

You guys have the source for 115, so you tell me whats up.

Is the headshot function calling the destroy script without decrementing the entity's health or what?

Because the shotdamage seems to be unable to detect headshots.

lol

I even tried shotdamage=1

Quote: "

:state=0:state=1

:state=1,shotdamage=1:sound=audiobank/smash/glass.wav

"


A regular shot plays it but the headshot doesn't.

Maybe Lee can fix that for us by having the headshot return 1001 shotdamage before it calls the destroy.
Then a shotdamage=1000 would tell on the headshot.

It would be nice to play a sound, or show a hud, or do other stuff (custom animation with exploding head?) for headshots.


Edit
I just had an idea.

We know the headshot returns zero shotdamage, right? (at least is seems to be with the =1 test above)

If we check the shotdamage in the destroy script, then we know not to play the sound if shotdamage=1, otherwise...

I'll test that too.

Nevermind, the shotdamage doesn't work in the destroy scripts, only in the Main AI.

Hockeykid
DBPro Tool Maker
17
Years of Service
User Offline
Joined: 26th Sep 2007
Location:
Posted: 11th Jun 2009 10:52 Edited at: 11th Jun 2009 10:53
umm got an idea but might not work to well. What about something like this


Bit scetchy but might work

Detecting if the health dropped to 0 in less then a second

Black Profductions
16
Years of Service
User Offline
Joined: 15th Sep 2008
Location: Argentina
Posted: 11th Jun 2009 12:34 Edited at: 11th Jun 2009 12:52

But, what if i shot someone with a weapon that kills the player in a shot?
And, one again, where do i have to put it? to a trigger zone?

Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 11th Jun 2009 19:20 Edited at: 11th Jun 2009 20:19
I've been testing this all last night, but I don't want to post any scripts until they are working as planned.

I've tried everything I could think of (so far) for a workaround to script this, but have not succeeded yet.

The best I have some up with is headshot detection on the first hit.

After respawning (or on initial spawn)...
If you hit him but don't get the head shot then no sound on when he does die.
If you get a head shot & kill on first hit, then the sound plays.

I have not been able to detect the headshot after the non-headshot hit, so it is still a WIP.
I won't post my script unless I can get full headshot detection working.



EDIT
Okay, fellow gamemakers, we are really close now.
I have every headshot detected except the next to last shot.
So in other words...
Shoot him once , twice, threes, it doesn't matter; only the headshot plays the sound.
Shoot him to death without a head shot and no sound.

Only problem is the last shot and the number I use must be tweaked depending on the weapon used.
That's not good unless the player is carrying weapons with nearly equal shot damage.
Otherwise the headshot might not be detected if the enemies health is already next to death.

I'll tweak this and see what I can come up with, but it's real close now...

Black Profductions
16
Years of Service
User Offline
Joined: 15th Sep 2008
Location: Argentina
Posted: 11th Jun 2009 20:24
Also, an image display would be cool, like a small circle that shows a head with a bullet near it
It would be a cool feature i think

Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 11th Jun 2009 20:31 Edited at: 11th Jun 2009 20:57
Quote: "Also, an image display would be cool, like a small circle that shows a head with a bullet near it
It would be a cool feature i think "


Yes, other features are nice but I simply play a sound for testing the functionality of the script.

If you replace the sound action with a state call, then you can go to another state and do whatever you want on the destroy.
Displaying a HUD would need to be done by activating a TARGET before you destroy.
That way the invulnerable entity could be used to display the HUD during and after the enemy has been destroyed.
That entity used for the display script could also be activated by many differently named characters. (any or all of them)


I may expand on this over the weekend, but for now all you get is the test script, so you can play with it and edit it to your heart's content.


This method uses one global variable and two scripts. (detect and destroy)

The first script is the dection script and is a working example of the commands needed to implement this is a charaters AI. (you edit/modify)

I named it headshotdetection.fpi and placed it in the user scriptbank.
I placed a WWII Unarmed Officer and used this for the MAIN AI, and I set him up to spawn.

Here is the
for the head shot detection.

Then I needed a custom destroy script so it can do its death sound thingy.
I named this script headshotdetectiondestroy.fpi and assigned it as the DESTROY AI for the Officer.

Here is the
for headshotdetectiondestroy.fpi


You also need to assign the Officer the appearwithheadshot.fpi found in your stock scriptbank, of course, for the head shot to work in the first place.

Try this out, because the only time it does not detect the headshot is if the health is already less than 20.
I used a MAS 36, from the WWII guns, which has a max damage of 20.

Try it out and do whatever you want with it as long as you do not replace or edit the top lines.

I've also included an image of the Officer's properties, and I highlighted the changes needed for the test...

Have Fun!

P.S.
This headshot detection system has been designed & tested for single player, not multiplayer.

Attachments

Login to view attachments
Black Profductions
16
Years of Service
User Offline
Joined: 15th Sep 2008
Location: Argentina
Posted: 11th Jun 2009 21:06
cxan you make one for multiplayer ? plissss

Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 11th Jun 2009 21:16 Edited at: 11th Jun 2009 21:19
Quote: "cxan you make one for multiplayer ? plissss"

no

Sorry, but scripting is limited in multiplayer, so I stick to single player games.

There have been a few people to make workarounds for multiplayer, but I think maybe MODs are better for that; I dunno.
That means, you would need the creators of the MODs to assist you with that, since their mods use a unique FPI command set.

Black Profductions
16
Years of Service
User Offline
Joined: 15th Sep 2008
Location: Argentina
Posted: 11th Jun 2009 23:16
, kk

Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 12th Jun 2009 01:40 Edited at: 12th Jun 2009 20:30
Sorry to disappoint, but I hope someone other than me finds it useful as single player thingy.

I needed this anyway, because I have been wanting exploding head animations since before headshots were a feature of the engine.

Now I need to finish this by incorporating it into a Enemy AI script and a destroy that calls the custom animation.
If I can get 1 working then I hope to do three, so I can do a random thingy to mix it up.
You know, one where it explodes then they fall to knees and flop foward.
Then one were they body limp falls to one side, and another where it does a spiral on the way down.
The exploding head is the tricky part and will be included in all three falls of course since they are all headshot falls.
So, I'm off to animate..L8rs

CNJURED


Edit
Wow, I never had any luck adding bones the the stock animations before, because it always messed them up.
However, I finally figured out a work around, so I have added bones to the boneset without ruing them, whic means custom animations on the way.
Until then, I wanted to give you guys an example of what I was talking about before when I said you could goto another state.
So, I whipped up another script that I canibalized my dieharder.fpi to create.
This is a replacement destroy script for the one above, and instead of a sound it does something else.
This script destroys the officer if no headhot killed him, so then he respawns and you try again.
However, if you do get a headshot, then he goes down (custom animation from stock frames) and he stays down and does not respawn.

Here is the
for headshotsplatter.fpi

Yes, it is a Work In Progress for the final script as you can tell from the name.


I have added a picture of what I have so far...
The idea is to do a really simple animation addition first just to see if this is going to work as planned.
I don't want to get elaborate on the head explosion if the animations aren't going to work right. (delays or glitches)
So, I have decided to just blow the top of his head off, which will be pretty simple to animate.
What I have done so far if duplicate the head, and added the bones I will need for the other effects.
I also had to duplicate the top of the head (the piece that blows off) and moved the other vetices down to make the hole.
I've also added vertices and faces the the top part so it will show brains and stuff underneath.
Once I get the animations done then I might fool around with the brain textures.
Til next time, CE

PS
I'm not trying to hijack your thread AG.
I will make a new thread for my WIP once I get the animation working in game.

Attachments

Login to view attachments
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 13th Jun 2009 09:59
Bumpin for this video...

Dudes, I added a simple head shot animation onto the end of the FPSC animations, but...
...but it has been so long since I exported any characters that I am having trouble getting it in game.

All my animations are glitched, so I must have something set wrong on the exports.
Or I forgot what the rules are about adding frames.
I ended up with 2530, so I add 32 frames onto the stock 2498 frames for this effect.

No, it isn't very good, but it was only for a test.
Was I supposed to stay under 2498 frames?
Or maybe I am setting it up wrong in the FPE?

...
anim90 = 832,851
anim91 = 852,881
anim95 = 2499,2529

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-11-25 02:37:29
Your offset time is: 2024-11-25 02:37:29