Scripts / [STICKY] Smallg's free scripts

Author
Message
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 15th Mar 2016 18:23
Quote: "yeeh... congrats with you badge smallg.

well deserved

Harry"


eagle eyes, i wouldnt even have noticed
but thanks
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 15th Mar 2016 19:22
about time too!

i7, NV960 4GB, 16GB memory, 2x 4TB Hybrid, Win10.
i5 , AMD 6770 1GB, 8GB memory, 512GB Generic SATAIII + 2TB Seagate Baracuda SATAIII, Win7.
i3, Radeon integrated graphics, 4GB memory, 512gB Generic SATAII, Win8.1.
Q6600, Intel integrated graphics, 2GB memory, 180GB Generic SATAII, WinXP.
science boy
15
Years of Service
User Offline
Joined: 3rd Oct 2008
Location: Up the creek
Posted: 15th Mar 2016 22:52
Agreed a well deserved title
an unquenchable thirst for knowledge of game creation!!!
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 17th Mar 2016 13:44 Edited at: 17th Mar 2016 13:45
i know i've done one similar to this but this is door with timed switch;
allows you to set up a switch somewhere in the level and then use it to unlock/open a door but if you don't find the door in time the switch will reset.
note; once the door has been opened - i.e. the player has actually reached the door and opened it - the switch will become inactive and the door becomes a normal door (so you wont get locked into an area once the timer runs out)

set a switch object with door_switch.lua to act as the switch, best if it has a single animation for pressing in & out (or up & down if it's a lever etc) and a sound at slot 0.
set a door with door_with_switch.lua and set it 2 sounds (open = slot0, close = slot1) and of course the normal animations 0 = open, 1 = close.

this script can be applied to many different pairs of doors and switches but will only work in pairs (i.e. 1 switch per door and vice versa) so *name both entities the same* to link them.

as always, plenty of settings in the top of the scripts to play around with
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11

Attachments

Login to view attachments
vrg
9
Years of Service
User Offline
Joined: 27th Aug 2014
Location: Netherlands
Posted: 17th Mar 2016 14:22 Edited at: 17th Mar 2016 14:30
More doors with switches without timers, you can use these for three different doors , doorswitch activate switchdoor, doorswitch1 activate switchdoor1 and doorswitch2 activate switchdoor2. Interesting to create more puzzles maybe more switches to open one door etc, or a combi of switches on or/and off.

Attachments

Login to view attachments
vrg
9
Years of Service
User Offline
Joined: 27th Aug 2014
Location: Netherlands
Posted: 17th Mar 2016 15:32
And the multi-switchdoor, you can use doorswitch, doorswitch1 and doorswitch2 to open this door.

Attachments

Login to view attachments
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 17th Mar 2016 15:40
OMG! a lot of switches here, Even serve player to lose weight, you can put the switch on the first floor, and then the door on the fifth floor in a building without an elevator.

a well-deserved recognition, my sincere congratulations mate.

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

PM
vrg
9
Years of Service
User Offline
Joined: 27th Aug 2014
Location: Netherlands
Posted: 17th Mar 2016 15:45
Thanks, I thought maybe interesting to share these for those who like more puzzles in the game.
vrg
9
Years of Service
User Offline
Joined: 27th Aug 2014
Location: Netherlands
Posted: 17th Mar 2016 17:59
OMG No more switches
A multi-switchdoor-combi, you can use this for a fixed sequence of switches, the correct sequence is switch 2,3,1.
If you choose the wrong sequence, you can use the Doorswitch-combi-reset switch, you can use this switch only once.
So you have two chances to open the door. I hope you like this puzzle for your game.

Attachments

Login to view attachments
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 21st Mar 2016 14:20 Edited at: 4th Apr 2016 16:56
player's personal shield with recharge settings
need to add a sprite for the player's health but here's a quick wip video (note; unfortunately the health bar is not working quite as i'd like so it must be placed at the bottom of the screen otherwise the sprite used to show the current level will be seen as it comes out the bottom but i think it still works well with some good image manipulation)



p.s. remind me to add optional shield restore pickups if i forget

edit2 sorry it's late but new shield script to allow health and shield restoration via pickups
to use the shield place the personal_shield.lua onto a non-static entity and always active = yes.
adjust the player health via the start marker and the shield settings in the script.

to use the shield/health pickups place shield_restore_pickup.lua onto an object, name them either "health" or "shield" depending on which it should increase (this allows you to use the same script for both) and set the 'strength' of the entity to the amount it can restore.

edit3: fixed the pick up (forgot to include the PlayerLooking function code)
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11

Attachments

Login to view attachments
Pirate Myke
Forum Support
13
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 1st Apr 2016 16:02
Very nice work again.

Reminder. Make those rechargeable shield restore pickups. lol.

Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit, Screen resolution 1680 x 1050.

smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 4th Apr 2016 11:27
hopefully an improvement to the ai rotation until it gets fixed officially.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11

Attachments

Login to view attachments
Defy
16
Years of Service
User Offline
Joined: 20th Aug 2007
Location:
Posted: 4th Apr 2016 12:21
Mate! This is awesome. This has raised the bar, and thank you so much for everything you do for the community.
Define R4, i7, 8g, R7 360
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 4th Apr 2016 13:08
Quote: "Reminder. Make those rechargeable shield restore pickups. lol."

done, new script for shield and pickups can be found in the post above.

Quote: "Mate! This is awesome. This has raised the bar, and thank you so much for everything you do for the community."

it's not perfect but at least they aren't so prone to just ignoring you now
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Pirate Myke
Forum Support
13
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 4th Apr 2016 14:37
Great job. Thanks
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit, Screen resolution 1680 x 1050.

HarryWever
3D Media Maker
14
Years of Service
User Offline
Joined: 14th Jan 2010
Location: below Sea level
Posted: 4th Apr 2016 16:16
Thanks Smallg, work much better now..

Harry
Harry
When nothing goes right, go left
PM
Wolf
Forum Support
16
Years of Service
User Offline
Joined: 8th Nov 2007
Location: Luxemburg
Posted: 4th Apr 2016 21:38
Very good!!
"When I contradict myself, I am telling the truth"
"absurdity has become necessity"
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 5th Apr 2016 00:39 Edited at: 5th Apr 2016 00:40
Quote: "to use the shield/health pickups place shield_restore_pickup.lua onto an object, name them either "health" or "shield" depending on which it should increase (this allows you to use the same script for both) and set the 'strength' of the entity to the amount it can restore."


It's not working right for me. Whether I name it health or shield it always heals the shield.

i7, NV960 4GB, 16GB memory, 2x 4TB Hybrid, Win10.
i5 , AMD 6770 1GB, 8GB memory, 512GB Generic SATAIII + 2TB Seagate Baracuda SATAIII, Win7.
i3, Radeon integrated graphics, 4GB memory, 512gB Generic SATAII, Win8.1.
Q6600, Intel integrated graphics, 2GB memory, 180GB Generic SATAII, WinXP.
Defy
16
Years of Service
User Offline
Joined: 20th Aug 2007
Location:
Posted: 5th Apr 2016 08:52
Yeah I am so happy I sent you that PM Tested the AI last night and boom! so much better.
Define R4, i7, 8g, R7 360
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 5th Apr 2016 17:06 Edited at: 5th Apr 2016 17:56
thanks guys but i really didn't change much, just added some small tweaks (mostly rotation back) so they will again actually detect the player better, the main script itself is still as it always has been and i take no credit for that... they're still a little bit blind at times but it was either that or always make them face the player which also leads to some moonwalking as seen when they first become alerted, so i settled for a result somewhere in the middle

i did find an interesting way to automatically detect cover with a little bit of added code - i know i have done this a few times before but in this case it wouldn't require cover markers or extra scripts to define cover and is handled entirely by the AI script (no outside entity numbers required) but i'm hoping to get it into the form of a function so i can add it into the AI scripts and let you all use it.
i didn't realise there used to be an actual command for this that seemed *because i never noticed it in action* to work before but from testing it now it certainly doesn't appear to work (the AI don't respond to the command at all)
it needs further testing and it certainly isn't as efficient as using predetermined placement of cover (naturally) - sometimes they seem to take an odd path to the destination, but the automatic click and play style is much more friendly... although i can definitely confirm it wont let you specify cover and is best used as a form of "hide and heal" type scenario.
edit: post too long so made a video demo (should be uploaded in about an hour if my connection holds)


@belidos, that's odd and i can't see any reason it would heal the shield if you have named it "health" as it specifically looks for the name(s) and any other name would result in no action at all, can you confirm you updated the original shield script?
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
0x7f
7
Years of Service
User Offline
Joined: 31st Mar 2016
Location:
Posted: 6th Apr 2016 19:15 Edited at: 18th May 2016 00:44
thanks for all the examples!

Attachments

Login to view attachments
PM
science boy
15
Years of Service
User Offline
Joined: 3rd Oct 2008
Location: Up the creek
Posted: 6th Apr 2016 19:45
i almost hear the benny hill theme
an unquenchable thirst for knowledge of game creation!!!
Pirate Myke
Forum Support
13
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 7th Apr 2016 02:04
Nice again smallg.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit, Screen resolution 1680 x 1050.

smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 11th Apr 2016 13:49 Edited at: 14th Apr 2016 16:32
hit a bit of an issue with not being able to read the result of the function correctly, not sure why but using
Quote: "return result1[e], result2[e]"
only gave me 1 value (result1[e])
if anyone can explain why then i can fix the function but for now i have a workaround.
so after a bit of playing around i found i could just combine the 2 values with a comma in the middle and then read the result myself using a separate function to do so, not exactly perfect but it works.

so my first draft of the function looks like this
edit, sorry, made a mistake
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
cybernescence
GameGuru Master
11
Years of Service
User Offline
Joined: 28th Jan 2013
Playing: Cogwheel Chronicles
Posted: 11th Apr 2016 17:10 Edited at: 11th Apr 2016 17:15
Should be fine. Did you do x,z = FindCover(e) when you had the return with 2 values?

Cheers.
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 11th Apr 2016 17:43
i see, so you need to still store it as 2 values? seems weird but works now, thanks
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
cybernescence
GameGuru Master
11
Years of Service
User Offline
Joined: 28th Jan 2013
Playing: Cogwheel Chronicles
Posted: 11th Apr 2016 17:56 Edited at: 13th Apr 2016 00:16
Looking forward to trying your cover function out. Video looks cool showing it in operation. Cheers

EDIT, quickly hacked in the below to ai_soldier - works really well, the soldiers aren't as stupid, they retreat to 'heal' when under attack using your cover code - awesome - thanks!



smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 14th Apr 2016 16:34
sorry i made a mistake with the function and it should actually look like this (not sure why it worked before)
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Pirate Myke
Forum Support
13
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 14th Apr 2016 16:36
Thank you.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit, Screen resolution 1680 x 1050.

cybernescence
GameGuru Master
11
Years of Service
User Offline
Joined: 28th Jan 2013
Playing: Cogwheel Chronicles
Posted: 14th Apr 2016 18:23
It was definitely working really well smallg, maybe it will be even better now, must go try

Thank you!
TheSourceCode
9
Years of Service
User Offline
Joined: 4th Mar 2015
Location:
Posted: 20th Apr 2016 22:41
SmallG, do you think it's possible to have a script where the player is aiming forever? Like, if they want to or not, it forces them in the aim position?
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 20th Apr 2016 23:03
i dont think so.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
JC LEON
13
Years of Service
User Offline
Joined: 22nd Apr 2010
Location:
Posted: 20th Apr 2016 23:59
ehi smallg what do you think about a gasmask script system with pickup for gasmask and oxygen recharge , damagegas zone ect_, pickups ect?

maybe e can start with this great old larry base script

https://forum.game-guru.com/thread/213129#msg2528017


what do you think?
PC Specs:

Q9550@3,8GHZ - 8GB RAM - SVGA R9 280 3GB GDDR5 - HDD WD 1500TB
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 22nd Apr 2016 19:08
floating platforms.
1. name them the speed of the platform (0.5 is a good start value)
2. set the strength to the size of the platform (going to have to play about with this) - must be circular / square.
3. place some waypoints for the platform to follow
4. optionally make the platform alwaysactive = yes (good idea in case you fall off or something as the platform might not be in range to keep moving)
when you get on the platform it will begin to move, the platform will then stay active the rest of the game.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11

Attachments

Login to view attachments
UndeadJoe
Reviewed GameGuru on Steam
8
Years of Service
User Offline
Joined: 30th Nov 2015
Location: Upstate New York, United States.
Posted: 1st May 2016 01:41
So much great stuff.
Many thanks.
Read a Free Preview of my new Zombie Apocalypse Thriller, Requiem for Humanity (Last Days: Book One)
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 11th May 2016 20:26
another small function for you.
RotateToPointSlowly(e,x,z,speed)

similar to the core function RotateToPlayerSlowly(e,v) but allows you to specify the target co-ords yourself so you can face any direction or entity (via his co-ords)

video with example usage


to use it simply copy and paste the code into your global.lua (or to the outside of a script that will call the function) and use in the same way as any of the other functions

lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 11th May 2016 22:38 Edited at: 11th May 2016 22:39
and coming soon - a 'walk and talk' through on how to create team based AI (allies and such) in GG.
basically recorded myself creating a basic allies vs AI script from scratch while doing my best to talk about how and why i'm doing it the way i do, video is about 1h40mins so will take a while to upload but should be up within a few days (think of it as a twitch from me).
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Jerry Tremble
GameGuru TGC Backer
11
Years of Service
User Offline
Joined: 5th Nov 2012
Location: Sonoran Desert
Posted: 12th May 2016 01:05
Awesome, looking forward to it, thanks!
MAME Cab PC: i7 4770@3.4Ghz (passmark 9945), 12GB RAM, Win 10/64, GeForce GTX645 (passmark 1898); Shiny new laptop: i7 4800MQ@2.7Ghz (passmark 8586), 16GB RAM, Win 10/64, GeForce GTX870M (passmark 3598); Old laptop: i5@2.3Ghz, 8GB RAM, Win 7/64, Intel 3000 graphics
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 12th May 2016 13:02 Edited at: 12th May 2016 18:13
part 1 is uploaded

part 2

part 3


p.s. forgot to say in the video that you can use as many teams as you like but all characters will be hostile to anyone not on their own team.

attached is the final script created in this video
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11

Attachments

Login to view attachments
Pirate Myke
Forum Support
13
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 14th May 2016 14:02
Well, well. Very nice smallg. You have made a lot of people happy with this.

Thank you.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit, Screen resolution 1680 x 1050.

Isagabe
9
Years of Service
User Offline
Joined: 12th Sep 2014
Location:
Posted: 14th May 2016 18:10
I am one of those. Many, many thanks smallg. can't wait to try it when i get home in a couple of days.
AceRimmer
Reviewed GameGuru on Steam
9
Years of Service
User Offline
Joined: 28th Feb 2015
Playing: classic British heavy metal mostly
Posted: 15th May 2016 20:12
absolutely fantastic. Great YouTube videos, subbed to your channel already, thanks for taking the time, really do appreciate it
Pink Panther
14
Years of Service
User Offline
Joined: 1st Feb 2010
Location:
Posted: 16th May 2016 17:54
Thank you so much for these videos! Very informative!
PM
lordjulian
10
Years of Service
User Offline
Joined: 10th Jan 2014
Location:
Posted: 22nd May 2016 20:16
I have attached this script to two characters. Then I changed one character's name to Team1 and the other Team2. I must have missed something because the characters just stand there.

What am I doing wrong?
Julian
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 22nd May 2016 20:50
did you put waypoints? they wont move unless they are following a waypoint or detect an enemy
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
lordjulian
10
Years of Service
User Offline
Joined: 10th Jan 2014
Location:
Posted: 22nd May 2016 21:27
Yes. I used waypoints.

My test level is attached.
Julian

Attachments

Login to view attachments
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 22nd May 2016 21:48
fixed, there's a '2' in the init(e) name which shouldn't be there, remove it from your script or redownload and it should now work, thanks
https://forum.game-guru.com/thread/207801?page=14#msg2548984
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 22nd May 2016 21:55 Edited at: 22nd May 2016 21:56
It's still not working for me.

Now with the change it comes up with an error:

i7, NV960 4GB, 16GB memory, 2x 4TB Hybrid, Win10.
i5 , AMD 6770 1GB, 8GB memory, 512GB Generic SATAIII + 2TB Seagate Baracuda SATAIII, Win7.
i3, Radeon integrated graphics, 4GB memory, 512gB Generic SATAII, Win8.1.
Q6600, Intel integrated graphics, 2GB memory, 180GB Generic SATAII, WinXP.

Attachments

Login to view attachments
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 22nd May 2016 22:01
OK, found out why the error, I was spelling their names wrong, but it's still not doing anything, they just stand their facing each other with guns drawn.


i7, NV960 4GB, 16GB memory, 2x 4TB Hybrid, Win10.
i5 , AMD 6770 1GB, 8GB memory, 512GB Generic SATAIII + 2TB Seagate Baracuda SATAIII, Win7.
i3, Radeon integrated graphics, 4GB memory, 512gB Generic SATAII, Win8.1.
Q6600, Intel integrated graphics, 2GB memory, 180GB Generic SATAII, WinXP.
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 23rd May 2016 11:55
fixed again sorry, forgot to add my functions to the script apparently.... great tutorial!
also think i actually haven't posted the RotateToPoint(e,x,z) code so i'll do that here
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-03-28 15:03:48
Your offset time is: 2024-03-28 15:03:48