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 Product Chat / Applying FPI script to self made entitys/animated models?

Author
Message
Orion_Uk
15
Years of Service
User Offline
Joined: 14th Jul 2010
Location: Isle Of Wight
Posted: 27th Jul 2010 14:17
I cant read any more irrelevant search results (having been through so many) so have decided to post, I hope help is at hand!

OK, so being new to script and FPSC my intention is to do the following, comments/advice much appreciated

As well as the FPSC bundle I also brought Dark game studio hoping that DB pro will be learnt along the way, when I get time to study it! Reading all I can about scripting (going through manual and tut files) my understanding of the FPI & script process is highly limited.

I have made a safe object (bank safe) with animated bones. Frames 0-25=door open,26-100=close (for example). If my understanding is correct, Frames 0-25= state 0 and frames 26-100= state 1 ?


I am assuming that I can apply (with modification) the doorkey.fpi script to safe.x (re-saved as safeopen-close.fpi) to my safe entity? I have not been lucky enough (yet) to put all the elements together in my head to establish the correct process of activating a self made animated object in FPSC via script.

My lack of understanding certain aspects cover the following:

Having place my safe entity in the work space and choosing its properties, I need to assign some form of FPI script in MAIN under the AI scripts section! A bit lost on the process here and steps I need to take yet strangely I feel so close!

Also,

AI Automated, I need to understand USEKEY & IFUSED as I feel that these my enable me to assign a script that unlocks the safe if the right key is found! And how to activate the different STATES that the safe object needs to be in at various points of its animation!

I have Two goals..

1) (long run) learn and fully understand the process of how to write FPI scripts and make them interact with my models/the environment.

2) (short term) learn how to activate an object/entity with the press of a key to open/start an animation and then again to reverse its effect via the same process.

Polite advice always welcome, thank you
Gencheff
16
Years of Service
User Offline
Joined: 12th Jun 2010
Location: UK by way of USSR
Posted: 27th Jul 2010 14:25
Wait wait wait...Frames 0-25= state 0 and frames 26-100= state 1?!

What do frames have to do with states?

States are conditions...example-
:state=0:do something
:state=1:do something
:state=2:state=3 (in this case we switch state 2 to 3 so then it would follow as this)
:state=3:do something

and so on.
What you have to do is in the .fpe file of the safe add animations.

anim0=frame start to frame end(0,300)
anim1= ...
so in the fpi script of the entity you call it like this

:state=0:animate=1
and so on

Orion_Uk
15
Years of Service
User Offline
Joined: 14th Jul 2010
Location: Isle Of Wight
Posted: 27th Jul 2010 15:18
OK... 1st and most important, Thank you for taking the time to reply to my post

I was thinking that I needed to `inform FPSC` (give it a point of reference) via script that the safe door has two different physical states/positions in the animations time line, sorry.

Maybe I should drop the whole `state=` thing here and now as to avoid further confusion

The more I try to explain the more stupid I am going to make myself look due to inexperience

Maybe you can point me in the right direction of a tutorial that introduces me to how entities and scripts interact to achieve this rather than a general tutorial on scripting? I suffer from information overload quite quickly due to a head injury from a quite recent serious RTA, This is why its a hobby for me and not a career path The manual gives me parts of the jigsaw but putting the pieces together is another thing! From your personal experience, where is best to start with script and putting it to effective use in FPSC please?

Thank you once again
Gencheff
16
Years of Service
User Offline
Joined: 12th Jun 2010
Location: UK by way of USSR
Posted: 27th Jul 2010 15:46
Well considering I had programming experience before I started messing with FPI It wasn't hard for me to pick up.Took me 2 days to learn everything.I don't know about you,but I found this - http://download.fpsfree.com/n79q24t66ks8/scripts/fpi_script.htmvery useful.Now about the entity situation I'll try to explain the best I can.

The entity's main script is used only on that entity.The states in that script are not valid in any other scripts.In other words if you change the state in a door's script to say state=3,that doesn't mean that the global state is changed,but only for the door.

Now about appear and destroy scripts.If I'm correct,they are executed only once,unlike main scripts.They're executed constantly.The appear script on an entity is to set its colission and make it visible.The disappear script can be different for each entity.You can choose to leave the corpse of a character on the map,or you can fade it.All the scripts are in the scriptbank\destroy folder.

Now there are functions that can affect the player from a distance.Say you put a main script on an entity(character) and he somehow has to determine whether you are near him or not.This is done by this command plrdistwithin=x.This is a condition.Conditions are put between 2 colons(I think it's caled a colon lol) :plrdistwithin=300: translates to IF the player is within 300 units radius THEN after the second : happens something.So to get a result would require to write an ACTION after the second colon.Example :plrdistwithin=300:rotatetoplr.In this case the entity rotates to the player if he is within 300 units radius.

Now in your case with the safe.Just pretend it's a door.



But this script wont help you much.Since it removes all collision from the entity.The part you need is with the opening of the door.So to explain what the script does :
First of all the change of the states is required because if you don't change a state then that line of code will be ran again and again and again...basically it's pointless.So you change the state after you set an action and then you keep it moving.Think checkpoints.Now everything else in the script is self-explanatory.

I guess you can use that script as long as you remove the collision actions and also you'll probably ask what sound=$1 and $0 is for.Those are the numbers of sound rows in the editor,when you right click on an entity.$1 is sound1 and $0 is sound0.That way it's easier to change it.You don't have to rewrite the script every time,just change the sounds for the entity you want.

Orion_Uk
15
Years of Service
User Offline
Joined: 14th Jul 2010
Location: Isle Of Wight
Posted: 27th Jul 2010 16:36
Hi Gencheff

You have given me a feast of food for thought there and I am really greatful Thank you for taking the time to explain things in such detail (and in such a well presented manor too) you are a star. I am going to pop off now and study the information you have provided a little closer and play around a little. If there is a merit/token system for helpful people in these forums I hope I find it to give you some credit/thanks

Cant thank you enough for the advice/info and links, I hope a simple thank you will do!

Cheers
Gencheff
16
Years of Service
User Offline
Joined: 12th Jun 2010
Location: UK by way of USSR
Posted: 27th Jul 2010 17:09
Sure no problem.If you have any questions ask in this topic,I'll do my best to answer adequately.

Login to post a reply

Server time is: 2026-07-05 18:58:39
Your offset time is: 2026-07-05 18:58:39