Scripts / Basic survival crafting scriptset

Author
Message
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 14th Jan 2018 10:23 Edited at: 14th Jan 2018 11:24
@HonkeyBoy: Make sure you test it in different screen resolutions, the text and icons might line up great in one mode and not in another.

Edited to add piccys of two commonly used resolutions on low end and high end systems.

This is why I said in an earlier post that for a really good looking menu it is best to have everything done with sprites.

When I've got dinner in the oven I'll make an example using sprites for all the text and numbers.
Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 14th Jan 2018 12:21 Edited at: 14th Jan 2018 12:26
Ok so I've played around with GGs text 'size' parameter (appears it is more a 'font' selector though) and here are the results in 4 different screen resolutions.

Script attached as well so you can see how I did it. ( a lot easier than making more sprites)

Screen resolutions are 1024x768, 1600x1080, 1920x1080 & 2560x1440. I think that covers most of the common resolutions used for games.
Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 14th Jan 2018 13:07 Edited at: 14th Jan 2018 13:15
Furnace script. Bit of a rewrite here as well, you had both g_copperscollected and g_coppercollected so I went with the former.
Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM
Honkeyboy
3D Media Maker
9
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 14th Jan 2018 13:08 Edited at: 14th Jan 2018 13:10
Changed both the top left and right icons so they matched size wise and adjusted the exp line to give more space for it to add up.
Testing the furnace now

Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on

Attachments

Login to view attachments
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 14th Jan 2018 13:16 Edited at: 14th Jan 2018 13:18
Download the furnace script again, realised it was supposed to be 'coppers'.

btw, the rar file only contains the script.
Been there, done that, got all the T-Shirts!
PM
Honkeyboy
3D Media Maker
9
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 14th Jan 2018 13:53
Right ok m8 Furnace works sweet now just had to adjust 1 line that was off, then adjust the mining script and the inventory to bring it in line with the inventory. I should now be able to adjust the funace script for the workbench (steel plate) and the Lathe (half way through making the model for that)
Thanks AM oh and need to get the recipe button to open a blank page to fill in for what the player needs to make what. all scripts included so far
and a quick looksee of it working:

Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on

Attachments

Login to view attachments
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 14th Jan 2018 14:08
Did you not take the changes I made to the text size/font for different resolutions?
Been there, done that, got all the T-Shirts!
PM
Honkeyboy
3D Media Maker
9
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 14th Jan 2018 14:31 Edited at: 14th Jan 2018 14:53
Using your new script m8 yes just the two sprites i made were different sizes so just changed them so they were the same
New Lathe model ready to script:



Neally Full Camp think i might need a chemical bench :/

Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on

Attachments

Login to view attachments
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 14th Jan 2018 14:35
Ok, it was just that the script in the last zip file seemed to be missing those changes.
Been there, done that, got all the T-Shirts!
PM
Honkeyboy
3D Media Maker
9
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 14th Jan 2018 14:46 Edited at: 14th Jan 2018 14:48
Erm did it? ewe no m8 all i changed was coppers to copper so the other scripts worked, resized those two sprites to the same size had to change camp_fire to cooker to match the new scripts. and 1 line in the furnace was off and doubleing up over another so just changed the position, unless ive included the older one.
what line are we talking?
Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 14th Jan 2018 14:55 Edited at: 14th Jan 2018 14:56
The version in second post on this page, has the text part re-written to change the 'size' of the text depending on the screen width. (I put 'size' in quotes because it also appears to change the font and 'size' 2 is smaller than 'size' 1!)
Been there, done that, got all the T-Shirts!
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 14th Jan 2018 15:08
Btw this looks a bit dodgy:

SetPlayerHealth(g_PlayerHealth+31)AddPlayerHealth (40)

Does that actually work?
Been there, done that, got all the T-Shirts!
PM
Honkeyboy
3D Media Maker
9
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 14th Jan 2018 15:22 Edited at: 14th Jan 2018 17:43
Yeah m8 if i added 30 it gave 29 etc so to get 30 i had to change it to 31 for some reason :/
oh and see what you mean about the sizing sry m8 had my modeling head on, wanted to get those done so i can give them away free with the scripts to save everyone having to hunt down models to fit , will have a look after some serious coffee

last model for the crafting tables the chemical table



Camp at full crafting ( still need to make my own camping stove as that ones one of harry's) nice set though on the stores



and a new stove for the pack now i need to go find a kettle get some caffine input and try to get my scripting head on



added warlock12's shelter to the pack had to redo the textures as half of it was invisble for me...Many thanks warlock12



added steel plate to the inventory for pistol, rifle and ammo crafting



Lathe now up and running ... corrected lead ore displaying instead of saltpeter

Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on

Attachments

Login to view attachments
PCS
8
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 14th Jan 2018 17:34
i like this thread, Honkeyboy, you are doing nice work.
Windows 7 Professional 64-bit
Intel(R) Pentium(R) CPU G3260 @ 3.30GHz (2 CPUs), ~3.3GHz RAM 4GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11
Honkeyboy
3D Media Maker
9
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 14th Jan 2018 19:49 Edited at: 14th Jan 2018 19:59
Thanks PCSKILLER shouldnt be too much longer for releasing the set Amen Moses has helped me speed it up alot

Collection side of the menu pretty much finished added resin and nails: altho i need to set up the required ing for the craft




Workbench now finished and working = crafting planks, logs, nails and steel plating all added to the main inventory script (just will need to spell check it when the heads fresh)



Next add the code to spawn crafted guns and ammo from the menu
complete the chemistry table script and toying with a spawn base idea (which will be the final item, whereas you can craft and spawn a fully fitted log homebase to protect you from zombie hordes or whatever you may have on your maps
Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on

Attachments

Login to view attachments
GraPhiX
Forum Support
19
Years of Service
User Offline
Joined: 15th Feb 2005
Playing:
Posted: 14th Jan 2018 20:01
Nice work you guys really nice once I have finished the Office building would you like me to make some crafting benches etc... so that you can continue with your scripting
Welcome to the real world!
Main PC - Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD
Test PC - Windows 10 Pro x64 - G4400 @3.3GHz - 16GB DDR3 RAM - GeForce GTX 950 2GB - 500GB SSD
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 14th Jan 2018 20:46 Edited at: 14th Jan 2018 21:12
@HonkeyBoy: Can you upload the latest inventory script please, I've got some modifications to make it easier to add more menus.

Edited: Alternatively you could merge them yourself. Here's my latest.
Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM
Honkeyboy
3D Media Maker
9
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 14th Jan 2018 21:19 Edited at: 14th Jan 2018 22:40
Yes m8 need some help here anyway (tired eyes) been at it sinse 10am lol problem im having it seems the lathe script is interfering with the workbench script I've been looking through them for over an hour now and the workbench is asking for the lathe ingredience ? anyway m8 i'll post it all and the fpm ive changed the weapons and critters for stock items to test = advanced survival includes mapbank and scriptbank files, all the models need to go into a "Advanced Survival Model pack" folder in the entity bank.
@ Graphix Its a free community project m8 please feel free to join in P.s the final model is going to be a wood lodge with wood fencing around it well this is an idea so it can be spawned with all the tables inside , bit like a rust kind of thing so you could say have a load of wandering zombies and put up a base to keep safe! lol dunno my mind goes 10 to the dozen when im making things for GG rofl
lol evil dead1 springs to mind such a mad film ...love it
Just a thought i did ask about this but couldnt get it to work instead of the recipies button it'd be really nice to run a clock e.g you survived a night type thing i did add the code smallg sent me but it just would't display anything any ideas? be kinda cool for a zombie or apoc type game i could always include the cold timer in for cold etc. just a thought
Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on

Attachments

Login to view attachments
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 14th Jan 2018 22:39 Edited at: 14th Jan 2018 23:06
So this version switches in and out of the recipes menu plus it should contain all the additions you made (i.e. nails and resin etc).

The menu system is easily extendable and should be obvious how to do so.

The button processing has also been changed quite a bit, you had some checks for quantities that didn't match up with what you were taking, i.e checking for >= 1 but removing 4 so I made those consistent.

One last thing that confuses me a bit, it looks like 'use' on food items manufactures the food item but also consumes the item. I presume you want to split that somehow otherwise you are literally having your pie and eating it.

Edited: See later post.

I'll take a look at the lathe and workbench scripts next.
Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM
Honkeyboy
3D Media Maker
9
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 14th Jan 2018 22:44 Edited at: 14th Jan 2018 22:57
lol yeah m8 hadn't got to that but yeah idea was to have the food in the inventory and then -pie when consumed "pie and eat it" lol as i said m8 I'm pretty new to scripting tbh i read through and got help from smallg quite abit (thanks m8) but I'm still no where near what you guys can do i just try my best
Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 14th Jan 2018 22:53
Few tweaks, made variables 'local' so the scripts don't interfere with each other. Haven't tested them though.
Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM
Honkeyboy
3D Media Maker
9
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 14th Jan 2018 23:04 Edited at: 14th Jan 2018 23:04
Just 1 error i changed g_planks_made in the inventory to g_planks to make it easier wasnt updated in the inventory script
Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on

Attachments

Login to view attachments
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 14th Jan 2018 23:05
Oops, didn't notice the change of g_planks_made to g_planks, fixed in this one.
Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM
Honkeyboy
3D Media Maker
9
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 14th Jan 2018 23:06 Edited at: 15th Jan 2018 23:23
Yeah spotted it m8 works fine now
Edit just tested as far as the workbench (need to adjust the rmining quantities but used the funace and made ingots and used the workbench and made a plate and some planks = no errors so looking good cheers AM
Will adjust the quantities and test properly up to weapon crafting tomorow when back from the nasty early morning grafting session lol

Edit:
Changed sulphur, saltpeter and carbon added an s e.g sulphurs as the new chemical mining script wouldn't work without the change and edited all the other scripts to match

Changed Main inventory script weapons code to only spawn the pistols, rifles and ammo and minus the ammount held by 1 as the crafting of these items is done via the lathe.

Added new Mining script and 2 stock rock models retextures to look like they have minerals/chemicals so no the player can mine for sulphur saltpeter etc

Collected resourses to craft a hammer
Mined for minerals, Mined for chemicals,
used the furnace to make Ingots, used workbench to craft plating and planks from the Ingots and wood to make parts for a pistol,
Used the Lathe to make a pistol and some ammo
Went out hunting Demon dogs with the pistol!
Now for the chemical bench



Modeled and added 3 shrooms to the pack, chemical bench now working



Flask added to the menu needed to collect water, crafted at the workbench with wood and hides



and lastly the basic log cabin without doors or fencing



@ Amen Moses updated script attached if you could add a clock with a some kind of you survived 24 hours to where the recipies are that'd be sweet m8
if not no worries i'll think of something
only have the 2 pills to do now, maybe some kind of poison condition from eating shrooms, something for the boost and the build a base which is a far as im going with it and thats me m8 lol

Log Cabin with fencing

Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on

Attachments

Login to view attachments
Honkeyboy
3D Media Maker
9
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 16th Jan 2018 00:10 Edited at: 16th Jan 2018 00:32
Ok guys here it is the full pack the models need to go in a folder called "Advanced Survival Model pack" there is a .fpm for you to check out how it all works.
Make sure if you are using this for your own game you open up the scripts and change the entity numbers accordingly.
For the mining scripts and the water scripts for each new addition you need to edit the scripts init, main and name to 3,4,5 etc as if you dont they will all disapear at the same time as they have the same number (I've done about 3 of each as you will see)
Study the map layout and get used to how it all works and you should get the hang of it all i would say its a medium level of scripting knowledge etc.
You should be able to add sounds etc, I've added a survive so long timer kindly added by Amen Moses.
I will be around to answer questions on it but have some rl stuff to do if not AM knows it inside and out as he tidied most of it up for me.
A Massive thank you to Amen Moses, Smallg, warlock12 for getting this up and running
Now lets see what you guys can do with it
Please add pics if you make something cool
Most of all have fun with it
Oh p.s if you would like to add to this please feel free the more we have the better
P.P.S all textures done with NORMALIZATOR
Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on

Attachments

Login to view attachments
Slaur3n
GameGuru TGC Backer
16
Years of Service
User Offline
Joined: 16th Sep 2008
Location: Norway
Posted: 16th Jan 2018 12:23
amazing what you guys manage to make! I have a question tho, if you mine a rock or tree, will it get destroyed? Or can it spawn in again after 10 minutes for example?
Visit our FB site and like
https://www.facebook.com/crowhillstudiosofficial
warlock12
8
Years of Service
User Offline
Joined: 12th Sep 2016
Location: Argentina
Posted: 16th Jan 2018 12:29
Honkey. I think that the pack (without seeing the final version, I have followed it step by step) is one of the great ideas brought to reality and is to congratulate him for his dedication, dedication, ability and spirit! Obvious that he was not only in his work, that there were those who knew how to give him help like Amen or Small ... but that also speaks spectacularly of you ... can accept teamwork and also has friendly hands ... it's all a (small has helped me many times ... but unfortunately I could not advance beyond their help ... it's like many of us psychologically refuse to scripting, unwittingly ... Beyond all ... the fact of volunteering to the community as it has done, it is really worthy of applause, to share each advance, allowing us to learn a little each time ... Really Congratulations !!! How nice it would be that the pack was included in the distribution of GG. .. is a piece that shows the potential of the GG to tend to AA games, go for a GREAT HUG and new congratulations !!!

Cesar Correa
Warlock12

Honkey. Considero que el pack (sin ver la versión final, la he siguido paso a paso) es uno de las grandes ideas llevadas a la realidad y es de felicitarle por su dedicación, esmero, capacidad y espíritu!!! Obvio que no estuvo sólo en su labor, que hubo quienes supieron darle una ayuda como Amen o Small... pero eso también habla espectacularmente de usted... puede aceptar labores en equipo y además cuenta con manos amigas... es todo un logro (small me ha ayudado muchas veces... pero lamentablemente no pude avanzar más allá de su ayuda... es como que muchos nos negamos psicológicamente al scripting, sin quererlo... Más allá de todo... el hecho de brindarse a la comunidad como lo ha hecho, es realmente digno de aplausos, de compartir cada avance, permitiendo que vayamos aprendiendo un poquito cada vez... Realmente Felicitaciones!!! Qué bueno que sería que el pack se incluyera en la distribución de GG... es una pieza que demuestra el potencial que tiene el GG para tender a juegos AA. Vaya un GRAN ABRAZO y nuevas felicitaciones!!!

Cesar Correa
Warlock12
The game is a serious thing (El juego es una cosa seria)
warlock12
8
Years of Service
User Offline
Joined: 12th Sep 2016
Location: Argentina
Posted: 16th Jan 2018 12:57
It would be very good if this thread did not close, so that everything that the community generates and can complement it is added here, to complement this excellent product !!!
The game is a serious thing (El juego es una cosa seria)
Honkeyboy
3D Media Maker
9
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 16th Jan 2018 15:36 Edited at: 16th Jan 2018 22:42
@ Slaur3n The rocks as with the water scripts reduce in size as you mine or collect them i supose if you combine them with smallg's respawn scripts e.g putting them on a zone with respawn on it i supose yes they would respawn as all they do is get smaller and then Destroy(e)
Edit: hmm dont know with the water scripts though as they are on a zone hmm thats a question For AM i think Im writing things and getting them into a level AM is correcting me where im going wrong and making it all work correctly

@ Warlock12 No, mi amigo, no estoy desapareciendo por completo, solo tengo algunas cosas que hacer en el mundo exterior
Lo mantendré funcionando, simplemente no tengo tanto tiempo para dedicarle como lo hice en este momento, ¿pensé que era mejor dejar que todos lo tengan todo y comenzar a adaptarlo para sus propios proyectos?
Solo mis actualizaciones tardarán un poco más en llegar.
Gracias por sus amables palabras

The pack as is should be able to get everyone up and running now the scripts now work correctly. Some of them will maybe need to be copy and pasted e.g water and mining script but this is done easily by just changing the script name number, init and main from say 1 to 2, 2-3 etc
but if anyone has any questions on it or any issues just ask i will be popping on

P.s The new models for this set are now in the models section of the forum here https://forum.game-guru.com/thread/219211
Cheers
Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 16th Jan 2018 20:35
You can't scale water!

Here is a fixed workbench script, can actually make a flask now.

Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM
Honkeyboy
3D Media Maker
9
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 16th Jan 2018 21:25 Edited at: 16th Jan 2018 21:49
lol no but you can scale the zone marker over the water sorry if that confused anyone was in abit of a rush
cheers m8 for the updated script
have a bit less time atm busy in the daytime for a few weeks but I'm still at it infact I've started making a 1 level game using all the scripts and assets sort of wake up next to a grounded ship in a world full of zombies lol dont usually do zombie games/levels but thought it would be a fun way to test both the zombies and the scripts or may well use the ugly dudes from the classis pack for a post apoc level will see what take my fancy at the time lol
dont know whether I'm going to spawn the objects in this instance just or have them in strategic places
quick looksee of the start of " A long road ahead"

this bit you have to find the key to the gennie to get the power up to get the stations running, just the very begginings and a bit of fun night and day script running starts at night
Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 16th Jan 2018 22:27
A few tweaks, now you only need a single script for mining minerals and another for the chems.

See if you can work out what all the changes I made do!
Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM
Honkeyboy
3D Media Maker
9
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 16th Jan 2018 22:29 Edited at: 16th Jan 2018 22:38
Thanks AM will add those now just added all that to the new map but with the old script looks alot better with vegitation on the map you have to really hunt for the stuff now P.s love the clock
corrected mushrooms saying wood

Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on

Attachments

Login to view attachments
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 16th Jan 2018 22:37
For future reference:

https://www.lua.org/pil/22.1.html

And here is your recipes menu:

Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM
Honkeyboy
3D Media Maker
9
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 16th Jan 2018 22:46 Edited at: 16th Jan 2018 22:52
Damn rofl why didnt that work for me!!!!! Dont say cos your stupid ! lol Cheers m8 p.s that link is a really interesting read
Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 16th Jan 2018 22:53 Edited at: 16th Jan 2018 22:55
For anyone following along who is also looking at the scripts and may be confused by the following code:

g_sulphurscollected = g_sulphurscollected or 0
g_saltpeterscollected = g_saltpeterscollected or 0

Let me explain.

Whenever using global variables in GG (you should always name then g_<name> to highlight the fact they are global!) you cannot use a global variable until it has been defined, if you do you will get an annoying code error.

You also cannot know which script is going to run first so to avoid a lot of stress it is good practice to do the above, basically what the code is saying is 'make the following global variable equal to any existing definition with the same name or if it has not already been defined create it and initialise it to 0'.

You can also use this trick in functions to allow parameters to be optional, for example:
Been there, done that, got all the T-Shirts!
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 16th Jan 2018 23:03
@HonkeyBoy, sooner or later you will have have the 'Aha' moment, then you will suddenly find Lua an absolute joy to use.

Honestly I have been coding for over 40 years now in hundreds of different languages and my all time favourite 'high level' language is Lua by a heck of a long way from any of the others. (I say 'high level' because ARM assembler is my real favourite )


Been there, done that, got all the T-Shirts!
PM
Honkeyboy
3D Media Maker
9
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 16th Jan 2018 23:05 Edited at: 16th Jan 2018 23:25
lol now your confusing me m8 rofl looks like kung ...foo to me but yeah should have mentioned
the globals e.g items you want in your level/game you should add g_whatever=0 to the top of the script that way GG knows that whatever is a name it is using as a global.
Then you can add things like if g_whatever = g_whatever + 1 to things you collect and it will add it if you have a menu say for example saying
doText( 8, 20, "Whatever", g_whatever )
AM scares me with his scripting knowledge but he is teaching some wicked shortcuts i hope that simplfies it abit lol
P.s m8 read that webpage so effectivley you could add dates etc etc yes? looks pretty straight forward
@ am i did use to use vb5 and the very early c++ just ,lua and maybe a long time and also being an environmental landscape manager kinda took me away from it all, sometimes i get it sometimes i dont I am actually calming down abit on the outside stuff for health reasons but abit of fresh air never hurts
but i have got a MSCE in server engineering (kinda sideline) hence would like to see the server client running in GG could maybe help out there apart from the .lua side of couse altho i do have both the client and server scripts
Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 16th Jan 2018 23:25 Edited at: 16th Jan 2018 23:31
Yes, the os library is pretty cool, also not so obvious at first glance is that it will output dates and times automatically in whatever the localisation for the machine is, so Americans will get their dates in the MMDDYY format that they like whereas Europeans will see the DDMMYY format with no special coding needed.

Lesson number two (or me explaining my code changes iow):

Consider the following code:
PlayerDX = g_Entity[e]['x'] - g_PlayerPosX;
PlayerDY = g_Entity[e]['y'] - g_PlayerPosY;
PlayerDZ = g_Entity[e]['z'] - g_PlayerPosZ;
PlayerDist = math.sqrt(math.abs(PlayerDX*PlayerDX)+math.abs(PlayerDY*PlayerDY)+math.abs(PlayerDZ*PlayerDZ));
if PlayerDist < 200 then

and compare with my version:
local Ent = g_Entity[e]
local PDX, PDY, PDZ = Ent.x - g_PlayerPosX, Ent.y - g_PlayerPosY, Ent.z - g_PlayerPosZ
if PDX*PDX+PDY*PDY+PDZ*PDZ < 200*200 then

Explanation:
Using global variables in Lua is extremely inefficient compared to locals, Lua is a register based scripting language so wherever possible local variables will simply use a CPU register for storage but global variables have to be loaded into the namespace of the global environment, any usage of a global requires Lua to look up the name in the global namespace (which in reality is a linked list of names and associated pointers to memory storage) locate the data store and load it into a register for use. Guess which is faster!

local Ent = g_Entity[e] - simply creates a 'local' (i.e. fast) access to a global variable, in this case to the entry in the global table containing the entity information, which we can then use to directly access data rather than going via the global environment.

local PDX, PDY, PDZ = Ent.x - g_PlayerPosX, Ent.y - g_PlayerPosY, Ent.z - g_PlayerPosZ - given the above you should be able to see that this will create 3 registers (i.e. really fast) containing values we need for the next bit.

if PDX*PDX+PDY*PDY+PDZ*PDZ < 200*200 then - a bit more vague this but all will soon become clear. Any value when squared will be positive and rather than use square root, which is computationally expensive, we simply compare with a squared constant which in Lua is evaluated when the script is tokenised rather than at runtime. Basically this is super fast to execute compared to the original as all we are doing is three register multiplications, two additions and a compare with a constant.

Lesson over.
Been there, done that, got all the T-Shirts!
PM
Honkeyboy
3D Media Maker
9
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 16th Jan 2018 23:30 Edited at: 16th Jan 2018 23:31
Oh yeah i get that m8 saw how you adaption of my original script speeded things up took me a bit to get it into my grey matter but i did get it in the end and yes far faster. right bedtime before the missis kils me lol
Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 16th Jan 2018 23:35 Edited at: 16th Jan 2018 23:36
Ahh, there's your problem. My missus buggered off years ago.
Been there, done that, got all the T-Shirts!
PM
GraPhiX
Forum Support
19
Years of Service
User Offline
Joined: 15th Feb 2005
Playing:
Posted: 17th Jan 2018 15:27
I've done a basic Furnace, working on the benches now. I will post the Furnace in the Model thread you have created and in my free models thread

Welcome to the real world!
Main PC - Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD
Test PC - Windows 10 Pro x64 - G4400 @3.3GHz - 16GB DDR3 RAM - GeForce GTX 950 2GB - 500GB SSD
Honkeyboy
3D Media Maker
9
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 17th Jan 2018 18:56 Edited at: 18th Jan 2018 00:18
Very cool thanks Graphix puts mine to shame lol. Been tweaking the scripts added the spawn lathe and chemical bench scipts and updated the main inventory script to produce both those items, and been building a full game map with all of them on it to see how it fairs.
Edit ran around tonight like a complete plank wondering why the lathe and chem station wern't spawning then after rechecking the inventory i hadnt added g_lathe = g_lathe + 1 lol what a prat :/ anyways it working now. pretty much everything works correctly apart from the pills need to suss out where i want to go with those
Anyways heres a pic of the new level around 200 collectables so far and 3 rather dumb zombies lol for testing, just as well!
and the updated Pack including the new spawn scripts
Idea is you wake up in the grounded ship with a note sying things are strange etc etc then you collect mine etc etc and head out = zombie time lol
P.s setting up the script e.g entity numebers etc takes me around 10 mins so pretty straight foward and easy to do when you know whats what
P.P.S no changes needed to the ss1 folder and thx to Bod for the ship

Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on

Attachments

Login to view attachments
GraPhiX
Forum Support
19
Years of Service
User Offline
Joined: 15th Feb 2005
Playing:
Posted: 18th Jan 2018 15:13 Edited at: 18th Jan 2018 16:00
I have posted a basic Workbench in your model thread, will do some more

Welcome to the real world!
Main PC - Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD
Test PC - Windows 10 Pro x64 - G4400 @3.3GHz - 16GB DDR3 RAM - GeForce GTX 950 2GB - 500GB SSD

Attachments

Login to view attachments
Honkeyboy
3D Media Maker
9
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 18th Jan 2018 20:08
Sweet ty Graphix just built the first standalone to see if it all works the furnace is in
Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on
GraPhiX
Forum Support
19
Years of Service
User Offline
Joined: 15th Feb 2005
Playing:
Posted: 18th Jan 2018 20:16
your welcome would like to see a video of that if that's ok ?

is there anything you need building that you have not got?
Welcome to the real world!
Main PC - Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD
Test PC - Windows 10 Pro x64 - G4400 @3.3GHz - 16GB DDR3 RAM - GeForce GTX 950 2GB - 500GB SSD
Honkeyboy
3D Media Maker
9
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 18th Jan 2018 20:53 Edited at: 18th Jan 2018 21:58
Yes m8 np will do a vid and yesh still need a lathe and chemical table to match lol was tring to craft and eat pies while fending off the undead with a hammer made me pee myself and now have a very neally complete mini game\level and while i had the evil dead chasing me while trying to craft lol i came up with a title




Here's a quick vid showing the crafting took a while because some how i had deleted half the stuff off that part of the map ....corrected ignore the lighting m8 im running a night and day script and havent sorted it yet so they are probebly dark because of that or maybe because i have pbr off

Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on

Attachments

Login to view attachments
GraPhiX
Forum Support
19
Years of Service
User Offline
Joined: 15th Feb 2005
Playing:
Posted: 18th Jan 2018 21:56
LOL that's awesome well done will get onto the other benches for you
Welcome to the real world!
Main PC - Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD
Test PC - Windows 10 Pro x64 - G4400 @3.3GHz - 16GB DDR3 RAM - GeForce GTX 950 2GB - 500GB SSD
Honkeyboy
3D Media Maker
9
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 18th Jan 2018 22:05 Edited at: 18th Jan 2018 22:17
Thanks m8 ahh i see yeah you have these set for PBR might have to change the shader to get them to glow when you shine the torch on them will adjust and play about. Problem is i have hundreds of non PBR assets so when you mix and match you get hmm well mixed results :/
Heres the map as of today most things in including the AI and lighting
Idea is you have the first half of the map to collect and craft then when you go through the gate at the farm all hell breaks loose lol I even have a zobie playing with a dogman with a ball on the beach rofl.
still all the notes/clues etc to put in and sort some scary music out but its coming along
NEED A CHAINSAW!!!!!!! lol
P.s im still constantly adjusting the scripts to make sure they all fit together properly as i build and test

Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on

Attachments

Login to view attachments
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 18th Jan 2018 22:19
You know how at present you collect something and 'Destroy' the entity, well it would be easy enough to have it just move somewhere else instead.

That way you could put down a couple of bits of wood say and then when they are collected they simply get moved to a random location far enough from the player to not be visible.

To ensure that they don't appear in weird places you could use my zones script combined with a check that the new position is clear of any existing objects (using raycasting) and is within the playing area.

My utils library contains the random position functions and I could knock up the ray casting bit easily enough.


Been there, done that, got all the T-Shirts!
PM

Login to post a reply

Server time is: 2024-11-16 20:49:37
Your offset time is: 2024-11-16 20:49:37