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 / Animation Viewer script for Artists and Scripters [PBUM]

Author
Message
Errant AI
18
Years of Service
User Offline
Joined: 24th Aug 2006
Location:
Posted: 14th Nov 2009 16:29
Heyas,

Here's my first contribution to the script board

This is just a script to help view animations and alt. textures in the game. I honestly didn't search to see if it had been done before. It's already saved me a lot of test-game loading time and maybe can help others as well.

It's only been tested in PBUM but will likely work the same in Project Green as well unless the debug printing was added later. It won't work in vanilla because it uses Ply's variables.

Simply assign the anim_viewer.fpi script to the main AI of any dynamic entity and use PgUp/PgDn to cycle through animations and Home key to toggle textures, if assigned. Script can be useful for artists needing a way to easily check their work and for scripters deciding which animation to choose.

It's capped at 50 anims but there are only 42 selectable anims in the stock FPSC rig anyhow. You can raise/lower the cap in the script if desired. It can be used on any animated entity and not only chars.

If using alttextures, be sure the textures are located in the texturebank and not the entity's directory!

If you have a weapon assigned it will show the appropriate anim based on the anim input number. So, if you have a pistol assigned and you select anim6 it will show the pistol reload, not the throw.

Known semi-buggy things are that if you have an alttexture assigned in the editor or FPE but don't have the alttexture in texturebank, the model will go white and its lighting will get messed up. Also, if you want to view anim0 (spawn, you must go up to anim1 then back down to anim0.

Lastly, if there is no anim assigned for the slot you have selected, they will just be frozen until a valid animation is selected.

Video of script in use:
http://www.youtube.com/watch?v=wOjxvJIExik

Here's the script (also attached to post):


I wanted to have a numeric hud to display anim# but I don't know how to do that yet

And here's a screenshot:


Any problems, please let me know.

Attachments

Login to view attachments
mgarand
16
Years of Service
User Offline
Joined: 22nd Dec 2007
Location: The Netherlands
Posted: 14th Nov 2009 16:36
great job!



Creativity is inventing, experimenting, growing, taking risks, breaking rules, making mistakes, and having fun.
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 14th Nov 2009 18:18
Not bad, Errant!

One word of optimization for you, though. You can remove this large chunk of script:


And change it to this:


It looks like you were trying to do this already but were attempting to use the "printstr" command instead. That command prints exactly what you give it, regardless of whether you gave it a variable. The "printval" command prints the value given to it, which is good for printing variable values.

Another thing to look into is using "etimerstart" and "etimergreater" for the timer, so as to prevent any conflict with the global timer.

And last but not least, using "keypressed" as opposed to "scancodekeypressed" can help out with forcing the user to let go of the key before they can press it again. Here's an example of how to use it:


It uses two states for the effect, but it's very consistent and it doesn't matter how long they hold it down. Of course, you could always use a variable (Maybe a stock local variable) instead of a state change, like so:



Hope that helped! And not bad for a first contribution.


The one and only,


leosmontu
15
Years of Service
User Offline
Joined: 16th Mar 2009
Location:
Posted: 14th Nov 2009 18:30
really super thing.
Errant AI
18
Years of Service
User Offline
Joined: 24th Aug 2006
Location:
Posted: 14th Nov 2009 19:14 Edited at: 14th Nov 2009 19:22
Thanks for the feedback

Quote: "printval=%anim"


Ah! I've previously tried as printval=anim and it would just say 0. The % indicator wan't in the manual but I'm spyched now because I've wanted to use that to help me debug a few things.

Yeah I noticed printstr does it verbatim. Forgot to delete that :S
I really hated having/making that nasty block and I'm so happy you've helped me to get rid of it!

I also had etimer originally but swapped out because personally I don't use the global timer for too much. Is there some processing overhead with etimers? I really love them but was worried using them too much for non critical things would eventually slow things. I've been assigning lower priority stuff to the global timer for that reason. Is that backwards thinking?

Lastly, I don't know what I've done wrong but keypressed never worked for me. It would always just read the line as true whenever I tried it. I must have done something wrong because I'd really rather use that approach! Oh wait... I see it now!!!

Where you have
or


I had been using just
without an on/off flag. Got it.

Awesome... I'm so glad you've shown me the light

Slowly, I'm assembling a list of all the conditions/actions with little notes to myself that the guide/manuals don't discuss.

Now I need to figure out how to get the hudsize to work correctly with hudtext... been trying to make it bigger but it's only ever big the first frame it's visible ten goes back to the small size.

Oh, Plystire... have a quick question for you. Is the debug text for testgame only or will it show in a built game?
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 15th Nov 2009 02:33 Edited at: 15th Nov 2009 02:42
Quote: "The % indicator wan't in the manual"


It better be, or I'm going to need to have a chat with a certain someone.

It should be in the Variable Recognition section(s).


Quote: "Is there some processing overhead with etimers?"


Nope. It doesn't slow it down any more than using the global timer does. (By maybe a few nanoseconds )


Quote: "Slowly, I'm assembling a list of all the conditions/actions with little notes to myself that the guide/manuals don't discuss."


I would like to see these notes when you're done. Perhaps they could be added to the manual at some point in time.


Quote: "Is the debug text for testgame only or will it show in a built game?"


It's not really "debug" text. I just labeled it that because it's so....... un-dynamic that I wouldn't think anyone would want to use it for a final game, lol. It should work just fine in a built game. Really, the only reason I added them was for debugging purposes, but you're free to use them after building.


[EDIT]

In case you're wondering, here's how to set up a numeric HUD for variables.

Make a numeric HUD like they're normally made, except for the following:
- "hudtype" must be set to 6
- Add another command after "hudtype" called "huduservar" and give that the name of your variable.

Example:
Quote: ":state=0:hudreset,hudx=70,hudy=7,hudsizex=16,hudsizey=16,hudimage=gamecore\huds\numeric1.tga,hudname=ArmorNum,hudtype=6,huduservar=PlrArmor,hudmake=numeric"



The one and only,


Errant AI
18
Years of Service
User Offline
Joined: 24th Aug 2006
Location:
Posted: 15th Nov 2009 13:09
Quote: "It should be in the Variable Recognition section(s)."


% is described in the var. recognition section. Just not in the description for printval, which reads like:

Quote: "- printval=X
--- Prints the value of the user variable named X to the screen"


Likewise, the 0/1 isn't mentioned in the description for keypressed. Actually, that condition seems to not be mentioned at all in the manual, except for in some example weapon script.

Quote: " Really, the only reason I added them was for debugging purposes, but you're free to use them after building."


OK, gotcha. I'll have to remember to cull that all out before a proper build or assign a debug global var to toggle on/off display of it. I'll likely just use normal hudtext for hud stuff because it's a hair more flexible. But it's good to know debug text can show in build games too. I'm using it mostly for debugging now and it's been a really valuable aid for me to learn FPI and see where my scripts are breaking.

Thanks also for the numeric hud tied to a variable info. That will be really useful to me a bit down the road

I've copied down your advice and will update the OP script after I can test it. Thanks again
PW Productions
15
Years of Service
User Offline
Joined: 13th Mar 2009
Location: sitting in a chair.
Posted: 15th Nov 2009 18:34
Wow! Nice job, Errant! This'll be great for custom animations. Thanks for another great contribution.

PWP

Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 16th Nov 2009 00:13
Quote: "Actually, that condition seems to not be mentioned at all in the manual"


Crap, you're right.

Well, I suppose that's better than having it in the manual and not working.


Yes, the manual is usually made after everything is done... and when I'm very very tired.


The one and only,


The Master Dinasty
16
Years of Service
User Offline
Joined: 14th Sep 2008
Location: Valhalla
Posted: 16th Nov 2009 15:57 Edited at: 16th Nov 2009 15:57
Nice ive been waiting for one of these thanks man!




-Massap2

Beacause massa is the master!

Login to post a reply

Server time is: 2024-11-25 05:29:14
Your offset time is: 2024-11-25 05:29:14