Scripts / How to incorporate one script into another script?

Author
Message
str8savagem8
Reviewed GameGuru on Steam
8
Years of Service
User Offline
Joined: 17th Nov 2015
Location:
Posted: 6th Jan 2017 17:31 Edited at: 6th Jan 2017 17:36
I got 2 scripts off the store, Moshroom's survival script and the deer.lua script from the deer character I bought. How do I make it so when I kill the deer in game it drops food that has the moshroom_survival_food.lua on it?

And how can i make it so they respawn too?
str8savagem8
Reviewed GameGuru on Steam
8
Years of Service
User Offline
Joined: 17th Nov 2015
Location:
Posted: 6th Jan 2017 19:18
bump someone please help
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 6th Jan 2017 22:02
What I would do is attach a script to the food items and have the init part hide them, then in the deer script have the exit part set a global flag which triggers the food item, to relocate to the deers location and show itself.
Been there, done that, got all the T-Shirts!
PM
str8savagem8
Reviewed GameGuru on Steam
8
Years of Service
User Offline
Joined: 17th Nov 2015
Location:
Posted: 6th Jan 2017 22:22
How do i do that?
MChapman
9
Years of Service
User Offline
Joined: 19th May 2015
Location: USA
Posted: 6th Jan 2017 23:58 Edited at: 7th Jan 2017 02:33
How i would do this (in theory)
1. when the deer is killed in its exit function spawn or un-hide the food entity and move it.
2. the foods script should be in the food, and then when the player picks it up make it hide instead of destroyed that way you can re use it. ( i don't know if the script will work again though when it is un-hid.

again this is theory, but you could also maybe find a loot script from your neighbor hood friendly Smallg. that may simplify some things. I haven't been to visible loot yet.



edit: testing with the theory above, I had to use dagored's rabbit ( i don't have mushrooms scripts but but for this I won't need them.)
on the rabbits exit function I made activate if used the dead rabbit in the medieval entities. so when the rabbit dies it will spawn the rabbit meat. using SetPosition(e,x,y,z) in the dead_rabbit script I made it spawn where the current rabbit died.

also added this into the rabbits exit function

this may be inefficient but this is how i got this to work maybe you this will give you an idea though for your own way of doing it.
Markchapman10 is my Skype let's have some dev talk.
str8savagem8
Reviewed GameGuru on Steam
8
Years of Service
User Offline
Joined: 17th Nov 2015
Location:
Posted: 7th Jan 2017 03:04
Thanks bro you're the man.
MChapman
9
Years of Service
User Offline
Joined: 19th May 2015
Location: USA
Posted: 7th Jan 2017 03:11
Like I said it may not be the best way to do it, I feel like it is the hard coded way cause you have to go through every food item/ animal in game to do this nad you would need a new global variable every time you killed something but you can work that out from here.
Markchapman10 is my Skype let's have some dev talk.
str8savagem8
Reviewed GameGuru on Steam
8
Years of Service
User Offline
Joined: 17th Nov 2015
Location:
Posted: 7th Jan 2017 06:43
Yea I'm gonna fiddle with it a bit and tweak it to how I need it. This definitely helps a lot though, so thank you for the help.
Honkeyboy
3D Media Maker
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 16th Jan 2017 18:51
These may help
item type: 61 - Survival : Food
item type: 62 - Survival : Drink
item type: 63 - Survival : Adrenaline
item type: 70 - Extra Life
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

Login to post a reply

Server time is: 2024-05-21 18:04:43
Your offset time is: 2024-05-21 18:04:43