Scripts / Communication between scripts

Author
Message
MaximEpihin
User Deleted
Posted: 15th Jun 2015 21:17
Script1.lua:


Script2.lua


How can i set variable from script1.lua into script2.lua
Create a game - it's like to start a new universe where there is only you and solitude with the environment
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 16th Jun 2015 00:09
you have Local and global but for global you dont need to type anything extra
i.e.
--script 1
local var = 1

--script 2
local var = 2

depending on which script you ask the value will change and any other script wont be able to find 'var' at all.

but if you use

--script 1
var = 1

--script 2

then from all scripts 'var' will always be 1 unless you change it in another script (var = 2 etc)
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
MaximEpihin
User Deleted
Posted: 29th Jun 2015 19:54
Quote: "[quote=]you have Local and global but for global you dont need to type anything extra
i.e.
--script 1
local var = 1

--script 2
local var = 2"

if I need to make such a system: if pressed the G button(for example) it is possible to throw your current weapon. Or just go and delete it current in arms. How to do that?
Create a game - it's like to start a new universe where there is only you and solitude with the environment
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 30th Jun 2015 18:26
i think right now you only get the option to remove all weapons at once so....

if GetInKey() == "g" then
RemovePlayerWeapons(e)
end

you'll have to feature creep the ability to remove 1 item/weapon at a time for now im afraid
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
MaximEpihin
User Deleted
Posted: 30th Jun 2015 18:41
Quote: "you'll have to feature creep the ability to remove 1 item/weapon at a time for now im afraid"

Thank
Create a game - it's like to start a new universe where there is only you and solitude with the environment

Login to post a reply

Server time is: 2024-12-22 01:19:53
Your offset time is: 2024-12-22 01:19:53