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 / Enemy reacts when shot

Author
Message
tecbug
15
Years of Service
User Offline
Joined: 29th Oct 2009
Location:
Posted: 7th Oct 2010 23:11
I have this fpi:

I'd like to put there condition that enemy attacks player (run shootplr) when it's being shot. How to do this?
Plystire
22
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 7th Oct 2010 23:41
I think the command you're looking for would be "shotdamage=1", which will return TRUE when the entity has received 1 or more shot damage.

The line of code would look like this:



The one and only,


tecbug
15
Years of Service
User Offline
Joined: 29th Oct 2009
Location:
Posted: 7th Oct 2010 23:54
That works just great. Thanks!
tecbug
15
Years of Service
User Offline
Joined: 29th Oct 2009
Location:
Posted: 12th Oct 2010 23:54
In addition to this script: How to do that enemy attacks when he hears gunshot, or sees that second enemy is killed?
Plystire
22
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 13th Oct 2010 22:59
I think the command for that is "noiseheard" or something along those lines. Might want to double check that in the manual, though, I probably misspelled it.
But you can look in some of the stock AI scripts. I know they use that command.

As for seeing another entity killed, that would require a lot more scripting. You would be better off scripting your AI to alert the AI near them when they are shot.


The one and only,


tecbug
15
Years of Service
User Offline
Joined: 29th Oct 2009
Location:
Posted: 14th Oct 2010 12:49
I've tried noiseheard. Doesn't work in this case.
Quote: "You would be better off scripting your AI to alert the AI near them when they are shot."

Good idea, could You post me example of that kind of script (i'm beginner scripter)?
Plystire
22
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 14th Oct 2010 22:38
You can do it a couple of different ways:
1) name all of your enemies the same name, then when they detect being shot have them "settargetname=<name of your enemies>,activetarget=1". Now script your enemies to wait for that activation value and, when received, immediately engage the player.

2) Script your enemies to utilize a global variable. Check for it to change value, and if changed, engage the player. If shot, or if they found the player and ARE engaging the player, have them set the global variable, so tht they effectively "alert" their buddies.


Hope those made sense.


The one and only,


Michael Thompson
16
Years of Service
User Offline
Joined: 15th Aug 2008
Location: Behind you (if not, in australia)
Posted: 28th Oct 2010 05:55 Edited at: 29th Oct 2010 14:18
Yes, I would have said a global variable too. this bit where you shoot them and they do nothing is annoying isnt it? im trying to add as much realism to my game as possible, so this will come in handy.
Thanks.

EDIT
Dont worry, it was a stupid question and I removed it.

EDIT 2
Also, is there a way to generate a random intiger?
Why I ask is I want to say generate a random number from 1 to 3.
if the intiger is 1, for them to fight it out alone.
if the intiger is 2, they run.
if the intiger is 3, they call backup and then attack.
Thanks.

Windows 7 ultimate x64, Intel i7, 4 GB RAM, NVIDIA GEFORCE 330m 1GB
Flash Star Game Creations

Login to post a reply

Server time is: 2025-06-04 10:34:23
Your offset time is: 2025-06-04 10:34:23