Scripts / [STICKY] Smallg's free scripts

Author
Message
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 31st May 2014 17:40 Edited at: 1st Jun 2014 20:27
here is a script to allow you to loot dead bodies, with some simple editing it'll allow you to loot anything (HP items, Ammo *although thats already done by TGC*, craft items, food etc etc)



again you need to set the (e) numbers for the characters you want to loot

(as you can see in the video i only set it for 4 of the 5 characters and as such 1 guy has no loot)



loot.lua











basically if you wanted to add different loot you would need to change this part

Quote: " if g_KeyPressE == 1 and pressed == 0 then

loot = loot + 1 --this line here

pressed = 1

checked[a] = 2

end"




so for example i wanted to give HP i would put

Quote: " if g_KeyPressE == 1 and pressed == 0 then

AddPlayerHealth(100) --where 100 is the entity number of the health item

pressed = 1

checked[a] = 2

end"


life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
rolfy
17
Years of Service
User Offline
Joined: 23rd Jun 2006
Location:
Posted: 31st May 2014 18:59 Edited at: 31st May 2014 19:43
Occlusion script: Many thanks for this, I was struggling to get something similar working where I wanted to simply spawn and destroy entities as the player moved through the level.



Had it working fine using player distance only but this looks far better.



I will dissect your scripts and see how you did this, I usually try myself as I want to learn, but it is also good to learn from others.

What your doing here is exactly the kind of level design required on the users end to increase performance instead of completely relying on the engine to do all the work for you. Great work on your part.



Thanks again

A funny thing happened on the way to the forum...
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 31st May 2014 19:47
if you do need some help getting it working i'll be happy to take a look at it, seems like you'd want to check for entities within range of the player to destroy - while increasing the range over a short time... you should definitely be able to adjust my code to fit your needs

life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
rolfy
17
Years of Service
User Offline
Joined: 23rd Jun 2006
Location:
Posted: 31st May 2014 20:01 Edited at: 31st May 2014 20:09
The problem was with entities within range which wouldn't be destroyed, destroying entities from distance is no problem. For example player leaves a building via a door, I wanted to destroy all entities behind him and spawn a fake door with some rubble to prevent him returning. A trigger zone would work far better for this rather than distance. Although I could probably do it all the same with some flummery.



Easy to do using fpi but not for me without any knowledge of Lua. I am now becoming aware of globals which should help me a lot

A funny thing happened on the way to the forum...
The Tall Man
9
Years of Service
User Offline
Joined: 24th May 2014
Location: Earth
Posted: 31st May 2014 20:12
If you could make one of the effects of the trigger-zone be to disable that same trigger zone. Then when the exit trigger-zone is triggered, it could re-enable the original one. That should allow objects to vanish that needed to vanish.



Might be a good idea too, to first read their visibility status, only showing already-visible objects (so as not to resurrect the dead and pre-born)
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 31st May 2014 20:42
i see, yh i would do that in 2 stages, 1. to check when player is outside the door and then 2. a second distance calculation based on the "trigger" (say the door location rather than the player location it should work better - that way you could be more confident that only stuff "behind" the player would be effected)

life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
rolfy
17
Years of Service
User Offline
Joined: 23rd Jun 2006
Location:
Posted: 31st May 2014 21:09 Edited at: 31st May 2014 21:34
Thanks for the pointers, will look into it



This was real easy with a trigger zone and ifused field, naming all entities containing script to spawn/destroy similarly and activating from zone made it a breeze. My difficulty is with sending this command to the specific entities that will be 'activated' in the level. Which makes distance irrelevant.



Obviously this can be done as you see with the door/key script but I see no functions sending this in the key script so maybe at this time it is hard coded for the 'door' only, once a named key is acquired.



It may be that using a pickup I could trigger it instead of a zone

A funny thing happened on the way to the forum...
morphtactic
12
Years of Service
User Offline
Joined: 10th Oct 2011
Location:
Posted: 31st May 2014 22:07
More great scripts! Does anyone know how to "find the first and last (e) number of the guys you want to kill" when the guys were put on the grid in between other entities, especially in a level filled with lots of entities? Thanks
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 31st May 2014 23:06
Lol smallg, I've been working on a light dark script myself, and something similar to the occlusion/hiding stuff. Looks like I should have just read more posts! Could have saved me some work. Still, it all serves to help learn and I got things working okay anyway. I'll check out the occlusion script as mine was for hiding entities individually. Nice scripts here!



SPECS: Q6600 CPU. Nvidia 260GTX. 8 Gig Memory. Win 7.
AuShadow
GameGuru TGC Backer
10
Years of Service
User Offline
Joined: 2nd Dec 2013
Location: Australia
Posted: 31st May 2014 23:12
@smallg any and all help is appreciated I was making (well trying) to make the script as it was something requested by science boy, hopefully he see's it here and its what he was after.



If not I can see many uses for this and is handy to keep in my s
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 31st May 2014 23:32 Edited at: 1st Jun 2014 20:17
Quote: "More great scripts! Does anyone know how to "find the first and last (e) number of the guys you want to kill" when the guys were put on the grid in between other entities, especially in a level filled with lots of entities? Thanks "


edit, incorrect: you can indeed place entities in any order, only entities with a HP value will be included in the checks so if you have characters you dont want included (allies or civillains maybe) then make sure their (e)s are outside the range otherwise you can include all (even non characters) numbers fine

anyway you can get (e) numbers by using a prompt script a couple posts below



@Dvader thanks

life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
morphtactic
12
Years of Service
User Offline
Joined: 10th Oct 2011
Location:
Posted: 1st Jun 2014 01:57
That would be very helpful, amazing!
Pirate Myke
Forum Support
13
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 1st Jun 2014 04:30
Nice scripts, thanks you.

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

smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 1st Jun 2014 18:43
here we go, a prompt script that will return all (e) numbers of the entities (upto 1999) when the player is within 100 range of it

just apply it to any entity (just 1, it will still give you the (e) for that object too) and then walk around your map to find the numbers



life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
morphtactic
12
Years of Service
User Offline
Joined: 10th Oct 2011
Location:
Posted: 1st Jun 2014 20:01
This is a really useful script. Thanks again smallg
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 1st Jun 2014 20:10 Edited at: 1st Jun 2014 20:13
ok so apparently normal entities without health DONT actually mess up the death points script...

and same for the loot

so it seems so long as i check for HP only character's will effect the outcome... this makes things MUCH easier for you guys to use the scripts

so if you want to add points for every enemy on the map you can simply set the numbers from 1 to 1999 and it'll work fine regardless of order and such (this will be an issue if you have neutral characters however as you would get points for killing them too )

life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
AuShadow
GameGuru TGC Backer
10
Years of Service
User Offline
Joined: 2nd Dec 2013
Location: Australia
Posted: 1st Jun 2014 23:01
An idea on neutral characters, set their health ridiculously high to make it seem like they can't be killed

PC Specs: Windows 7 home 64-bit, Amd 7900 3gb DDR5 graphics, 8gb DDR3 Ram, Intel i7 3.4ghz

Feel free to visit and edit the public FPSCR resource wiki page: http://fpscrresource.wikispaces.com/home
The Tall Man
9
Years of Service
User Offline
Joined: 24th May 2014
Location: Earth
Posted: 3rd Jun 2014 01:20
For the occlusion script:

To be able to access specific entities:
http://fpscrforum.thegamecreators.com/?m=forum_view&t=208845&b=5&msg=2489063#m2489063
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 3rd Jun 2014 19:19
Quote: "An idea on neutral characters, set their health ridiculously high to make it seem like they can't be killed"


yes that's a possible solution but it might look a bit odd if you did try to kill them and they refused to die so if someone really needs it to ignore neutrals i can always add in an exception check (if they really wanted the neutrals to be killable but i feel this would just complicate things for now so i'd rather leave it as is and not require any input from the user)

Quote: "For the occlusion script:

To be able to access specific entities:
http://fpscrforum.thegamecreators.com/?m=forum_view&t=208845&b=5&msg=2489063#m2489063"


yh i had considered adding a way to ignore (or maybe select only set objects) rather than just doing a general distance check but i wasn't sure if it would really be needed, again if someone has a specific requirement for this script that isn't currently being met i can have a look at it if you let me know what you need it to do.

life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 9th Jun 2014 15:07 Edited at: 16th Jun 2014 12:45
i have edited the door script from the wiki to work with the supply crate found in the Reloaded Store



along with all the standard settings from the door script (lock on/off etc) you now have options to put a weapon, ammo and/or health pack inside (max 1 of each but you can take all 3 or just 1 or 2 depending on how you set it up)







life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
boilingpoint2
9
Years of Service
User Offline
Joined: 9th Jun 2014
Location:
Posted: 9th Jun 2014 16:46
That's cool !

http://francoismorin460.wix.com/specialagents
PM
Imchasinyou
10
Years of Service
User Offline
Joined: 22nd Mar 2014
Location: OH
Posted: 9th Jun 2014 16:54
That script is exactly what I wanted to do! Great job.

Case: Antec 900, Mobo: Asus Sabertooth 990FX, CPU: AMD T1100 Thuban 6 core @3300 ghz stock settings, COOLER: Thermaltake Frio, MEM: G Skill Ripjaws X series DDR 3 @ 1866 9-10-9-28, HDD: 2 Western Digital caviar Black 750 Gb set in RAID 0, GPU: Saphire HD 6950 flashed with 6970 bios, PSU: Corsair CX750M, MS: Cyborg Rat 7, KB: Logitec G510, OS: Windows 7 home premium 64 bit.
PM
World Class Multimedia
15
Years of Service
User Offline
Joined: 15th Aug 2008
Playing: Game Development
Posted: 10th Jun 2014 15:14
smallg: my level is truly huge and your ambient occlusion script would be really great. However, I am confused how to use it, where to apply it, etc.

There are literally HUNDREDS of entities in my level, so I hopefully do not have to edit every single one. I just need to limit what the player sees based on a circle around him so that the frame rate is not so dismal. Is there any way to create a script that fades entities in based on a distance away from the player in a circumference?

Thanks for your help. Your scripts seem invaluable.

Mike

YOU DREAM IT - WE CREATE IT!

www.world-class-multimedia.com

For world-class virtual instruments - www.supersynths.com
morphtactic
12
Years of Service
User Offline
Joined: 10th Oct 2011
Location:
Posted: 10th Jun 2014 15:53
Smallg. So far the .071 has improved the crash problem for me, but not the frame rate issue. Your occlusion script is the bomb! It works very well, only do you think that there is some way to get rid of things like the start marker, and sound zone markers? I'm getting desperate. Thanks dude!
morphtactic
12
Years of Service
User Offline
Joined: 10th Oct 2011
Location:
Posted: 10th Jun 2014 16:42
After a test it seems the occlusion script is not working properly in .071 it is not rendering objects at a certain distance, strange?
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 10th Jun 2014 19:10
@morphtactic i will take a look at occlusion again for you, see if i can help remove the markers, i did have a working method in a previous trial so it should be done soon (so long as the new update hasn't really messed it up )

@World Class Multimed
World Class Multimedia
15
Years of Service
User Offline
Joined: 15th Aug 2008
Playing: Game Development
Posted: 10th Jun 2014 20:09
Is there any way to attach the zone to the player so that it simply moves where ever the player moves?

Mike

YOU DREAM IT - WE CREATE IT!

www.world-class-multimedia.com

For world-class virtual instruments - www.supersynths.com
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 10th Jun 2014 20:19 Edited at: 10th Jun 2014 20:21
yes you could just use a distance check rather than a zone but the original request was for it to be done by zone, i will put up both versions anyway as it's a simple adjustment.



all you need to set is the start markers (e) value (as the check is HP based and apparently the start markers HP value is taken from the actual player HP value you set for some reason (while i could set a max limit to technically automate this it would cause issues if you set (for example) a boss with a high HP)



feel free to adjust the range based on whatever works for you



and the HP value is just to hide markers (no idea if lights still show or not as they currently error for me and i dont use them anyway)



occlusion_zone.lua







occlusion.lua (always on - just set to any entity that will always be present in the level)





let me know if you have any issues but it's working for me so should be fine

life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
World Class Multimedia
15
Years of Service
User Offline
Joined: 15th Aug 2008
Playing: Game Development
Posted: 10th Jun 2014 21:42
Sorry to be so dense. Which script do I add this to. If this is a stand-alone script, how do I use it? The Player does not seem to have a place to use a lua script.

Mike

YOU DREAM IT - WE CREATE IT!

www.world-class-multimedia.com

For world-class virtual instruments - www.supersynths.com
World Class Multimedia
15
Years of Service
User Offline
Joined: 15th Aug 2008
Playing: Game Development
Posted: 10th Jun 2014 21:56
OK, I added a zone and named it Zone_Tropical. I changed the lua script to occlusion_zone.lua (what I named your script).

I have NO IDEA how to find the startmarker number. When I right click on the startmarker, there is no number.

What else do I have to do to make this work (do I need to define entities in their lua scripts or is there some other thing
I have to do to make this work or is it automatic)? I only get 9fps with or without this script right now.

Mike

YOU DREAM IT - WE CREATE IT!

www.world-class-multimedia.com

For world-class virtual instruments - www.supersynths.com
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 10th Jun 2014 22:05
updated friendlyfire and trap scripts to include the new HurtPlayer command so they now kill the player (and changing damage done is much easier)

@World Class Multimedia which script are u using now? the one for the zone marker i assume?

you can get the start marker e by running a prompt from inside the test game (this should really be included in the editor as everyone seems to have issues with this) http://fpscrforum.thegamecreators.com/?m=forum_view&t=207801&b=2&msg=2488873#m2488873

basically to use the non zone script you need to place an entity (any entity, a box / a barrel / doesnt matter really but it's best to use something like a building so it wont look out of place in the map) and apply the script occlusion.lua to it

if you're using the zone script you need to do as u did but it wont take effect until the player is inside the zone

life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
morphtactic
12
Years of Service
User Offline
Joined: 10th Oct 2011
Location:
Posted: 10th Jun 2014 22:37
Great work once again smallg. If anyone should win an award around here it should be you! Thanks so much for the occlusion scripts, I'll try therm out, and let you know!
World Class Multimedia
15
Years of Service
User Offline
Joined: 15th Aug 2008
Playing: Game Development
Posted: 11th Jun 2014 03:39 Edited at: 11th Jun 2014 03:40
I found the e for the start marker and changed the startmarker in the Lua script.



I created zones for each section of my map (about 6 zones) and attached the occlusion_zone.lua script to each one.



So far, I really do not see any benefit. Am I doing something wrong? In my case, the player is almost ALWAYS in one of the zones.



Can zones overlap?



Mike

YOU DREAM IT - WE CREATE IT!

www.world-class-multimedia.com

For world-class virtual instruments - www.supersynths.com
World Class Multimedia
15
Years of Service
User Offline
Joined: 15th Aug 2008
Playing: Game Development
Posted: 11th Jun 2014 04:27
OK, obviously I needed to reboot or re-start FPSCR because now it seems to work. Now for the fine-tuning.

Anyone discover the perfect range and fog range?

Mike

YOU DREAM IT - WE CREATE IT!

www.world-class-multimedia.com

For world-class virtual instruments - www.supersynths.com
morphtactic
12
Years of Service
User Offline
Joined: 10th Oct 2011
Location:
Posted: 11th Jun 2014 05:06
Smallg the occlusion scripts now hide the markers and zones, very cool, but the: occlusion_zone.lua, for some reason, does not work for me, except for hiding markers. So I use the occlusion always on script, and that works, but only up to the distance I include. If it is 2000, then it will occlude up to 2000, etc. Beyond 2000 most other entities have vanished, never to be seen again. If I stay in a 2000 radius, for example, and walk around in it, the occlusion works great... Strange...
morphtactic
12
Years of Service
User Offline
Joined: 10th Oct 2011
Location:
Posted: 11th Jun 2014 05:21
Smallg: after testing the occlusion_zone.lua script, by placing a new zone every 2000 it works perfectly. And that's fine. Before, I could just pull the zone over my entire level, and it would work, this time I have to do it in smaller chunks, or zones, but that is the idea anyway. Thanks for the great scripts. I'll keep you posted...
morphtactic
12
Years of Service
User Offline
Joined: 10th Oct 2011
Location:
Posted: 11th Jun 2014 14:24
So far the easiest thing to do, is to make copies of the "Occlusion Always On" script. Like Occlusion,1, 2,3,4, etc. and place them strategically along the map path. I add one to an entity. Run the map. See how far it occludes in terms of the distance I need to occlude to get the desired frame rate, then go back to the map editor. Then I add the next script to an entity that is just before the point where the occlusion effect stops. So far this is working splendidly, and much easier to do than adding many trigger zones that just screw up all the time. Thanks again dude, there is a spacial place in cyber paradise waiting for you!
almightyhood
10
Years of Service
User Offline
Joined: 9th Oct 2013
Location:
Posted: 11th Jun 2014 14:36
Quote: " Thanks again dude, there is a spacial place in cyber paradise waiting for you!"

lmao morph your so right about that smallg is a god send!! helped me countless times now and even puts up with me breaking everything he scripts lol... hats off to the guy .

evga GeForce gtx 750 ti boost2.0 2gb gddr5. win 8.1 quad core 4gb ram.
PM
morphtactic
12
Years of Service
User Offline
Joined: 10th Oct 2011
Location:
Posted: 11th Jun 2014 15:03
Almightyhood: agreed
Smallg: it is confounding, but after adding the 9th occlusion script the map crashes at initializing physics. I wonder if this is the script crash people are talking about, although right now I don't have that many scripts on the grid... What an up hill battle
almightyhood
10
Years of Service
User Offline
Joined: 9th Oct 2013
Location:
Posted: 11th Jun 2014 15:10
yeah 17 custom scripts and that happens sadly, maybe less on bigger maps no idea but on a flat blank map its 18 for a crash

evga GeForce gtx 750 ti boost2.0 2gb gddr5. win 8.1 quad core 4gb ram.
PM
morphtactic
12
Years of Service
User Offline
Joined: 10th Oct 2011
Location:
Posted: 11th Jun 2014 15:10
Nasty!
almightyhood
10
Years of Service
User Offline
Joined: 9th Oct 2013
Location:
Posted: 11th Jun 2014 15:13
your right there m8, kill or be killed used 100's of scripts for the whole game now its limited to just 17 out of all those... how can I do anything for that game now?!.

evga GeForce gtx 750 ti boost2.0 2gb gddr5. win 8.1 quad core 4gb ram.
PM
morphtactic
12
Years of Service
User Offline
Joined: 10th Oct 2011
Location:
Posted: 11th Jun 2014 15:16
Lee gives us this little bit of wisdom:

"A tip on scripts, make sure you include an _INIT in your script, similar to _MAIN. So it would be function myscript_init(e) just above the function myscript_main(e). This might solve your issue."

it can't hurt to try?
almightyhood
10
Years of Service
User Offline
Joined: 9th Oct 2013
Location:
Posted: 11th Jun 2014 15:21
where he put that tip? and does it work I wonder lol... im guessing myscript is the name of the script being used and not the bit to put in right lol?. so for example it would be something like crafting_init(e) for a crafting script? im not a scripter so don't really know these things lol

evga GeForce gtx 750 ti boost2.0 2gb gddr5. win 8.1 quad core 4gb ram.
PM
morphtactic
12
Years of Service
User Offline
Joined: 10th Oct 2011
Location:
Posted: 11th Jun 2014 15:30
Well, normally you would put it right above the main function, which is the same as the script name, so yes mysript is the name of the script, and should be the same name of init(e) function, just copy and paste the function name into the init function name. Problem is I just tried it and got errors... we shall see...
almightyhood
10
Years of Service
User Offline
Joined: 9th Oct 2013
Location:
Posted: 11th Jun 2014 15:33
oh lol errors a... think I just wait for abit then lol

evga GeForce gtx 750 ti boost2.0 2gb gddr5. win 8.1 quad core 4gb ram.
PM
morphtactic
12
Years of Service
User Offline
Joined: 10th Oct 2011
Location:
Posted: 11th Jun 2014 15:37
I get: script\occlusion2.lua:28 'end' expected (to close 'function' at line 11) near <eof>. Line 11 is where the new inti function lives, so looks like we are missing code, or wrong syntax...
almightyhood
10
Years of Service
User Offline
Joined: 9th Oct 2013
Location:
Posted: 11th Jun 2014 15:57
I got something like scriptname.lua tried to call something else a nil value or some such.. lol

evga GeForce gtx 750 ti boost2.0 2gb gddr5. win 8.1 quad core 4gb ram.
PM
morphtactic
12
Years of Service
User Offline
Joined: 10th Oct 2011
Location:
Posted: 11th Jun 2014 16:13
almightyhood: just add the 'end --end function' at the bottom of the script, and it should work fine. I forgot to do this.
almightyhood
10
Years of Service
User Offline
Joined: 9th Oct 2013
Location:
Posted: 11th Jun 2014 16:32
its ok I didn't add the function bit 1st lol... then I read about the end bit aswell it sort of works but sort of courses issues aaswell... will wait on smallg though thanks though morph m8

evga GeForce gtx 750 ti boost2.0 2gb gddr5. win 8.1 quad core 4gb ram.
PM

Login to post a reply

Server time is: 2024-04-25 10:46:20
Your offset time is: 2024-04-25 10:46:20