Bug Reports / g_Entity[e]['y'] doesn't refresh (this probably explains why the AI have problems with stairs)

Author
Message
Moshroom
9
Years of Service
User Offline
Joined: 18th Jul 2015
Location: Finland
Posted: 10th Nov 2015 22:43 Edited at: 10th Nov 2015 22:46
Error report: Even if an entity moves along Y-axis, function GetPlayerDistance(e) gives the original Y-coordinate of the entity. If I want to test whether the entity is for example 100 units away from the player, as soon as the entity has descended or ascended 100 units in the Y-axis, the program thinks the entity is more than 100 units away from the player even if player and the entity are standing next to each other.

Repeatable: Always. And since the problem with AI and stairs is even mentioned in the feature vote, I'm probably not the first one to encounter this.

Howto: Add these lines to ai_fantasycharacter.lua (or some other that wants to follow you but doesn't shoot):
Let the entity follow you down the hill. In some point the prompt disappears (as well as anything you wanted the entity do when it's near to player).

Workaround: Use this instead of GetPlayerDistance().
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 10th Nov 2015 23:36
yes but this is only an issue for stuff set as a character, the g_Entity[e]['y'] result always returns 600 on characters for some reason.
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, AMD R9 200 series , directx 11
perelect
10
Years of Service
User Offline
Joined: 27th Mar 2015
Location: Australia
Posted: 19th Nov 2015 14:38 Edited at: 19th Nov 2015 14:41
FYI: I found this a while back.
The GetPlayerDistance(e) function looks like this in the global.lua

So if the player and entity is more than 100 units away from each other in height then it multiples the height 4 times which gives an altered distance.

I may be old, but at least my memory still ....hmmm

DT:Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz (8 CPUs), ~3.6GHz, Windows 8.1 64-bit, 16 GB Ram, NVIDIA GeForce GTX 750 Ti, Display Memory: 4018 MB. Resolution 1360x768, Passmark 3528, AutoCAD, 3DsMax, Paint.Net, Solidworks.

Login to post a reply

Server time is: 2025-04-29 17:08:18
Your offset time is: 2025-04-29 17:08:18