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 / heltors animated target script help

Author
Message
wizardious
14
Years of Service
User Offline
Joined: 18th Aug 2009
Location: Saskatchewan Canada
Posted: 29th Mar 2015 05:04 Edited at: 29th Mar 2015 10:14
Hey
So, I must admit, I\'m a scripting noob, but I want to learn, because to make the game I want, I will need to learn. One small step at a time. Hopefully, I will be able to get enough help here on the forums to get started. So the first thing I\'ve decide to try is heltor\'s targets for a firing range. The one I\'m working on lays flat on the ground and pops up 90 degrees upright. It is 100 frames long, and starts to lay back down at frame 60. What I\'m trying to accomplish is to have the animation reverse when struck by a bullet. So, a. I need it to register a hit, and .b if hit reverse animation. I saw \"shotdamage\" so, I thought that might work, but I don\'t know if it is only for characters? Some kind of raycast detection?
For the reverse animation, I am pretty lost. \"Decframe\"?
So here is the original.


And here is my failed edit.


Any help would be appreciated. (FPSCv1.19)
Thanks
wizardious
14
Years of Service
User Offline
Joined: 18th Aug 2009
Location: Saskatchewan Canada
Posted: 29th Mar 2015 22:46 Edited at: 30th Mar 2015 00:10
Well, I got it to work. I saw the action 'animationreverse', and decided to trim the animation to 60 frames to better control it with scripts. I didn't have any luck with animationreverse, but got it working with this.

So basically, when I get near the target it pops up, if I shoot it it goes down.
However, it pops up to slow, and doesn't go down after being shot for about a second, so I'm going to work on 'etimer' and 'setanimatespeed' and try to fix that.
[EDIT] So I realized, when I was testing the script above, I would approach target, move back to make sure it stayed up (which makes no sense logically) and shoot it. What I didn't realize, was that I was moving out of the 'plrdistance' condition. When I just stood there and shot, nothing happened. So I went back to the drawing board and came up with this.

It works, but there is a slight delay after you shoot the target, and then it slams down. This is very challenging, and I have a new respect for scripters!
ncmako
12
Years of Service
Recently Online
Joined: 19th Feb 2012
Location: Hendersonville,NC
Posted: 30th Mar 2015 03:58 Edited at: 30th Mar 2015 03:59
wizardious
Quote: "it pops up to slow, and doesn't go down after being shot for about a second"

60 seconds is probably to much. If you want it to pop-up quick
10 frames may work better. In you export settings it probably states the frames per second (usually about 24fps) so 10 frames would be just under 1/2 sec.
But first look in your entities .fpe file. Near the bottom
what "frames" did you assign to "anim0=" or anim1="? It should be something like "anim0= 0,1 anim1= 1,60". As for the script it's a very good start. Look at a typical "dooruse.fpi" script, it's
very similar to what you want to use.
If you gave anim1 the frames to play the animation (anim1= 1,60)
then try something like this...


Note that the "setframe=1" or "incframe=1" is not the animation itself but a reference which "anim#" in the entities .fpe file.
If possible what is the targets .fpe file like?
best

My games never have bugs. They just develop random features..
Lots and lots of random features...
wizardious
14
Years of Service
User Offline
Joined: 18th Aug 2009
Location: Saskatchewan Canada
Posted: 30th Mar 2015 21:37 Edited at: 30th Mar 2015 22:17
Hey ncmako
Thanks for the help. I tried out your script, and it works quite well. I changed the values to anim0, as that is the animation number. I did run into a confusing anomaly when testing however. The further your are from the tartget, the slower it reacts. I took out the line 'plrdistfurther', thinking that might be the issue, but it still functioned the same. Not really sure why. I played with the speed value, and found that controlled the animation speed, but not the reaction to the bullet strike, that was controlled by player distance?
Looking at the two scripts, I noticed you used the'setframe' action, and the 'frameatend' condition, something I missed, and a good lesson to reset the animation.
I am slightly confused about the "script command value" of decframe, and incframe.
The "Unofficial complete script syntax list" the description on page 61 says
Quote: "Description: This steps the animation X back one frame.
Range: X = See animation list.
Example: :state=0:decframe=3"


and

Quote: "3.6.2.6 INCFRAME=X
Description: This steps the animation X forward one frame.
Range: X = See animation list.
Example: :state=0:incframe=3"


But does it not move the entire animation back and forward?
Anyway the playerdistance for my shooting range is close enough for this all to work acceptably, so I'm now moving on to the next target type, a "destroy" target.
Thanks again for the help, and here is the .fpe of the target.

ncmako
12
Years of Service
Recently Online
Joined: 19th Feb 2012
Location: Hendersonville,NC
Posted: 30th Mar 2015 22:15
wizardious
Quote: "I took out the line plrdistfurther"

Yeah, I don't see a need for it
I see from the entities .fpe file animation frames 1-60 are set to
anim=0. So set "setframe and incframe or decframe" all to =0 (zero)
You said it still pops-up slowly? Try exporting with less frames?
(like 10 frames or so)

Quote: "I am slightly confused about the "script command value" of decframe, and incframe"

Ok, the setframe=" sets what animation to play next. "setframe=0"
calls for anim=0 frames 1,60.(get it?)
"incframe" increases the frame one at a time. "decframe" decreases them. Then look at these lines..

First we "setframe" then at state=1 we start to increase them
till we get to "frameatend". At the last frame, Stop! Go to state=2
and it waits for "shotdamage". With a "shotdamage" it decrease the frames till at "frameatstart". then Stop!
Starting to make sense?

My games never have bugs. They just develop random features..
Lots and lots of random features...
wizardious
14
Years of Service
User Offline
Joined: 18th Aug 2009
Location: Saskatchewan Canada
Posted: 30th Mar 2015 22:34
Ya, okay, that makes sense, the way its stated is just a little confusing.
it looks like it only advances and reverses one frame.
Any insight into why player distance effects 'shotdamage' reaction speed?
Is the raycast that slow?
ncmako
12
Years of Service
Recently Online
Joined: 19th Feb 2012
Location: Hendersonville,NC
Posted: 31st Mar 2015 20:17
wizardious
Ah, your using "raycast"? Yeh, in past postings members have noted that using the "raycast" commands has drop both fps and caused some issues. Try it without it. If it still doesn't make a difference try changing the entity to a character. (noticed in the
.fpe file it is not)

My games never have bugs. They just develop random features..
Lots and lots of random features...
wizardious
14
Years of Service
User Offline
Joined: 18th Aug 2009
Location: Saskatchewan Canada
Posted: 1st Apr 2015 00:13 Edited at: 1st Apr 2015 08:15
Hey ncmako
No, I haven't referred to raycast in my scripts, I just assumed that it was how the hardcoded bullets work. Just curious really, my pop-up target is acceptable, so will not try turning it into a character, and I have the destroy vertical target working, (easy after this pop-up one).
Now I have to figure out why the horizontal moving one is disappearing and re-appearing? I'm also working on a skeet range.
[EDIT] Well from browsing on the forums it appears the dynamic entities disappearing is a v1.19 bug.
ncmako
12
Years of Service
Recently Online
Joined: 19th Feb 2012
Location: Hendersonville,NC
Posted: 1st Apr 2015 20:43
wizardious
Quote: "dynamic entities disappearing is a v1.19 bug"

May not be a bug?
V1.19 I think still had "culling" enabled. It just
might only be a culling problem. Look through the syntax list
and try to turn "cullmode" off or adjust with "cullrange".
Culling allowed entities to be rendered (or not) by player distance
freeing up resources and was suppose to give better performance.
But sadly it caused other problems and was dropped.

My games never have bugs. They just develop random features..
Lots and lots of random features...
wizardious
14
Years of Service
User Offline
Joined: 18th Aug 2009
Location: Saskatchewan Canada
Posted: 3rd Apr 2015 22:44
So, I tried to use the cull settings in my scripts, but didn't have any luck, tried a bunch of Setup.ini settings, but just can't seem to figure out how to fix this. I might try updating to 1.20 or reverting to 1.18, not sure yet, but I'm just going to set this problem aside until I try one of those.
Mriganka
9
Years of Service
User Offline
Joined: 16th Jun 2014
Location: Virtuality
Posted: 4th Apr 2015 08:37
If you are thinking of changing versions I would recommend beta 17 of 1.20. It is very usable and has most of the features. And also 1.19 has proven to be very buggy.

wizardious
14
Years of Service
User Offline
Joined: 18th Aug 2009
Location: Saskatchewan Canada
Posted: 4th Apr 2015 18:04
Hey Mriganka

Ya I chose 17 as my version, but when I downloaded it the .rar was broken. I tried v1.18 which I already had, but the dynamic entities still disappeared. I will have to try a re-download on v1.20.17 and try again.
Mriganka
9
Years of Service
User Offline
Joined: 16th Jun 2014
Location: Virtuality
Posted: 4th Apr 2015 21:12
The beta 17 download is broken. You have to download beta 17a. It is available in one of the stickies of the product chat board. It is titled beta 18 rc or something. It is the second last link there in the first post.

wizardious
14
Years of Service
User Offline
Joined: 18th Aug 2009
Location: Saskatchewan Canada
Posted: 4th Apr 2015 23:49
So, I managed to get beta v120.18 and tried it out, the test game build times were 4 or 5 times longer, my tf341 characters were invisible, fps was slower,and the animated target and skeet entities still disappeared!
I've gone back to 1.19, which in my opinion, is far superior to 1.18 or 1.20.18.
Since my disappearing entity problem does not seem to be going away, I'm just going to compromise. Having the horizontal targets behind windows to disguise the problem, and having the skeets come directly at you instead of horizontal, which lessens the disappearing. Not realistic, but I'm tired of fighting with this problem, and just want to move on to the mountain of other tasks at hand.

Login to post a reply

Server time is: 2024-04-19 11:48:44
Your offset time is: 2024-04-19 11:48:44