Scripts / FPS Creator style prompts

Author
Message
Avenging Eagle
19
Years of Service
User Offline
Joined: 2nd Oct 2005
Location: UK
Posted: 26th Apr 2017 19:01 Edited at: 26th Apr 2017 19:05
I was bored of Game Guru's static prompts, so I decided to try and create something visually more akin to the old FPS Creator prompts we used to have. I've been using an animated sprite script created by smallg to great effect to bring up prompts at the certain key moments in my level. These rely on .png image sequences I created in Adobe After Effects that are over 200 frames long. Now that I've added a few, the level loads pretty slowly as it has some 700 sprites to load already, and I'd like to do more prompts like this throughout my level.

It would be a lot easier if there was a script that simply animated one sprite to do the same movement. This is what I want the sprite to animate like:

(^ This video uses the animated sprite script smallg made, with some minor amendments)

And this is how far I've got with my script:


This makes the sprite pop up, hold for 3 seconds, then go back down and disappear. However, whilst I know that sprite opacity can be dynamic and controlled with a script, I don't know where to add the commands or what would be the right way to go about it. I also don't like the way the sprite currently moves, in a very linear way. As you'll see from the video above, I want the sprite to decelerate to halt smoothly, then accelerate out. I have a feeling this could be controlled with some kind of sin or cosine function but my maths knowledge isn't sufficient to know what I'm looking for (or where to put it, or how to write it).

I bow to those more learned scripters than me, and ask for your help!

AE

P.S. Sprite opacity is controlled using the SetSpriteColor (sprite name,r,g,b,a) command, with alpha having a value between 0 and 255. Any equation that returns a value outside of this will cause a runtime error.
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 27th Apr 2017 14:29 Edited at: 27th Apr 2017 14:29
Quote: "However, whilst I know that sprite opacity can be dynamic and controlled with a script, I don't know where to add the commands or what would be the right way to go about it."

Do you means something like this?



If so, I can post here the script.
Fade appears in the firts barrel. the other one is just a experiment I'm doing here.

3com
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 27th Apr 2017 15:20 Edited at: 27th Apr 2017 19:54
just add it into the parts that are moving the sprite so that it will fade in and out, like so


edit, added acceleration code
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 27th Apr 2017 17:02
@ smallg
Perhaps you should control your "spralph" var, or you might end getting runtime error 314.
I've experienced that error with mine, just control if spralph<0 then spralph=0 (the same with 255 if needed)

3com
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
Avenging Eagle
19
Years of Service
User Offline
Joined: 2nd Oct 2005
Location: UK
Posted: 27th Apr 2017 19:38
Yeah I keep getting runtime 314 errors with this, but that script is so so close. I tried adding in some conditions myself but didn't do it right. I feel so needy asking, but can you add the conditions controlling spralph to your aforementioned script?

AE
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 27th Apr 2017 19:56
good idea, most things in AGK automatically do this stuff for you so i forgot
but i also had the fade time 10x too fast, it shouldnt technically need the check now.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 27th Apr 2017 20:28
Try this one:




hth

3com


Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
Avenging Eagle
19
Years of Service
User Offline
Joined: 2nd Oct 2005
Location: UK
Posted: 27th Apr 2017 21:11
Legend.

Now that I've had a chance to test the script fully, I realised you both got your deceleration and acceleration the wrong way round. No matter, I've tweaked the script a bit and got something very pleasing to the eye.



Thanks again, smallg and 3com, I couldn't have done it without you!

AE
Freakon
GameGuru TGC Backer
15
Years of Service
User Offline
Joined: 24th Feb 2009
Location: UK
Posted: 30th Apr 2017 15:49
This is very cool!
lotgd
3D Media Maker
14
Years of Service
User Offline
Joined: 2nd Apr 2010
Location: italy
Posted: 30th Apr 2017 16:03
Thanks to the great work!

A stupid question ..
But why is it so complex to display an image in GameGuru?
They could not simplify, for example:

showimage ("scriptbank\\images\\folder\\1.png")
hideimage ("scriptbank\\images\\folder\\1.png")

I'm having a lot of difficulties with the pictures, and being a editor of simplicity, this should be reviewed.

My Pc Specs : Win10pro64bit /Msi z97 / i74770k / gtx1070 / 16gb ram / SSD 850Evo
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 30th Apr 2017 18:13
@lotgd even if it was that simple you would still have cases where you want to set the size or the position so it would still get confusing, the current system is fine and makes perfect sense when you get used to it.
but for making 1 image it is as simple as 1 line...
spr = CreateSprite(LoadImage("scriptbank\\images\\folder\\1.png"))
is all you need to show an image on screen - pretty sure it defaults to position 0,0 and keeps the size of the loaded image

and now you just have extra commands to do stuff with it like move it or resize it etc
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11

Login to post a reply

Server time is: 2024-12-23 05:46:24
Your offset time is: 2024-12-23 05:46:24