Trace to find ZoneInfo

Discussions about Coding and Scripting
Post Reply
ShaiHulud
Adept
Posts: 459
Joined: Sat Dec 22, 2012 6:37 am

Trace to find ZoneInfo

Post by ShaiHulud »

Hey all,

I'm trying to find out whether there's a harmful Zone below a bot when it has been projected into the air across a map. So far I've been attempting this using a Trace, straight down, from the terminal Location at which the bot arrives (in the instance that I'm investigating, it eventually smacks into a wall well above ground level).

The Trace (or actually, I've switched to using TraceActors) completes OK, and I can see that the HitLocation that it returns is directly below the location of the bot (I recorded the co-ordinates, opened the editor, moved another actor to those co-ordinates and then searched for the actor), but it ALWAYS returns "LevelInfo" as the HitActor. And nothing else. I don't seem to be able to detect any other ZoneInfo types - lavazone, waterzone, slimezone, etc (or surfaces, or any other object).

It's sort of similar to what's being discussed in this thread:

https://forums.epicgames.com/showthread ... tor-is-Sky

Is this possible at all using this or another technique? I want to know whether I need to adjust the bot location to prevent it falling to its death (in a zone with DamageSec > 0), or allow it to drop.

Thanks in advance!

Edit: just had a thought... maybe I can spawn an invisible actor at the termination point, give it some enormous velocity (so that it reaches its destination as quickly as possible) and send it down along the same Vector that I'm currently tracing. If it's ZoneChange event fires, I can interrogate the ZoneInfo object parameter to find out what I'm dealing with. The trouble is, there's the added overhead of all of this, and I'll have to do it asynchronously, waiting for the ZoneChange event to fire. So I suppose I'll have to get the bot to sleep for a moment and then test for a ZoneChange result - stored somewhere. What a mess.
User avatar
Barbie
Godlike
Posts: 2802
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: Trace to find ZoneInfo

Post by Barbie »

I have no clue how to detect the Zone of a certain location (that's the core of your problem).

But I have another idea:
  1. do a long Trace() down with bTraceActors=false so that you hit the level geometry
  2. spawn a test actor at given HitLocation
  3. access the zone infos via TestActor.Region.Zone
If you intend to do that more than once, I'd spawn TestActor only once (because that's an "expensive" operation) and set its location then.
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
ShaiHulud
Adept
Posts: 459
Joined: Sat Dec 22, 2012 6:37 am

Re: Trace to find ZoneInfo

Post by ShaiHulud »

Oh, I like this idea much more than the kludge I'm in the middle of hacking together, I'll give this a try - thanks Barbie!

Edit: initial testing seems to suggest that it's working! Thank you again, that's saved me a huge headache
User avatar
sektor2111
Godlike
Posts: 6410
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Trace to find ZoneInfo

Post by sektor2111 »

I would spawn it by default and keeping it stored somewhere. Just call a SetLocation without over-spawning 100 things. A custom helper (like brain no. 2) might do this task as well nearby the rest of required tasks.
ShaiHulud
Adept
Posts: 459
Joined: Sat Dec 22, 2012 6:37 am

Re: Trace to find ZoneInfo

Post by ShaiHulud »

Thanks sektor, that's pretty much what I've ended up doing. It's working well
Post Reply