Product Chat / @Lee; Creative games

Author
Message
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 27th Mar 2020 19:10 Edited at: 27th Mar 2020 19:40
My scripts rely upon a close interaction between entities.
These entities sometimes must (or inadvertently) get removed, replaced
and switched around on the map (but a VERY careful build of a map) can
rectify this. What that means is that if you accidentally build a map with
an entity out of place [e]# or Object # wise, your best bet in the current
state of GG is to start all over from scratch and redo the map.
Easy? For my map, not weeks of work, but at least a full day probably--
and HOPE you don't find a mistake again near the end!
Currently there is a crucial entity "out of place", and I can't even find which
one has replaced it...

A certain entity is looking to interact with another entity -- and finds it
via (e)# in the script // in comparison with it's own (e)#, for example;
if ____x[e+127]____ < __x[e]__ then
do something.

A panel that has a list of all the entities, and their assigned [e]#'s as
well as the capability to EDIT those numbers (constraints are okay folks!)
would be very nice. Would the constraints outweigh the creativity?!
Please say creativity sounds nice!
PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 27th Mar 2020 19:16
Part 2 (A bonus) would be if in that panel of entities, the script assigned
to them was shown, and even if in that panel /group selection/ and
other helpful features, one could re-assign attributes such as the script
assigned (basically at least a list of the used scripts like the entity panel
on the left) would be pretty useful.

So in other words, an overall view of the entity/ (e)#+scripts and the
ability to modify in a UI editor panel is the idea.
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 27th Mar 2020 21:12
You shouldn't use explicit entity ids, if you need entities to interact, iow access variables in one script from another, store them in a global list or have them communicate via global functions.

To identify different occurrences of the same entity give them unique names and use the _init_name function.

Been there, done that, got all the T-Shirts!
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 27th Mar 2020 22:20
^ what amen said

store the 'e' values in global variables or lists/arrays

i.e. to water some flowers
store the watering can 'e' in a variable
function tool_init(e)
watering_can = e
end

for the flower you can now get the 'e' at any time using the above variable - any change to the e on the map(s) is fine as the script will keep track of it.
(note different script being run by a flower)
function flower_main(e)
--replace GetPlayerDistance() with a distance check for flower and passed in entity etc
if GetPlayerDistance(watering_can) < 100 then
--flower is watered
end
end


storing all flowers could be done like
flowerID = {}
flower_init(e)
flowerID[e] = e
end

now you can get how many flowers like
totalflowers = #flowerID
or process the flowers with an 'in pairs' loop
for k, v in pairs( flowerID) do
--flower number k has value of v
end
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 27th Mar 2020 23:30
Great ideas.
For certain uses, I do already have global assignments. It's just as for A to B
direct correlation, the [e]# sounded faster!

So I might just have to re-write all of my scripts if they all need separate scripts
referencing individual names. Thanks for your examples smallg. I'm going to
mull it over and see how that could work.

My menu panel suggestion is just a way for one lone person to work out these
hurdles in a fairly more easy/ fast and visual way. If you can do it by numbers,
in a menu, that sounds convenient! But as AmenMoses said-- this could be poor
scripting practice in the long term scope of it.
Really, I wanted to ask if it where at all possible?? (Not promise, but possible!)
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 28th Mar 2020 12:36
Quote: "Really, I wanted to ask if it where at all possible?? (Not promise, but possible!)"

Maybe, but not as engine integrated system, this is up yo Lee.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 28th Mar 2020 18:54
Quote: "My menu panel suggestion is just a way for one lone person to work out these
hurdles in a fairly more easy/ fast and visual way"

with max you will get access to a script properties panel which would allow you to set such values in the editor much easier so in a sense it is already "on the way"
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 28th Mar 2020 19:09 Edited at: 28th Mar 2020 19:09
You already have a way of identifying entities in the parameters settings, just give it a unique name!

Then you can use the 'ifused' mechanism for simple triggering or for more advanced use just have the scripts save the names away in a list.

The spitfire I was playing around with had over 20 separate models in use, all were associated with a specific spitfire body at runtime just by the names matching, so you could have an entire squadron if you so wished.

Oh and it used a single script!
Been there, done that, got all the T-Shirts!
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 28th Mar 2020 23:54
Quote: "with max you will get access to a script properties panel which would allow you to set such values in the editor much easier so in a sense it is already "on the way""

Do not almost nothing about how to, but it sounds to me like Avram's project style.
Being able to attach script to some entity at runtime would be nice, even being able to switch entity from static to dynamic and vice-versa, via LUA of course.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 29th Mar 2020 05:07
@smallg;
"With MAX... set such values in the editor..."
even modify [e]#'s? per entity? That would be nice.

I did create a very simple entity finder though, since I had lost the location
of a misplaced entity-- Now where did I put that?! Just scroll up and
down [e]#'s and use the PromptLocal(e) to locate it! Very simple, but once
there was a thread on this topic-- and a deep mystery if I recall correctly.

@AmenMoses;
Understood. Er, well never used, so a little more studying up would be
good for me to get the technique clarified in practice.
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 29th Mar 2020 11:42
Quote: "Oh and it used a single script!"

how would you get the other entities names if they don't have a script?

Quote: "Being able to attach script to some entity at runtime would be nice, even being able to switch entity from static to dynamic and vice-versa, via LUA of course. "

that's already possible with switchscript(), you can also switch to an empty script to simulate static

Quote: "even modify [e]#'s? per entity?"

if the script is taking an array/list then yes you can modify each entity with a different value - i.e. same as the text put into the new speech box
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 29th Mar 2020 13:05
Quote: "how would you get the other entities names if they don't have a script?"


The same script is attached to all the entities.

The script uses the name of the entity to tailor the functionality, so for example if the name is 'left aileron' the script knows to position it relative to the 'left wing' entity.
Been there, done that, got all the T-Shirts!
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 29th Mar 2020 13:14 Edited at: 29th Mar 2020 13:15
Quote: "how would you get the other entities names if they don't have a script?"

Ehmm, I worote it to get ids and names entities list, using it in a project I'm working now.
Basically listed all entity's ids and names over the map in a txt file locate a "Files" folder.



Quote: "that's already possible with switchscript(), you can also switch to an empty script to simulate static"


I know, I know.



edit: fixing quotes.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 29th Mar 2020 15:28
Quote: "The same script is attached to all the entities."

ah ok, thought you were implying there's a way to get the name without a script attached to store it - would have been useful to know if so
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 29th Mar 2020 15:50
Quote: "ah ok, thought you were implying there's a way to get the name without a script attached to store it - would have been useful to know if so "


If the object is dynamic you can get its name using GetEntityName( e )

If you have its objectId, i.e. from a raycast, then use physlib function ObjectToEntity( obj ) to convert to entity id.
For example:
name = GetEntityName( P.ObjectToEntity( objectId ) )

Been there, done that, got all the T-Shirts!
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 29th Mar 2020 16:50
Don't update yet to last build, so ignore whether it is already fixed, but It would be nice to document these variables in the global.lua file.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 29th Mar 2020 18:22 Edited at: 29th Mar 2020 18:28
@3com;
Nice job.
Any errors when writing a file, and the 'name' of entity is empty?
@AmenMoses
Same question for when you GetEntityName( e ) a (empty) name...?
Am I missing something? "If the object is dynamic you can get its name
using GetEntityName( e )"
-- there is still a value to referencing a slew of entities by number...
or maybe that's just my thick skull!

For other readers, you can 'turn off' a script by (near the beginning);
if // condition // then
return end.

https://forum.game-guru.com/thread/221209
PM

Login to post a reply

Server time is: 2024-11-23 19:08:06
Your offset time is: 2024-11-23 19:08:06