Scripts / [STICKY] Smallg's free scripts

Author
Message
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 13th Dec 2015 23:04 Edited at: 13th Dec 2015 23:05
Wow that looks amazing, I think I did something wrong though, my arrows don't show on the map. Does the map have to be a certain size or is there a special way to take the image? I just zoomed out to printscreen and copy pasted into paint, trimmed it and saved it in the right folder as map.png, then created two arrow pictures for the icons. Is there anything else I should have done?
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 14th Dec 2015 11:09
so the map appears but the icons dont?
the map and icons dont need to be any specific size as sprites are automatically scaled to a % of the screen (set by you in the script), so the larger the image used the better the quality in games with larger resolutions.

double check the name and file path are the same as the ones you set in the script and that the size of the image is appropriate - i.e. if it has lots of invisible border then you will need to remove this (as the sprites are placed using their top left corner)
otherwise does anyone else have any issues?
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, AMD R9 200 series , directx 11
Pirate Myke
Forum Support
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 14th Dec 2015 14:06
I will give it a try. Thank you 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

smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 14th Dec 2015 16:42
updated map script - now offers the optional ability to move it, adjustable enemy icon range and a basic fog of war.
redownload from the previous page
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, AMD R9 200 series , directx 11
Isagabe
10
Years of Service
User Offline
Joined: 12th Sep 2014
Location:
Posted: 17th Dec 2015 11:44
Thanks smallg. Incredible work. Map is pure genius. Not to mention the rest of this thread. It's gracious people like yourself and others on this forum that transform my humble creation into something that resembles an interesting game. There is so much new stuff to try out from all you guys and of course the twitch broadcasts. It truly is Xmas. Now to attempt understating it all.

Merry Xmas and happy holidays.
wermer
9
Years of Service
User Offline
Joined: 18th Sep 2015
Location:
Posted: 18th Dec 2015 16:28
Thanks smallg! Your scripts are inspiring!
Windows 10 Home 64-bit / Intel i5 2500k @ 4.4Ghz + Asetek 510LC / Intel DP67DE / Intel 530 Series 240GB SSD / 12GB Kingston KVR 1333 / XFX Radeon R9 285 / Corsair TX 650 / Antec 300
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 18th Dec 2015 20:36 Edited at: 18th Dec 2015 20:37
thanks guys, merry christmas to everyone (or happy holidays if you prefer)
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, AMD R9 200 series , directx 11
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 24th Dec 2015 23:53
@belidos did you get the map to work?

new script to come soon, working cover markers and ai script to use them

-cover markers can be set to allow a certain number of characters to use them at any 1 time (stops enemies clustering at 1 point but allows you to set 1 marker for bigger cover also - no need to fill the map with cover markers if you use good design)
-cover markers can be rotated 360 degree to match the angle of the cover
-enemies will try to move to nearest cover initially and then move closer to your position if they can find nearby cover (needs more testing and tweaking)

1 enemy showing his cover finding skills


group of enemies using the enemies per cover limit technique
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, AMD R9 200 series , directx 11
HarryWever
3D Media Maker
14
Years of Service
User Offline
Joined: 14th Jan 2010
Location: below Sea level
Posted: 25th Dec 2015 09:53
That is a amazing script smallg... really good, the ai gets more reality with this.
and it gives you more of a interaction feeling..
awesome..


harry
Harry
PM
Pirate Myke
Forum Support
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 25th Dec 2015 13:04
Very nice.
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

Old Larry
GameGuru TGC Backer
12
Years of Service
User Offline
Joined: 26th Apr 2012
Location: Bucharest, Romania
Posted: 25th Dec 2015 20:59
@smallg always gives us the most amazing scripts
Smile today, tomorrow could be worse

http://bestradiolarry.ro/fps/

"The best forum, game software, operating system or web platform, it's that software which can give you most of the features and speed, not just amazing graphics."
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 26th Dec 2015 15:04
ok version 1 of the cover system is ready for a beta test, let me know how it works for your maps please so i can make adjustments.
the enemies aren't great at pathfinding but that's not something i can control, you will need to make sure there's plenty of logical area for them to move in so they will actually be able to get to their cover.
remember this is not likely to be a 1 script fits all situations but hopefully gives the impression of a slightly more intelligent AI.

-cover markers can be set to allow a certain number of characters to use them at any 1 time (stops enemies clustering at 1 point but allows you to set 1 marker for bigger cover also - no need to fill the map with cover markers if you use good design)
-cover markers can be rotated 360 degree to match the angle of the cover
-enemies will try to move to nearest cover initially and then move closer to your position if they can find nearby cover (needs more testing and tweaking)
- they are supposed to now try to flank the player if there's available cover (after finding front cover) *new*
-waypoints code added for patrol state *new*

setup
1. place cover markers on the map pointing to your desired cover and give them cover_zone.lua
1.a. if you want a piece of cover to be useable by more than 1 character *at a time* change the 'name' of the marker to the number (leave it default to automatically allow 1 character per marker, when characters leave cover or die that cover automatically becomes available again)
2. place soldiers near waypoints or cover and give them ai_take_cover.lua
(see picture for example layout used in video)
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, AMD R9 200 series , directx 11

Attachments

Login to view attachments
HarryWever
3D Media Maker
14
Years of Service
User Offline
Joined: 14th Jan 2010
Location: below Sea level
Posted: 26th Dec 2015 16:15
Yeeeh.. i got it working, really nice script.
a small video of the ai working in my halls
video:



really cool, and thank you..
Harry
PM
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 27th Dec 2015 17:09
Quote: "@belidos did you get the map to work?"


Nope, no idea why, must be something i'm doing wrong, gave up in the end.
m2design
GameGuru TGC Backer
14
Years of Service
User Offline
Joined: 25th Mar 2010
Location:
Posted: 27th Dec 2015 21:31 Edited at: 28th Dec 2015 02:17
@smallg
I have been trying to use the password.lua file to enter a 2 digit code and the drawbridge drop down. I have not been able to activate the drawbridge.

The video shows a strange jumping around issue with the freeze commands and the script will not release the program back to the player.
I have to use the esc key to exit test and return to the editor.

With my limited understanding of Lua commands I just can't figure out draw bridge let alone the freeze issue.



Edit:
I am pleased to say I have resolved the jumpy problem and the return of the screen to the player. I have not had any success in getting the bridge span to drop. It appears this problem is beyond my level of expertise at the moment. Any suggestions from you would be greatly appreciated.

The attachment illustrates where I am at the moment with changes I have made to solve the jumpy and non screen return problems I had. May not be as elegant as you might have been but I think it works.

Any suggestions for the bridge drop solution?
Windows 10,64 bit|AMD FX-6200 Six-core-3.80 Ghz |CPU PASSMARK 6,142 |Memory 10GB |NVIDIA GEFORCE GTX 660 SC |GPU PASSMARK 4,114

Attachments

Login to view attachments
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 28th Dec 2015 12:24
ok try this, you need to set the number of the drawbridge in the script and will also need to set a hidden object under the drawbridge if it's to be walked on after it lowers (as you need to turn collision off to walk through it, like a door)
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, AMD R9 200 series , directx 11

Attachments

Login to view attachments
m2design
GameGuru TGC Backer
14
Years of Service
User Offline
Joined: 25th Mar 2010
Location:
Posted: 28th Dec 2015 23:31 Edited at: 29th Dec 2015 02:07
@smallg

Thank you for the direction...
Took me a while to figure out the hidden entity trick but finally got something that works.

In the video you might notice four additional posts that are holding an invisible surface under the bridge span for the player to walk on.



Attached is the final script for your review...
Windows 10,64 bit|AMD FX-6200 Six-core-3.80 Ghz |CPU PASSMARK 6,142 |Memory 10GB |NVIDIA GEFORCE GTX 660 SC |GPU PASSMARK 4,114

Attachments

Login to view attachments
Rabid
User Banned
Posted: 30th Dec 2015 09:31 Edited at: 30th Dec 2015 09:32
Some great scripts you have smallg, ever thought about making them into a pack we can buy? I'd buy it in a heart beat for the right price

Also just a general question and not a request, but do you think it is possible to make a 'ladder script', that could be attached to a model say, I dunno, a ladder perhaps? That would give basic ladder climbing functionality. Where a player can run into it and slide up and down in an old school shooter kind of fashion and will disengage at the top and bottom of said model.

Or is this something currently beyond the lua limitations of GG as it stand?

Such a script if possible would be a literal game changer.
-i5-3570k - Galax GTX970 - 8GB Kingston DDR3 - Windows 10 Pro 64bit - ASRock Z77 Extreme6-
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 30th Dec 2015 10:01 Edited at: 30th Dec 2015 10:13
Quote: "Also just a general question and not a request, but do you think it is possible to make a 'ladder script', that could be attached to a model say, I dunno, a ladder perhaps? That would give basic ladder climbing functionality. Where a player can run into it and slide up and down in an old school shooter kind of fashion and will disengage at the top and bottom of said model.

Or is this something currently beyond the lua limitations of GG as it stand?

Such a script if possible would be a literal game changer."


You can sort of do that without a script, it just doesn't work on completely vertical ladders, if you angle the ladder a little you can run up and down it. It would be nice to be able to do on ladders that are standing upright too though.
Rabid
User Banned
Posted: 30th Dec 2015 13:13
Quote: "You can sort of do that without a script, it just doesn't work on completely vertical ladders, if you angle the ladder a little you can run up and down it. It would be nice to be able to do on ladders that are standing upright too though."


Yeah having a ladder straight up the side of a building so you can get on and off the roof is what I have in mind.
-i5-3570k - Galax GTX970 - 8GB Kingston DDR3 - Windows 10 Pro 64bit - ASRock Z77 Extreme6-
m2design
GameGuru TGC Backer
14
Years of Service
User Offline
Joined: 25th Mar 2010
Location:
Posted: 30th Dec 2015 16:49 Edited at: 30th Dec 2015 16:51
@smallg
Can a guru lua script save the number of times a player (by passing near the entity ) has passed this entity a certain number of times. When the player has activated said entity by passing within the scripted zone say 3 times it will activate an animation of the subject entity.

Can a lua script increment a semi permanent variable that triggers an animation and then resets the variable to zero. Would this be done by making the variable global (no local label) . Is this possible? I want to be able to inform the player that he has been here before and there is nothing to be gained by returning to this area.
Windows 10,64 bit|AMD FX-6200 Six-core-3.80 Ghz |CPU PASSMARK 6,142 |Memory 10GB |NVIDIA GEFORCE GTX 660 SC |GPU PASSMARK 4,114
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 30th Dec 2015 19:55 Edited at: 30th Dec 2015 20:12
ladders are difficult because we don't have an easy way to move the player (you need to move him via an object)
have you tried adjusting the lift script? it would in theory work in the same way (just use a hidden object at the base of the ladder rather than the ladder itself)

@m2design reread your questions and to answer yes you can quite easily tell if the player has passed an object using a few distance checks and a couple variables

i.e.

hopefully that's easy enough to follow for both and with a bit of a change around you should get what you require, if you have any issues though let me know
p.s. written in this reply box so may have errors
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, AMD R9 200 series , directx 11
m2design
GameGuru TGC Backer
14
Years of Service
User Offline
Joined: 25th Mar 2010
Location:
Posted: 1st Jan 2016 06:17
@smallg

I made a few revisions but nothing major (added some animations and a few prompts)
Your script worked as designed, and was easy to follow.
Thanks for your time and effort.
Windows 10,64 bit|AMD FX-6200 Six-core-3.80 Ghz |CPU PASSMARK 6,142 |Memory 10GB |NVIDIA GEFORCE GTX 660 SC |GPU PASSMARK 4,114
m2design
GameGuru TGC Backer
14
Years of Service
User Offline
Joined: 25th Mar 2010
Location:
Posted: 7th Jan 2016 21:34
@smallg

Is there a lua function that allows me to control where on the screen a prompt will appear?
I have attached my lua script for playing a sound when an entity is approached by the player but I don't want the text prompt at the default position.
Windows 10,64 bit|AMD FX-6200 Six-core-3.80 Ghz |CPU PASSMARK 6,142 |Memory 10GB |NVIDIA GEFORCE GTX 660 SC |GPU PASSMARK 4,114

Attachments

Login to view attachments
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 7th Jan 2016 22:09
use one of the Text commands instead of Prompt (you can find them in the global.lua)
i normally use
TextCenterOnX(x,y,size,"string")
because then it's much easier to know where it will appear.
i think
TextCenterOnX(50,95,3,"Hello")
is about the same as
Prompt("Hello")
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, AMD R9 200 series , directx 11
m2design
GameGuru TGC Backer
14
Years of Service
User Offline
Joined: 25th Mar 2010
Location:
Posted: 11th Jan 2016 01:45 Edited at: 11th Jan 2016 22:20
Edit:
post relocated to new thread
Windows 10,64 bit|AMD FX-6200 Six-core-3.80 Ghz |CPU PASSMARK 6,142 |Memory 10GB |NVIDIA GEFORCE GTX 660 SC |GPU PASSMARK 4,114

Attachments

Login to view attachments
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 12th Jan 2016 12:24 Edited at: 10th Feb 2016 11:41
@m2design, answered in your other post

new little function today.
needed to check if an entity was "looking" at another entity so i adjusted my PlayerLooking function and now have
EntityLooking(e,t,dist,v) = 0~1
works the same but instead of automatically checking the player you now specify which entity to check so...
'e' is the entity you want to check is looking at something
't' is the target entity
'dist' is the maximum distance to check (view range if you will)
'v' is the angle or "cone" of vision (halved just like in PlayerLooking)
returns 0 if not looking and 1 if true - see video


edit; fix so function works without needing GetDistance() function
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, AMD R9 200 series , directx 11
perelect
9
Years of Service
User Offline
Joined: 27th Mar 2015
Location: Australia
Posted: 12th Jan 2016 12:58
Quote: "EntityLooking(e,t,dist,v) = 0~1
works the same but instead of automatically checking the player you now specify which entity to check "


That's a really neat spin on your playerlooking function smallg. I can see where this will be very useful.
Thanks for your kindness as your scripts make it a lot easier to learn.
Cheers
Desktop: Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz (8 CPUs), ~3.6GHz, Windows 8.1 64-bit, 16 GB Ram, NVIDIA GeForce GTX 750 Ti, Display Memory: 4018 MB. Resolution 1360x768, Passmark 3528.
Laptop: Pavilion dv6 Notebook, Intel(R) Core(TM) i5-2410M CPU @ 2.30 GHz, Win 7 64 bit, 16 GB Ram, Radeon (TM) HD 6490M, 2336 MB Memory. Resolution 1366x768, Intel(R) HD Graphics 3000. (WEI 5.8)
str8savagem8
Reviewed GameGuru on Steam
9
Years of Service
User Offline
Joined: 17th Nov 2015
Location:
Posted: 13th Jan 2016 03:28 Edited at: 13th Jan 2016 03:30
For the Taxi script, is there any way to make it so the vehicle stops going in circles and just goes from point A to point B then just stops?
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 14th Jan 2016 14:11
sprint limit

- set an object always active = yes
- and copy it's name into it's ifused field.
- set a sound for exhaustion at slot 1
you will get exhausted and have added settings for maximum sprint (and a % output) so you can easily allow for greater running distances and an optional penalty for jumping (removes jumping if you're too tired too)

note the flickering screen is a by-product of the FreezePlayer() and TransportToIfUsed(e) calls but it works ok for now, i may add support for a full screen sprite layer so you can add some blur and make it look better.

sprint.lua
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, AMD R9 200 series , directx 11

Attachments

Login to view attachments
jimmufc
8
Years of Service
User Offline
Joined: 27th Jan 2016
Location:
Posted: 27th Jan 2016 22:56
Not sure if its possible or been done yet but is there a way of making a points/money system when shooting a character preferably a zombie?. Thanks
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 28th Jan 2016 09:21
It's very easy, add a variable used to store the points/money and then in the AI scripts you just increase it in the exit(e) part.

If I get GG running again I'll try remember to make a video to show it (there might already be a twitch on it?)
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, AMD R9 200 series , directx 11
science boy
16
Years of Service
User Offline
Joined: 3rd Oct 2008
Location: Up the creek
Posted: 28th Jan 2016 11:34
Gg running again?
an unquenchable thirst for knowledge of game creation!!!
jimmufc
8
Years of Service
User Offline
Joined: 27th Jan 2016
Location:
Posted: 28th Jan 2016 17:03
ok thanks I would love if you could put a video up if possible and do you have anywhere i could donate to you. Thanks
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 31st Jan 2016 12:59
enemies that only move when you're not looking at them (angels from Dr who style)
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, AMD R9 200 series , directx 11

Attachments

Login to view attachments
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 3rd Feb 2016 13:16 Edited at: 5th Oct 2017 19:15
edit* fixed 05/10/2017
blood splatter by request

assign blood_for_enemies.lua to the decals and set them dynamic (1 decal per enemy but if you have a lower fade time and kill the enemies in a reasonable time the script will reuse the decals that have become available again so you can get away with using a lot less decals... I.e. a blood_fade_time = 3000 and only a handful of enemies engaging the player at any 1 time will let you use about 5 or 6 decals for the entire game)

assign blood_for_enemies_control.lua to an always active object and set it dynamic

start killing!

note; blood will get assigned in random order.

edit; added random order and fixed timer issue
edit2; fixed no decal available crashing 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
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 3rd Feb 2016 17:26 Edited at: 29th Mar 2019 19:19
edit 29/03/2019 - new version requires you add DropLoot(e) to exit(e) function of any AI scripts you use in your map that you want to drop loot
i.e.

using the same logic i have put together a similar script which has been requested many times....loot drops.

- 1 drop per enemy (or none if you get unlucky) - chance based system with adjustable settings and setup in the script
- apply loot_for_enemies.lua to the required loot items (and name them appropriately to link with the name in the script - i.e. for item named QuasarGun you would change the line to read "if itemis[e] == "QuasarGun (ammo)" then") and you can now set the chance to drop and the type of drop (note it's best to keep repeat loot items to just 1 or 2 while setting up the map or you will further increase/decrease the chance to drop) - this does mean that killing enemies en-masse will naturally give a higher chance to drop rarer items as the more common item will already be dropped and thus not included in future checks til it is added back to the pool (picked up or timed out).
*TLDR - place only 1 of rare loot but consider adding more of the more common loot entities in set up if your level includes a lot of grouped enemies.*
assign 1 *always active* object loot_for_enemies_control.lua
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
Bolt Action Gaming
GameGuru Tool Maker
11
Years of Service
User Offline
Joined: 24th Oct 2013
Location: Harrisburg, PA (USA)
Posted: 3rd Feb 2016 17:48
Awesome. I'll need to check out the script in depth later but this almost exactly what we were discussing
Pirate Myke
Forum Support
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 3rd Feb 2016 19:01
Brilliant. Thanks 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
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 4th Feb 2016 11:21
Quote: "ok thanks I would love if you could put a video up if possible and do you have anywhere i could donate to you. Thanks"

just noticed you wanted a zombie but the process is the same, just open the zombie script instead and find the exit(e) function and add your variables to that - i'll upload 1 as an example using the code from the video but you will need to do it for all AI scripts you want to give rewards.
hope this is helpful and clear enough to follow

p.s. this might already be covered in the official channel
https://www.youtube.com/channel/UC1q1e3Q9IKMk4nDlAGb_5Jg/videos
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, AMD R9 200 series , directx 11

Attachments

Login to view attachments
Uman
GameGuru TGC Backer
20
Years of Service
User Offline
Joined: 22nd Oct 2004
Location:
Posted: 4th Feb 2016 14:01
smallg,

Any way to have a script that keeps enemies on a Path (waypoints) and shoot the player while following it rather than leaving the path and making a bee line straight to the player. I have some scenarios where restriction and control like this would be very useful and also to try and stop them walking straight into the player when in close proximity when they then also tend to lose track of where the player actually is and get confused.

Not sure if it's possible at all or a bind to do if it is.

I would have a go myself but have not had much luck really with .lua when it comes to the enemies AI and making them do anything much different than the defaults. Either I am too stupid or can't over ride hard coded stuff?

No worries, sorry if this is cheeky and if so and I apologies and just ignore the post/request.

Thanks

Peter

System : Advent Windows 7 Home Premium 64bit. Intel(R). i5-2310 CPU @ 2.90GHz. 8.00 GB RAM DDR3. Storage : 1389 GB : 1088 GB Free (1389 GB Total). Graphics : NVIDIA GeForce GT 530. Total Available Graphics Memory : 4095 MB. Dedicated : 1024 MB. Shared : 3071 MB. Direct X10

Pink Panther
14
Years of Service
User Offline
Joined: 1st Feb 2010
Location:
Posted: 4th Feb 2016 16:54
Thanks smallg for another great script! The loot system is awesome and easy to use!
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 4th Feb 2016 18:13
Quote: "Any way to have a script that keeps enemies on a Path (waypoints) and shoot the player while following it rather than leaving the path and making a bee line straight to the player. I have some scenarios where restriction and control like this would be very useful and also to try and stop them walking straight into the player when in close proximity when they then also tend to lose track of where the player actually is and get confused."


can you clarify what you would like to happen when they do engage the player? should they.....
1. continue to walk the waypoint path but also fire at the player if he can be seen?
or
2. stop and face the player and fire if possible and then return to walking the path if the player dies or retreats?
(i would likely add a setting to give you a little bit of play on how far they can move from their current position)
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, AMD R9 200 series , directx 11
Uman
GameGuru TGC Backer
20
Years of Service
User Offline
Joined: 22nd Oct 2004
Location:
Posted: 4th Feb 2016 19:45
Hi smallg,

Quote: "can you clarify what you would like to happen when they do engage the player? should they.....
1. continue to walk the waypoint path but also fire at the player if he can be seen?
or
2. stop and face the player and fire if possible and then return to walking the path if the player dies or retreats?
(i would likely add a setting to give you a little bit of play on how far they can move from their current position)"


Either one or the other would be a big help or both - combined or separately, but I have no idea how much work it might be and don't want to be silly when asking for help. Any of those would be great - main thing is restricting them to the path and fire weapon at some stage. (we already have roaming AI by default as it were). I guess if I had to choose then probably 2 would be the most useful overall and sounds good

Anything at all on those lines though would be great thanks.

Peter
System : Advent Windows 7 Home Premium 64bit. Intel(R). i5-2310 CPU @ 2.90GHz. 8.00 GB RAM DDR3. Storage : 1389 GB : 1088 GB Free (1389 GB Total). Graphics : NVIDIA GeForce GT 530. Total Available Graphics Memory : 4095 MB. Dedicated : 1024 MB. Shared : 3071 MB. Direct X10

smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 5th Feb 2016 14:15 Edited at: 12th Feb 2016 22:24
so i have some form of it working, they can stray a set distance from the point they are aggroed if the player is more than the minimum range (edit; added a check so they can move within minimum range if player isn't visible).
they return to the patrol if the player moves out of sight for a while (time set in the script)
it's still possible to lure them away if you keep swapping them from attack to patrol (as the distance gets reset each time they enter attack state) but it's certainly not like the default AI.
let me know if you need it changed.
ai_on_path.lua
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, AMD R9 200 series , directx 11

Attachments

Login to view attachments
Pirate Myke
Forum Support
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 5th Feb 2016 15:11
Nice. 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.

Uman
GameGuru TGC Backer
20
Years of Service
User Offline
Joined: 22nd Oct 2004
Location:
Posted: 5th Feb 2016 16:04 Edited at: 6th Feb 2016 14:27
smallg,

Had a quick run of that, first out of the box and then made use of the adjustments to suit the scenario in game level and from what I can see its a great addition to the AI. Works great.

It adds an apparent new level of AI behavior and can be used I can see to advantage in numerous ways both in outdoor and indoor scenes....

I have not tried all the things I can think of in putting it to use of course yet, but I love it.

Just what I needed for the level I was working with.

Thanks very much indeed.

Peter



EDIT UPDATE :

I have found an issue in GG using the script where the enemies freeze up when the player is at any reasonably close proximity(s) and when not in direct line of sight and the enemy directly facing the Player.

I have attached a screen shot, showing the enemy frozen. He wont move at all until the Player moves away at greater distance and or/hides. Effectively I can even approach an enemy from the side and or behind and follow him along the path and he wont react again until I move away or hide so he eventually goes back to the path when I can repeat the same if do the same. In the scenario where the Player does as described the enemy seems to deactivate/ freezes. At greater distances/ player to view the AI enemy behaviour is fine as as should be.

I have no real idea why this happens and I have tried editing the script and enemy settings with every permutation I can think of with no affect. Not sure if it has anything to do with the script at all or if its a GG hard coded thing or other.

Effectively the enemy behaves much as they always have done here and just go haywire not being able to see or actually target the Player half of the time, not rotating or pointing weapon and shooting at Player accurately, slow to react and so on. Not much different to what its always been the case.

The enemy works fine when it works, but stops functioning correctly the rest of the time. As said not saying its a script things as is just as likely to be GG Internally?


UPDATED :

Seems like my problem is related to trying to restrict the enemies to the path . i.e. attack the player while restricted to the path as looks like they need to leave the path to do their thing. If you try to force them to stay on the path they simply stop functioning correctly/or at all. They clearly can't actually attack while on the path - all things of which seem to be the way the defaults work as hard coded I guess and perhaps can't be overridden.

Spent a few more hours on it and given up again I think as I cant make it any better from what I can see.

Still a good script to be used in some situations to extend the AI behaviors.

Thanks.

System : Advent Windows 7 Home Premium 64bit. Intel(R). i5-2310 CPU @ 2.90GHz. 8.00 GB RAM DDR3. Storage : 1389 GB : 1088 GB Free (1389 GB Total). Graphics : NVIDIA GeForce GT 530. Total Available Graphics Memory : 4095 MB. Dedicated : 1024 MB. Shared : 3071 MB. Direct X10

Attachments

Login to view attachments
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 12th Feb 2016 21:57 Edited at: 20th Jun 2016 20:28
new note script for sign posts but using sprites so you now only need to worry about having 1 image (best to make it bigger so it wont look stretched though at larger resolution)

after you have created your images
1. open the script and point the "folder" setting to the correct path where it will find the images (note; do not put the image name here)
i.e. "scriptbank\\images\\my game"
2. set the position and the size of the sprite (this is in % of the screen)
3. edit the prompt and the range on the PlayerLooking()
4. place your sign posts and name them (in GG) to the relevant image (remember to include the file type)
i.e. image1.png

p.s. the same script will work for all images in the same folder (no need to copy or create new ones unless you want to store your images in a different folder), just name the entities uniquely to link to the correct image (only 1 image per sign post)
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
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 12th Feb 2016 22:23
@uman i'm not getting any issue with them not firing, does it still happen with the stock characters?
i did fix the sneaking behind them issue though, thanks (edited previous code)
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, AMD R9 200 series , directx 11
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 15th Feb 2016 18:29
incase any1 needs it at a later date, a new function to check if an object is looking at the player (unfortuantely EntityLooking() didn't work for the player number)

life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, AMD R9 200 series , directx 11

Login to post a reply

Server time is: 2024-12-22 11:24:41
Your offset time is: 2024-12-22 11:24:41