Scripts / Invisible,non-collideable entity for waypointing

Author
Message
benjiboy
7
Years of Service
User Offline
Joined: 24th Mar 2017
Location: In the depths of rural Norfolk
Posted: 28th Feb 2020 11:27
From a post I made on the Steam discussion board:-
I want an invisible entity I can place in my maps at the same locations as my waypoints. Any knowledgeable soul have guidance for me?

Corrosion suggested the invisible_wall script which I tried, but . . .

I am failing entirely in my quest.
I have opted to use the shovel in the scenery pack.
I have renamed it's dbo
I have changed the fpe to get rid of the old fpi references and made aimain=invisible_wall.lua
I have changed collisionmode to 11.
I can still see it but don't collide with it.

I have also tried changing the properties in the editor to use invisible_wall.
Nuthin' I do don't seem to work...

I have also tried using the invisible wall from the easter pack, renamed it's dbo, changed the fpe to collisionmode=11.
I can't see it, but I still collide with it.

Frustration mounts >
You can't teach an old dog.
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 28th Feb 2020 13:03
Why are you setting collisionmode to 11? My invisible walls have it set to 0 and they work fine.
Been there, done that, got all the T-Shirts!
PM
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 28th Feb 2020 13:32
He's not trying to give it collision, he's trying to turn the collision off, he wants the object to be a hidden object ruining a script. collisionmode 11 and Hide(e) in the script should do it.

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.
benjiboy
7
Years of Service
User Offline
Joined: 24th Mar 2017
Location: In the depths of rural Norfolk
Posted: 28th Feb 2020 13:44
ferzackerly
You can't teach an old dog.
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 28th Feb 2020 15:17 Edited at: 28th Feb 2020 15:20
Oh, in that case just put CollisionOff( e ) in the script.

What exactly are you trying to achieve though?
Been there, done that, got all the T-Shirts!
PM
benjiboy
7
Years of Service
User Offline
Joined: 24th Mar 2017
Location: In the depths of rural Norfolk
Posted: 28th Feb 2020 15:35 Edited at: 28th Feb 2020 15:49
@amenmoses: collisionmode=11 is no longer collision off? I picked it up from an earlier thread.
And why when I use Hide(e) is my shovel still visible? I tried it first on a bowl in the abandoned apartment set and concluded that it didn't work because those models only have .DBO's, not .x's, but it didn't work on the shovel either.

Aarggggh!

invisible_wall.lua works on the eggs from the Easter pack, on the walls from the easter pack, but not on the shovel from Scenery or the bowl from abandoned apartment.

It's this kind of thing that causes unrest
You can't teach an old dog.
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 28th Feb 2020 16:01 Edited at: 28th Feb 2020 16:04
Are you making them active?

Shovel works fine for me btw.

Made it active, Physics off and issimobile=yes attached invisible wall script and it's magically disappeared.
Been there, done that, got all the T-Shirts!
PM
benjiboy
7
Years of Service
User Offline
Joined: 24th Mar 2017
Location: In the depths of rural Norfolk
Posted: 28th Feb 2020 16:11 Edited at: 28th Feb 2020 16:49
Okay.
Slow on the uptake. Shouldn't have selected a static entity.

Problem solved.
You can't teach an old dog.
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 28th Feb 2020 16:39
I don't mess about with fpe files if I can avoid it.
Been there, done that, got all the T-Shirts!
PM
benjiboy
7
Years of Service
User Offline
Joined: 24th Mar 2017
Location: In the depths of rural Norfolk
Posted: 28th Feb 2020 17:06
What I'm doing is experimenting to see what I could achieve in terms of npc behaviours, were I able to access waypoint proximity in the npc script - or vice-versa. For instance - when the npc approaches this point he gets killed by the autocannon, (do we have one in the plethora of assets?), giving the player the insight that he shouldn't approach that location without finding some means of disabling the defenses.
No idea whether any of that is feasible but finding out will give my laggardly brain something to chew on - probably for quite a while, (so no Ah - you can do that like this's please ).
You can't teach an old dog.
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 28th Feb 2020 18:28 Edited at: 28th Feb 2020 18:30
unless you are planning on using free-form paths you can already do this with the normal waypoints - there's code there already even to tell the NPC's to move to the next point.
if you want to use a free-form path (i.e. for flight / movement not restricted to entities or terrain) then sure, use an invis object.

tell if you're close to a certain point is done like this
(nodeIndex is the number of the node along the path (i.e. how many points/dots there are in the path - set the number to the one you want to trigger the event) *note i'm not sure if you start counting from 0 or 1*


Quote: "What I'm doing is experimenting to see what I could achieve in terms of npc behaviours, were I able to access waypoint proximity in the npc script - or vice-versa. For instance - when the npc approaches this point he gets killed by the autocannon"

this doesn't really suit your example, you should just use a proximity to the cannon or a zone
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
benjiboy
7
Years of Service
User Offline
Joined: 24th Mar 2017
Location: In the depths of rural Norfolk
Posted: 28th Feb 2020 18:45 Edited at: 28th Feb 2020 18:52
@smallg: bad example, I agree. How about making the npc stop and change animation - maybe sit down on a chair for a while, get up and run away?
Thanks for the code, but it seems to me about as opaque as it could possibly be, relying upon a knowledgebase that I cannot, nor ever will be able to call upon.

I know you were trying to help, but now I'm to have to go find something else to occupy my mind.
You can't teach an old dog.
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 28th Feb 2020 19:10
What's about a trigger zone, when npc approaches it, the cannon will be activate.
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 Feb 2020 20:45 Edited at: 28th Feb 2020 20:52
Quote: "Thanks for the code, but it seems to me about as opaque as it could possibly be, relying upon a knowledgebase that I cannot, nor ever will be able to call upon."

not really sure why it would be opaque, it's using the normal method to get distance based calculations, all answers on the subject will use it in some form, trial and error is your friend, just change the numbers and see what happens

to trigger sitting down for a while (for example) you just need to trigger the state to do so...
i.e.
this code would be used to trigger an entity to change to "sit" state when he reaches node 5 on the path
(note it doesn't actually work, it's just theory - you would need to add code to actually walk the path and animations etc)


if you need it broken down then essentially these lines
local patrolx = AIPathGetPointX(ai_bot_pathindex[e],nodeIndex)
local patroly = AIPathGetPointY(ai_bot_pathindex[e],nodeIndex)
local patrolz = AIPathGetPointZ(ai_bot_pathindex[e],nodeIndex)
are just getting the point's location in GG - i.e. the same as if you had an invis object at some location and called
local patrolx = GetEntityPositionX(e)
local patroly = GetEntityPositionY(e)
local patrolz = GetEntityPositionZ(e)

the next part just works out the difference between the object/node and the NPC
local tDistX = g_Entity[e]['x'] - patrolx
local tDistZ = g_Entity[e]['z'] - patrolz
local VertDist = math.abs(g_Entity[e]['y'] - patroly)

and finally get those values as 1 value rather than 3 (or 2 in this case as height is dealt with separately in the next step)
local DistFromPath = math.sqrt(math.abs(tDistX*tDistX)+math.abs(tDistZ*tDistZ))

then that value is compared to some distance you want the NPC to be within
if DistFromPath < 25 and VertDist < 95 then
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 Feb 2020 22:05
Or use utillib which has functions to do that stuff in already.

Been there, done that, got all the T-Shirts!
PM
benjiboy
7
Years of Service
User Offline
Joined: 24th Mar 2017
Location: In the depths of rural Norfolk
Posted: 29th Feb 2020 08:27
Sorry for my responses to everyones helpful replies.
Brain rot is obviously now well advanced in my cranium.
Ciao.
You can't teach an old dog.
benjiboy
7
Years of Service
User Offline
Joined: 24th Mar 2017
Location: In the depths of rural Norfolk
Posted: 29th Feb 2020 15:19
?utillib?
You can't teach an old dog.
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 29th Feb 2020 16:31
utillib.lua, it is one of the libraries I have provided that gives a variety of useful functions.

I did post a tutorial showing how to use it but I can't find it.

Basically you add:
local U = require "scriptbank\\utillib"
at the top of your script and then use the functions from it like this:
if U.PlayerCloserThan( e, 200 ) then
Been there, done that, got all the T-Shirts!
PM
benjiboy
7
Years of Service
User Offline
Joined: 24th Mar 2017
Location: In the depths of rural Norfolk
Posted: 29th Feb 2020 17:12
That looks very useable. Where can I find it?
You can't teach an old dog.
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 29th Feb 2020 17:19
it's part of the core scripts, you will have it already, just add the code amen posted to another script to start using it
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
benjiboy
7
Years of Service
User Offline
Joined: 24th Mar 2017
Location: In the depths of rural Norfolk
Posted: 29th Feb 2020 17:31
Doh!
Found it.
Not working on the right PC.
You can't teach an old dog.

Login to post a reply

Server time is: 2024-04-26 08:29:26
Your offset time is: 2024-04-26 08:29:26