Scripts / Write FIle - Quit Game

Author
Message
thatandplaygames
4
Years of Service
User Offline
Joined: 12th Feb 2020
Location: In a creative space
Posted: 17th Dec 2020 19:36
My head hurts. I'm putting this on a trigger zone and it's not working. What am I missing?

File name - "Write_QUIT.lua"
--------

function Write_QUIT_init(e)
end

function Write_QUIT_main(e)
if g_Entity[e]['plrinzone']==1 then
file = io.open("missiondone.txt", "w")
io.output(file)
io.write("Some text...")
io.close(file)
QuitGame()
FinishLevel()
Destroy(e)
end
end
thatandplaygames
4
Years of Service
User Offline
Joined: 12th Feb 2020
Location: In a creative space
Posted: 17th Dec 2020 19:56
After a cup of coffee it works.

-----

function writequitt_init(e)
end

function writequitt_main(e)
if g_Entity[e]['plrinzone']==1 then
file = io.open("mytextfile.txt", "w")
io.output(file)
io.write("Some text...")
io.close(file)
QuitGame()
FinishLevel()
Destroy(e)
end
end
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 18th Dec 2020 17:31
Don't use capital letters in your _main and _init, GG doesn't like it, it's ok to use _ to break up words in the _main and _init, but try to limit how many as GG is easily confused.

Primary Desktop:
i7 7700,k NV1070 8GB, 16GB 3200mhz memory, 1x 2TB Hybrid, Win10.

Secondary Desktop:
i5 4760k, NV960 2GB, 16GB 2333mhz memory, 1x 2TB Hybrid, Win10.

Primary Laptop:
i5, NV1050 4GB, 8GB memory, 1x 1TB HDD, Win10.

Secondary Laptop:
i3, Intel 4000 series graphics, 6GB memory, 1x 500gb HDD, Win8.1.
Nevin
8
Years of Service
User Offline
Joined: 19th May 2015
Location: U.S.A
Posted: 19th Dec 2020 14:58
this is off topic. but are you adding some sort of level select?

you can put down winzones and have triggers to all your levels in them wins zones. in the level

then go to the any level when you want

thats a good way to do it if you wanted to get rid of the old gg main menu and have some sort of live background as your main menu.

if your not doing something like that then woops haha

Login to post a reply

Server time is: 2024-03-29 13:42:11
Your offset time is: 2024-03-29 13:42:11