Scripts / [STICKY] Smallg's free scripts

Author
Message
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 7th Jan 2015 18:56 Edited at: 7th Jan 2015 20:16
made a (mostly) working cross hair script

- only works correctly if target and player are same height (i.e flat terrain only)

- not 100% accurate detection of target but only because it would take me ages to code in all the possible values based on distance to target - (you will need to adjust the values if you wanted to use different scale models from the stock enemies.)

-edit; also forgot to say it wont be able to detect objects in the way so will always change if you are facing the enemy... if you have a lot of obstacles consider reducing the GetPlayerDistance(e) range.







create a folder inside your scriptbank/images folder called "target" a place your desired cross hair png file inside that



here's the main code *note need to call it ai_soldier2.lua* - i used the default ai script because it is set up for them





the actual code added is this (note wont work like this, you need to place it correctly as above - you will find it within the comments
Quote: "--cross hairs"
)





edit: uploaded picture for cross hair - but it's very simple, use your own if you wish, i found 50 x 50 is about right

life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
Tingalls
GameGuru TGC Backer
11
Years of Service
User Offline
Joined: 5th Nov 2013
Location: Great Northwest, USA
Posted: 7th Jan 2015 19:02
@smallg -- seems like you haven't published your youtube vid yet

Experiencing a cool Game --> Tingalls



Win 7 Home Premium, 64bit(srvPack 1),AMD FX 4100 Quad-core 3.8Ghz @ 8Gb Ram - NVIDIA GeForce GTX 750 Ti @ 2GB Ram
Tingalls
GameGuru TGC Backer
11
Years of Service
User Offline
Joined: 5th Nov 2013
Location: Great Northwest, USA
Posted: 7th Jan 2015 21:01
I like your Cross hair script looks nice especially the red dot that shows up when over a target.

I tweaked your rain script and got the lightning to show in different places without dropping to low.
I hope you don't mind.



Experiencing a cool Game --> Tingalls



Win 7 Home Premium, 64bit(srvPack 1),AMD FX 4100 Quad-core 3.8Ghz @ 8Gb Ram - NVIDIA GeForce GTX 750 Ti @ 2GB Ram

Attachments

Login to view attachments
rolfy
18
Years of Service
User Offline
Joined: 23rd Jun 2006
Location:
Posted: 7th Jan 2015 21:25 Edited at: 7th Jan 2015 22:50
All images are present and numbered correctly.



I have mailed these to you to try out
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 7th Jan 2015 21:51
Quote: "I like your Cross hair script looks nice especially the red dot that shows up when over a target."

that IS what the script does
nice video, just a few images and the scene really looks so much more impressive
Quote: "I hope you don't mind."

everything here is for use however you wish, edit away

@rolfy: your images aren't numbered but named... you have to name them 000, 001, 002, 003 etc, i assume in future this will get fixed but for now that's how it is.

life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
rolfy
18
Years of Service
User Offline
Joined: 23rd Jun 2006
Location:
Posted: 7th Jan 2015 22:17 Edited at: 7th Jan 2015 22:21
Lol, my bad, I thought I had numbered them all, must have been from a previous tryout and assumed I had done them all, just did that and yes they all show but it doesn't run very well so some optimisation and tinkering with the delay time might fix that



The images I sent you have light snow so the file sizes are very small and probably would run fine. Blizzard is another kettle of fish entirely
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 7th Jan 2015 22:33
also i think you may need to resize those so they are the size of your screen resolution - noticed a couple are 532 x 532 but most seem to be 1024 x 1024, that should help make things look better

life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
rolfy
18
Years of Service
User Offline
Joined: 23rd Jun 2006
Location:
Posted: 7th Jan 2015 22:48 Edited at: 7th Jan 2015 22:58
For some reason PS is auto resizing the aspect ratio with some png files using automated batch actions and resizing a few in the folder to 532x532.... I have yet to track down the cause of this but should have it fixed soon enough. Is there an auto aspect for reloaded with hud images? Not sure this would work across different monitor resolutions to cover the entire screen or if I will have to make these large so they crop with smaller screen res.
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 7th Jan 2015 22:59
no even the standard media uses multiple images for different resolutions.
i very much doubt we'll get any control on that side of things unfortunately.

i renamed & resized your files and for me it looks like 000 to 001 is pretty different (059 to 000 is correct though) nice job though, the overall animation is really nice

life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
rolfy
18
Years of Service
User Offline
Joined: 23rd Jun 2006
Location:
Posted: 7th Jan 2015 23:14 Edited at: 7th Jan 2015 23:17
Yep, I need to tighten it all up now, probably overwritten 000 during a batch conversion and too much fiddling around, it will all work out eventually thanks for taking the time with it
rolfy
18
Years of Service
User Offline
Joined: 23rd Jun 2006
Location:
Posted: 11th Jan 2015 01:48 Edited at: 11th Jan 2015 03:25
I have nightvision working pretty well though it has two issues for now.

We can't as far as I know bind it to a key for on/off so uing a trigger zone for now.

I can't figure a way to delay the removal of the HUD before the lighting swaps out.



Any of you scripter chaps got any ideas? This will be released for free when completed





You will notice the problem the second time the hud is removed in the video, for some reason it works just fine at other times. On the other hand this may have been down to the video frame capture.If the HUD has a fractional delay on removal it will ensure this always works as it should.

smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 11th Jan 2015 11:27
you can use the E key to put it on / off, i already did my own version before which hasn't got any delay code and works fine so i would guess it is likely the frame rate issue causing the delay in lighting



see if doing it via keypress helps


life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
Tingalls
GameGuru TGC Backer
11
Years of Service
User Offline
Joined: 5th Nov 2013
Location: Great Northwest, USA
Posted: 11th Jan 2015 11:43 Edited at: 11th Jan 2015 11:50
@Rolfy ---> Very nicely done. You have that Image stuff down pretty good. I like how you matched the green in the image goggles with the atmosphere.



@smallg --> I like the binocular look -- looks great

Experiencing a
EXTREME D3CIMATE
11
Years of Service
User Offline
Joined: 8th Dec 2013
Location: ebensburg,PA
Posted: 12th Jan 2015 01:45
Guys, you don't have to "skip" images, you can load an exact image, based on a variable.
I use the script below, "health" is a global variable, and when health is 50 (of 100), image 50 is loaded.

"health"
morphtactic
13
Years of Service
User Offline
Joined: 10th Oct 2011
Location:
Posted: 12th Jan 2015 01:53
smallg, I was wondering if your supply crate script in working in V9. Everything seems ok until I try to open the crate with E, than nothing happens. With door and boxnokey scripts everything is ok. I have added the correct entity number for the gun, and the script is set to 0, to lock. I assigned the key to be found and put it into the USE KEY. It works until: "The supply crate is locked. Press E to unlock it". It does not unlock, or play the animation. Thanks
rolfy
18
Years of Service
User Offline
Joined: 23rd Jun 2006
Location:
Posted: 13th Jan 2015 02:08
Many thanks smallg for your help with the nightvision script, it didn't work for me out of the box but with a couple of minor changes and shuffling around it now works perfectly. The animated nightvision will be released free to the store pretty soon for all to have.
Old Larry
GameGuru TGC Backer
12
Years of Service
User Offline
Joined: 26th Apr 2012
Location: Bucharest, Romania
Posted: 20th Jan 2015 10:08 Edited at: 20th Jan 2015 10:11
Very nice night-vision !

I try to put some arrows in the vision hud, but I don't know how

Any help will be very appreciate.

I want the hud from the attached picture.

Thanks in advance.

Smile today, tomorrow could be worse

http://bestradiolarry.ro/fpsarea

"The best forum, game software, operating system or web platform, it's that software which can give you most of the options and speed, not just amazing graphics."

Attachments

Login to view attachments
Tingalls
GameGuru TGC Backer
11
Years of Service
User Offline
Joined: 5th Nov 2013
Location: Great Northwest, USA
Posted: 20th Jan 2015 10:41
Not sure if this is what you were looking for.

Experiencing a cool Game --> Tingalls



Win 7 - Quad4100 - 3.8Ghz @ 8Gb - NVIDIA GeForce GTX 750 Ti @ 2GB

Attachments

Login to view attachments
Old Larry
GameGuru TGC Backer
12
Years of Service
User Offline
Joined: 26th Apr 2012
Location: Bucharest, Romania
Posted: 20th Jan 2015 12:45 Edited at: 20th Jan 2015 13:01
Full thanks @Tingalls

I've made another new one and this is work very fine.





Smile today, tomorrow could be worse

http://bestradiolarry.ro/fpsarea

"The best forum, game software, operating system or web platform, it's that software which can give you most of the options and speed, not just amazing graphics."
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 20th Jan 2015 23:37
*warning* script has bugs
made an attempt at an AI cover system - could definitely be better but this is my first attempt at AI (logic) scripting and i really think the stock AI needs to use some cover so here's a start



2 scripts for this
- 1 to define an object as cover
set the object as dynamic and then give it this script
this_is_cover.lua


now place an enemy and give it this script
ai.lua


there is an offset setting which is used to determine flanking values - basically how far the enemy tries to move away when you flank them (so they can try get to the other side of the cover)

it doesnt always work, sometimes the enemies get stuck for no reason, not sure why... possibly a script range issue.
also i had to turn off collision for all entities used as cover otherwise the AI can't pathfind at all - they literally have almost no idea how to move around things with the current pathfinding.

hopefully it's an improvement on the current suicide AI anyway

life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11

Attachments

Login to view attachments
morphtactic
13
Years of Service
User Offline
Joined: 10th Oct 2011
Location:
Posted: 21st Jan 2015 01:16
This is the best script! Great job, love the video. Proper cover is what I've been waiting for. Finally enimies can ract the way the should. Thanks for this.
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 21st Jan 2015 18:45 Edited at: 21st Jan 2015 20:38
let me know how it works for you and any feedback is great, i made it pretty quick so didn't get a lot of testing done.

edit;

added a casual patrol state so they now follow waypoints until the player is detected (if no waypoints they will simply stand still)

- also removed the prompt as i forgot last time



(cover script part is the same still so use the one above)

ai.lua



life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
morphtactic
13
Years of Service
User Offline
Joined: 10th Oct 2011
Location:
Posted: 21st Jan 2015 23:29
I will let you know how it works for me. I hope to add this to my compitition level, perhaps, for the Steam Rlease. The way point add sounds good. Thanks
morphtactic
13
Years of Service
User Offline
Joined: 10th Oct 2011
Location:
Posted: 22nd Jan 2015 16:16
Quote: "let me know how it works for you and any feedback is great, i made it pretty quick so didn't get a lot of testing done."

Hi some how it can't index the global for cover. This is the message:
error running functions: scriptbank\ai.lua:106: attempt to indexglobal 'cover_true' (a nil value)
yet it looks like the scripts are initiated properly?
thanks
tomjscott
User Banned
Posted: 22nd Jan 2015 16:47
I don't see anywhere in that script where cover_true is defined or initialized.

System Specs: OS - Windows 7 Home Premium 64-bit SP1, CPU - AMD Phenom II X4 945, 3.0Ghz, RAM - 8Gb DDR3, GFX Card - 2048MB NVIDIA GeForce GT 640, FPSC-R Version - Beta 1.0085
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 22nd Jan 2015 16:49
Quote: "set the cover object as dynamic and then give it this script"



life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
morphtactic
13
Years of Service
User Offline
Joined: 10th Oct 2011
Location:
Posted: 22nd Jan 2015 16:58
Sorry forgot the dynamic part! Thanks again
morphtactic
13
Years of Service
User Offline
Joined: 10th Oct 2011
Location:
Posted: 22nd Jan 2015 17:39
smallg, so far I am really excited about this script. It makes combat already so much more believable. So far I can see only a couple of small issues: the ai is slow to react when I flank them. And obviously the no collision command creates sometimes a merging effect with the ai and cover, not a big deal. I will continue to try it out.

I love the fact that sometimes ai double up in one cover zone, it appears random and spontaneous, natural looking. All we need is a few different animations that can be played randomly to mix it up a bit.

Nice Work!
morphtactic
13
Years of Service
User Offline
Joined: 10th Oct 2011
Location:
Posted: 22nd Jan 2015 17:53
I have question, is it possible to add more range to plrvisible:

if g_Entity[e]['plrvisible'] == 1 then
state[e] = "find_cover"

Range seems to be an issue in Reloaded. I find the plrvisible range way too short. I would like to see ai shooting at me from long distances, or already running for cover. When changing View Range, and View Cone Angle in the properties section of the asset, these settings don't seem to affect the ai's ability to see the player coming.
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 22nd Jan 2015 19:16
Quote: "And obviously the no collision command creates sometimes a merging effect with the ai and cover"

you can try adjusting the offset values to compensate for bigger cover size - the cover i used was quite small and square (if your cover isnt square you would adjust 1 more than the other) but if you have bigger cover you can use bigger values - currently they adjust by both x and z so they end up at a kinda diagonal from the cover (generally) so keeping the value tight is best - unfortunately there's no way to check for object size so you just have to kinda tweak it until it looks ok - using similar objects (size-wise) as cover is best.

tried to adjust the moving/flanking code so it's faster to update but it caused a weird stop/start issue with their running when they get close to cover - not sure why but i guess it'll have to stay as it is - i did however update the code a bit to increase run speed in general.
- also reduced the "stuck" issue by moving the health check so now if they get stuck if you shoot them again they should respond again (as long as there's cover nearby i guess)
- also fixed the initial cover code so they wont all go to the same piece of cover the first run through if they are in the same area
- and finally added a check for player range so that if they are out of (their) firing range they will return to patrol correctly.



life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
morphtactic
13
Years of Service
User Offline
Joined: 10th Oct 2011
Location:
Posted: 23rd Jan 2015 00:10
Thanks I'll try this out, cool...
morphtactic
13
Years of Service
User Offline
Joined: 10th Oct 2011
Location:
Posted: 23rd Jan 2015 00:32
I tried the new ai script and got this:

error running function: scriptbank\ai.lua: 162: attempt to compare number with nil

Looks like the last ai.lua version was working better. I went back to it, and everything was fine. Waypoints work well too.
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 23rd Jan 2015 18:47
weird it worked fine for me, must be an issue with the new initial check for cover if there isn't 1 nearby or something, i will likely redo the entire system at some point so you can leave collision on - currently it's only good for show, not actual cover.

life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
morphtactic
13
Years of Service
User Offline
Joined: 10th Oct 2011
Location:
Posted: 23rd Jan 2015 20:01
Sounds good. I'll be watching for more of your incredible work. For now the old ai.lua is working nice.
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 28th Jan 2015 22:02 Edited at: 28th Jan 2015 22:03
wasn't happy with the pathfinding issues so i gave up on the cover for now

did some play testing with lifts again and i got a script working for you all to play with again.

this isn't perfect as physics are difficult to predict but works pretty well till an official fix / release



bugs;

-you might fall off, this is just the physics trying to make the object rotate because of it reacting to the player's weight (i tried to counter this by setting rotation to 0,0,0 but it's still not instant) - note if u do fall off while the lift is going up it wont come back down on it's own so i guess maybe next is a control panel for the lift if this is a big issue?

- it will move much faster while the player isn't on the lift - again this is just because of the player weight.

- it may have some unintended movement while "wait"ing - this is a frame rate issue and i did my best to correct it for the ranges i could test for (30 ~ 100ish) so it should work.



now on to the actual script;

lift2.lua





you can adjust speed, heights and scale of the lifts individually via the init(e) part so the 1 script can be used for multiple lifts easily as seen in the video



life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
Tingalls
GameGuru TGC Backer
11
Years of Service
User Offline
Joined: 5th Nov 2013
Location: Great Northwest, USA
Posted: 29th Jan 2015 00:13
I changed it so that lift can be called remotely with liftcall.lua
you need to give the lift/entity a unique name and then type the name into
the ifUsed properties of the remote switch
you can use the lift either way without changing the script

I did this with smallg's earlier script - I haven't looked at the updated script yet.

Experiencing a cool Game --> Tingalls



Win 7 - Quad4100 - 3.8Ghz @ 8Gb - NVIDIA GeForce GTX 750 Ti @ 2GB

Attachments

Login to view attachments
HarryWever
3D Media Maker
14
Years of Service
User Offline
Joined: 14th Jan 2010
Location: below Sea level
Posted: 1st Mar 2015 19:40
Thanks for the script, but i have Always the problem. with no function called.......
What am i missing.
or doing wrong
Harry
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 7th Mar 2015 17:16
working on a shop script with the new input
only set up for weapons right now but should be easy enough to expand to other items

you can change the keys used to cycle and purchase in the script

- need to set a shop keeper (give him a sound at slot 0 for purchases if you wish - 'item.wav' works well)
- place the weapons as STATIC entities and input their entity numbers in the corresponding setting (you can hide the weapons completely if you want to only use the images but they need to exist for the addplayerweapon call)
- update the name and cost of each weapon in the corresponding setting
- optional images - create a folder called "shop" and place the images inside (see the attachment for examples used in video)

*Note script is attached too*


life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11

Attachments

Login to view attachments
Super Clark
GameGuru TGC Backer
13
Years of Service
User Offline
Joined: 4th Apr 2011
Location: UK
Posted: 7th Mar 2015 18:19 Edited at: 7th Mar 2015 19:03
Fantastic script smallg is there away to have the items disappear once bought
without turning off static?

added a Ka-Ching for sale sound and swoped $ to £ ( as I am UK )


PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 7th Mar 2015 23:15 Edited at: 7th Mar 2015 23:17
if you add
Quote: "Hide(item_number[item])
Destroy(item_number[item])"

below the AddPlayerWeapon call it should do it as a tempory fix but it wont skip it in the list (i may have to add a quantity setting and skip an item for 0 quantity, nice idea)
haha well i'm from england but i like $ more as a currency symbol, it just looks more like money? but as always all scripts are free to use and change as you wish
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
Super Clark
GameGuru TGC Backer
13
Years of Service
User Offline
Joined: 4th Apr 2011
Location: UK
Posted: 8th Mar 2015 00:33
Works like a charm thank smallg.
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 16th Mar 2015 21:10 Edited at: 29th Jun 2018 21:18
new script to create passwords now we can use all the keys (note; password should be real characters only though - a~z, 1~9 etc)
the on screen prompt isn't perfect but it's functional

*setup*
- assign to a door and change the door 'name' to your desired password

- password input is a bit temperamental, you need to make sure you release all keys before inputting the next (in game)

(old 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
Tarkus1971
Audio Media Maker
9
Years of Service
User Offline
Joined: 24th Feb 2015
Location: England, UK
Posted: 28th Mar 2015 20:35
I tried this script and I can collect the three keys but when I try to use them the door, it will not unlock, I have assigned the multikeydoor script to the animated door, but it just displays the message insert keys using E but nothing happens when I press E, anyone know why?
HarryWever
3D Media Maker
14
Years of Service
User Offline
Joined: 14th Jan 2010
Location: below Sea level
Posted: 28th Mar 2015 21:38
Try the door properties and in the usekey or ifused field the name of the key
Gr
Harry
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 30th Mar 2015 12:53 Edited at: 30th Mar 2015 15:54
i see myke already fixed the door issue, i think it's just related to an animation change with the engine

edit: i thought you may appreciate a little video i put together to showcase the new bugs -well, only the bees but the rest are great too- Gtox made *available from the store*... the standard scripts he has work very well already but i wanted to make some more realistic bee activities

edit: new video


the scripts can be found in his insect thread here https://forum.game-guru.com/thread/211438 (direct = https://forum.game-guru.com/thread/211438#msg2513797)
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
Tarkus1971
Audio Media Maker
9
Years of Service
User Offline
Joined: 24th Feb 2015
Location: England, UK
Posted: 30th Mar 2015 20:08
applied this to the masked soldier and the combat soldier in GG but they just stand still, I can't see why ??? any ideas?
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 30th Mar 2015 22:08
applied what?
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 4th Apr 2015 20:41
fixed the landslide to work with GG
less options now but working collision so you can use ramps to make them bounce down at the player

apply script to all rocks
note i have add the scale command as the stock rocks are kinda big so remember to change it if you have smaller rocks
they will automatically move higher by the value you set in "startingY" so if you want to be more specific about their height you can always set this to 0 and place them the desired height by hand

landslide.lua


if you find any issues please let me know

life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 5th Apr 2015 15:19
zombie slaying the old fashioned way - who needs trees when you can cut down some zombies?


life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
HarryWever
3D Media Maker
14
Years of Service
User Offline
Joined: 14th Jan 2010
Location: below Sea level
Posted: 5th Apr 2015 15:38
Hahahaha.
nice

Harry
Harry
PM

Login to post a reply

Server time is: 2024-12-22 02:31:13
Your offset time is: 2024-12-22 02:31:13