Scripts / [SOLVED] Can Entity Static be toggled?

Author
Message
Privateer_Lev
5
Years of Service
User Offline
Joined: 19th Mar 2019
Location:
Posted: 26th May 2019 19:59 Edited at: 27th May 2019 07:12
I hope the question is not out of bounds here.
I'd like to add HUD items as achievements / advancements of player through game play, ie: collect radar in mission, activate radar after collection or on mission turn in.
I can try to figure out how to hide/show it but since it's HUD and always active (for proper use once shown) it's overhead that I'd like to avoid running when HUD parts are not shown.

Attached some pics of the game.

Something else that is totally unrelated (except to me). Is there any published work on single entity, multi quest script(s).
Entity offering different 'defined' quests based on a definable player variable (ie: lvl, money etc).

The author of this post has marked a post as an answer.

Go to answer

Attachments

Login to view attachments
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 27th May 2019 15:37
This post has been marked by the post author as the answer.
Hud elements are just sprites so to hide them you simply move them off screen, i.e. position them at 200, 200 or similar.
Been there, done that, got all the T-Shirts!
PM
Teabone
Forum Support
18
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 3rd Jun 2019 08:22
I was actually curious about the question in the title, last night. Whereas instead of a Destroy(e) etc, we had something that would set the entity to then a static.
Youtube - Teabone3 | Store Assets - Store Link | Patreon - Teabone3

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GTX 960
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 3rd Jun 2019 09:50 Edited at: 3rd Jun 2019 09:54
Neat idea in theory but not practical, the entire point of static objects is that they are set up at the beginning of the level and then forgot about for the remainder of the game, by defining something as static you would need to re-setup the entire map (ai pathing, lighting etc) which would make it more time consuming than just leaving the model dynamic
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 3rd Jun 2019 11:49 Edited at: 3rd Jun 2019 11:50
Another issue that will occur changing between static and dynamic is lightmapping, one of the primary functions of static entities is to tell the engine what to lightmap, if you start it off dynamic and switch it to static via lua it will still not be lightmapped, so it won't use dynamic lighting, but also won't have a lightmap to work from.

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.

Laptop:
i3, Intel 4000 series graphics, 6GB memory, 1x 500gb HDD, Win8.1.
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 3rd Jun 2019 20:33
And of course AI collision! That is worked out once at start-up based upon the location of static entities, switch something to static during game play and the AI will still try to navigate through it rather than around it!
Been there, done that, got all the T-Shirts!
PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 4th Jun 2019 21:30
Courtesy of AmenMoses scripts, I've noticed something...
If you just want the script to essentially "turn off" and your objects
are isimmobile = yes, so you still want them visible, then you can add
a 'return end' right at the beginning of the script (when a certain condition
is triggered. I've done so, and it works, but again check the properties of
the entity (isimmobile, etc). Also you can Hide(e) them I'm supposing at the
same time?

BTW if entity is hidden- what happens to lighting? lol

if script[e] == 0 then return end --- exit script
PM
Privateer_Lev
5
Years of Service
User Offline
Joined: 19th Mar 2019
Location:
Posted: 5th Jun 2019 20:17
After some thought and replies from others who are by far more familiar with GG. It makes sense that static y/n be set at startup.

Perhaps where I need to look is at better understanding how to use SwitchScript(e,str) for something other than cover while not crashing my tests.
PM
Teabone
Forum Support
18
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 5th Jun 2019 22:02
So what's a good way to brick an entity?

For example like a chest you open and you no longer want it to run any scripting what so ever after its opened?
Youtube - Teabone3 | Store Assets - Store Link | Patreon - Teabone3

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GTX 960
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 5th Jun 2019 22:29 Edited at: 5th Jun 2019 22:33
You could swap the script for default.lua.

I.e. SwitchScript( e, "default.lua" ) -- or maybe "scriptbank\\default.lua"
Been there, done that, got all the T-Shirts!
PM
Privateer_Lev
5
Years of Service
User Offline
Joined: 19th Mar 2019
Location:
Posted: 6th Jun 2019 01:27
Quote: "You could swap the script for default.lua.
I.e. SwitchScript( e, "default.lua" ) -- or maybe "scriptbank\\default.lua" "


How about the reverse though? assigning default.lua (allowing the entity to be not static) and switching to something else on a trigger?
I.e. SwitchScript( e, "rpgchat.lua" ) or some other script action to become active on a condition.
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 6th Jun 2019 02:10
Nah, if the script is default.lua then GG doesn't even attempt to call it, likewise if an entity is static GG doesn't attempt to call it's script.

The entity has to be active before GG will check to see if it has a script to call. If the script name is default.lua then GG just skips that entity entirely for Lua processing.

One other oddity I noticed is that GG will attempt to call the _init_name function for an entity and even if that succeeds it will still attempt the _init function, so in theory you could have and _init_name function which does some stuff and an _init function that switches the script to default.lua and you wouldn't need a _main function at all! (I haven't actually tested this though)


Been there, done that, got all the T-Shirts!
PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 6th Jun 2019 16:53
Whoa! Really? You can switch scripts mid-game?!
Now that sounds like it holds potential.

This might sound funny, but too bad you can't have GG call to open
up another software while the level is playing (for example you want to
create a menu in a another engine, or add perhaps a story)-- ya know
those little Visual Novel game makers. That would be all the way!
It would be cool if something allowed you to do this.

You could tie many software pieces into GG with trigger points or something.
That would take care of many feature requests... no?
PM
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 6th Jun 2019 16:59 Edited at: 6th Jun 2019 17:00
Yes, it's quite simple, i can't remember the exact format off hand without my crib sheet, but it's basically two lines, the first would be placed above the _init and is a require command that tells the script that it will be using another script at some point, and then the second line would be in the _main wherever you need it which would actually switch to the other script when the conditions you set are achieved.

Quote: "This might sound funny, but too bad you can't have GG call to open
up another software while the level is playing"


I don't think you can open up other software, but i'm pretty sure i read somewhere that there's a command you can use to open up a web page in your browser.

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.

Laptop:
i3, Intel 4000 series graphics, 6GB memory, 1x 500gb HDD, Win8.1.
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 7th Jun 2019 15:12 Edited at: 7th Jun 2019 15:14
Look at the lua manual and you'll find some commands to deal with system stuff, think the one to open other files is os.execute("name")
Though iirc it opens in the background as GG takes fullscreen focus so you would need to make the user aware they need to tab to it or find a way to bring it to the front
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11

Login to post a reply

Server time is: 2024-12-22 14:19:14
Your offset time is: 2024-12-22 14:19:14