Character:CreateNearPlayer issues

I might just be fudging something up here, but my testing of Character:CreateNearPlayer seems to differ from how it was mentioned in the 1.2.1.3 patchnotes where it was added:

I assume I need a Character object (from Character.Create) to call this function from, a Player object (from Game.getLocalPlayer()), and a boolean. But in practice, it seems like the script is expecting an address for a string variable:

image
My code below, where AVATAR_DBR is a string of a creature dbr.

		local player = Game.GetLocalPlayer()
		local avatar = Character.Create(AVATAR_DBR)
		avatar.CreateNearPlayer(player, true)

Second issue I’m encountering with this script call is that the script interpreter seems to hang from the above position of suggesting alternate overloads; which is to say, my script never succeeds or fails. This results in a near-guaranteed crash (note: may need subsequent script calls to trigger crash? My script runs when Korvaak_03 is killed but there is a second Crate script that runs when his corpse is removed from world, to spawn the exit portal) when exiting to the main menu. See the absence of the successful or failed script calls below:


I have tested the above in both the public playtest branch and the spooky-praet branch of the game to the same results.

I’m bumping this thread (breaking the “don’t bump bug reports” rule!) because experimentally, I’m still not finding CreateNearPlayer to show behavior remotely similar to what the v1.2.1.3 patchnotes allege.

Some quick background, though.

I reached out to @Zantai on Discord with my worries that CreateNearPlayer, as quoted in the first post, was not the proper syntax. This turned out to be true! Zantai (and, likely, the programmer) investigated and replied that the proper syntax was…

And as Zantai said, he updated the patchnotes to the following:

However, I still do not find this alleged behavior to be the case in-game.

I’m open to someone telling me I don’t understand Lua…which would be mostly true. But to the best of my understanding, CreateNearPlayer wants only a const string& argument, and nothing else.

I’ve tried more than a dozen variations of the below code, and the results are always the same; Grim Dawn thinks I am trying to override the function with some other argument set.




The common results from all of this code and all the terminal logs are that CreateNearPlayer is expecting a const string&, and nothing else.

If someone can manage to run CreateNearPlayer in any version of the game (public, playtest, or spooky praet playtest), please let me know. But I’ve been going at this for weeks now, and have made no progress.


I am also bumping this thread, however, because the second bug mentioned in the first post also still remains:

Grim Dawn has a guaranteed CTD when a script fails, a user exits to main menu, and then the user tries to launch another game session from the main menu.

If needed, I can record the sequence of events that lead to this crash to make it clearer.

I haven’t had any luck either in my tests. I just tested on the public test version.

Here is my script, I call it from an NPC dialog option.

function gd.wavespawn.CreateNearPlayer()
  local player = Game.GetLocalPlayer()
  local testSpawnDBR = "_eternal/creatures/wavespawn/boss/warden01.dbr"
  local testSpawn = Character.Create(testSpawnDBR)
    testSpawn.CreateNearPlayer(testSpawnDBR, player, true)
    print(testSpawn.CreateNearPlayer) -- make sure it isn't nil
end

I’m no expert in lua or any programming language, but I generally am able to figure something out if i I tinker with it long enough. Like Ceno, I’ve tried it dozens of different ways, but I’m not making any progress. I get the same error messages, so it seems like the function is still only accepting a string, and none of the other variables.

Perhaps the class and/or function are not public and hence not available to lua?

Odd for it to be in the [Modding] section of the 1.2.1.3 patchnotes then. :stuck_out_tongue:

Well it might be an oversight on the devs part. Again, just my guess on why it doesn’t work, especially since it’s new. :grinning:

Though, I’d think Lua would throw an error.
I’ve no exp with Lua.

Someone left debug code in your build. Try next build.

3 Likes

It works now.

1 Like