Scripts / [STICKY] Smallg's free scripts

Author
Message
Tomahawk
12
Years of Service
User Offline
Joined: 16th Dec 2012
Location: United States
Posted: 15th Feb 2016 21:58
Here is a request for a secret game I am working on, it is a script that forces the player to sprint forward, and if they are stopped by a an entity (so basically not moving)

Sorry if this is a really hard script, feel free to accept it only if you wish.
Uman
GameGuru TGC Backer
20
Years of Service
User Offline
Joined: 22nd Oct 2004
Location:
Posted: 16th Feb 2016 15:28 Edited at: 16th Feb 2016 16:06
Hi smallg,

Re : Updated : ai_on_path script

Attached 2 screen Shots :

1. Top down editor view showing 4 way Junction corridor building.

Top left Bespoke character with Unarmed script just idles.
Simple path around building at some distance from the structure.
Default stock soldier on path with ai_on_path script.

2. In test level :

If I test run level and play by moving towards enemy walking along path in his line of sight, if we both stand where we are then the enemy will shoot me and I shoot and kill the enemy.

If I test run randomly and simply move around until the enemy starts shooting at me I shoot him and kill him.

All fine.

However as I am testing this - as I would in a real game I can see the enemy before he sees me so I have no intention of approaching the enemy in his direct line of sight - straight on/face view as I don't want to get hurt so in a real game I would try and out flank the enemy by approaching out of line of sight from the side or from the rear....

Here you can see in this instance I have been able to make an approach - in the open but the enemy can not see me. Effectively the enemy is de-activated - frozen and wont move or attack the player until the player moves back or out of the line of sight behind the building. Or moves to a more in direct line of sight position to the enemy front.

The enemy options will then revert to activated and will then attack the player or move back to path if he cant see the player so what he does will depend upon the aforementioned....

Whatever the point being I can indeed sneak up to the enemy at some distance or even very close if at certain angles away from the enemies front view point or even inside it the exact position and angle being erratic and variable. (Much like enemies behave using the default soldier AI when they sometimes - particularly at close quarters lose the ability to accurately track the player position of track it at all.) In such instances the enemy then does not respect the attack range and so on and does not do anything at all even if standing next to the enemy (behind him).

I have no idea how the enemies internally track the player position either in the open outdoors or around building structures however the answer seems to be in a limited or erratic fashion. When they freeze up they cant hear the player approach, cant see the player at all and don't respond to the player shooting - as they might a moment later when conditions are met and they reactivate.

I would not worry about this until TGC update GG, buildings and AI and I can keep the script and try it again then.

Thank you kindly for all your help.



EDIT UPDATE :

2 more screen shots in support of theory?

1. Player in corner of building :

Here they player is in a corner of the building. The enemy is stopped and frozen. Player move closer (slide along walls) and the enemy attacks. Player move backwards (slide along walls.) the enemy attacks. Move back into corner position the enemy stops again.

2. Player other side of Building :

Here the enemy has started to walk the path and when he is in direct view to the player straight through the corridor the enemy freezes and is deactivated. He will not rotate to player/attack, he will not move along the path. In essence he is frozen looking to the side as shown until the player moves from his position (line of sight).....

Here is a trace issue or similar perhaps where the enemy cant see the player when the enemy or the player or perhaps both are in various positions relative to the building where the engine presumably cannot calculate the player position or other so the enemy ceases to function altogether. Presumably the Player is masked by the building and is unseen.

Whatever you can see the results - do they look like they know where the player is in any of the screen shots?

Down to the engine I think.

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
Uman
GameGuru TGC Backer
20
Years of Service
User Offline
Joined: 22nd Oct 2004
Location:
Posted: 16th Feb 2016 16:18
FINAL EDIT :

And finally here is a screen shot of the enemy using the default soldier AI script :

Test run game - AI walks path then shoots at player when he seems him, Player moves out of sight to where you see him in the screen shot. AI is frozen. Player behind the enemy here is unseen and the enemy does nothing.

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
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 16th Feb 2016 17:29
Just a quick tip Uman, when attaching pictures it's best to use PNG, that way when you click them you will view them in the browser, JPG's force you to download the image before you can see them.
i7, NV960 4GB, 16GB memory, 2x 4TB Hybrid.
i5 , AMD 6770 1GB, 8GB memory, 512GB Generic SATAIII + 2TB Seagate Baracuda SATAIII.
i3, Radeon integrated graphics, 4GB memory, 512gB Generic SATAII.
Q6600, Intel integrated graphics, 2GB memory, 180GB Generic SATAII.
Uman
GameGuru TGC Backer
20
Years of Service
User Offline
Joined: 22nd Oct 2004
Location:
Posted: 16th Feb 2016 17:46
Belidos,

Thanks for that. Since when? must be another GG thing is it? Does not seem to be or ever have been the case at other web sites. But then there are a lot of image issues at this web site. Never seen such poor image/display handling system for a game engine or other company site including the gallery. No need for poor image management and display these days. Looks unprofessional. Not that this is the only example.

PNG it shall be then if anything.

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

Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 16th Feb 2016 19:16
Yeah it's just a thing with this forum I think.
i7, NV960 4GB, 16GB memory, 2x 4TB Hybrid.
i5 , AMD 6770 1GB, 8GB memory, 512GB Generic SATAIII + 2TB Seagate Baracuda SATAIII.
i3, Radeon integrated graphics, 4GB memory, 512gB Generic SATAII.
Q6600, Intel integrated graphics, 2GB memory, 180GB Generic SATAII.
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 16th Feb 2016 19:34
it doesnt quite match what i would expect to see but yes in door AI is pretty much a no hope, they simply can't understand how to navigate even simple buidlings and get stuck way too easily right now... however i can't reproduce the AI being "frozen in place" - if mine get stuck they kinda just keep bumping into the wall and rotating to face me and repeat but if i go near them they will still respond correctly.

i'm sure you already have but does the corridor entity already have forcesimpleobstacle = 3 in the fpe?
turn on debug visuals and you will see a pink line which is their intended path, see the video.

hopefully this will get fixed soon once the AI is looked at again though as it is indeed very limiting and annoying to only be allowed completely open maps


@tomahawk
i believe this does something similar to what you want - set the entity name into the ifused field which contains player.lua
obstacle.lua is for taking health away if you hit something
and rail_checkpoint.lua is a custom checkpoint zone to save the player's progress

life\'s one big game

windows vista ultimate

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

Attachments

Login to view attachments
dimoxinil
18
Years of Service
User Offline
Joined: 20th Mar 2006
Location:
Posted: 16th Feb 2016 19:41 Edited at: 16th Feb 2016 19:43
Smallg... great LUA master.

Would you be able to hear my question?

Would it be possible that the enemies associated with a path can move between the various points that make it up, depending on the distance of the points to the player?

For example, we can move enemies into the furthest path points of the player if they have low life or strike close to the player if they have a full life or the player has little life

Your humble servant, Dimoxinil.
My little APOCALYPSE world My little APOCALYPSE world

Uman
GameGuru TGC Backer
20
Years of Service
User Offline
Joined: 22nd Oct 2004
Location:
Posted: 16th Feb 2016 21:23 Edited at: 16th Feb 2016 21:24
Hi smallg,

Thanks for the video which is very revealing and shows what I had not seen regarding the way the enemies see their intended route and what seems to be their boundary cutting into the building itself - it's enormous. Not really any obstacle avoidance system in place there at all. So basic it's not real. Clearly that and the results is well pretty much hopeless. I had thought that enemies could at least navigate around an object as opposed to inside it but from what we both experience that it not the case. Your video shows similar issues to my characters except that mine don't see the player but actually don't get stuck as much as in your video - perhaps as the scale of my building is smaller than yours.

Anyway each has similar issues - bottom line being enemies are hopelessly unacceptable to have in a game at this stage to me at least. Seems like a big task is needed to make improvements to what is shown in your video and some sort of actual accurate object avoidance path finding system introduced into the GG engine. Wishful thinking perhaps. Who knows.

Anyway thanks for your help again.

I will put it on hold with everything else I gave up on.

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: 16th Feb 2016 21:24 Edited at: 16th Feb 2016 21:25
@dimoxinil in theory yes, it would take a while to get the code fully working but i was curious how much i could understand the waypoint code and i got this.
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, AMD R9 200 series , directx 11
dimoxinil
18
Years of Service
User Offline
Joined: 20th Mar 2006
Location:
Posted: 17th Feb 2016 07:28 Edited at: 17th Feb 2016 07:38
I was nearly brought to tears by this video. I got to say, that was impressive.

I'm using paths for most of the enemies, and they are just randomly moved between the path points.

if DistFromPath < 50 then ai_path_point_index[e] = math.random(1,ai_path_point_max[e]) end

I've tried make them move looking for the path point closest to the player so many many times... but I failed all. I thought that cannot be done... But it seems that I was wrong.

Your Kun fu is very strong.
My little APOCALYPSE world My little APOCALYPSE world

smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 17th Feb 2016 21:54
ok here's a working code, might (read most likely) have a few issues but as long as you keep the waypoints fairly even in distance it shouldn't be too bad... i tried to make them wrap around the start/end of the waypoints in the correct direction based on the player location but i think it may not be 100% correct.

you can adjust the characters view angle & range in their menu properties to make them attack at shorter range, i have simply set them to always find the nearest waypoint unless hurt so technically you shouldn't need any extra aggro checks (as they will always be aggro) but it is possible that they will be a little bit blind while running although they definitely can stop and fire while on the path (they are already set to try detect the player all the time).

hope it helps and if you need me to add sound or headshots or something i am happy to do so when i next get time
ai_control_waypoint.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
Tomahawk
12
Years of Service
User Offline
Joined: 16th Dec 2012
Location: United States
Posted: 18th Feb 2016 00:01 Edited at: 18th Feb 2016 02:33
@smallG
Sorry I was not very clear, I meant if the player speed drops to 0 then the player dies, and I needed a script to force the player to sprint without using any keys.

Also, I know you were working on a friendly AI script, how where you able to get the enemy to shoot at the entity, also, would it work for a static entity?

Thank you so much.

And off topic from above, I am also trying to use your wave script on the zombies, I thought I switched the required names in the script, but I am not having any luck, this is what I changed it too.

dimoxinil
18
Years of Service
User Offline
Joined: 20th Mar 2006
Location:
Posted: 18th Feb 2016 08:20 Edited at: 18th Feb 2016 08:24
Thank you very much, smallg

I can't wait to study the script. Everything I know about LUA script I learned by studying your scripts. I really think we'd make a great team... Perhaps in the future.

When you're stuck and someone give you a helping hand... is a cool feeling. Your Kun fu is incredible!!!

P.S.
I left you a little a small gift in the PM.
My little APOCALYPSE world My little APOCALYPSE world

smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 18th Feb 2016 09:11
Thanks dimoxinil, your game is great so any help I can provide is a pleasure

@tomahawk that is as close to a forced sprint as we can currently get and would only require you to add a check for the player getting stuck (comparing players position with his position a few milliseconds ago for example)

The shooting is done by using dummy objects to move as bullets, not sure what you mean by static object but no script works on static objects.. If you mean for something that doesn't move like a turret then yes.

For the wave script you missed the script name in the init(e) part -it still refers to ai_soldier_init(e)
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, AMD R9 200 series , directx 11
Tomahawk
12
Years of Service
User Offline
Joined: 16th Dec 2012
Location: United States
Posted: 18th Feb 2016 20:07 Edited at: 18th Feb 2016 21:11
@smallg
Thank you so much.

EDIT:
I fixed the script, now the enemy spawns properly, and sounds play, but is stuck, they do not move or attack, only play sounds.

EDIT:
Not the zombie script problem, it is not working for any type of character, even combat soldier.
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 18th Feb 2016 21:50
are they on the terrain or indoors?
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, AMD R9 200 series , directx 11
Tomahawk
12
Years of Service
User Offline
Joined: 16th Dec 2012
Location: United States
Posted: 18th Feb 2016 23:10
@smallg
I recorded a quick video, here it is.
https://goo.gl/photos/WWoVUYfXzUDZTDJy8
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 19th Feb 2016 00:22
try with them set 'spawn at start = yes'
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, AMD R9 200 series , directx 11
Tomahawk
12
Years of Service
User Offline
Joined: 16th Dec 2012
Location: United States
Posted: 19th Feb 2016 02:19
@smallG

Thank you so much, last question, about the friendly AI script you had on here, how did you get the enemy's to target them, and can it apply to objects, such as building and barricades.
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 19th Feb 2016 08:21
While you're on the subject of AI smallg, I don't suppose you have a very basic script I can put on my current mech project (vdeo below), it just needs to be basic, with only three animations; run/walk, idle, and death, it needs to use a rocket launcher, and try to keep at a distance from the player.

I've tried editing the soldier ai's, but I've just made a complete mess of it.

I'd be greatful for any help you could give me mate.

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
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 19th Feb 2016 11:00
Quote: "Thank you so much, last question, about the friendly AI script you had on here, how did you get the enemy's to target them, and can it apply to objects, such as building and barricades."

i suggest taking a look at my EntityLooking(e,t,dist,v) function, it's probably the easiest way to achieve a "fake" gun fight right now.
i.e.

would make it play the sound in slot 1 of the first entity while he was looking at the "target" (i.e. to simulate a gunshot)

Quote: "While you're on the subject of AI smallg, I don't suppose you have a very basic script I can put on my current mech project (vdeo below), it just needs to be basic, with only three animations; run/walk, idle, and death, it needs to use a rocket launcher, and try to keep at a distance from the player."

yes i believe i can edit the script i did for Harry's cylon warrior to fit, would it be possible for you to mail me the model so i can test it (my email is in the email button below) or i can simply give you the script and you can play with it yourself?

@aushadow(by pm) i believe this old script should work (see attachment)
life\'s one big game

windows vista ultimate

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

Attachments

Login to view attachments
AuShadow
GameGuru TGC Backer
11
Years of Service
User Offline
Joined: 2nd Dec 2013
Location: Australia
Posted: 19th Feb 2016 11:16
Thanks smallg I should get the chance to test it In a week, got work till then.
PC Specs: Windows 10 home 64-bit, Amd 7900 3gb DDR5 graphics, 8gb DDR3 Ram, Intel i7 3.4ghz
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 19th Feb 2016 11:26
Quote: "yes i believe i can edit the script i did for Harry's cylon warrior to fit, would it be possible for you to mail me the model so i can test it (my email is in the email button below) or i can simply give you the script and you can play with it yourself? "


Sure, I still have to finish the animations off, only have a run cycle at the moment, and it's not textured yet. As soon as I finish the anims i'll send it over to you.
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
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 19th Feb 2016 11:32
@dimoxinil
added a new snippet to allow the character to move between the 3 closest points if he gets to the nearest point and still can't attack the player (will stop him kinda standing in place and looking bored )
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: 19th Feb 2016 18:36
a new personal project, a basic ally that will follow you around and help you as you clear the level
(very much inspired by the likes of RE revelations 2)

not sure how much of it i will get into 1 customisable script but i shall definitely be releasing the script in some form in the near future.

currently i have a basic system of; follow, reload, attack or downed states.
also an upgrade system based on exp (just for the ally, player improvements would be done via normal weapon loot and other scripts)
while downed you have to manually restore the ally's health (just stand there and hold e for now)
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, AMD R9 200 series , directx 11
dimoxinil
18
Years of Service
User Offline
Joined: 20th Mar 2006
Location:
Posted: 19th Feb 2016 20:07
Thank you very much smallg. I not be able to calmly look at how the srcipt operates ( today I'm working on my game skills) , but I'm sure your script has been very useful.

Sensei Arigato !!!

My little APOCALYPSE world My little APOCALYPSE world

Honkeyboy
3D Media Maker
9
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 29th Feb 2016 21:05
Smallg ive been testing the night vision hud is there any way to get this to work with the day/night system? As when I try it it works initially but then when turned off it already has changed the light values and just stays daylight, so basically it would need to test to see whether its actually daylight or night time? can it be done? I'm using saints script just for ref cheers m8
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 1st Mar 2016 19:39
new script to show how to create and display a custom HUD
i will likely expand on this more soon but for now it's working and allows a basic amount of customisation.

set script to any non static item and set always active = yes.

*remember to change the image paths to match your own images*
adjust settings as you wish.

custom_hud.lua


thanks to Lee for adding the ability and for showing me how to show text on top of the sprites
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
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 1st Mar 2016 20:16
Nice work smallg. Again you amaze.
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: 1st Mar 2016 21:37
Thats really nice... great script smallg


harry

Harry
When nothing goes right, go left
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 4th Mar 2016 12:39
new script to interact with objects and set your own small text prompts.

you need to use the 'name' of the object in the editor properties to fill in the text and use a fullstop/period as a separator.
i.e.
Hello there. How are you?. I have a quest for you.
would read as 3 lines with the player needing to press e to move to the next line.

more settings in the script for text size and placement and the first prompt line (because the 'name' field is short and i figure this is likely going to be the same for most objects)

interact_object.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
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 7th Mar 2016 18:23 Edited at: 14th Mar 2016 20:56
new flashlight with a natural restoration of power while not in use and a GUI/HUD instead of text display.
(i will keep the old one just because some of you may prefer it)

p.s. the battery script is the same but i will include it just so you don't need to look in 2 places if you don't already have it.
edit* sorry my last update broke the script so hopefully it will be fixed now - note you DO need the new battery script too*
flashlight2.lua


flashlight_battery.lua


same set up the previous - set the entity with the flashlight.lua as always active = yes
and name any batteries to the number of seconds 1% of power lasts for.

images attached or make your own, default placement is "scriptbank\images\flashlight" but you can modify in the script.
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
JC LEON
14
Years of Service
User Offline
Joined: 22nd Apr 2010
Location:
Posted: 7th Mar 2016 23:02 Edited at: 7th Mar 2016 23:11
MANY MANY THANKS....

some questions

is there a way can we hae this wonderful flashlight script without the power restoration but whit restoration take only from batteries?

and is there a way we cant use the flashlight (flashlight key disabled) untl we fuond a flashlight object pickup and hud images not show ntil i found a flashlight or/e a battery?

this will be more realistic to me...

please can you help me?
PC Specs:

Q9550@3,8GHZ - 8GB RAM - SVGA R9 280 3GB GDDR5 - HDD WD 1500TB
PM
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 8th Mar 2016 07:33 Edited at: 8th Mar 2016 08:32
Quote: "is there a way can we hae this wonderful flashlight script without the power restoration but whit restoration take only from batteries?"


I suppose the easiest way to do that would be to change the number in the line below to a stupidly high number so it takes hours to regen 1% (I know it's a bit of a hack, but it's easy)



Quote: "and is there a way we cant use the flashlight (flashlight key disabled) untl we fuond a flashlight object pickup and hud images not show until i found a flashlight or/e a battery?"


You would need another script and an object for the flashlight. You would also need to alter the flashlight script.

This is just a guess as i'm not good with LUA scripts, but you would probably have to create an array in the flashlight script, something like:

above the init section

then something like:

in the init section

then wrap the flashlight script in main in an if statement, something like:

then you would need a script to pickup an item which you would put on the flashlight object, this would have the line is_flashlight_active = 1 in it, something like:

collect_flashlight.lua

somewhere in the script

I think that's about right, i'm sure smallg or someone can correct me and do far better, i'm not very well informed about LUA.

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.
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 8th Mar 2016 08:26 Edited at: 8th Mar 2016 08:33
I'm a numpty, the command for disabling the flashlight is SetFlashLightKeyEnabled(1) I've edited the post above to reflect this. As I say i'm not a scripter but I "think" what I posted above is right, please correct me if i'm wrong, I can't test it at work.

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
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 8th Mar 2016 09:43
(Line 17) regen_while_off allows you to turn regen off, it is commented for you.

It's been a while since I wrote the original script but I believe turning regen off and setting (line 20) current_battery to 0 should stop you using the flashlight until you find a battery.
You could in theory have a flashlight pick-up in your game, just use a dummyobject and make sure there's a battery there at the same time so the flashlight will start working.
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: 9th Mar 2016 14:16
Nice smallg.

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
JC LEON
14
Years of Service
User Offline
Joined: 22nd Apr 2010
Location:
Posted: 9th Mar 2016 17:43
Quote: "(Line 17) regen_while_off allows you to turn regen off, it is commented for you.

It's been a while since I wrote the original script but I believe turning regen off and setting (line 20) current_battery to 0 should stop you using the flashlight until you find a battery.
You could in theory have a flashlight pick-up in your game, just use a dummyobject and make sure there's a battery there at the same time so the flashlight will start working."



thanks for your help Smallg..
I made as you told me and now my flashlight dont autoregenerate.. but if I set current_battery to 0 the flahslight correctly dont work until i found a battery but when i pickup my battery counter add 2 batteries instead 1

btw i noticed that even if my flashlight at start game dont works due to missing batteries if i press F it flickering shown i have one flashlight yet ..but i want if I press F key to do nothing until i found one flashlight

sorry for my poor english ..hope you can understand me
PC Specs:

Q9550@3,8GHZ - 8GB RAM - SVGA R9 280 3GB GDDR5 - HDD WD 1500TB
PM
Pink Panther
14
Years of Service
User Offline
Joined: 1st Feb 2010
Location:
Posted: 13th Mar 2016 16:07
Wow smallg! The interact with object is great! Thanks!
PM
JC LEON
14
Years of Service
User Offline
Joined: 22nd Apr 2010
Location:
Posted: 13th Mar 2016 17:40
I FOUND A BUG in the flashlight script--

If I collect 5 batteries after i have the message that i cant carry other batteries and it's right..
but if i use oe battery and the counter refresh to 4 batteries when i try to collcet another battery i have again the message that tell me i cant carry more batteries.. like the counter dont refresh...
PC Specs:

Q9550@3,8GHZ - 8GB RAM - SVGA R9 280 3GB GDDR5 - HDD WD 1500TB
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 13th Mar 2016 18:08
Quote: "I FOUND A BUG in the flashlight script--

If I collect 5 batteries after i have the message that i cant carry other batteries and it's right..
but if i use oe battery and the counter refresh to 4 batteries when i try to collcet another battery i have again the message that tell me i cant carry more batteries.. like the counter dont refresh..."


thanks, fixed (both versions), please redownload
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
14
Years of Service
User Offline
Joined: 22nd Apr 2010
Location:
Posted: 13th Mar 2016 22:34 Edited at: 13th Mar 2016 23:16
Hi smallg ...thanks for your fix but there is another bug related now..

when i start without batteries and pickup one the battery counter refresh correclty to 1 but when i press F to install battery , after the recharge the battery counter refresh correctly to Zero but the flashlight battery is not charged and remain to 0%..

the bug dont apper if i pickup more than 1 battery...

AND EDIT

anothe issue is that if i collect first 1 battery and after the flashlight the counter give the flashlight with complete charge (100%) +1 battery
PC Specs:

Q9550@3,8GHZ - 8GB RAM - SVGA R9 280 3GB GDDR5 - HDD WD 1500TB
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 14th Mar 2016 17:38
could you tell me what settings you are using as i can't reproduce the issue.
just post the entire top like so
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
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 14th Mar 2016 17:44
Exactly the same as the original, except the regen line is set to 0

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
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 14th Mar 2016 17:54 Edited at: 14th Mar 2016 18:13
edit, ok hopefully it should be fixed and working now, sorry about that
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
14
Years of Service
User Offline
Joined: 22nd Apr 2010
Location:
Posted: 14th Mar 2016 19:00 Edited at: 14th Mar 2016 19:18
redonwlaoded both (battery and flashlight script) and counter now works but bug about "cant carry more batteries" is back

e.g. if i collect five batteries and safter use one the counter go to 4 but if i try to collect another one the counter tell methat i cant carry more batteries..
PC Specs:

Q9550@3,8GHZ - 8GB RAM - SVGA R9 280 3GB GDDR5 - HDD WD 1500TB
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 14th Mar 2016 20:58
1 step forward, 2 steps back
ok redownload the battery script, it's fixed (again)
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
14
Years of Service
User Offline
Joined: 22nd Apr 2010
Location:
Posted: 14th Mar 2016 21:34
Quote: "1 step forward, 2 steps back
ok redownload the battery script, it's fixed (again) "




yes.. tried and works right.. great....

many thanks...
PC Specs:

Q9550@3,8GHZ - 8GB RAM - SVGA R9 280 3GB GDDR5 - HDD WD 1500TB
PM
HarryWever
3D Media Maker
14
Years of Service
User Offline
Joined: 14th Jan 2010
Location: below Sea level
Posted: 15th Mar 2016 17:30
yeeh... congrats with you badge smallg.

well deserved

Harry

Harry
When nothing goes right, go left
PM

Login to post a reply

Server time is: 2024-12-22 11:29:04
Your offset time is: 2024-12-22 11:29:04