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 / Difficult to explain request.

Author
Message
foobly
16
Years of Service
User Offline
Joined: 10th Feb 2008
Location:
Posted: 13th Mar 2008 03:24
I was messing around with my game ideas, and I was wondering if it would be possible to bind a key to do the following.

1) Play an animated overlay (don't know if this is possible)

2) Kill all enemies within a certain radius (does FPSC have the ability to gauge the distance of enemies from the player?)

3) You can't use the "ability" again for the rest of the level.

If someone would either tell me that this is impossible or help me do this I would be sincerely grateful and compensate in any way possible. I normally do my own scripting but this had me stumped.

Thanks.
xplosys
18
Years of Service
User Offline
Joined: 5th Jan 2006
Playing: FPSC Multiplayer Games
Posted: 13th Mar 2008 17:21 Edited at: 13th Mar 2008 17:29
I don't think we can do animated overlays yet. I guess you could use a sprite or decal.

Enemies can determine the distance to the player with the plrdistwithin= condition. So something like: plrusingaction=1 or scancodekeypressed=## and destroy should delete the enemies within a range of the player.

:scancodekeypressed=37,plrdistwithin=300:destroy

If you need the enemies to visibly die, you may have to script that, but it can be done. As for once only, I'd have to think more about that.

Best.

foobly
16
Years of Service
User Offline
Joined: 10th Feb 2008
Location:
Posted: 13th Mar 2008 22:23
Thanks for the info.

You can in fact do animated overlays with a sequence of 8 .tga files somehow, I've seen it done, I just don't know how to do it myself.

As for the one time only thing, Is there a condition that can check if a key has been pressed before, and if it has, it disables that key action? I don't know how exactly that would work.

Thanks for any more help you can give.
xplosys
18
Years of Service
User Offline
Joined: 5th Jan 2006
Playing: FPSC Multiplayer Games
Posted: 14th Mar 2008 00:07
We will soon have variables to work with and then much more will be possible. Until then, we struggle to find ways to work around the scripting limitations.

I don't know anything about the animated overlays. Sorry.

best.

foobly
16
Years of Service
User Offline
Joined: 10th Feb 2008
Location:
Posted: 14th Mar 2008 00:12
How soon is "soon"? Just wondering, and if that has been posted somewhere else, oops.
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 14th Mar 2008 03:30
Quote: "If you need the enemies to visibly die, you may have to script that, but it can be done. As for once only, I'd have to think more about that."


I believe you can replace "destroy" with "runfpidefault=2", which will run the enemies already scripted.

Not sure if that will still make them animate their death, but it's worth a shot.


The one and only,
~PlystirE~

Flatlander
FPSC Tool Maker
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 14th Mar 2008 03:59 Edited at: 14th Mar 2008 04:08
Plystire, it seems like it should but it doesn't for some reason. I was playing around with destroying characters programmatically but was never able to come up with anything. Before writing this post I double checked running the destroy default script. The script only does what is in the script. In other words a fade/corpse script will fade out the character and then use the "destroy" action to get rid of it. Apparently the death sequence (animation) is hard coded and begins when the entity loses all of its health.

Calling the fpidefault=2 simply uses the destroy action. Another problem with using the destroy action is that if you are using the shadow hud for the character then the shadow will remain where the character last was after destroying it. I made that hud invisible because I have games that require characters to disappear and I use the destroy action to accomplish that.

I have not tested this but there is an "animate=x" action and "incframe=x" I do not know to what x refers. I know how to control an animation in DBP but not here. If these can be used perhaps one can animate the entity's death sequence and then run either the default destroy fpi or use the destroy action.

Another possible option I had originally thought of was to subtract the entity's health like one can with the players health. However, I could not find an action to do that.
xplosys
18
Years of Service
User Offline
Joined: 5th Jan 2006
Playing: FPSC Multiplayer Games
Posted: 14th Mar 2008 04:08
Good info, thanks. This idea would work well with that.... what was it? The most destructive weapon ever.. the boom box.

You press the key to play the boom box, and as the sound of Michael Jackson begins to fill the room, all enemies within range dissapear, leaving only a scorch mark on the ground. A little smoke would complete the illusion. LOL

Best.

Seth Black
FPSC Reloaded TGC Backer
19
Years of Service
User Offline
Joined: 22nd Feb 2005
Location: Pittsburgh, PA
Posted: 14th Mar 2008 04:10
...Michael Jackson...

ARE YOU A LONE WOLF? CLICK BELOW TO JOIN THE PACK.

foobly
16
Years of Service
User Offline
Joined: 10th Feb 2008
Location:
Posted: 14th Mar 2008 04:17
Hmmm... tinkered with it a bit today... no luck. Could you possibly tell the program to subtract x amount of health from all entities within a certain radius of the player? God I wish I had variables...
Flatlander
FPSC Tool Maker
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 14th Mar 2008 04:42
xplosys,

funny rofl

foobly, as I mentioned we can't subtract health from an entity. There is no way. No action command to do this. Unless I've missed it.
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 14th Mar 2008 04:47
Quote: "God I wish I had variables..."


You can go always go download my Mod, located in the FPSC Chat board, it's entitled "Ply's Scripting Mod V1". It includes user defined named variables, entity timers, ability to script what level the user goes to next, and variable recognition so you can use the variables with any command.


For the issue at hand:

Here's the snippet for making the enemy animate their "death from front" animation.



You guys can tinker with it. Using that as-is will make the enemy fall over and die as soon as they appear.

To animate in FPI:

setframe=X
incframe=X
frameatend=X

X refers to the animation number and nothing else. You can find the animation numbers on page 88 (44 in pdf format) in the FPSC Official Manual. (The one that's on your computer, not the dinky pamphlet that came in the box)


Have fun! (And could a kind Moderator please move this to the Scripts board? Thanks )


The one and only,
~PlystirE~

Flatlander
FPSC Tool Maker
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 14th Mar 2008 04:52 Edited at: 14th Mar 2008 04:53
I believe animate, setframe, incframe, and decframe all have the x value as the frame #. I think you can get the frame (animate) numbers in the fpe file for the character. Out of my own curiosity I think I will play around with this.

Also, foobly, what you want to accomplish will require all of the characters to have similar scripts to make sure that each one has the capability to be killed once this super weapon explodes or whatever. I believe this is possible but complex for this scripting language. But, then again, I might be wrong -- either way.
Flatlander
FPSC Tool Maker
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 14th Mar 2008 04:57
oops, plystirE, you posted while I was still writing.

There you go. Yea, I think I will still play with it. Sounds like something cool for a game. Aren't we now posting in the FPSC Scripts board now. That's where I thought I was. But, then again I very seldom know where I am at any given moment.
xplosys
18
Years of Service
User Offline
Joined: 5th Jan 2006
Playing: FPSC Multiplayer Games
Posted: 14th Mar 2008 05:04
Thanks Plystire for the animation info. It's not anything I've messed around with yet.

F l a t l a n d e r, please keep us informed of your progress. I like the idea.

Best.

Flatlander
FPSC Tool Maker
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 14th Mar 2008 05:16 Edited at: 14th Mar 2008 05:18
Since you asked, I will.

Use this if you want to actually see the character fall down.



Put the code in the character's main, set up a trigger zone in front of the character and use "plrinzoneactivateused.fpi" in the tz main and put the character's name in the tz's "ifused" parameter. Set the player marker in front of the trigger zone and make the player walk through the trigger zone. Character will fall down dead and then fade away.
Flatlander
FPSC Tool Maker
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 14th Mar 2008 06:01
Should I post what I've come up with here, foobly? Or start another thread?
Flatlander
FPSC Tool Maker
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 14th Mar 2008 06:20 Edited at: 14th Mar 2008 06:24
For testing I used the thug with pistol. Since he had "chase" in the shoot parameter, I used that. I copied the "chase" fpi and put it in a blank script document and added the lines that are in bold.

============================

;Artificial Intelligence Script

;Header

desc = Look and Shoot Far From Player (SHOOTCLOSE replaces CHASE until DarkAI added)

;Triggers

:state=0,plrcanbeseen:state=1,settarget
:state=0:runfpidefault=1

:state=1,scancodekeypressed=37:state=20
:state=1:rotatetoplr
:state=1,plrcanbeseen:settarget
:state=1,ifweapon=1,plrdistfurther=100,plrelevwithin=10:movetotarget=1,animate=5
:state=1,plrdistwithin=101:rotatetoplr
:state=1,ifweapon=1,plrdistwithin=400,plrcanbeseen=46,rateoffire:animate=1,rotatetoplr,freeze,useweapon,rundecal=6
:state=1,ifweapon=0:animate=1,freeze,state=2,setframe=6
:state=1,plrdistwithin=200,random=20:state=5
:state=1,plrdistwithin=50:state=10
:state=1,losetarget=100:state=5

:state=2,scancodekeypressed=37:state=20
:state=2:incframe=6
:state=2,frameatend=6:state=1,reloadweapon,sound=audiobankgunsreload.wav

:state=5,scancodekeypressed=37:state=20
:state=5,random=1:state=6,setframe=4
:state=5:state=7,setframe=3

:state=6,scancodekeypressed=37:state=20
:state=6:incframe=4,strafe=90,rotatetoplr
:state=6,frameatend=4:state=1,animate=1

:state=7,scancodekeypressed=37:state=20
:state=7:incframe=3,strafe=-90,rotatetoplr
:state=7,frameatend=3:state=1,animate=1

:state=10,scancodekeypressed=37:state=20
:state=10:state=11,setframe=5

:state=11,scancodekeypressed=37:state=20
:state=11:incframe=5,strafe=180,rotatetoplr
:state=11,frameatend=5:state=1,animate=1

:state=20,plrdistfurther=90:state=1
:state=20,plrdistwithin=90:setframe=11,state=30
:state=30:incframe=11
:state=30,frameatend=11:state=40
:state=40:destroy


;End of Script

====================================

Since we don't know exactly where the script is going to be at any given moment I thought it would be best to place the key press code at the beginning of each new state.

Since the player can press the "k" key anytime he wants we need to be sure that the character resumes the chase script. I used 90 units as the distance. Further from this, he will continue shooting. Within this distance he will die.

This is just a quick look and test haven't tried other situations as yet. However, maybe this is enough to get others started who are interested. If I finish with a full blown workable script other than this one will let you know.

BTW, if there is script in the shoot parameter you need to put the additional code in that script rather than the main script. Also, for some reason rundefaultfpi doesn't seem to work using this code although it did in the simple test. That's why I used destroy. Maybe it is because it is being run from the "shoot" script rather than the main. If you want the character to fade then you probably just need to add the script for that.
Flatlander
FPSC Tool Maker
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 14th Mar 2008 06:34
Here is the code beginning at state=20 that includes the fade corpse code.

=====================

:state=20,plrdistfurther=150:state=1
:state=20,plrdistwithin=150:setframe=11,state=30
:state=30:incframe=11
:state=30,frameatend=11:state=40
:state=40,alphafadeequal=100:decalphafade=0,state=45
:state=45,alphafadeequal=0:destroy,state=50
:state=50:none

===============================

I changed the distance to 150. I had to wait too long before I could kill the guy with the touch of a key. Anyway, after testing a few times, sometimes you will get the effect with the chase script of when the guy dies he falls down and the slides right to towards the player on his back. And as he is sliding towards the player he just fades away.
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 14th Mar 2008 07:14
Instead of making variations of your code to include the fading or simply disappearing, why not us the "runfpidefault=2" command, which will go and run the entities "Destroy" script specified in their properties. It wouldbe cleaner and you would only need one variation of the code to work with most deaths.


Nice scripting, btw.


The one and only,
~PlystirE~

Flatlander
FPSC Tool Maker
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 14th Mar 2008 08:46 Edited at: 14th Mar 2008 08:48
Thanks Plystire. Appreciate that.

I know that it is difficult to read all of a post especially since it is long. But this is what I had said in the previous post:

Quote: "Also, for some reason rundefaultfpi doesn't seem to work using this code although it did in the simple test. That's why I used destroy. Maybe it is because it is being run from the "shoot" script rather than the main. If you want the character to fade then you probably just need to add the script for that."


When I ran the simple script in main on the character it worked fine. But when I tried it in the shoot script (calling runfpidefault=2) the character did not fade/disappear. It just remained on the ground. I'm not sure why. It would make sense to do it that way, obviously. But, one's got to do what one's got to do.
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 14th Mar 2008 09:31 Edited at: 14th Mar 2008 09:32
Interesting indeed, are you sure that the entity didn't have the "leavecorpse.fpi" as it's Destroy AI?


By all accounts it should work. And if it doesn't, then you're right, it might be best to do it the round-about way.

[EDIT]
I noticed that you mispelled "runfpidefault" and accidentally typed "rundefaultfpi". Make sure you didn't make the same mistake with your Shoot AI.
[/EDIT]


The one and only,
~PlystirE~

Flatlander
FPSC Tool Maker
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 14th Mar 2008 10:37
Mispelled only here as I was very tired and still am. I should go to sleepy now. Also, I use FPI Maker and if it is a correct command it will turn colors depending on condition or action. Except for those that were undocumented and didn't make the FPI Maker cut. Of course, that still doesn't necessarily keep me from making mistakes. And yes it was fadecorpse. I used the thug with pistol and used the default destroy script which was fadecorpse.
xplosys
18
Years of Service
User Offline
Joined: 5th Jan 2006
Playing: FPSC Multiplayer Games
Posted: 14th Mar 2008 15:01
F l a t l a n d e r, thanks again for the scripting and info. I'm sure something cool will come of this.

Best.

Login to post a reply

Server time is: 2024-11-24 06:43:06
Your offset time is: 2024-11-24 06:43:06