@JRH:
If you had gone through the tutorial I wrote that MADE this script, it wouldn't look like "gobltgook".
@The challenge master:
Here is your free lesson from someone who
may actually be able to help you... you ready for it? Okay, let's take it from the top. (I don't do this very often anymore, so do yourself a favour and
pay attention! )
Section 1: The Decal
The "glow effect" you see underneath those floating weapons is called a
decal. Decals are 2D images textured onto a flat object known as a "plain" (or so the DBP manual would have us believe.... joke) in rapid succession, to give the illusion of animation. You following so far? Good!
These decals can be found in the following folder:
gamecore\decals
You'll see lots of folders in there, each one containing a texture and a text document. The text document tells FPSC specific things about the decal. Right now, this is not important. What you need to know is how to apply these decals to your automed, so let's get onto that.
For starters let take those weapons you mentioned as an example. Each of them had a red/yellow ring underneath of them, correct? Where did this come from? I'll tell you.
Let's use the "law" as an example weapon. It's a bazooka that can be found in the "generic" category of entity's. The information we're looking for is in the following folder:
entitybank\generic\items
Go into that folder and find the file called "law.fpe". A little general knowledge here for you... FPE files contain information about an
FPSC
Entity. With that in mind, let's open it up in Notepad and take a look at what makes the "law" entity tick. (Reminder, this file contains info about the law ENTITY and not the gun itself... that is found elsewhere)
Inside you'll see lots of stuff about AI, spawning, properties, orientation and the like... but what you're interested is at the Verrrrrrrrry bottom.
You should see:
Quote: ";Decals
decalmax = 1
decal0 = glowred"
This is where that little glowing circle comes from. The law entity is told that it should use the "glowred" decal. You can look at this decal in it's texture form by going into the decals folder and finding it like I showed you just earlier in this mini-tut.
Now that we know HOW the weapon knows what decal to use, let's tell your AutoMed to do the same. First we need to find it in this sea of folders... to save you some time, you can find the scifi one here:
entitybank\scifi\wall furniture
Open up the "automed.fpe" file.
You'll notice that there is NOTHING in here that tells it what decal to use. Let's copy and paste the decal lines from the law.fpe into the automed.fpe at the very bottom. It should look something like this:
;Entity Spec
;Header
desc = Automed
;AI
aiinit = appear1.fpi
aimain = healthuse.fpi
aidestroy = disappear1.fpi
;Spawn
spawnmax = 0
spawndelay = 0
spawnqty = 0
;Orientation
model = meshbank\scifi\scenery\special\automed\automed.X
offx = 0
offy = 0
offz = 0
rotx = 0
roty = 0
rotz = 0
materialindex = 3
forwardfacing = 1
defaultheight = 50
defaultstatic = 0
;Visualinfo
textured = texturebank\scifi\scenery\special\automed\automed_D2.tga
effect =
;Identity Details
strength = 0
;Animationinfo
animmax = 0
anim0 = 0,0
;Decals
decalmax = 1
decal0 = glowred
There... now the automed has a decal to use. It will use the glowred decal. I'm not too fond of this decal for medicinal purposes, though... I much more prefer the "shockwave" decal, so I changed it to that.
After adding that, save the file and close it.
Section 2: The Script
Now... there's one thing left to do. You need to tell the automed WHEN to run the decal.
We don't yet know what actually runs the decal, so let's open up that "weaponglow.fpi" file and find out.
It looks like this:
;Artificial Intelligence Script
;Header
desc = Weapon Glowing Pickup
;Triggers
:state=0:hudreset,hudx=50,hudy=90,hudimagefine=gamecore\text\pickedupaweapon.tga,hudname=weaponprompt,hudhide=1,hudmake=display,state=10
:state=10:rundecal=5,spinrate=4,floatrate=10
:state=10,plrdistwithin=40:state=1,playertake,coloff,rundecal=-1,plrsound=audiobank\items\pickupweapon.wav,hudshow=weaponprompt,hudfadeout=weaponprompt
;state=2:state=3,playerdrop,colon,plrsound=audiobankitemspickup.wav
:state=3,plrdistfurther=65:state=10
;End of Script
Here is the line that uses the decal:
Quote: ":state=10:rundecal=5,spinrate=4,floatrate=10"
This is the line that JRH used for his "fixed script". But, what I bet he didn't do is give the automed the decal, like we just did. Since the automed is a mounted item and SHOULD NOT spin NOR float up and down... you can cut out the "spinrate" and "floatrate" commands from JRH's script.
Here's your detailed scripting lesson -
"rundecal" is a command that tells FPSC that it needs to do the following:
- Show the entity's decal
- Animate the entity's decal
- Orientate the decal properly
But how does it do all of that in just one command?
It does all of this with the number that you pass into the command.
What does that number tell FPSC, though? And why are we using "5" for the weapon?
Here are all the numbers accepted by the command and what they do:
-1 - Stop playing a looping decal
0 - Animate once while ALWAYS facing the player
1 - Animate once while keeping the decals orientation from the Editor (How you put it in the level)
2 - Loop animation while ALWAYS facing the player
3 - Loop animation while keeping the decal's orientation from the Editor
4 - Animate once and face straight up
5 - Loop animation and face straight up
6 - Character spot decal (At end of entity character's gun, usually)
Now, it's up to you to decide how you want the decal to be played.
For an automed, I would prefer that the decal NOT always face the player, but instead keep it's rotation. Since this decal is bound to an entity through it's FPE file, the decal will have the orientation of the automed. So it will be at the same height, location, and rotation of your automed. To get this effect, we would use a value of "3" for the "rundecal" command. Now remember, this will loop the decal indefinitally until we tell it to stop. We'll put the "stop running decal" parts where the "stopsound" commands are.
So... taking JRH's "fix" and re-editing it, we'll get something like the following:
; Automed Unit
;Header
desc = AutoMed Station
;Triggers
:activated=0,plrdistwithin=50,plrusingaction=1:plraddhealth=1,loopsound=audiobank/atmos/acidhum.wav,rundecal=3
:state=0:hudreset,hudx=50,hudy=90,hudimagefine=gamecore\text\pressentertouse.tga,hudname=useswitchprompt,hudhide=1,hudmake=display,state=10
:plrdistwithin=50:hudshow=useswitchprompt,hudfadeout=useswitchprompt
:activated=0,plrusingaction=0:stopsound,rundecal=-1
:activated=0,plrdistfurther=50:stopsound,rundecal=-1
:activated=0,plrhealthgreater=499:stopsound,rundecal=-1
:state=100:activate=1,incstate=1,stopsound,rundecal=-1
Btw... this doesn't look like the script I made... so, either you edited it, or you copied it wrong. I see that some parts are missing, such as preventing the automed from giving MORE health than necessary.
If that was your intention, that's fine. Edit it as you see fit.
Your decal will now be visible out of the sides of the automed while it is healing you. If you don't like the decal, feel free to change it to something else or use a different "rundecal" value to get different effects.
This concludes today's lesson. If you are still completely and utterly lost... I recommend you read my other tutorials in the Official Community Guide, specifically the ones aimed towards scripting beginners.
For a small recap, here's what needs to be done:
- Edit the AutoMed.FPE file to give the AutoMed a decal
- Change the script to make the decal appear
The one and only,