Guild icon
Ark Server Api
── ( Beginners | Topics ) ── / 【💬】ᴅɪꜱᴄᴜꜱꜱɪᴏɴ-ʙ
Avatar
Hello, I'm an ARK player and a web developer so I've some basic concepts in C++. I'd like to create a plugin to notify Discord's channel about player inactivity. I'm playing from MacOS using Nvidia Geforce Now. Do I need a Windows computer with ARK installed to develop my plugin ? Is there any updated resource to start ? (edited)
Avatar
@Saxor I'm no professional, but if you have git and access to reliable C++ compiler then you are good to go. No need for Windows with ARK as long as you already have server on Windows. As for your second question it's hard to find something that is up to date. At least I had problems with it. But don't be afraid, if I sorted things out I'm more than sure you will as well.
Avatar
any ideas where i can find tutorials to learn how to create a plugin, have very basic C++ knowledge but I have no idea where to start and there seems to be no tutorials out there. Anyone know of any?
Avatar
Good the KalsCrossChat plugin works what is chat in the game and discord but the destruction notices are not working, I passed it to English and not anything else to do,? thanks. (edited)
Avatar
How do i get the name (for example "Tek Foundation") from "APrimalStructure"? 😄
Avatar
APrimalStructure::DescriptiveNameField()
Avatar
Thanks a lot 😄 i tried to use "NameField" all the time :/ this works ty ❤️
Avatar
NameField returns the BP name, like the name the blueprint file has. For example "Floor_Metal_C_1" (edited)
Avatar
ya i saw that, but didnt found DescriptiveNameField() Btw this shows me the german words, prob just Server / game setting right?
Avatar
Yes, it depends on server culture (edited)
Avatar
Ok 👍 Thanks alot for your quick help
Avatar
No worries, feel free to ask anything else
👍 1
Avatar
any ideas where i can find tutorials to learn how to create a plugin, have very basic C++ knowledge but I have no idea where to start and there seems to be no tutorials out there. Anyone know of any?
@Browne there's a great google doc here: https://docs.google.com/document/d/1U4kRBevkLbXxcVMzKTmsjRKFkCEjtG46bfi5TdHNluQ/edit
This guide is based on the Visual Studio Community 2019 version install Prerequisites: 1. https://visualstudio.microsoft.com/vs/ 2. https://github.com/Michidu/ARK-Server-API/archive/master.zip Step N1: Install Visual Studio by the link given on the first prerequ...
Avatar
I have it all set up however im not sure about the code itself, as I said my knowledge is very basic but its the code itself im struggling with
Avatar
@Ashington
Avatar
ah right, what are you trying to do?
Avatar
basically i have used C++ before but never for anything like this, its way beyond what i know and i want to start learning i have looked everywhere for videos, turtorials and shit like that but i cant find anything and because im completely new to it im not even sure what exactly im looking for outside of searching ark plugin tutorials, so im looking for some resources to help me learn from basics up to creating my own plugin from scratch any help would be appretiated @Ashington
Avatar
ah right, makes sense
12:26 AM
best source of information for me was the plugins out there - a lot of the functionality has been done there first so the interactions with the API can be sourced from there
12:27 AM
in terms of other management in memory/files etc that's just a standard programming problem which you'd have to tackle by designing your systems/writing tests etc
12:28 AM
I would say the first thing you should work out is what is possible using the API, and then work around that when designing the rest of your system, I did all the easy stuff first and found that it was difficult to do the actual interaction with the API (lesson learned)
12:28 AM
what are you trying to make as a plugin?
Avatar
I have nothing in mind at the moment, will probably start by recreating existing plugins, easy ones
12:32 AM
work my way to harder ones
12:32 AM
then work on developing my own
12:33 AM
however my knowledge of C++ is so limited now that its probably betterr saying i know nothing
12:33 AM
because it has been a very long time since i have used it
12:33 AM
so for me its going to be a matter of re-learning the code
12:34 AM
then learning all the plugin sort of stuff which i dont even understand yet
Avatar
Hey, i’d like to create a cluster. Any advice about hosting? (edited)
Avatar
Hetzner serverbörse
4:29 PM
Are u thar danish guy?
Avatar
If you're talking to me, I'm not Danish, I'm a French
Avatar
Does anyone know how to get the FTribeAlliance by an AllianceID? 😄
Avatar
Try something like this
10:39 AM
int alliance_id; AShooterPlayerState* State = static_cast<AShooterPlayerState*>(shooter_pc->PlayerStateField()); FTribeAlliance* FTA = static_cast <FTribeAlliance*>(State->MyTribeDataField()->FindTribeAlliance(alliance_id));
10:39 AM
tho you need to get the shooter pc first
Avatar
good, see I have 7 servers of the 6 the plugin load perfect and in one strip 11/08/20 06:44 [KalsCrossChat][info] ServerKey ? Ragnarok CreateProcess failed (5). which means that mistake thank you.
Avatar
```cpp int alliance_id; AShooterPlayerState* State = static_cast<AShooterPlayerState*>(shooter_pc->PlayerStateField()); FTribeAlliance* FTA = static_cast <FTribeAlliance*>(State->MyTribeDataField()->FindTribeAlliance(alliance_id)); ```
@Foppa whats type is shooter_pc in that case?
(edited)
3:23 PM
Because, the alliance i want, (where i got the Id from, i got nothing except the id :/
Avatar
AShooterPlayerController* shooter_pc
8:09 PM
What do you want to have in return?
Avatar
I have the Alliance Id and what the FTribeAlliance typ of that, from that i would take the members (tribes) of the alliance
Avatar
found a way around it / found that i got something else i can work with
Avatar
ark website access error
Avatar
You don't have the pdb file installed so we can't know what crashes 🤷
Avatar
so i need to put the pdb file of the plugin into the plugin folder?
Avatar
If you want more detailed crash logs yes
Avatar
ok, then gimme a few min
Avatar
ok, weird, i copy pasted the code into a another plugin and now it doesnt crash?!! xD
5:16 PM
Ah ik why; this: Log::GetLog()->info("tribemembersInviter: {}", alliance.MembersTribeIDField().Num()); returns me this: -623357952 and cuz its negative it doesnt go into the next step
Avatar
hello i cant compile...
11:27 AM
Avatar
You are redefining an already existing struct
Avatar
@Pelayori thanks! i did it!
Avatar
do someone here know how to use ServerRequestRemoveAllianceMember(AllianceId, MemberId) i've tried saving the AllianceId after i force created one but it's changing all the time i leave manually
Avatar
I think i tried that one, but if i remember correct, that didnt work, try using this ServerRequestRemoveAllianceMember_Implementation
Avatar
thanks that's working. next thing is that i don't get the right ID directly. I have to request leaving once (and denie it with a hook) to get the correct Alliance ID how do you get the correct one?
10:18 PM
TArray<FTribeAlliance> allys = aPlState->MyTribeDataField()->TribeAlliancesField(); if (allys.Num() > 0) { m_AllianceID = allys[0].AllianceIDField(); } that's how i get it now which is the wrong one -.-
Avatar
thats an issue i currently have, too. I am not sure, but i guess it doesnt get the FTribeAlliance correctly, sth there is broken i guess. Maybe someone else can help there 😄
Avatar
So alliances num is greater than zero but the actual FTribeAlliance is empty?
Avatar
not really empty but "wrong" the Id isnt correct and i couldnt get the tribe id´s of the tribes in that alliance with MembersTribeIDField() (edited)
Avatar
it's just little bit confusing how to retrive the correct data...
2:45 AM
But this works: AShooterPlayerState* state = static_cast<AShooterPlayerState*>(shooter_pc->PlayerStateField()); if (state) { FTribeData* mytribedata = state->MyTribeDataField(); int mytribe_id = state->TargetingTeamField(); Log::GetLog()->info("Checking For Tribe ID: {}", mytribe_id); int tribeMemberCount = mytribedata->MembersPlayerDataIDField().Num(); Log::GetLog()->info("My Member Count: {}", tribeMemberCount); // will return the count of players in your tribe if (tribeMemberCount > 0) { int alliancesCount = mytribedata->TribeAlliancesField().Num(); Log::GetLog()->info("My Alliance Count: {}", alliancesCount); // Will return the count of how many alliances you have int allyMemberCount = state->MyTribeDataField()->TribeAlliancesField().GetData()->MembersTribeIDField().Num(); Log::GetLog()->info("My Alliance Member Count: {}", allyMemberCount); // Will return the count of you and the members of the alliance (edited)
👍🏼 1
Avatar
is there a second part to this?
Avatar
`struct FTribeAlliance { FString AllianceNameField; unsigned int AllianceIDField; TArray<FString> MembersTribeNameField; TArray<unsigned int> MembersTribeIDField; TArray<unsigned int> AdminsTribeIDField; }; /* struct FTribeAlliance { FString& AllianceNameField() { return GetNativePointerField<FString>(this, "FTribeAlliance.AllianceName"); } unsigned int& AllianceIDField() { return GetNativePointerField<unsigned int>(this, "FTribeAlliance.AllianceID"); } TArray<FString>& MembersTribeNameField() { return GetNativePointerField<TArray<FString>>(this, "FTribeAlliance.MembersTribeName"); } TArray<unsigned int>& MembersTribeIDField() { return GetNativePointerField<TArray<unsigned int>>(this, "FTribeAlliance.MembersTribeID"); } TArray<unsigned int>& AdminsTribeIDField() { return GetNativePointerField<TArray<unsigned int>>(this, "FTribeAlliance.AdminsTribeID"); } // Functions FString* GetDescriptiveString(FString* result) { return NativeCall<FString, FString>(this, "FTribeAlliance.GetDescriptiveString", result); } bool operator==(FTribeAlliance* Other) { return NativeCall<bool, FTribeAlliance*>(this, "FTribeAlliance.operator==", Other); } static UScriptStruct* StaticStruct() { return NativeCall<UScriptStruct*>(nullptr, "FTribeAlliance.StaticStruct"); } }; */` found it you have to replace the Struct in Tribe.h and then it works
(edited)
Avatar
not rly tho
Avatar
@ouzo1986 i get error if i use the struct like that, prob because it doesnt have the pointers 🤔
10:28 AM
can you maybe send me the code that worked for you? 😄
Avatar
@SorPlex that struct override and this: AShooterPlayerState* aPlState = static_cast<AShooterPlayerState*>(ps); TArray<FTribeAlliance> allys = aPlState->MyTribeDataField()->TribeAlliancesField(); if (allys.Num() > 0) m_AllianceID = allys[0].AllianceIDField; works fine for me. (edited)
Avatar
and you just used that struc without any pointers or so?
10:46 AM
cuz i get an error without these pointers https://prnt.sc/vkn0m8
10:46 AM
@ouzo1986
Avatar
yes i can. don't know why you can't
Avatar
you also use the latest api right? xDD
Avatar
was there an update in the last three days?
Avatar
idk, but then i guess we have the same
11:01 AM
weird
Avatar
I'm using Visual studio 2017 maybe that's the difference
Avatar
im using 19, but would be weird, i redownloaded the api, ill test it again
Avatar
seems to work now, updated the tribe.h and used the latest api
1:48 PM
ty
Avatar
Дивоглюк 11/21/2020 6:24 PM
@staff after server starting my plugin does not respond to chat commands. If I reload plugin he start react to chat commands, but after time again not responding. how fix this problem? Plugin source - https://pastebin.com/WnWLW7LA
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Avatar
You shouldn't be using precompiled headers (edited)
Avatar
Avatar
Pelayori
You shouldn't be using precompiled headers (edited)
Дивоглюк 11/21/2020 6:30 PM
precompiled headers already disabled
Avatar
You are including pch.h
6:34 PM
@Дивоглюк
Avatar
Дивоглюк 11/21/2020 6:34 PM
yeah, thanks, I am testing your solution
Avatar
Avatar
Pelayori
You are including pch.h
Дивоглюк 11/21/2020 6:38 PM
after server started chat command not working
6:39 PM
after reloading plugins started response to chat command
Avatar
By plugins.unload and plugins.load?
Avatar
Дивоглюк 11/21/2020 6:39 PM
yeah
6:40 PM
but now plugin stopped response...
6:41 PM
I think after switched to other window by Alt-Tab?
Avatar
Avatar
Pelayori
By plugins.unload and plugins.load?
Дивоглюк 11/21/2020 7:05 PM
where can I find log messages generated by command Log::GetLog()->debug("Testing 123, please load the project for me ;)"); ? In console window they don't show
Avatar
Then the plugin isn't loading/unloading
Avatar
Дивоглюк 11/21/2020 7:06 PM
rcon console say "successfully unloaded\loaded plugin"
Avatar
Oh well, ->debug might not show if it isn't compiled with debug
7:07 PM
try ->info
Avatar
Дивоглюк 11/21/2020 7:13 PM
It detach my plugin by unknown reason...
Avatar
Дивоглюк 11/21/2020 7:23 PM
oh... I searched this thread by 'detach' word and founded same problem) lost break in dll attach switch... deleted thread attach\detach cases and now it's work) thanks)
7:26 PM
there is another question... why melee, speed and max is 0?
Avatar
Дивоглюк 11/21/2020 7:51 PM
okay GetBaseStatusValue return stats on 1 level dino I mean. How can I get stats of dino which will be used on mating?
Avatar
does someone know how to create this type "FUniqueNetIdUInt64" as variable?
Avatar
@ouzo1986 what do you want to use it on? I can't see a use for it. I believe it's also empty on ark code, I'd stay away from that (edited)
Avatar
it's defined in GameMode: void AllowPlayerToJoinNoCheck(FUniqueNetIdUInt64* PlayerId) { NativeCall<void, FUniqueNetIdUInt64*>(this, "AShooterGameMode.AllowPlayerToJoinNoCheck", PlayerId); }
Avatar
This is the definition of FUniqueNetIdInt64: struct FUniqueNetIdUInt64 : FUniqueNetId { unsigned __int64 UniqueNetId; };
4:46 PM
Just declare a new funiquenetidUInt64, set its uniquenetid field to the id you want and pass a pointer with &your_variable
4:46 PM
@ouzo1986
Avatar
thanks
Avatar
Hello everyone! Using the Improved Commands source code, I was able to create a updated dino stats plugin (my first plugin). It is quite simple and only shows the dino the players own. I would like to be able to also show wild dino stats and I am having a hard time figuring out what is the wild dino team. I have set the setcheatplayer true and looking at few dinos, but it shows different teams ids. The wild teams ids, is it a range? Or should I go about another way to figure out if a dino is wild or not?
Avatar
I believe it is 0
Avatar
Then perhaps the team id in game is different from the dino->TargetingTeamField()!
Avatar
In fact wild team id are between 0-10000 iirc (edited)
Avatar
that would explain the many teams id i am looking at!
Avatar
You also have APrimalDinoCharacter::BPIsTamed too, will return false on wild
Avatar
Hello Pelayori! We meed again! 😮
12:48 AM
thanks for the help once again!
Avatar
No worries, I hang around here to help people
Avatar
Hello, I am in need enlightenment. I am trying to make a list of all players spawn points to put on Safezones plugin, I did that on Extinction map and took a few hours, so naturally I thought I should make a plugin to record the position of the player death and safe it to a file or log. So far o got this: void outPos(AShooterPlayerController* spc, FString* cmd, bool /**/) { if (spc) { FVector pos = spc->DefaultActorLocationField(); FString aaa = pos.ToString(); Log::GetLog()->info("Player position ({})", pos.ToString()); } } When the player type /outPos it should output to the screen, but my knowledge of c++ is limited and I cant figure out how to get the FString to the Log::GetLog()->info function. I keep getting the error “Cannot format argument. To enable the use of ostream operator<< include fmt/ostream.h. Otherwise provide an overload of format_arg.” Any tips on how to proceed, is greatly appreciated
Avatar
You must provide std::string or TCHAR array. you can pass aaa.ToString()
2:07 PM
And to get player location you might want to use spc->GetPlayerCharacter()->RootComponentField()->RelativeLocationField()
Avatar
I cant believe I was putting pos.toString() 😮
Avatar
Avatar
Pelayori
You must provide std::string or TCHAR array. you can pass aaa.ToString()
it worked. many thanks!
Avatar
No worries
Avatar
Hello again, when my plugin crashes, the server stops
6:29 PM
is there anyway to prevent that from happening ?
Avatar
SublimeStyle 12/12/2020 6:39 PM
It’s hard to say without a closer look. At a basic level, that’s what exceptions are for, but the engine is complex and it’s possible handling a particular exception will still cause the server to crash. I would start by figuring out where it’s crashing at and you can isolate the issue. Something like trying to access a null pointer should resolve itself just fine within a try/catch; just be mindful of performance.
Avatar
in this new update, everything is crashing, i was wandering if it would be possible prevent at least the plugins from crashing
6:49 PM
thanks!
Avatar
ran out of memory allocating 1015808 bytes with alignment 0. I think that might be the problem 😅
Avatar
SublimeStyle 12/12/2020 7:03 PM
Sounds like it could be a memory leak. Something like this could happen when, for example, building a large dataset in which each item is a pointer in memory. Check to make sure you’re properly de-allocating your dynamic memory/variables.
Avatar
that might be a problem. I don't know how!
7:09 PM
but i will figure out, i hope. Thanks for the help!
Avatar
SublimeStyle 12/12/2020 7:13 PM
Start with a stack trace- it should popup a huge paragraph of text/code with line numbers (when the server crashes), you should be able to see within your plugin at what line it failed. I believe there are crash logs that you can access as well but not as familiar with that. I'm pretty oldschool and not as familiar with UE4 so I would suggest looking at how UE4 allocates/de-allocates memory and what class(es) you could use to help with that. But for good ol' C++ pointers/concepts, this youtuber is amazing (got me through my degree lol): https://www.youtube.com/watch?v=Fa6S8Pz924k
Avatar
i looks nice. i will give it a try. Thanks!
👍 1
Avatar
jraServerAPI 12/30/2020 7:05 AM
Hello 🙂 Is there a function in the Api that returns the current player count? (edited)
Avatar
jraServerAPI 12/30/2020 7:55 AM
hmm i think i found it... int playerCount = ArkApi::GetApiUtils().GetShooterGameMode()->GetNumPlayers(); Will this return just the online player count or all players regardless of state?
Avatar
It actually calls this function directly: int GetNumPlayers() { return NativeCall<int>(this, "AGameMode.GetNumPlayers"); } I would say yes, but best way to get answers is just to log it!
Avatar
jraServerAPI 12/31/2020 11:23 PM
Yes, it returns the online player count 👍
Avatar
Good day guys, i'm new, where can I find the documentation?
Avatar
Avatar
DragoKing
Good day guys, i'm new, where can I find the documentation?
I think there is nothing really like that unfortunately
Avatar
hey guys, is there something similar to javascript's Map().join() in c++?
6:44 AM
or am i better off just using JSON
6:45 AM
i'm trying to store all tribe members in a database, sorted by their tribe id, and my plan was to store the members by their character id in either one long string or a JSON object
Avatar
I need to serialize character inventory data and send it to my webserver. But to understand the structure and understand without a description is difficult. If anyone can help, I will be grateful.
Avatar
Deleted User 1/15/2021 6:55 AM
hi i downloaded the Ark Api Hook Generator but get a error could not create ssl/tls when opening the program can leave me a message of how to get it to work
Avatar
Deleted User 1/15/2021 7:11 AM
yes me too. Probably because of the github ssl version update. You need api hook generator rebuild.
7:12 AM
I have received the source and rebuilt it and am using it
7:12 AM
Tools i have made to make stuff a heck of a lot easier. - ownprox/Tools
👍 1
Avatar
Deleted User 1/17/2021 1:46 AM
can i ask how do u rebuild the source code i am very new only messed with Jason configs
Avatar
Deleted User 1/17/2021 5:00 AM
I opened and compiled the project in the visual studio 2019 community.
5:00 AM
There is nothing special.
Avatar
Deleted User 1/19/2021 12:58 AM
ok i will give it a go thanx
Avatar
Deleted User 1/20/2021 7:06 AM
hi i still get same message even after source code rebuild
7:06 AM
Avatar
Дивоглюк 1/21/2021 7:14 AM
is it possible to somehow disable configs that turn off the lighting, shadows, leafage?
Avatar
hiii (edited)
7:22 PM
i'm fully new to ark pc and linux servers
7:22 PM
is there a way i can setup multiple servers on 1 machine?
7:22 PM
but all use the same code?
Avatar
SublimeStyle 1/26/2021 7:54 PM
that's how most, if not all, hosts do it for clusters... they just run them on separate ports (edited)
Avatar
well i just figured out
8:01 PM
ARK api needs windows
8:01 PM
Rip my work for 2 days 😭
3:12 PM
just host it on windows, even the dedicated running more smooth on windows
Avatar
SolaoBajiuik 2/3/2021 11:13 PM
I'm just starting on ArkAPI Development for Plugins. I'm thumbing through the calls in VisualStudio right now, but hoping someone can assist me faster here. What's the call to get a players exact location?
Avatar
SolaoBajiuik 2/4/2021 12:11 AM
Think it is FVector Location = player->GetPlayerCharacter()->RootComponentField()->RelativeLocationField();
12:11 AM
But, how trying to figure out distance between 2 locations
Avatar
SublimeStyle 2/4/2021 12:21 AM
there might be a util function for this, but there are offsets you have to apply to get the 100x100 coordinate values
Avatar
SolaoBajiuik 2/4/2021 12:23 AM
Thanks @SublimeStyle
👍 1
Avatar
Avatar
SolaoBajiuik
But, how trying to figure out distance between 2 locations
If you want to calculate the distance between 2 points, do something like: FMath::Abs((vector1 - vector2).Size())
8:05 AM
It will get you the distance in unreal units
Avatar
SolaoBajiuik 2/4/2021 1:29 PM
I used FVector::Distance(location1, location2) to get the distance (edited)
Avatar
Ohh didn't know that was a thing (edited)
Avatar
Hello. When i use AActor* actor = primal_character->GetAimedActor and the player is dead ou on thw spawn screen it crashes the server
6:38 PM
is there anyway to check to prevent the crash?
Avatar
check if primal_character is nullptr
6:40 PM
@Uaca
Avatar
ok. im going to learn how to do~it, thank you!
Avatar
just do if (primal_character) (edited)
7:19 PM
or if (primal_character != nullptr)
Avatar
Hello, Can someone tell me how can I debug the code ? I mean, in other language, we can execute directly from the IDE or somewhere else and use breakpoints or other things like that to check objects etc... But here, I'm a little lost because I don't know how I can debug correctly ? If someone have some tips for that. Thank you in advance
Avatar
Avatar
Neka
Hello, Can someone tell me how can I debug the code ? I mean, in other language, we can execute directly from the IDE or somewhere else and use breakpoints or other things like that to check objects etc... But here, I'm a little lost because I don't know how I can debug correctly ? If someone have some tips for that. Thank you in advance
SublimeStyle 2/7/2021 9:43 PM
Discover how to attach the Visual Studio debugger to a running process on a local or remote computer.
Avatar
@SublimeStyle Thank you very much 🙂
👍 1
Avatar
SolaoBajiuik 2/8/2021 10:40 PM
Is there a safe way to save FVector to a json file and use it later, or would i need to setup some conversion process ?
Avatar
You could just store X Y Z in a json array, and with that array initialize another FVector from constructor when needed
Avatar
SolaoBajiuik 2/8/2021 10:56 PM
Is there technical documentation for the API that I can read through ?
10:56 PM
Trying to find how to split the player->GetPlayerCharacter()->RootComponentField()->RelativeLocationField() nowinto XYZ
Avatar
not really however most functions in the game are from UE directly so most likely you can just google the function itself
Avatar
SolaoBajiuik 2/8/2021 10:57 PM
K.. Thanks 🙂
Avatar
Nvm that was too long lol
11:00 PM
You can do FVector.X for the components
Avatar
SolaoBajiuik 2/8/2021 11:00 PM
Now to find out how to get it BACK to an fVector so I can use FVector::Distance
Avatar
FVector(float x, float y, float z)
11:00 PM
That's the constructor
Avatar
SolaoBajiuik 2/8/2021 11:00 PM
Noice.. Thanks 🙂
Avatar
Well, one of them
Avatar
SolaoBajiuik 2/8/2021 11:22 PM
Sorry about all the questions. I haven't done c++ in... almost a decade..
11:22 PM
11:22 PM
I'm seeing that. Attempting to figure out why.
Avatar
You need to add a reference to the function with &funcName
Avatar
SolaoBajiuik 2/9/2021 12:18 AM
Is it possible to use cSharp instead of cpp ?
Avatar
SolaoBajiuik 2/9/2021 12:35 AM
Apparently, I'm really rusty
Avatar
SolaoBajiuik 2/9/2021 1:10 AM
Anyone see 1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\xtree(1458): message : see reference to function template instantiation 'std::_Tree_find_result<std::_Tree_node<std::pair<const StringType,nlohmann::basic_json<std::map,std::vector,StringType,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer>>,std::_Default_allocator_traits<_Alloc>::void_pointer> *> std::_Tree<std::_Tmap_traits<_Kty,_Ty,_Pr,_Alloc,false>>::_Find_lower_bound<_Other>(const _Keyty &) const' being compiled 1> with 1> [ 1> StringType=std::string, 1> _Alloc=std::allocator<std::pair<const std::string,nlohmann::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer>>>, 1> _Kty=std::string, 1> _Ty=nlohmann::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer>, 1> _Pr=nlohmann::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer>::object_comparator_t, 1> _Other=SIZE_T, 1> _Keyty=SIZE_T 1> ] When saving from a json variable to an ofstream file ?
Avatar
SolaoBajiuik 2/9/2021 11:41 PM
Got it compiling now. But when in game, we see all of the logs, but the command doesn't actually work.
11:41 PM
Even before a reload.
11:42 PM
I started with @SublimeStyle 's template (edited)
Avatar
Hi, sorry to bother. I am pretty new to this all but am looking at plugins for an ark server. My main problem is, I am using nitrado for hosting for now and I have no idea if arkapi even works with nitrado? I will look at the guides in a bit but not sure if they're applicable because I'm not self hosting 🙂
Avatar
@Azarela nitrado doesn't support the API
2:01 PM
@SolaoBajiuik hard to say without seeing your implementation of your command
Avatar
Sad times 😦 Thank you for that. Do you know if any of the server hosting services do support API? @WETBATMAN
Avatar
https://serverblend.com/ is ArkServerAPI's official partner
Server hosting services in Europe, USA and Canada. Start your own game server or Teamspeak 3 server with world class server hosting at an unbeatable price.
Avatar
Thank you 🙂
Avatar
SolaoBajiuik 2/10/2021 8:48 PM
@WETBATMAN I am thinking it might be because I'm trying to do arguments. /mtape start /mtape stop (edited)
8:48 PM
and i'm not doing something right for the argument processing
Avatar
how do you load the command ?
Avatar
SolaoBajiuik 2/10/2021 8:58 PM
COMMANDS.AddConsoleCommand("mtape", ChatCommand); (edited)
8:59 PM
using the template he pushed up so COMMANDS is a macro for ArkApi::GetCommands()
Avatar
that's a console command
9:16 PM
it would be cheat mtape
9:16 PM
in admin console
9:17 PM
if you want a chat command
9:17 PM
you need AddChatCommand
Avatar
SolaoBajiuik 2/10/2021 10:59 PM
Ahhhh. K. Thanks :)
Avatar
Hello, What is the best way to change the value of health / torpor / etc... from a character please ? I'm using the Hook_APrimalCharacter_TakeDamage but when I try to use the function SetHealth (from _this who is APrimalCharacter), it simply doesn't work. Is there another way to set those stats ? Thank you in advance
Avatar
Avatar
Neka
Hello, What is the best way to change the value of health / torpor / etc... from a character please ? I'm using the Hook_APrimalCharacter_TakeDamage but when I try to use the function SetHealth (from _this who is APrimalCharacter), it simply doesn't work. Is there another way to set those stats ? Thank you in advance
You can get the PrimalStatusComponent, and it has functions to set hp, stam, etc...
Avatar
Avatar
Pelayori
You can get the PrimalStatusComponent, and it has functions to set hp, stam, etc...
Thank you for your answer. I'm going to test that 🙂
Avatar
void GivePlayerStat(AShooterCharacter* Char, EPrimalCharacterStatusValue::Type Stat, float AmountToGive) { if (Char && Char->MyCharacterStatusComponentField() && AmountToGive > 0) { UPrimalCharacterStatusComponent* Comp = Char->MyCharacterStatusComponentField(); float CurrentStat = Comp->BPGetCurrentStatusValue(Stat); float MaxStat = Comp->BPGetMaxStatusValue(Stat); float NewStat; if (CurrentStat + AmountToGive >= MaxStat) NewStat = MaxStat; else NewStat = CurrentStat + AmountToGive; Comp->BPDirectSetCurrentStatusValue(Stat, NewStat); Comp->ServerSyncReplicatedValues(); } }
Avatar
Is there any documentation about the arkapi?
Avatar
is there any example of how to use the permission plugin from my plugin?
Avatar
Avatar
Uaca
is there any example of how to use the permission plugin from my plugin?
ok. i did not realize that the ArkShop is an example
Avatar
Is there an Ark API plugin that can force same tribe across all servers?
Avatar
Avatar
Azarela
Is there an Ark API plugin that can force same tribe across all servers?
Yes, it is called TribeEnforcer
Avatar
Ah ty ❤️ @Pelayori
Avatar
hello again!
4:47 PM
wild guess here, but would it be possible using plugins to make a player mount any dino?
Avatar
Hello again, i would like to make a rest call
6:51 PM
i figure it out how to use the API::Requests::Get().CreateGetRequest
6:52 PM
but does not work from the Load function while the plugin is loading
6:54 PM
any tips on how to call a request as soon as the plugin finished load is very much appreciated
Avatar
maybe, it would be the hook Hook_UEngine_IsInitialized ?
Avatar
Avatar
Uaca
maybe, it would be the hook Hook_UEngine_IsInitialized ?
If you want to get when the server is fully started, Hook AShooterGameMode::InitGame
Avatar
Avatar
Pelayori
If you want to get when the server is fully started, Hook AShooterGameMode::InitGame
thank you very much!
🤟 1
Avatar
the hook AShooterGameMode::InitGame does no fire when using plugins.load from rcon
1:33 AM
is there any other hook i can use from when the plug in is loaded from rcon? (edited)
Avatar
I'm looking to make a plugin that will listen for when a player kills a boss dinosaur in the standard Ark arena or via open world spawn. I figure to do this I need to find the hook for when a Dino dies and check it's name against the list of bosses. Can anyone help me find the hook I need? I'm super new to this and appreciate any help.
Avatar
Avatar
Ashton
I'm looking to make a plugin that will listen for when a player kills a boss dinosaur in the standard Ark arena or via open world spawn. I figure to do this I need to find the hook for when a Dino dies and check it's name against the list of bosses. Can anyone help me find the hook I need? I'm super new to this and appreciate any help.
Server Api Creator Tool Source Overview: this tool allows you to quickly generate hooks for in game server functions saving you a lot of time of having to lookup the argument's / structure's / class's manually. Features: Ark & Atlas Api...
1:38 PM
very nice to search the hook, also use the Michidu plugins to search for examples (edited)
Avatar
Avatar
Uaca
the hook AShooterGameMode::InitGame does no fire when using plugins.load from rcon
if (ArkApi::GetApiUtils().GetStatus() == ArkApi::ServerStatus::Ready)
1:41 PM
you can check if server is started like this
1:42 PM
so then you can do whatever you wanted to do on load
Avatar
i see, thanks!
Avatar
on the arkshop source code is has a few log for the sqlite database:
4:02 PM
Log::GetLog()->error("({} {}) Unexpected DB error {}", FILE, FUNCTION, exception.what());
4:02 PM
i cant find where this log is stored.
4:02 PM
does anyone have a clue or know where i can find this info?
Avatar
ShooterGame\Binaries\Win64\logs
4:03 PM
Everything Log::GetLog() does will be in the API logs.
Avatar
since it is not writing any messages, my code must be wrong before the sqlite function. Thanks!
Avatar
DigitalVagrant 3/9/2021 6:54 AM
quick question from a nooblet to ARK plugins; I've got an SQL server set up and finally connecting to plugins, but the default Permissions plugin is shooting me an error message that it can't add player (it's just me on my test server). Any likely causes?
Avatar
Grab the latest beta version from Lethal, and it should work
Avatar
hey guys, if I were to try to create my own plugins (not new to coding/basic c++ knowledge, but completely new to plugin stuff), where would I start? Honestly I am completely lost 😄 is there some red line to follow somewhere? A guide, do's and don'ts? Some documentation I can't find? Thanks in advance!
Avatar
take an existing project and start messing around. thats what i do lol
2:14 AM
there is a template out there somewhere too. i think one of these channels links it
Avatar
Ok yes I have been trying to do that but some stuff isn't yet making sense to me 😅 guess I'll keep digging around
Avatar
Hi, I was having a look at MAGA PVP Cooldown System and ORP. Does anyone have any experience with it? And is it worth a try? I currently am using the PVPCooldowns 2.16 but we're having an issue with people popcorning.
Avatar
Avatar
Azarela
Hi, I was having a look at MAGA PVP Cooldown System and ORP. Does anyone have any experience with it? And is it worth a try? I currently am using the PVPCooldowns 2.16 but we're having an issue with people popcorning.
If you have an issue try reporting it and describe the issue as thoroughly as possible to Lethal in his discord. This is kind of the wrong forum.
Avatar
Ah thanks 🙂 I will do that!
Avatar
Avatar
Azarela
Ah thanks 🙂 I will do that!
Or maybe update to a version that isn't 8 months old 🙂 (edited)
rooWut1 1
2:31 PM
Also popcorning (old version/config may have popcorn listed for pvp) is only for raids which you need LethalORP for detection of the Raid CD. Running the latest version of most plugins is always advised.
Avatar
Thanks for that. I am running both on new version but after I sent the message I was looking into the Lethal ORP and realised that due to people not actually using it, it wasn't proccing the raid detection (derp). So this is what i'm looking into atm 🙂
👍 1
Avatar
🐺LiamMcIntyre!🦄 3/14/2021 12:09 AM
I completely understand this is a noob question, but I'm just really starting to look into plugin development out of interest 😅 Trying to gain an understanding from open source work . . . For this example I'm looking into how the Suicide plugin works, and how its linked to Permissions I have read through the guide in #【🔶】ᴘʟᴜɢɪɴ-ᴛᴜᴛꜱ and my understanding was I would link it in Linker -> Additional Library Directories But no matter what I do, it cannot open source file "Permissions.h" Does anyone know why that might be? (edited)
Avatar
Avatar
🐺LiamMcIntyre!🦄
I completely understand this is a noob question, but I'm just really starting to look into plugin development out of interest 😅 Trying to gain an understanding from open source work . . . For this example I'm looking into how the Suicide plugin works, and how its linked to Permissions I have read through the guide in #【🔶】ᴘʟᴜɢɪɴ-ᴛᴜᴛꜱ and my understanding was I would link it in Linker -> Additional Library Directories But no matter what I do, it cannot open source file "Permissions.h" Does anyone know why that might be? (edited)
For linking permissions you need to include the permissions header, "ArkPermissions.h" (also add the header directory to C++ -> General and there additional include directories Then you will need to go to Linker-> Additional Library directories for including the directory of Permissions.lib And in your code #pragma comment(lib, "Permissions.lib")
12:14 AM
Permissions header name file has changed over time, if I recall correctly. That's why some plugins have Permissions.h, probably before Atlas came out
Avatar
🐺LiamMcIntyre!🦄 3/14/2021 12:15 AM
Yeah, I noticed the open source permissions had ArkPermissions so had messed about with re-naming a little both in the code and the actual file name But I will try the other things you mentioned too and see if that clears my error, thank you 😊
Avatar
Yeah, you need to include the header and link the lib with the pragma comment
12:16 AM
Same applies to base ark api, you need to include its header and pragma comment ArkApi.lib
12:17 AM
Otherwise you will end up with unresolved externals
Avatar
🐺LiamMcIntyre!🦄 3/14/2021 12:25 AM
You are a star, thank you Pelayori 💙
Avatar
🐺LiamMcIntyre!🦄 3/15/2021 8:12 PM
Me again . . . with probably another daft question 😁 So just trying to gain basic understanding of the process I should be following, I tried using WETBATMAN's Suicide plugin for the example below(also tried a couple others) and I keep getting this error when attempting to build, the issue doesn't seem to be with the plugin but with the api file, any ideas? 1>Suicide.cpp 1>C:\******\ARK-Server-API-master\version\Core\Public\API\UE\Templates\Tuple.h(409,121): error C2760: syntax error: unexpected token ')', expected 'expression' 1>C:\******\ARK-Server-API-master\version\Core\Public\API\UE\Templates\Tuple.h(455): message : see reference to class template instantiation 'UE4Tuple_Private::TTupleImpl<TIntegerSequence<uint32,Indices...>,Types...>' being compiled 1>C:\******\ARK-Server-API-master\version\Core\Public\API\UE\Templates\Tuple.h(419,94): error C2760: syntax error: unexpected token ')', expected 'expression' 1>Done building project "Suicide.vcxproj" -- FAILED.
Avatar
Newest visual studio release breaks compiling.
8:57 PM
Change this at the top of Tuple.h //#if defined(_MSC_VER) && !defined(__INTEL_COMPILER) // #define USE_TUPLE_AUTO_RETURN_TYPES (PLATFORM_COMPILER_HAS_AUTO_RETURN_TYPES && USING_CODE_ANALYSIS) //#else #define USE_TUPLE_AUTO_RETURN_TYPES 1 //#endif
💙 3
Avatar
thank you so much, I'm having the same issue
Avatar
How can I start my code in C ++?
Avatar
Someone has the most up-to-date shop with new functions, whoever I have I buy.
Avatar
do you mean arkshop?
Avatar
He is talking about a ideas and suggestion that doesn't exist yet. There is some function in the Rework (Unstable version) But in the official ARK Shop these function is not yet applied, and he want to have a build with several functions. But there is no such thing yet, not even to "buy".
3:17 PM
Will update the Official ArkShop among other fixes with some soon, but not all those functions (edited)
Avatar
someone asked me the same thing, i guess everyone wants some new functions on arkshop
Avatar
Exactly, it is not just me, I have other friends who ask if there is any more updated shop, but there is only the official free, but there are some things missing in it that could go on later.
Avatar
Well the way you are expecting it to be there is quite interesting
Avatar
Yes, if I saw many things from those suggestions, I believe that shop will be even more complete.
Avatar
Yeah, we will most likely see some more functions in the future 🙂 (edited)
Avatar
Let's wait
Avatar
jraServerAPI 4/5/2021 3:16 AM
I'm trying to prevent players from leaving tribe once they join join. The code below only seems to prevent a player from being kicked (via the kick button), however they can still leave on their own. (via the leave tribe button) Is there anyway to keep 'em in the tribe forever? 😂 c++ void Hook_AShooterGameMode_RemovePlayerFromTribe(AShooterGameMode* _this, unsigned __int64 TribeID, unsigned __int64 PlayerDataID, bool bDontUpdatePlayerState) { bool bCanNeverLeaveTribe = config["General"].value("LifetimeTribeMembership", false); if (bCanNeverLeaveTribe) { Log::GetLog()->info("CannotRemovePlayerFromTribe"); return; } AShooterGameMode_RemovePlayerFromTribe_original(_this, TribeID, PlayerDataID, bDontUpdatePlayerState); }
Avatar
substitute 4/5/2021 4:08 AM
@jraServerAPI there is one way I can think
4:08 AM
with debugger
4:08 AM
when you leave tribe, your targeting team id is changed (edited)
4:09 AM
you can use Cheat Engine and find your targeting team address (I would log this value with a plugin) and attach the debugger
4:09 AM
and select break-point on write
4:10 AM
then when that changes, you will have the call stack at that instant and you can backtrace to see what function you need to hook.
4:10 AM
There's also a function from the player side to request to leave a tribe....so you could just hook that and block it 😉
4:10 AM
both options should work.
Avatar
void Hook_AShooterPlayerState_ServerRequestLeaveTribe_Implementation(AShooterPlayerState* _this) { AShooterPlayerState_ServerRequestLeaveTribe_Implementation_original(_this); }
4:11 AM
Sadly it's a void 😛
Avatar
Avatar
Foppa
void Hook_AShooterPlayerState_ServerRequestLeaveTribe_Implementation(AShooterPlayerState* _this) { AShooterPlayerState_ServerRequestLeaveTribe_Implementation_original(_this); }
substitute 4/5/2021 4:20 AM
void doesn't cause a problem
4:20 AM
just return without calling the original
4:21 AM
void Hook_AShooterPlayerState_ServerRequestLeaveTribe_Implementation(AShooterPlayerState* _this) { return; }
Avatar
jraServerAPI 4/5/2021 4:38 AM
hmm I see there are two versions of the Hooks and I've been using the version without the "implementation" at the end... What is the difference? It looks like I may be doing it wrong 🤦‍♂️
4:40 AM
(i noticed because you both posted Implementation responses lol) (edited)
Avatar
jraServerAPI 4/5/2021 4:57 AM
🤦‍♂️
4:58 AM
thank you guys 🙂 it's working now, using the Implementation hook instead. (edited)
4:58 AM
So what is the golden rule? Always use the implementation hook? or is it hit or miss?
Avatar
Fake it until you make it?
😂 2
12:55 PM
😄
Avatar
Avatar
jraServerAPI
So what is the golden rule? Always use the implementation hook? or is it hit or miss?
hooks that have implementation in their name specify that that function has a client and server variant
👍 1
1:25 PM
most of the time the hook that doesn't have implementation is the server one
1:25 PM
however in some cases it's reverse
1:32 PM
if you look at the function name it has ServerRequest, which means it gets called from the client first, then you can logically deduce that the function with Implementation is the one that gets called on the server and it's the function you need to hook 😄
Avatar
jraServerAPI 4/5/2021 3:46 PM
Thank you all!
Avatar
Anyone knows how to get the current region name from Atlas ?
4:38 PM
I manage to get the grid's server name from FSeamlessServerInfo
Avatar
But haven't found yet a solution on getting the region without making a function from grid x/y
Avatar
Avatar
Foppa
But haven't found yet a solution on getting the region without making a function from grid x/y
I do 🙂 hmu
Avatar
i made a function of it instead 😛 (edited)
👍 1
Avatar
@Foppa
9:57 PM
Current grid is two shorts packed as an int
9:58 PM
Under something like aws id in query info
Avatar
DigitalVagrant 4/24/2021 12:56 AM
Still having difficulty with Permissions plugin throwing the "can't add player" error. Any advice?
Avatar
Avatar
DigitalVagrant
Still having difficulty with Permissions plugin throwing the "can't add player" error. Any advice?
jraServerAPI 4/24/2021 5:16 PM
are you using mysql?
Avatar
DigitalVagrant 4/24/2021 5:17 PM
Mariadb atm.
5:17 PM
...I'm not the one who chose that one. Please tell me it's not incompatible.
Avatar
jraServerAPI 4/24/2021 5:18 PM
5:19 PM
only 2 db's are supported.. sqlite requires nothing for you to do.. but Permissions will be map based only (edited)
5:19 PM
install mysql community server (free) on your machine and you can use mysql and have Permissions cluster wide (edited)
5:21 PM
you would need to setup mysql properly also..
Avatar
DigitalVagrant 4/24/2021 5:22 PM
Faaaaaaark
5:22 PM
That'd be it then
5:23 PM
A lot of other plugins are compatible with mariadb
5:23 PM
But if permissions isn't, then fair enough
Avatar
maria is mysql just not the official version
Avatar
DigitalVagrant 4/24/2021 9:33 PM
@Lethal oh, so it should be alright then?
Avatar
Foppa uses MariaDB
Avatar
MariaDB is to recommend imao
Avatar
I have someplug in source code which is hard-coded with !player->bIsAdmin - preventing blocks running for non-admin users (who have permissions to run the cheat <command>), if I remove the references to these blocks does it mean that non-admins will be able to run these code blocks as a result if they have cheat.command permissions ?
Avatar
A New Home 5/5/2021 2:57 PM
I'm trying to rebuild the mutes plugin - I've solved most of the issues install and what not - but trying to compile it - I'm hit by one error - any clues how to fix this, so I can get the original source code to finish compiling in my enviroment?
Avatar
Avatar
A New Home
I'm trying to rebuild the mutes plugin - I've solved most of the issues install and what not - but trying to compile it - I'm hit by one error - any clues how to fix this, so I can get the original source code to finish compiling in my enviroment?
Try casting szitem["Word"] to std::string
Avatar
A New Home 5/5/2021 3:05 PM
Thank you that worked.
Avatar
you can also just do .get<std::string>()
3:36 PM
instead of casting
Avatar
A New Home 5/5/2021 3:57 PM
Well.. I've managed to fix the Mutes plugin so that it can run certain commands now without doing the admin check so it integrates with the admins permissions plugin, so I would say that its been a very successful day so far and I now have a DLL which works and I dont need to give my Moderators full admin permissions. Thank you all for your help.
Avatar
NeO_Anderson 5/5/2021 8:43 PM
hi guys, im new to plugin development and haven't used C++ in many years. I'm hoping to try to fix the ArkHomes plugin to not crash the server as it's currently doing. how might I send a console message? that would be logged in the ark servers loggs?
8:46 PM
o nvm may have figured that out XD
Avatar
Avatar
NeO_Anderson
hi guys, im new to plugin development and haven't used C++ in many years. I'm hoping to try to fix the ArkHomes plugin to not crash the server as it's currently doing. how might I send a console message? that would be logged in the ark servers loggs?
If you want API-style logs (those that print like [PluginName][info] This is my message), then use Log::GetLog()->info, but make sure to init it first. Init can be done on plugin's Load() function `Log::Get().Init("PluginName"); Other way is using the ark's integrated logs, that you can use from AShooterGameMode::PrintToServerGameLog or PrintToGameplayLog (both of these need -servergamelog in the server launch args)
Avatar
NeO_Anderson 5/5/2021 10:57 PM
ok thanks, I saw another mention of the Log:: inside the ArkHomes plugin so I assumed that was the way to do it. its loading now so we see what happens
10:58 PM
really sad this plugin crashes, its very useful
Avatar
A New Home 5/6/2021 3:13 AM
Does anyone know of a simple method I can get all tribes and last login dates for that tribe - so I can export it to the logs?
Avatar
Avatar
A New Home
Does anyone know of a simple method I can get all tribes and last login dates for that tribe - so I can export it to the logs?
you're barking up a tree of insanity
10:22 AM
that information isn't loaded if the tribe is offline
Avatar
Avatar
A New Home
Does anyone know of a simple method I can get all tribes and last login dates for that tribe - so I can export it to the logs?
if you know the tribeID you can use GetOrLoadTribeData
2:05 PM
FTribeData* CreatedTribeData = static_cast<FTribeData*>(FMemory::Malloc(0x200)); RtlSecureZeroMemory(CreatedTribeData, 0x200); ArkApi::GetApiUtils().GetShooterGameMode()->GetOrLoadTribeData(CreatedTribeID, CreatedTribeData); FMemory::Free(CreatedTribeData);
2:05 PM
replace CreatedTribeID with the tribe id of your choice
2:06 PM
cache the results, because this function leaks memory, don't call it alot
2:08 PM
and ofc call FMemory::Free after you're extracted the info you need not immediately after GetOrLoadTribeData 😄
Avatar
A New Home 5/6/2021 2:10 PM
Thank you that makes sense, I'm assuming that you can only get the online tribeIds rather than find all tribeIDs with a plugin?
Avatar
there should be a way to get all tribes online and offline
Avatar
Avatar
WETBATMAN
cache the results, because this function leaks memory, don't call it alot
substitute 5/6/2021 7:05 PM
You know what, I might attach Valgrind or something to the API
7:05 PM
I want to know why that function leaks memory and if it can hotpatched to NOT leak
💯 2
Avatar
jraServerAPI 5/7/2021 4:12 AM
Using Hook_APrimalDinoCharacter_Die what is the best method to determine if the dino that just died was an alpha? a titan, or a boss? c++ bool Hook_APrimalDinoCharacter_Die(APrimalDinoCharacter* _this, float KillingDamage, FDamageEvent* DamageEvent, AController* Killer, AActor* DamageCauser) { return APrimalDinoCharacter_Die_original(_this, KillingDamage, DamageEvent, Killer, DamageCauser); } thank you in advance
Avatar
jraServerAPI 5/7/2021 9:15 AM
Answer c++ FString myDescriptiveName = _this->DescriptiveNameField(); (edited)
Avatar
@Lethal @WETBATMAN I think I know what the memory leak for that function is
10:20 AM
it's a different function it calls when the data isn't already loaded.
10:20 AM
10:20 AM
this v233 pointer is constructed but is never free'ed before returning
Avatar
a similar function that reads user data returns the pointer created from NewObject while LoadTribeData only returns true/false since you pass in a buffer.
Avatar
Ya, that is part of the code where it reads the physical tribe data file from disk.
Avatar
Avatar
Lethal
Ya, that is part of the code where it reads the physical tribe data file from disk.
substitute 5/7/2021 4:36 PM
I sent my findings to Wildcard so hopefully they’ll add a free
4:37 PM
The heap object is used for the deserialization but they only copy a field from that into the passed in buffer
4:37 PM
The object can safety be deleted after you get a copy of this buffer
Avatar
Ah, nice. I'd be interested if they actually confirm they fix it back to you.
Avatar
NeO_Anderson 5/7/2021 4:53 PM
?map
4:53 PM
>map
4:54 PM
whats the command for that interactive map again please?
4:54 PM
oh nvm, wrong discord haha xD
Avatar
maps.google.com
Avatar
A New Home 5/7/2021 8:09 PM
Thank you for investigating that memory leak
Avatar
I'm trying to post a resource to the API site - I'm only getting the ability to post to Atlas instead of ARK , any ideas on how to fix this?
Avatar
Avatar
A New Home
I'm trying to post a resource to the API site - I'm only getting the ability to post to Atlas instead of ARK , any ideas on how to fix this?
You need to be approved as a developer first.
Avatar
Oh I see - I have prob 20 years coding experience across a number of different languages, my first language was pascal 😄
Avatar
hey guys, I have a couple of questions regarding the server API plugin. 1. I am trying to make my own ark plugin, but i can't seem to find what extentions i should use for the plugin to be compatible with the ark server API. 2. I am using visual studio code for the plugin. are there any specific settings that i should do before i start making my plugin? 3. I also am a bit of a newbie in coding. So i am wondering one more thing before i can start. How can i get information out of ark. For example the amount of experienced gained in game to use the number for a points system. Thank you for reading this and even more thanks for any possible response 🙂 Ps: Please don't mind my bad english xD
Avatar
Avatar
kevinvanb
hey guys, I have a couple of questions regarding the server API plugin. 1. I am trying to make my own ark plugin, but i can't seem to find what extentions i should use for the plugin to be compatible with the ark server API. 2. I am using visual studio code for the plugin. are there any specific settings that i should do before i start making my plugin? 3. I also am a bit of a newbie in coding. So i am wondering one more thing before i can start. How can i get information out of ark. For example the amount of experienced gained in game to use the number for a points system. Thank you for reading this and even more thanks for any possible response 🙂 Ps: Please don't mind my bad english xD
GSH | MrOwlSky 5/24/2021 7:14 PM
This guide is based on the Visual Studio Community 2019 version install Prerequisites: 1. https://visualstudio.microsoft.com/vs/ 2. https://github.com/Michidu/ARK-Server-API/archive/master.zip Step N1: Install Visual Studio by the link given on the first prerequisite. When the inst...
Avatar
❤️
7:21 PM
@GSH | MrOwlSky
Avatar
uint64 playerTribeId = player->TargetingTeamField(); const int dinoTribeId = dino->TargetingTeamField(); if (playerTribeId != dinoTribeId) <--- this line is crashing return;
2:09 AM
Hello, in the code above the if is crashing the server
2:09 AM
i cant figure out why would this crash when comparing values
Avatar
substitute 6/1/2021 2:30 AM
Really depends on a lot of things
2:30 AM
What’s the whole function look like
Avatar
void Imprint(AShooterPlayerController* player, FString* message, EChatSendMode::Type /*unused*/) { if (!player || !player->PlayerStateField() || ArkApi::IApiUtils::IsPlayerDead(player)) return; const uint64 steamid = ArkApi::IApiUtils::GetSteamIdFromController(player); uint64 playerTribeId = player->TargetingTeamField(); AActor* Actor = player->GetPlayerCharacter()->GetAimedActor(ECC_GameTraceChannel2, nullptr, 0.0, 0.0, nullptr, nullptr, false, false, false); if (Actor && Actor->IsA(APrimalDinoCharacter::GetPrivateStaticClass()) == false) { ArkApi::GetApiUtils().SendChatMessage(player, GetText("Sender"), *GetText("Invalid")); return; } APrimalDinoCharacter* dino = static_cast<APrimalDinoCharacter*>(Actor); const int dinoTribeId = dino->TargetingTeamField(); if (playerTribeId != dinoTribeId) { ArkApi::GetApiUtils().SendChatMessage(player, GetText("Sender"), *GetText("NotInTribe")); return; } .... } (edited)
3:13 AM
after that is just dino->UpdateImprintingQuality(1.0);
3:14 AM
maybe APrimalDinoCharacter* dino = static_cast<APrimalDinoCharacter*>(Actor); is not working as expected ?
Avatar
Atomicskullz 6/5/2021 7:42 PM
Anyone know why AShooterPlayerController_OnAddItemFinished isnt triggering? Other hooks work fine (edited)
7:42 PM
DECLARE_HOOK(AShooterPlayerController_OnAddItemFinished, void, AShooterCharacter*, bool, TArray<unsigned __int64>, unsigned __int64); void Hook_AShooterPlayerController_OnAddItemFinished(AShooterCharacter* _this, bool bSuccess, TArray<unsigned __int64> SteamItemUserIds, unsigned __int64 SteamID) { const FLinearColor color{ 255, 255, 255, 255 }; ArkApi::GetApiUtils().SendServerMessageToAll(color, "[TEST]Player added item!"); } (edited)
7:43 PM
ArkApi::GetHooks().SetHook("AShooterPlayerController.OnAddItemFinished", &Hook_AShooterPlayerController_OnAddItemFinished, &AShooterPlayerController_OnAddItemFinished_original);
Avatar
Might never be called from the game
Avatar
Atomicskullz 6/6/2021 8:27 PM
ah ok
8:28 PM
btw is there anyway to print to the console?
Avatar
Avatar
Atomicskullz
btw is there anyway to print to the console?
Log::GetLog()->Info()
Avatar
Atomicskullz 6/6/2021 8:45 PM
epic, thanks
Avatar
Atomicskullz 6/6/2021 9:39 PM
unsure why this isnt functioning
9:39 PM
void CC_RunString(APlayerController* player_controller, FString* cmd, bool /*unused*/) { ArkApi::GetApiUtils().SendServerMessageToAll(FColorList::Blue, "Testing!"); if (cmd != nullptr && cmd->Len() > 0) luaL_dostring(CGELuaHandle::GetSingleton()->GetState(), cmd->ToString().c_str()); } void RegisterLuaConCommands() { auto& commands = ArkApi::GetCommands(); commands.AddConsoleCommand("lua_run", &CC_RunString); }
9:40 PM
when i run the console command the server message does not get sent
9:40 PM
and yes, RegisterLuaConCommands() is called elsewhere
Avatar
what are you typing in chat?
9:41 PM
oh nvm it's a console command
Avatar
Is that a LUA wrapper? :p
Avatar
Avatar
Atomicskullz
when i run the console command the server message does not get sent
Are you running it with cheat lua_run? (edited)
Avatar
Atomicskullz 6/6/2021 9:42 PM
no
9:42 PM
do i have to?
Avatar
You need cheat prefix in console always, otherwise they don't execute
Avatar
yes it's a console command
Avatar
Atomicskullz 6/6/2021 9:43 PM
oh damn
9:43 PM
there's no way around it?
Avatar
why'd you want a way around it?
9:43 PM
if you want a command for all players you can just add a chat command instead
Avatar
Atomicskullz 6/6/2021 9:43 PM
so you dont have to type "cheat"
9:43 PM
idm but i was just curious
Avatar
Avatar
Pelayori
Is that a LUA wrapper? :p
Atomicskullz 6/6/2021 9:44 PM
and yes, its my own lol
Avatar
Interesting, I used lua for fivem a few years ago (edited)
Avatar
only used lua to make some plugin for a csgo cheat 😄
Avatar
Avatar
Atomicskullz
so you dont have to type "cheat"
well whatever you type into the console is supposed to be a console command and i don't think it's gonna be sent to the server unless it's prefixed with cheat
Avatar
Avatar
WETBATMAN
Log::GetLog()->Info()
Atomicskullz 6/6/2021 11:11 PM
doesnt appear to be printing anything into the console
Avatar
Avatar
Atomicskullz
doesnt appear to be printing anything into the console
Did you Init the log? You need to add Log::Get().Init("PluginName"); at the plugin load function
Avatar
Atomicskullz 6/6/2021 11:12 PM
yep
Avatar
Atomicskullz 6/7/2021 2:26 PM
could someone tell me which one I should use if im inserting, removing, and accessing elements frequently? A or B?c++ // A typedef unordered_map<string, int> Sub; // possibly 30+ entries typedef unordered_map<string, Sub> Main; // possibly 30 or fewer // B typedef vector<tuple<string, int>> Sub; // possibly 30+ entries typedef unordered_map<string, Sub> Main; // possibly 30 or fewer (edited)
Avatar
Atomicskullz 6/10/2021 10:42 PM
would this be the correct way to add experience when given an AShooterCharacter* ?
10:42 PM
// m_pInstance is AShooterCharacter* auto ctrl = m_pInstance->GetCharacterController(); auto shooter_ctrl = static_cast<AShooterPlayerController*>(ctrl); shooter_ctrl->AddExperience(100, false, false);
10:44 PM
and how do i get the total experience a player has?
Avatar
jraServerAPI 6/11/2021 2:00 AM
That looks like it will work, although you may want to have the last argument true, otherwise I believe it will share the experience with the tribe mates in the area if you leave it false. (edited)
Avatar
Avatar
Atomicskullz
would this be the correct way to add experience when given an AShooterCharacter* ?
I would use the API, or take a look at the function: AShooterPlayerController* aspc = ArkApi::GetApiUtils().FindControllerFromCharacter(character); (edited)
Avatar
Avatar
Foppa
I would use the API, or take a look at the function: AShooterPlayerController* aspc = ArkApi::GetApiUtils().FindControllerFromCharacter(character); (edited)
that function takes O(n) time AShooterPlayerController* FindControllerFromCharacter(AShooterCharacter* character) const { AShooterPlayerController* result = nullptr; const auto& player_controllers = GetWorld()->PlayerControllerListField(); for (TWeakObjectPtr<APlayerController> player_controller : player_controllers) { auto* shooter_pc = static_cast<AShooterPlayerController*>(player_controller.Get()); if (shooter_pc->GetPlayerCharacter() == character) { result = shooter_pc; break; } } return result; } while that field should always have the player controller
10:13 AM
honestly we should probably update FindControllerFromCharacter to use the field if the field is non-null
Avatar
There's a few other issues in the helpers class
10:17 AM
FindControllerFromCharacter has null checks but GetSteamName does not for example
10:17 AM
nothing too horrible but def. inconsistent
10:17 AM
maybe this weekend I can spend some time to update the header
Avatar
@substitute I had updated it, but from tests it seemed to be unreliable
11:39 AM
AShooterPlayerController* FindControllerFromCharacter(AShooterCharacter* character) const { if (character) { AShooterPlayerController* result = (character->GetOwnerController() != nullptr) ? static_cast<AShooterPlayerController*>(character->GetOwnerController()) : static_cast<AShooterPlayerController*>(character->GetInstigatorController()); return result; } return nullptr; }
11:40 AM
Not sure if you have any idea on how to improve it, because it was crashing at GetOwnerController
Avatar
Avatar
Pelayori
Not sure if you have any idea on how to improve it, because it was crashing at GetOwnerController
had the very same issue actually
12:59 PM
GetOwnerController was working perfectly fine on my end but it crashed on someone else's server
Avatar
even tried the exact same server config on both machines
12:59 PM
mine always worked, the other always crashed idk why 😄
Avatar
I had pushed a PR with those changes but ended up closing it because of that unreliability to reproduce the crash
Avatar
Avatar
Pelayori
I had pushed a PR with those changes but ended up closing it because of that unreliability to reproduce the crash
Did we ever get the specific crash logs?
3:55 PM
I’m curious why that would happen
Avatar
No, but I can dig up for them
Avatar
Thanks
3:55 PM
Maybe it’s something with a mod
3:55 PM
Very curious
3:56 PM
That's the one I remember having
3:56 PM
It was from when I compiled permissions with that function I sent
3:57 PM
At the bottom when equipping an item, at the front one right after startup
3:57 PM
Quite old though
3:58 PM
@substitute
Avatar
Hm, yeah. Only thing I can think of off the top of my head is a race condition
Avatar
It had null check, but I can also remember some things I worked on where even though null check they were still passing and failing on getting something of said pointer
4:01 PM
So they weren't really null
10:53 PM
Super noob man here
10:53 PM
I wanna make it so that Argy's get the imprint speed buff like other dinos do
10:53 PM
This doable?
Avatar
Avatar
Pelayori
Click to see attachment 🖼️
The compress2 error is fixed with DumpAll i'm pretty sure which is why we need to just release the API with it enabled. I have been providing it that way in my early releases on my discord.
Avatar
Avatar
Lethal
The compress2 error is fixed with DumpAll i'm pretty sure which is why we need to just release the API with it enabled. I have been providing it that way in my early releases on my discord.
It’s like 3 extra seconds of start up for worlds more compatibility
4:54 AM
Dump all should be default
4:55 AM
(3 seconds of start up is nothing when the server takes 5 minutes to boot clowntrophy )
Avatar
Avatar
Lethal
The compress2 error is fixed with DumpAll i'm pretty sure which is why we need to just release the API with it enabled. I have been providing it that way in my early releases on my discord.
Ah great then. I guess APawn is not dumped by default then?
Avatar
Avatar
Pelayori
Ah great then. I guess APawn is not dumped by default then?
Ya, it's not in the default config.json.
Avatar
That would explain everything. Thank you very much. By that time I didn't have dumpall true. However I'll still ship pdbconfig files since even though official api will have it I'm sure someone will skip the new config.json
Avatar
actually API does dump APawn without DumpAll
2:21 PM
this is because when you specify a class/struct for pdbreader it dumps it and it's children
2:21 PM
APawn is child of AActor (which is dumped by default)
Avatar
But then why would it crash without dump all and then work with it enabled
Avatar
Atomicskullz 6/12/2021 3:16 PM
typedef std::tuple<const char*, int> CCEntry_t; typedef std::unique_ptr<CCEntry_t> CCEntryptr_t; typedef std::vector<CCEntryptr_t> CCVec_t; // contains the console commands along with their luareg index (edited)
3:16 PM
is this too complex for what I need to be done?
3:16 PM
i was thinking of doing an unordered_map with const char* as key and int as value
3:17 PM
but i was thinking of performance
3:17 PM
and the problem is that const char* isnt hashable, therefore it wont work correctly in a map (edited)
3:18 PM
so im unsure what to use (edited)
Avatar
Avatar
Atomicskullz
and the problem is that const char* isnt hashable, therefore it wont work correctly in a map (edited)
Std string
Avatar
Atomicskullz 6/12/2021 7:17 PM
yes ik
7:17 PM
but the performance
Avatar
Standard library strings are absolutely hashable (edited)
Avatar
Atomicskullz 6/12/2021 7:55 PM
i know that...
7:55 PM
im asking if its feasible for this
7:56 PM
compared to using find_if with strcmp if it were a vector (edited)
Avatar
Atomicskullz 6/13/2021 11:16 AM
Can anyone explain the difference between static_cast and dynamic_cast? Did research but i cant wrap my head around it. All i know is that static_cast occurs during compile time, while dynamic_cast occurs during runtime. I dont really understand
Avatar
Can't really say myself, but I'd guess static cast is on compile time, faster and used for pointers while dynamic is at runtime, slower and for references?
11:39 AM
I mostly use either static/reinterpret casts
Avatar
Atomicskullz 6/15/2021 2:46 PM
How do i add new blueprints using the API?
Avatar
Atomicskullz 6/15/2021 2:57 PM
If anyone could just tell me a function name
2:58 PM
I could just look it up on github and find examples
Avatar
you mean like add an additional item?
Avatar
Atomicskullz 6/15/2021 3:10 PM
Yeah
3:10 PM
Like making my own
Avatar
i don't think this is doable with a plugin, since it would have to be replicated to the client
Avatar
Atomicskullz 6/15/2021 3:12 PM
Damn thats right
3:12 PM
Didnt think of that
Avatar
Atomicskullz 6/16/2021 12:22 PM
Any1 know if there’s a macro for determining if the server is using ark or atlas?
Avatar
hm?
12:24 PM
you have to compile with AtlasAPI for atlas and ArkApi for ark
Avatar
Atomicskullz 6/16/2021 4:32 PM
is there anyway to manipulate weapon damage or other stats?
Avatar
Avatar
Atomicskullz
is there anyway to manipulate weapon damage or other stats?
jraServerAPI 6/16/2021 5:23 PM
Avatar
Atomicskullz 6/16/2021 5:38 PM
uh that doesnt really answer the question
5:38 PM
oh wait wtf
5:38 PM
nvm
5:38 PM
scroll was bugged
5:38 PM
thanks
Avatar
Atomicskullz 6/18/2021 12:27 AM
Does the EngramBlueprintClassesField() function in Gamemode.h actually contain all the current engram entries available?
Avatar
Yes
12:27 AM
Well, wait
12:28 AM
I know EngramBlueprints from UPrimalGameData does have all engrams
Avatar
Atomicskullz 6/18/2021 12:45 AM
Ah ok, interesting. Which ever one is best performing for a simple iteration that retrieves the names and levels of them ill use (edited)
12:46 AM
Will have to do some experimenting
Avatar
Avatar
Atomicskullz
Will have to do some experimenting
auto Singleton = (UPrimalGlobals*)Globals::GEngine()()->GameSingletonField(); auto GameData = Singleton->PrimalGameDataOverrideField() ? Singleton->PrimalGameDataOverrideField() : Singleton->PrimalGameDataField(); auto EngramClasses = GameData->EngramBlueprintEntriesField(); (edited)
Avatar
Atomicskullz 6/18/2021 12:50 AM
Ok cool, thanks
Avatar
Atomicskullz 6/19/2021 1:52 PM
is there anyway to get the stored weapons? like a list of them with their damages and stuff
Avatar
Atomicskullz 6/19/2021 2:20 PM
or just a list of all the items with their stats. because im not sure if i can get the template damages from a UPrimalEngramEntry (edited)
Avatar
Atomicskullz 6/19/2021 2:49 PM
yeah unsure. i found out a way but it looks a little dirty
2:49 PM
auto Singleton = (UPrimalGlobals*)Globals::GEngine()()->GameSingletonField(); auto GameData = Singleton->PrimalGameDataOverrideField() ? Singleton->PrimalGameDataOverrideField() : Singleton->PrimalGameDataField(); auto EngramClasses = GameData->EngramBlueprintEntriesField(); for (auto x : EngramClasses) { auto sub = x->BluePrintEntryField().uClass->GetDefaultObject(); auto casted = static_cast<UPrimalItem*>(sub); float damage = casted->GetWeaponTemplateMeleeDamageAmount(); }
2:49 PM
mind the var names, just tempoary
Avatar
That's probably one of the best ways if you need all craftable weapons
2:53 PM
There is no such singleton with all weapons
Avatar
Deleted User 6/19/2021 3:19 PM
Are there any very basic plugins I could have a look at as an example to get an understanding of what plug-in development is like?
3:19 PM
I'm very new to C++
Avatar
Atomicskullz 6/19/2021 6:10 PM
Sorry if this sounds blunt, but you shouldn’t really be doing this kind of stuff if you’re “very new.” There’s a lot of stuff you have to learn in order to make efficient code.
Avatar
Avatar
Atomicskullz
Sorry if this sounds blunt, but you shouldn’t really be doing this kind of stuff if you’re “very new.” There’s a lot of stuff you have to learn in order to make efficient code.
I disagree. If the person has previous experience in other languages, picking up C++ is usually straight forward.
👍 1
Avatar
Atomicskullz 6/19/2021 9:35 PM
C++ is a totally different beast wtf are you saying waitwhat
Avatar
Avatar
Atomicskullz
C++ is a totally different beast wtf are you saying waitwhat
I had no issues picking up C++
Avatar
Atomicskullz 6/19/2021 9:36 PM
Cool
Avatar
If you understand the concepts, it’s a straight forward language.
Avatar
Atomicskullz 6/19/2021 9:37 PM
People who say they are “very new” usually tend to not understand it, otherwise they wouldnt say it
9:38 PM
I see it all the time in another server (edited)
9:41 PM
I dont mind if someone is new to c++, but trying to explain something to someone like that is uh (edited)
9:42 PM
idk its prolly just me and my past experiences
Avatar
Atomicskullz 6/20/2021 1:22 AM
so uh why am i getting an error when using FString as a key for a map?
1:22 AM
struct EngramEntry { FString name; TSubclassOf<UPrimalItem>* engram; int level{}; }; extern TMap<FString, EngramEntry> g_EngramMap;
1:22 AM
could have sworn FString was hashable
1:22 AM
on compile it throws "TMap must have a hashable KeyType unless a custom key func is provided."
Avatar
Avatar
Atomicskullz
could have sworn FString was hashable
Easy work around, use the c string value
7:07 AM
There’s a function to get the underlying string from FString
Avatar
Atomicskullz 6/20/2021 11:54 AM
Ok thanks
Avatar
Atomicskullz 6/20/2021 2:27 PM
yeah, but thing is that FString is the key used for some of the functions/fields in the API, like in AShooterGamemode Struct (edited)
2:27 PM
TMap<FString, FString, FDefaultSetAllocator, TDefaultMapKeyFuncs<FString, FString, 0> >
2:28 PM
yet the compiler doesnt complain when it goes through that
2:28 PM
only thing i can try is setting the KeyFuncs
2:28 PM
but by default it should have worked
Avatar
Atomicskullz 6/20/2021 2:37 PM
found something that may work
2:37 PM
struct FMyStruct { // String which identifies our key FString UniqueID; // Some state which doesn't affect struct identity float SomeFloat; explicit FMyStruct(float InFloat) :UniqueID (FGuid::NewGuid().ToString()) , SomeFloat(InFloat) { } }; template <typename ValueType> struct TMyStructMapKeyFuncs : BaseKeyFuncs< TPair<FMyStruct, ValueType>, FString > { private: typedef BaseKeyFuncs< TPair<FMyStruct, ValueType>, FString > Super; public: typedef typename Super::ElementInitType ElementInitType; typedef typename Super::KeyInitType KeyInitType; static KeyInitType GetSetKey(ElementInitType Element) { return Element.Key.UniqueID; } static bool Matches(KeyInitType A, KeyInitType B) { return A.Compare(B, ESearchCase::CaseSensitive) == 0; } static uint32 GetKeyHash(KeyInitType Key) { return FCrc::StrCrc32(*Key); } };
2:37 PM
[UE4] Use of TMap, Programmer Sought, the best programmer technical posts sharing site.
2:38 PM
but still, i dont know why the compiler doesnt complain about maps using fstring in the api
Avatar
Just use the TMap
4:01 PM
TMap is the UE4 map type
Avatar
Atomicskullz 6/20/2021 4:45 PM
Yes thats what ive been using
Avatar
Atomicskullz 6/20/2021 5:41 PM
struct FStringStruct { // String which identifies our key FString UniqueID; // Some state which doesn't affect struct identity float SomeFloat; explicit FStringStruct(float InFloat) :UniqueID(FGuid::NewGuid().ToString()) , SomeFloat(InFloat) { } };
5:41 PM
it says NewGuid() is missing (edited)
5:41 PM
any alternative?
Avatar
Atomicskullz 6/20/2021 10:46 PM
ya even Crc::MemCrc32 isnt there
10:46 PM
so its impossible to make a hashable struct
Avatar
Avatar
Atomicskullz
ya even Crc::MemCrc32 isnt there
You can always add the missing references if any are missing
Avatar
Atomicskullz 6/20/2021 11:20 PM
ye thats what im doing rn
Avatar
In IDA you can find CRC Mem32
11:21 PM
and then construct a header similar to the FMemory header
Avatar
Atomicskullz 6/20/2021 11:21 PM
oh im just using the UE4 source lol
Avatar
That will cause you a lot of problems
Avatar
Atomicskullz 6/20/2021 11:21 PM
all im doing is getting the MemCrc32 function
11:22 PM
which has nothing to do with the game
11:22 PM
if you know what i mean
Avatar
Yes, don't reference it from the UE4 source, reference the one built into the game.
Avatar
Atomicskullz 6/20/2021 11:22 PM
its poco stuff
11:22 PM
yeah but i dont know how to ida pro lol
Avatar
You just open the game in IDA pro
11:22 PM
there it will have a function list
11:22 PM
you can ctrl+f
11:23 PM
example with FMemory
11:23 PM
it uses the function pointer from the game via the PDB
11:24 PM
@Atomicskullz anyways, if you are just wanting to store a map based on the value of the string
11:24 PM
map<std::string, FString>
11:25 PM
if you want the FString to also map to a complex object just make a wrapping struct struct MyStruct { FString a; void* whateveryouwant; } map<std::string, MyStruct> myMap
Avatar
Atomicskullz 6/20/2021 11:27 PM
so i shouldnt use TMap then?
11:29 PM
Crc.h and Crc.cpp fit into the project perfectly
11:29 PM
all the required headers were already there
11:29 PM
i might need to make a new fork
Avatar
jraServerAPI 6/23/2021 5:48 AM
Does anybody know where the Additional Harvesting levels are stored on a dino? (eg, the Additional Delicate/Power harvesting values on a Therizinosaur) I'm searching the UPrimalCharacterStatusComponent but not coming up with much yet... Thanks in advance!
Avatar
Avatar
jraServerAPI
Does anybody know where the Additional Harvesting levels are stored on a dino? (eg, the Additional Delicate/Power harvesting values on a Therizinosaur) I'm searching the UPrimalCharacterStatusComponent but not coming up with much yet... Thanks in advance!
It is a BP function on the dino.
Avatar
Atomicskullz 6/23/2021 11:34 PM
what class/struct is an item that's pick-up-able by the player? (for example, a weapon that a player dropped)
Avatar
ADroppedItem
Avatar
Atomicskullz 6/23/2021 11:50 PM
thanks
Avatar
Atomicskullz 6/26/2021 3:04 PM
are all engram entries prefixed with EngramEntry_ ? (edited)
Avatar
Avatar
Atomicskullz
are all engram entries prefixed with EngramEntry_ ? (edited)
Most likely. I'd check parent class too, or maybe an IsChildOf to be 100% sure
Avatar
I tried to compile a basic Plugin following the tutorial in the plugins-tutorial channel. When I include "API/ARK/Ark.h" and want to build my solution, I get the following errors:
4:11 PM
What should I do?
Avatar
Avatar
KraxKrokat
I tried to compile a basic Plugin following the tutorial in the plugins-tutorial channel. When I include "API/ARK/Ark.h" and want to build my solution, I get the following errors:
Atomicskullz 6/26/2021 4:24 PM
change the content located at the top of the Tuple.h header. You just need to comment-out some lines, like so://#if defined(_MSC_VER) && !defined(__INTEL_COMPILER) // #define USE_TUPLE_AUTO_RETURN_TYPES (PLATFORM_COMPILER_HAS_AUTO_RETURN_TYPES && USING_CODE_ANALYSIS) //#else #define USE_TUPLE_AUTO_RETURN_TYPES 1 //#endif (edited)
Avatar
Thanks - I'll give that a shot 🙂 By the way, shouldn't that be a step in the beginner tutorial maybe?
Avatar
Atomicskullz 6/26/2021 4:25 PM
outdated tutorial. visual studio had some updates that broke it
👍 1
Avatar
@Atomicskullz those lines were already commented out for me? 😕
Avatar
Atomicskullz 6/26/2021 4:36 PM
oh
4:36 PM
which version of visual studio you using?
Avatar
2019
Avatar
Atomicskullz 6/26/2021 4:36 PM
idk then
4:36 PM
atm im using preview but i doubt thats the case
Avatar
Just checking: are those the only 4 lines I should comment out?
4:38 PM
Or should I also comment #define TUPLES_USE_DEFAULTED_FUNCTIONS 1 ?
4:39 PM
Oke, I found the issue I think, the only error thats left is the TSharedPtr one
Avatar
Avatar
KraxKrokat
2019
Fixes are on the github as a PR from me.
5:35 PM
Avatar
Ty Lethal 🙂
Avatar
Atomicskullz 6/27/2021 1:56 PM
so i need some help with when I should use dynamic_cast. Previously, I always used static_cast when downcasting, and according to research I conducted its more safer than dynamic_cast. I know that dynamic_cast occurs during run-time, but I dont know the significance behind it.
Avatar
So im really new to this stuff, anyone know how i would go about placing lets say a metal foundation with the plugin?
Avatar
Avatar
Axenari
So im really new to this stuff, anyone know how i would go about placing lets say a metal foundation with the plugin?
You would need to load the BP path of the foundation, to get the UClass* of the foundation. to load it use UVictoryCore::BPLoadClass() Then you can use ArkApi::GetApiUtils().GetWorld()->SpawnActor() (edited)
Avatar
Atomicskullz 6/30/2021 11:30 AM
Does ark api have the full reflection system from UE? Basically i need to inject base class functions without class derivation (since lua doesnt support it)
Avatar
Avatar
Atomicskullz
Does ark api have the full reflection system from UE? Basically i need to inject base class functions without class derivation (since lua doesnt support it)
It should
Avatar
jraServerAPI 7/5/2021 9:56 PM
no worries
Avatar
I don't need the whole code though, just the section where the steamid issue is
Avatar
Avatar
Pelayori
I don't need the whole code though, just the section where the steamid issue is
thats the problem everywhere
9:57 PM
where getsteamidfromcontroller is used
9:57 PM
from the arkapiutils
Avatar
Did you try using the official repo's headers?
Avatar
what are the official repos headers? i got mine out of herer https://github.com/WETBATMAN/ARK-Server-API
Server plugins support for ARK. Contribute to WETBATMAN/ARK-Server-API development by creating an account on GitHub.
Avatar
Server plugins support for ARK. Contribute to Michidu/ARK-Server-API development by creating an account on GitHub.
Avatar
i tried those before that
Avatar
Hmm, not sure then
9:59 PM
I have no clue
Avatar
xD your not the only one
Avatar
Hey! Is there a place that has a collection of premade JSON files I can build off of for my servers for the Shop,Currency, and Kits plugin? ☺
Avatar
Hey, I am getting a ton of errors similiar to this: version\Core\Public\API\UE\Containers\../Windows/MicrosoftPlatformString.h(24): error C2664: 'errno_t strcpy_s(char *,rsize_t,const char *)': cannot convert argument 1 from 'WIDECHAR *' to 'char *' version\Core\Public\API\UE\Containers\../Windows/MicrosoftPlatformString.h(24): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt\string.h(32): note: see declaration of 'strcpy_s' It seems UE/BasicTypes is including headers that, at least on my system, contradicts each other. Has anyone encountered this before?
12:01 AM
Oh, yeah, I am using CMake in CLion; not sure if anyone has managed to get that working? Slowly warming up to the idea of welcoming VS back on my system. 😛 (edited)
Avatar
Got it all figured out. 😄
Avatar
Has anyone stumbled across a variable that can tell if a player is controlling a Noglin? For reference, I currently use OwnProx's Teleport Plugin and allow players to use the /tpr and /tpa functions. However, the plugin doesn't (and had no reason to until now) check to see if the player is controlling a Noglin and will actually put the player who is teleporting where the Noglin is and not the actual location of the player. So, my basic idea was to prevent accepting a request if the player is controlling a Noglin. Hopefully that all makes sense.
Avatar
Probably the controller of said noglin is now a player controller
Avatar
Yeah, that is my assumption based on the way it is functioning.
Avatar
Im trying to give an item to a player by command, i need this item to have a custom name. ive not been able to find how id do something like that tho. Last try was this: item->DescriptiveNameBaseField() = "Trophy"; item->UpdatedItem(false); Log::GetLog()->warn(item->DescriptiveNameBaseField().ToString()); AttackerShooterController->GetPlayerInventory()->AddItemObject(item); This gives the actual item i want to, the log shows the name ive given it but the client doesnt see it
Avatar
And won't see it either
9:05 PM
Name is not replicated
Avatar
So theres no way to do this?
9:07 PM
Not sure if there's anything like custom item name that is replicated
9:07 PM
but I know you can change description (edited)
Avatar
Maybe that would work then, how would i do that?
Avatar
Tbf, I don't remember 😂
9:08 PM
Custom Item description I believe
9:08 PM
then multicast it
9:08 PM
and replicate
Avatar
oh god ive got no clue how to do that xD
Avatar
or replicate at the end might not be necessary (edited)
Avatar
multicasting is smthing ive never done (or know what it means)
Avatar
multicasting means sending the updated value of a replicated variable over to clients when multicasted
9:10 PM
you do actor->MulticastProperty(FName(L"varNameWithoutField", EFindName::FName_Add, false));
Avatar
Cool ty!
Avatar
I don't 100% remember it was that way though
9:12 PM
Just keep in mind multicasting just works for variables that are replicated (wouldn't work for example with descriptive item name)
Avatar
While im asking.. ive got 1 more issue. I want to use a hook when an item gets taken from an inventory (not hard at all) but heres the catch, i want to see who takes it and from where so i can check if their from the same tribe
9:13 PM
Makes sense, ty!
Avatar
Avatar
Pelayori
Not sure if there's anything like custom item name that is replicated
I think you can do a custom name
Avatar
On items?
Avatar
Im listening xD
Avatar
🐨Dream Doctor🦘 7/25/2021 3:23 AM
@Foppa Any chance you could add that github source code link to #【💌】ʜᴇʟᴘꜰᴜʟ-ʟɪɴᴋꜱ ? (edited)
Avatar
Avatar
🐨Dream Doctor🦘
@Foppa Any chance you could add that github source code link to #【💌】ʜᴇʟᴘꜰᴜʟ-ʟɪɴᴋꜱ ? (edited)
GSH | MrOwlSky 7/25/2021 3:45 AM
Done
Avatar
Avatar
GSH | MrOwlSky
Done
🐨Dream Doctor🦘 7/25/2021 3:45 AM
Thank you! 🙂
GOGCHECK 1
Avatar
Did anyone get increasing of memory using by servers after the updating to 3.51?
10:11 AM
Like gen2 now uses about ~16 gb of memory (edited)
Avatar
Avatar
Nice
Did anyone get increasing of memory using by servers after the updating to 3.51?
Yes, issue has been identified and a new patch is soon to arrive
Avatar
Anyone know how i would delete an item? Tried this but first makes me crash and second times out the player and freezes real bad item->BeginDestroy(); item->RemoveItemFromInventory(true, true); (edited)
Avatar
Remove it from the inventory reference
8:18 PM
UPrimalInventoryComponent::RemoveItem
Avatar
So i wont be able to remove the item from any inventory by deleting an item?
Avatar
No, you need to loop trough every inventory and delete it, or loop trough all item references if you have a list already, get owner inventory and then remove item
Avatar
Alright! That makes me wonder something. Ill give a quick explenaition, im trying to create a custom spoil system
8:22 PM
If they drop the item i think that will bypass right?
Avatar
Most likely
Avatar
Mhh, ive been told every class has a destroy function that will get rid of it entirely
8:24 PM
its not the case for UPrimalItem i guess?
8:24 PM
Sorry if im being dumb, trying to figure out whats my best bet for deleting this item
Avatar
There is DestroyAll command, but it does not work for child classes s you'd need to loop each dropped item class either way
Avatar
Okay let me ask different, if you were to make a spoil system, You already have a working timer, and a pointer to the actual item How would you make the item get removed?
Avatar
Avatar
Axenari
Okay let me ask different, if you were to make a spoil system, You already have a working timer, and a pointer to the actual item How would you make the item get removed?
item->OwnerInventoryField()->RemoveItem(&item->ItemIDField(), false, false, true, true);
Avatar
epic! i didnt know you could reverse get an inv from an item 😮
8:35 PM
ty
Avatar
Yeah, items hold a reference to the owner inventory
8:36 PM
And from the owner inventory, you could get OwnerField, that can be character, structure, etc...
Avatar
Very interesting!
8:42 PM
im still struggling with me timing out the entire time because of my plugin first before i can test xD
Avatar
oof! that crashed my server
8:53 PM
(yes i copied the plugin of WetBatman to create my private plugin)
Avatar
Might be worth to check if the inventory is valid
Avatar
Its literally my own inventory tho
8:57 PM
Ill add it for just future cases
8:57 PM
Its a spawned in item, unmoved and in my personal inventory
Avatar
@Axenari Is it for resources that could stack more than 1 actually?
9:13 PM
If that's the case you can use this
9:13 PM
item->OwnerInventoryField()->IncrementItemTemplateQuantity(item->ClassField(), -1, true, false, nullptr, nullptr, false, false, false, false, true, false, true);
Avatar
It wont stack
9:21 PM
Its a survivers trophy w custom name
Avatar
Hmm, then don't use the increment function, it will choose any item of that class and remove
Avatar
Avatar
Pelayori
item->OwnerInventoryField()->RemoveItem(&item->ItemIDField(), false, false, true, true);
try this but instead print the ids from itemidfield
9:22 PM
to see what it outputs (edited)
Avatar
Willdo when i get home
9:22 PM
Tf
9:22 PM
Ty*
Avatar
Avatar
Axenari
Ty*
Either way, the removeItem just calls the UPrimalItem::RemoveItemFromInventory though
Avatar
Problem seems to be finding the item
9:42 PM
Oddly
Avatar
How are you storing the pointer? (edited)
Avatar
UPrimalItem* alphatrophyitem;
10:36 PM
and then when i want to spawn it i do this
10:36 PM
FCustomItemData cdata; cdata.CustomDataName = FName("Alpha Trophy1", EFindName::FNAME_Add); alphatrophyitem->CustomItemNameField() = L"Alpha Trophy"; alphatrophyitem->SetCustomItemData(&cdata); alphatrophyitem->UpdatedItem(false); static_cast<APrimalStructureItemContainer*>(Stand)->MyInventoryComponentField()->AddItemObject(alphatrophyitem);
10:36 PM
theres only 1 instance of the item at a time so i think i dont need a fancy system
Avatar
🐨Dream Doctor🦘 7/28/2021 5:22 AM
Hey @substitute , did you ever hear back from WC about this? Do you know if they have fixed it?
Avatar
Does anyone know how i can ensure a structure stays unlocked?
Avatar
ArkApi::Tools::ConvertToWideStr is deprecated? Is there a replacement?
Avatar
@Uaca ArkApi::Tools::Utf8Decode(config["Messages"].value(str, "No message")).c_str());
Avatar
@Pelayori any chance you know how to lock and unlock a structure
7:58 PM
Tried to check w ida but i cant find it (kinda dont know how to use it fully either tbh)
Avatar
Avatar
Axenari
Tried to check w ida but i cant find it (kinda dont know how to use it fully either tbh)
substitute 8/1/2021 4:21 AM
Do you mean pin code or engram?
Avatar
Literally the lock and unlock on lets say a storage box
Avatar
Avatar
Axenari
Literally the lock and unlock on lets say a storage box
you need to set the pin code
10:20 AM
to unlock simply set the pin code to nothing
Avatar
oh wow, that easy? xD testing it soon
Avatar
Can anyone help me with attaching a debugger? it either crashes the server or freezes the server, no clue what im doing wrong
Avatar
@Axenari to unlock just set bUnlocked() to false/true, bIsPinCoded() to true/false and if setting pin lock set the pin code (think there's a function for it)
Avatar
Thanks! just found that out 😄
Avatar
Hi, does anybody know where the Survival Quotient (killed bosses) is stored? I looked using ark-tools into .arkprofile and .ark save and didn't find anything
Avatar
Avatar
Fenix
@Uaca ArkApi::Tools::Utf8Decode(config["Messages"].value(str, "No message")).c_str());
ThankS!
Avatar
Does anyone know if theres a hook for items that spoil? or how to detect it via another hook?
Avatar
Avatar
Axenari
Does anyone know if theres a hook for items that spoil? or how to detect it via another hook?
Maybe not directly, but you could look at UPrimalItem_GetSpoilingTime and when time is 0 or 1, (small time), you could trigger your logic
Avatar
@Pelayori Do you know a hook i should use for checking when any item gets destroyed? Ive got this item of which there at any point should only be 1. this item spoils too. So im thinking how i should track this item dissapearing. and ive got no clue
7:02 PM
Right now im trying the hook BeginDestroy However this triggers at really weird moments (My IDA is fucked too, cant check there) 😦
Avatar
@Axenari There is a hook I found in the Server API hook Creator App. I'm not sure if it actually works though. c++ DECLARE_HOOK(UPrimalItem_BeginDestroy, void, UPrimalItem*); void Hook_UPrimalItem_BeginDestroy(UPrimalItem* _this) { UPrimalItem_BeginDestroy_original(_this); } ArkApi::GetHooks().SetHook("UPrimalItem.BeginDestroy", &Hook_UPrimalItem_BeginDestroy, &UPrimalItem_BeginDestroy_original); ArkApi::GetHooks().DisableHook("UPrimalItem.BeginDestroy", &Hook_UPrimalItem_BeginDestroy); (edited)
Avatar
Thats the thing @DizzyDwarf i use this, but it fires at random situations where nothing happens to the item
Avatar
Avatar
Axenari
Thats the thing @DizzyDwarf i use this, but it fires at random situations where nothing happens to the item
This is when the engine destroys the actor
8:19 PM
Not when the item breaks
Avatar
It doesnt seem to be the case tho
9:18 PM
it triggers when i spawn in an item
Avatar
and it somehow triggers multiple times without even doing anything
Avatar
Avatar
Axenari
It doesnt seem to be the case tho
Called before destroying the object.
10:07 PM
Destroy in this instance means to clean up a garbage object from memory.
10:09 PM
An object can be moved around in memory to different instances as required, which would leave the previous instance as garbage. One example is dropping an item from your inventory. The item no longer exists and is instead the dropped item instance. Now whether or not WC moves the object reference or creates a new one on the dropped item, I don’t know, this is just an example where it could do a copy construct
Avatar
Right so that doesnt really mean the item is gone..
Avatar
Correct
Avatar
Maybe i should take it another way, as theres always only 1 of the items i have a pointer to it. Is there a way to see if the item is still in the server?
Avatar
Check if pointer is nullptr
2:34 PM
You might want to use weak object ptrs when storing them somewhere where the pointer persists. TWeakObjectPtr<UPrimalItem> item_ptr = GetWeakReference(item);
2:35 PM
That will store the pointer safely and retrieve it if it's still valid, if not then it will return a plain nullptr
2:35 PM
To get the pointer back you can do item_ptr.Get()
2:36 PM
Anyways let me search deeper for spoil
Avatar
To check if its still a thing if(item_ptr != nullptr)
2:36 PM
Right?
Avatar
if (item_ptr.Get() != nullptr)
Avatar
Spoil isnt needed per se, i just need to know if its still there
Avatar
Well, if the pointer is valid means the item is somewhere in the world
2:37 PM
Might be on a dropped item, might be on an inventory, etc...
Avatar
I first took it with the approach to check when it despawns and when it spoils, thats why i wanted to know a spoil hook
2:37 PM
The only info i need is if its anywhere or nowhere so i know enough :)
2:39 PM
One thing i am still struggling with however is spawning in a structure, i got a code from someone where i can spawn in an actor. But i can walk thru it, it doesnt have an owner and it doesnt have an inventory. I would check IDA but its literally broken for me
Avatar
How are you spawning the actor?
Avatar
Let me find it
2:41 PM
inline AActor* BPSpawnActor(UWorld* uworld, FString blueprint, FVector* location, FRotator* rotation, bool do_begin_play) { //auto* world = ArkApi::GetApiUtils().GetWorld(); if (!uworld) { return nullptr; } UClass* object_class = UVictoryCore::BPLoadClass(&blueprint); if (!object_class) { return nullptr; } FActorSpawnParameters new_actor_spawn_params; new_actor_spawn_params.bDeferBeginPlay = true; auto* actor = uworld->SpawnActor(object_class, location, rotation, &new_actor_spawn_params); if (actor) { if (do_begin_play) { actor->BeginPlay(); actor->ForceReplicateNow(false, false); } return actor; } return nullptr; } auto* world = ArkApi::GetApiUtils().GetWorld(); auto character = player_controller->GetPlayerCharacter(); auto location = character->RootComponentField()->RelativeLocationField(); FString blueprint = "Blueprint'/Game/PrimalEarth/Structures/StorageBox_Small.StorageBox_Small'"; auto* actor = BPSpawnActor(uworld, blueprint, &location,
2:42 PM
Accidentally removed too much from the end part here, the last line is normally intact
2:43 PM
I know how to set the health, but not to add an inventory etc
Avatar
UWorld* world = ArkApi::GetApiUtils().GetWorld(); FString tek_path = FString("Blueprint'/Game/PrimalEarth/Structures/StorageBox_TekShield.StorageBox_TekShield'"); UClass* structure_class = UVictoryCore::BPLoadClass(&tek_path); if (!structure_class) Log::GetLog()->critical("There was an error while processing new structures"); AActor* new_actor = world->SpawnActor(structure_class, &loc, &rot, &params); if (new_actor && new_actor->IsA(APrimalStructureItemContainer::GetPrivateStaticClass()))
2:45 PM
This works for me
2:46 PM
loc, rot are on another place outside there, and params is just empty FActorSpawnParameters
Avatar
Oh damn nice
7:43 PM
will test that very soon
Avatar
@Pelayori I tried the TWeakObjectPtr thing, the weird thing is it comes thru as a nullpointer at random times. Whenever i throw it on the ground like 15 seconds before it spoils it had a nullpointer
Avatar
Avatar
Axenari
@Pelayori I tried the TWeakObjectPtr thing, the weird thing is it comes thru as a nullpointer at random times. Whenever i throw it on the ground like 15 seconds before it spoils it had a nullpointer
Then dropped items re create the item
9:43 AM
Probably not the best idea to store the pointer since items get created and destroyed a lot
Avatar
But it stays on the ground just fine for 1 minute 40 seconds
9:51 AM
thats the weird part
Avatar
The item gets destroyed and a clone is created most likely
10:06 AM
So the original ptr is not valid anymore
Avatar
Any way you can think of doing this?
10:11 AM
To be clear, ive got a custom item of which there should only be 1, I can have a pointer to the item as theres only 1 Whenever it cannot detect the item it should fire a function
Avatar
Im kind of out of options 😄
Avatar
Avatar
Axenari
Im kind of out of options 😄
Did you try get spoling time hook?
2:15 PM
Check if it's your item, and if spoiling time is due to something
2:15 PM
Spoiling time might be world seconds, if so then you just do spoling_time - GetWorld()->GetTimeSeconds()
Avatar
I did get that part
4:29 PM
Ive got an idea that ima test out, thanks for the tip
4:29 PM
It indeed is the time second thing brw
Avatar
So, rn im having this issue. this is a spawned in structure by command
9:19 PM
9:19 PM
it has the servers tribe id, its unlocked and yet i cannot access it
Avatar
It may not have an inventory component @Axenari
Avatar
If i make this my own tribe id it does actually have it
9:21 PM
Found this: AllowStructureAccess();
9:22 PM
but its used to set for 1 player
9:22 PM
i bet its something i need to set it to where everyone can access it
Avatar
That’s now how access checks work
Avatar
im confused to how i can access it when its my own tribe tho?
Avatar
Maybe you need to replicate the bUnlocked field
Avatar
Isnt it replicated as it tells in the yellow text unlocked?
Avatar
It might just be the server knowing it's unlocked and setting the box name field to (Unlocked)
9:24 PM
Try force replicate or multicast property
Avatar
(how do i do that?)
Avatar
Try either: Structure->ForceReplicateNow(false, false); or Structure->MulticastProperty(FName("bIsLocked", EFindName::FNAME_Add)); (edited)
9:29 PM
If you can access it when it's your own tribe it might be client not aware of it
Avatar
Which will be fixed w a replicate?
Avatar
That you can access if unlocked
9:29 PM
It's just a guess, I don't know any of your setup
Avatar
Its a simple SpawnActor w a few things added to it
9:31 PM
sidenote
Avatar
Yeah, I can't find anything in the trophy base that prevents inventory access out of the usual checks (edited)
Avatar
whenever i reload my plugin my MySql functions crash my server
9:32 PM
am i missing something with unloading or smthing?
Avatar
It depends, mysql shouldn't crash on unload normally. But without knowing something of your setup it's hard to tell
Avatar
nvm i think i know why.. my mysql is loaded on Init, i guess after reload it doesnt init anymore?
Avatar
On Init game hook?
Avatar
Yeah, could be an issue
9:34 PM
You can add a check on Load() and init if server is ready
Avatar
Its safe to load at any other point right?
9:35 PM
or does it need to be at init
Avatar
if (ArkApi::GetApiUtils().GetStatus() == ArkApi::ServerStatus::Ready) { // code... }
9:35 PM
Yeah, should be safe
Avatar
Alr ty 😄
9:36 PM
Ill try the other thing asap
Avatar
Update, no difference
9:43 PM
9:43 PM
here->bForceNoPinLocking(); here->bIsLocked() = false; here->bIsPinLocked() = false; primal_structure->bBPOverrideAllowStructureAccess() = true; here->ForceReplicateNow(false, false); here->MulticastProperty(FName("bIsLocked", EFindName::FNAME_Add));
Avatar
Try replicating the team id
Avatar
here being the very vague naming of the inventory
Avatar
It shouldn’t be yellow if it is your team
Avatar
Its not supposed to be my team
9:44 PM
this is supposed to be an server spawned structure everyone should be able to open
Avatar
Why are you enabling bp override allow access?
Avatar
Avatar
Axenari
this is supposed to be an server spawned structure everyone should be able to open
Use an obi
9:44 PM
Or a drop
9:45 PM
Both would be more obvious too
Avatar
That makes a custom function run to check if the player is allowed and it's likely returning no always
Avatar
And should work without anything special
Avatar
ive got no idea Pelayori
9:45 PM
ill delete it but i dont think itl make a change?
9:45 PM
substitute, its going to be an trophy inside of it, a custom one that lights up
9:45 PM
so it makes sense to have it in there 😄
Avatar
You are enabling a function, which the structure does not implement, and it's likely preventing access always
Avatar
Oh, on my way to test it 😄
9:47 PM
Removed it, no success yet D:
Avatar
and what is "here"?
Avatar
auto actor = world->SpawnActor(structure_class, &location, rotation, &params); auto* primal_structure = static_cast<APrimalStructure*>(actor); primal_structure->HealthField() = primal_structure->MaxHealthField(); primal_structure->StructureIDField() = 10 + 1; primal_structure->TargetingTeamField() = database->getServerTribeID(); if (primal_structure->IsA(APrimalStructureItemContainer::GetPrivateStaticClass())) { APrimalStructureItemContainer* here = static_cast<APrimalStructureItemContainer*>(primal_structure); here->bForceNoPinLocking(); here->bIsLocked() = false; here->bIsPinLocked() = false; here->ForceReplicateNow(false, false); here->MulticastProperty(FName("bIsLocked", EFindName::FNAME_Add)); }
9:49 PM
Here is the context 😄
9:49 PM
& yes im aware i should name things more clear, im an idiot
Avatar
Hmm that structure id I don't know if that is entirely correct
Avatar
ill try and delete that one, see if it changes anything
9:50 PM
Still nope
Avatar
No idea then
Avatar
My ida is broken, any chance you can look me up which things get added normally? so i can replicate the process of a normal placement as much as possible?
Avatar
Spawning is fine, but there's something else we are not seeing for the unlockt (edited)
10:00 PM
what if you just keep the bis locked = false and replicate / multicast (edited)
Avatar
I can try that soon
Avatar
Still doesnt work D:
Avatar
Hello, Sometimes my code enters the if condition bellow, and sometimes it does not: std::wstring blueprint = L"/Game/PrimalEarth/CoreBlueprints/Weapons/PrimalItem_WeaponMetalHatchet.PrimalItem_WeaponMetalHatchet_C"; UObject* object = Globals::StaticLoadObject(UObject::StaticClass(), nullptr, blueprint.c_str(), nullptr, 0, 0, true); if (!object) // Error It seems like I need to wait for the garbage collector or something in the background to happen before I can call this code again. If I call it two times in a row without waiting a little the second call returns NULL. I don't know what is happening exactly and I'm searching a way to always be able to load the blueprint object. Any help appreciated thank you.
Avatar
You might be better off calling UVictoryCore::BPLoadObject or BPLoadClass
Avatar
alright I don't know this namespace, I'm going to look at it thank you (edited)
6:58 PM
also I was trying to reach the ArkModding discord and you helped me on the other Discord server ^^
Avatar
Oh, true
Avatar
but I'm actually using ARK Server API, so I guess it's useless for me to go there, I'm better here right?
6:59 PM
they use Unreal dev kits and so on on the other Discord I suppose
Avatar
It isn't useless, I find some examples of stuff I don't get the idea to do, but in bp code which can be easily translated into cpp
6:59 PM
Or ark quirks they know about and we don't
7:00 PM
It's a good resource with discord search
Avatar
ok
Avatar
Avatar
OSubMarin
Hello, Sometimes my code enters the if condition bellow, and sometimes it does not: std::wstring blueprint = L"/Game/PrimalEarth/CoreBlueprints/Weapons/PrimalItem_WeaponMetalHatchet.PrimalItem_WeaponMetalHatchet_C"; UObject* object = Globals::StaticLoadObject(UObject::StaticClass(), nullptr, blueprint.c_str(), nullptr, 0, 0, true); if (!object) // Error It seems like I need to wait for the garbage collector or something in the background to happen before I can call this code again. If I call it two times in a row without waiting a little the second call returns NULL. I don't know what is happening exactly and I'm searching a way to always be able to load the blueprint object. Any help appreciated thank you.
But this I'd use bp load object/class. only time I needed to use static load object was to load icon objects to use in notifications/chat
Avatar
I used this based on the old Michidu repos ^^
Avatar
Do you need the class or an object itself? Because you could load class and then get the default object, cast to the specific object type and get vars from there
Avatar
it's actually working almost perfectly, just sometimes the function randomly returns NULL for some reason
7:02 PM
I'm just trying to instantiate a new item in game and then make a player drops this new item in front of him
Avatar
You also have StringReferenceToClass which works similarly to BPloadClass
Avatar
Avatar
OSubMarin
I'm just trying to instantiate a new item in game and then make a player drops this new item in front of him
Then you'd want to load the class
7:02 PM
not the object itself
👌 1
Avatar
static bool MySpawnDrop(unsigned long long steamId, const wchar_t* blueprint, int amount, float item_quality, bool force_blueprint, float min_random_quality, float life_span, float offsetX, float offsetY) { ArkApi::IApiUtils& utils = ArkApi::GetApiUtils(); AShooterPlayerController* aShooterPC = utils.FindPlayerFromSteamId(steamId); if (!aShooterPC) return false; FVector pos = utils.GetPosition(aShooterPC); pos.X += offsetX; pos.Y += offsetY; UObject* object = Globals::StaticLoadObject(UObject::StaticClass(), nullptr, blueprint, nullptr, 0, 0, true); if (object == nullptr) return false; TSubclassOf<UPrimalItem> archetype; archetype.uClass = reinterpret_cast<UClass*>(object); UPrimalItem* item = UPrimalItem::AddNewItem(archetype, nullptr, false, false, item_quality, false, amount, force_blueprint, 0.0F, false, nullptr, min_random_quality); if (!item) return false; FItemNetInfo* info = static_cast<FItemNetInfo*>(FMemory::Malloc(0x400)); RtlSecureZeroMemory(info, 0x400); item->GetItemNetInfo(info, false); TSubclassOf<ADroppedItem> archetype_dropped; archetype_dropped.uClass = reinterpret_cast<UClass*>(object); FVector zero_vector{ 0.0F, 0.0F, 0.0F }; FRotator rot{ 0.0F, 0.0F, 0.0F }; ADroppedItem* dropped = UPrimalInventoryComponent::StaticDropItem(aShooterPC, info, archetype_dropped, &rot, true, &pos, &rot, true, false, false, true, nullptr, &zero_vector, nullptr, life_span); FMemory::Free(info); if (!dropped) return false; return true; }
Avatar
Hmm, there's an api utils function for spawning and dropping an item
Avatar
haha
7:04 PM
complete function above, but I will have to look what you told me about
Avatar
Well yeah, the class is an object technically so that isn't wrong either
Avatar
yes it's mostly copy pasted from API utils
Avatar
Never used said function so can't say if it works or not
Avatar
I randomly enter the if (object == nullptr) return false; sometimes
Avatar
Yeah, shouldn't happen if the class is there
7:05 PM
Try using bpload class
Avatar
yep
Avatar
And just set archetype to that class
Avatar
thanks
Avatar
I'm doing some custom mods for the cluster I'm hosting, but later on I might be able to extract some features from it for a public mod. Actually the only thing that could be interesting is the additional rcon command "zipsavegame" that creates a zip archive of all the .ark/.arkprofile/.arktribe files asynchronously using std::thread.
7:18 PM
I use it because I don't host on my machine so I need to get these data from FTP
7:18 PM
Not really worth to release a mod just for that, it would fit better in ExtendedRCON mod and it's still for a specific usage. (edited)
Avatar
jraServerAPI 8/21/2021 8:17 PM
that's cool
Avatar
Im trying to create an FItemNetID, If found: FItemNetID item_id; item_id.ItemID1 = id1; item_id.ItemID2 = id2; but couldnt find what id1 and id2 are supposed to be. can anyone help me out?
Avatar
The item ids
12:47 PM
FItemNetId has 2 ints, id1 and id2
Avatar
Randomizing them is fine when making an item
🤞 1
Avatar
so there's no function to get a new one that does not exist? (edited)
7:36 PM
indeed iterating over every items just to make sure the ids are not taken is probably not worth unless very well optimised
Avatar
To create a new item just use UPrimalItem::AddNewItem with nullptr inventory if you don't want to add it to the inventory yet. Then you could add it with inventory->AddItemObject(item)
Avatar
yep that's what I'm doing, I was just reacting to FItemNetID problem above ^^
7:38 PM
I switched to BPLoadClass as you suggested
Avatar
Results?
Avatar
it removed the unpredictable aspect
7:40 PM
I still have one weird error and I have to run one portion of the code a second time so still not perfect but now it's working, I just need a little more tests to solve the remaining problem
Avatar
Which error?
Avatar
I have one function for spawning an item into a player's inventory and another to spawn and drop an item at the feet of a player. The error only happens with the spawn drop function. I modified a little (but not tested yet), I have this at the moment: static bool MySpawnDrop(unsigned long long steamId, FString* blueprint, int amount, float item_quality, bool force_blueprint, float min_random_quality, float life_span) { ArkApi::IApiUtils& utils = ArkApi::GetApiUtils(); AShooterPlayerController* aShooterPC = utils.FindPlayerFromSteamId(steamId); if (!aShooterPC) return false; UClass* bpUClass = UVictoryCore::BPLoadClass(blueprint); if (!bpUClass) return false; TSubclassOf<UPrimalItem> archetype = TSubclassOf<UPrimalItem>(bpUClass); UPrimalItem* item = UPrimalItem::AddNewItem(archetype, nullptr, false, false, item_quality, false, amount, force_blueprint, 0.0F, false, nullptr, min_random_quality); if (!item) return false; ADroppedItem* dropped = NULL; FVector zero_vector{ 0.0F, 0.0F, 0.0F }; FRotator rot{ 0.0F, 0.0F, 0.0F }; FVector pos = utils.GetPosition(aShooterPC); FItemNetInfo* info = static_cast<FItemNetInfo*>(FMemory::Malloc(0x400)); if (!info) return MyRemoveItem(&item); try { RtlSecureZeroMemory(info, 0x400); item->GetItemNetInfo(info, false); TSubclassOf<ADroppedItem> archetype_dropped = TSubclassOf<ADroppedItem>(bpUClass); dropped = UPrimalInventoryComponent::StaticDropNewItemWithInfo(aShooterPC, info, archetype_dropped, &rot, true, &pos, &rot, true, false, false, true, nullptr, zero_vector, nullptr, life_span); } catch (...) {} FMemory::Free(info); if (dropped == NULL) return MyRemoveItem(&item); return true; } (edited)
7:50 PM
and this one is working without errors: static FORCEINLINE bool MySpawnInInventory(unsigned long long steamId, FString* blueprint, int amount, float item_quality, bool force_blueprint, float min_random_quality) { UClass* bpUClass = UVictoryCore::BPLoadClass(blueprint); if (!bpUClass) return false; AShooterPlayerController* aShooterPC = ArkApi::GetApiUtils().FindPlayerFromSteamId(steamId); if (!aShooterPC) return false; AShooterCharacter* aShooterCharacter = static_cast<AShooterCharacter*>(aShooterPC->CharacterField()); if (!aShooterCharacter) return false; UPrimalInventoryComponent* inventoryComponent = aShooterCharacter->MyInventoryComponentField(); if (!inventoryComponent) return false; // Probably some cleaner way to check if item is stackable here: UPrimalItem* tmp = (UPrimalItem*)(bpUClass); UPrimalItem* tmpB = (UPrimalItem*)(bpUClass); int quantityOverride = 2; bool canStack = (inventoryComponent->bAllowItemStacking()() && tmp && tmpB && tmp->CanStackWithItem(tmpB, &quantityOverride)); TSubclassOf<UPrimalItem> archetype = TSubclassOf<UPrimalItem>(bpUClass); UPrimalItem* item = UPrimalItem::AddNewItem(archetype, nullptr, false, !canStack, item_quality, false, amount, force_blueprint, 0.0F, false, nullptr, min_random_quality); if (!item) return false; bool isUsableConsumable = item->IsUsableConsumable(); try { UPrimalItem* item2 = inventoryComponent->AddItemObjectEx(item, false, false, !canStack, true, !isUsableConsumable, false, aShooterCharacter, false, nullptr, false); if (item2 == NULL) return MyRemoveItem(&item); } catch (...) { return MyRemoveItem(&item); } return true; }
7:52 PM
so yeah my problem is only on the MySpawnDrop() function. On the first call I enter the if (dropped == NULL) return MyRemoveItem(&item); but on second call it works
7:53 PM
I will test this version cause it changed a bit but I will let you know ^^
7:53 PM
ho and : static FORCEINLINE bool MyRemoveItem(UPrimalItem** item) { // Probably some cleaner way to make sure item has been removed from game here: try { if ((*item)->bAddedToWorldItemMap()()) (*item)->RemoveFromWorldItemMap(); (*item)->ConditionalBeginDestroy(); (*item) = NULL; } catch (...) {} return false; }
7:54 PM
I'm kinda going ham to get rid of previous item haha, probably some cleaner way
Avatar
UPrimalItem* tmp = (UPrimalItem*)(bpUClass); UPrimalItem* tmpB = (UPrimalItem*)(bpUClass); I'd use (UPrimalItem*)(bpUClass->GetDefaultObject(true));
Avatar
ah right
Avatar
AShooterCharacter* aShooterCharacter = static_cast<AShooterCharacter*>(aShooterPC->CharacterField()); Also this will get the dino pawn (and thus cast is null) if riding dino. You can use aShooterPc->GetPlayerCharacter() as a more reliable way to get the player character
👌 1
👍 1
Avatar
I want real instances not just class
Avatar
You could also try other static drop functions, there's 3 of them. There's Static Drop Item which will take an existing's FItemNetInfo*, and Static Drop New Item which takes class and just creates a new item then drop it
👌 1
7:57 PM
For remove, there's inventory functions for it, which have return bools for safety
7:58 PM
bool RemoveItem(FItemNetID * itemID, bool bDoDrop, bool bSecondryAction, bool bForceRemoval, bool showHUDMessage)
Avatar
yes but I want to clean item in case of drop error
7:58 PM
so the item is not in any inventory
Avatar
ah well
Avatar
(I created it with nullptr) (edited)
7:59 PM
so yeah I tried the dirty hack above and cross finger so that it doesn't mess up ^^ (edited)
Avatar
I'm not confident about that way
8:00 PM
If it's not dropped nor in any inventory you could just leave it there and if it's not referenced or taken care of eventually it'll get cleaned by GC
Avatar
yeah basically I'm just telling GC I'm done with it, so that eliminates a possible memory leak (unused memory), but I take the risk of a pointer still pointing at it somewhere in the game's logic (edited)
8:01 PM
(*item)->ConditionalBeginDestroy(); (*item) = NULL; This tells GC I'm done with it, if I'm correct (edited)
8:02 PM
and I saw there was these two functions bAddedToWorldItemMap() RemoveFromWorldItemMap() so I added them too
8:02 PM
so far no Segmentation Fault 🤞 ^^ (it would be safer to just remove the MyRemoveItem call I agree) (edited)
Avatar
UPrimalItem::RemoveFromWorldItemMap() this call could be a bad thing or the thing saving me from segfault, I don't know what it does actually (edited)
8:14 PM
based on function name I just assumed it has to do with the list of UPrimalItem in the world (maybe it's not even called I didn't check if I enter this if condition yet). (edited)
Avatar
there's no way of getting the inner logics of game functions except by testing them or IDA I suppose? (this discord and repositories is already very good sources of knowledge, also I want to get into the other arkmodding discord but still getting a 404) (edited)
9:27 PM
I kinda miss managed code for that ^^ (edited)
Avatar
Avatar
OSubMarin
there's no way of getting the inner logics of game functions except by testing them or IDA I suppose? (this discord and repositories is already very good sources of knowledge, also I want to get into the other arkmodding discord but still getting a 404) (edited)
if it's a function made strictly for ARK, the only way you can find info about it is via IDA or maybe devkit documentation
9:49 PM
if it's a function from Unreal imported into the game, then you can just google it and unreal docs will have all the info about it
Avatar
true, I've already read a little* Unreal documentation already (edited)
9:52 PM
and sorry for the edits, searching my words sometimes, english is not my primary language
Avatar
Avatar
OSubMarin
indeed iterating over every items just to make sure the ids are not taken is probably not worth unless very well optimised
There’s no concern with two randomized ids
3:17 AM
It’s a large numbers birthday problem
3:17 AM
Both random id 1&2 are large numbers, so the odds A or B are the same are very small
3:17 AM
For an item to be a duplicate both A & B must be the same
3:17 AM
Not just A or B
3:18 AM
But it’s already unlikely two items will have A or B be the same, significantly less A and B
3:18 AM
I think it is an unsigned short, so you have 1/2^16 for A or B being the same
3:18 AM
And what like 1/2^32 both are?
Avatar
perhaps larger odds, it's been a hot minute since I've had to figure probability out
3:26 AM
tldr; two random ids for A and B are essentially always unique
Avatar
yeah, except they're not and you can still end up with duplicate if unlucky (or very unlucky if you prefer) ^^ (edited)
9:45 AM
but I get your point, it seems safe enough for sure (edited)
Avatar
Avatar
OSubMarin
yeah, except they're not and you can still end up with duplicate if unlucky (or very unlucky if you prefer) ^^ (edited)
Randomization is literally how the game engine generates them
9:52 AM
The chances that you generate two of the same random Id sets is so significantly low it’s less than a rounding error on a rounding error
Avatar
you're not taking into account the number of already generated IDs tho
Avatar
You do know how significant figures works right?
Avatar
no but I know about probabilities
Avatar
Even if you had 100 million items active you still have less than a 3% chance of a duplicate (actual value) (edited)
Avatar
alright, seems safe enough for sure
Avatar
Item ids are also often discarded/regenerated
9:55 AM
It really is a really insignificant chance of a duplicate
👌 1
👍 1
9:55 AM
If you manage to get one, buy a lottery ticket
Avatar
ok haha ^^
9:57 AM
I guess the AddNewItem() function is responsible for generating these IDs
Avatar
Probably, I’m not at my pc atm
Avatar
seems a bit like a waste of time to generate random IDs when you could just use a static float somewhere
10:01 AM
I guess it has to do with networks constraints, or maybe security so that you cannot guess IDs easily (edited)
Avatar
Hey! im still struggling with the same things, this is like a duo issue im dealing with right now
4:15 PM
4:16 PM
4:17 PM
Picture 1: Trophy stand that i spawned in with code, this doesnt look right to me but i generally dont care it looks weird. but it might cause the issues in pic two
4:17 PM
Picture 2: this is the trophy i spawn in with code. this normally has a spoil timer of 1 hour. when i spawn it in on the trophy stand it 1. does not switch to the trophy slot, 2. doesnt have a spoil timer (i did not test to spawn in any other inventory yet) (edited)
4:18 PM
my goal: structure is from the server, this is accessable by everyone. i want to be able to respawn the trophy with a function. it should be with a full spoil timer (the stand makes it never spoil as the multiplier is very high) and in the trophy slot.
4:19 PM
code 1: spawning of the base. auto actor = world->SpawnActor(structure_class, &location, rotation, &params); auto* primal_structure = static_cast<APrimalStructure*>(actor); primal_structure->HealthField() = primal_structure->MaxHealthField(); primal_structure->TargetingTeamField() = database.get()->getServerTribeID(); if (primal_structure->IsA(APrimalStructureItemContainer::GetPrivateStaticClass())) { APrimalStructureItemContainer* here = static_cast<APrimalStructureItemContainer*>(primal_structure); here->BeginPlay(); here->bIsLocked() = false; here->ForceReplicateNow(false, false); here->MulticastProperty(FName("bIsLocked", EFindName::FNAME_Add)); }
4:19 PM
code 2: spawning of the trophy: FString classname = FString(TrophyBPPath); UObject* trophyclass = UVictoryCore::BPLoadClass(&classname)->GetDefaultObject(true); UPrimalItem* alphatrophyitem = static_cast<UPrimalItem*>(trophyclass); if (alphatrophyitem) { alphatrophyitem->NextSpoilingTimeField() = ArkApi::GetApiUtils().GetWorld()->TimeSecondsField() + 3600; alphatrophyitem->UpdatedItem(false); static_cast<APrimalStructureItemContainer*>(Stand)->MyInventoryComponentField()->AddItemObject(alphatrophyitem); alphatrophyitem->AddToSlot(-1, true);
Avatar
I am not sure adding an item class default object to an inventory can bring anything good
4:20 PM
Since all items get their settings fro CDO instance (edited)
4:20 PM
You can use UPrimalItem::AddNewItem and set inventory to nullptr, then you can use the add item object func
4:21 PM
About the structure, what is the issue exactly?
Avatar
The structure does not really have an issue, i thought it might be the cause of the issue
4:25 PM
im going to try your method and update 😄
4:28 PM
How do i get TSubClassOf
4:28 PM
@Pelayori
Avatar
You can just input UClass
Avatar
& how do i get that xD
Avatar
You get it from bp load class
Avatar
Mhh ive got a line for that in my previous code but it made an UObject tho
Avatar
because you are getting the class default object
4:30 PM
Either way, UClass is an UObject too
4:30 PM
The return type of bp load class is UClass pointer
Avatar
ah sorry, i get confused w these terms sometimes
4:30 PM
thanks!
4:33 PM
it works!
4:33 PM
except that it doesnt switch to the equip slot
4:34 PM
alphatrophyitem->AddToSlot(-1, true);
Avatar
I don't know the indexes for the slots
4:34 PM
But is -1 one of them?
Avatar
if i index the slot for equip it says its -1
Avatar
Try using the functions to add to slot in the inventory
Avatar
only function i could find that might work is: ServerEquipItem
Avatar
ServerAddItemToSlot or ServerAddItemToSlot_Implementation might do the trick
4:38 PM
Maybe try using 0 for the index
Avatar
no result
Avatar
try equpping it manually, and loop trough the items, and log the slot index to console
Avatar
tried this on an additem hook: Log::GetLog()->warn(item->SlotIndexField());
4:52 PM
it always returns -1 tho, even if it enters normal inv
Avatar
that might be too early
Avatar
interesting, ill try it another way!
5:00 PM
very weird
5:00 PM
5:00 PM
5:00 PM
in a fabricator?
Avatar
That's why I think -1 is not the right index to equip on the slot
5:01 PM
-1 is likely used when no slot is used
5:01 PM
I'd try 0, 1 indexes as those seem logical, but this is ark lol (edited)
Avatar
it depends on the inventory
5:02 PM
but each inventory has 2 arrays
5:02 PM
for items to hold
5:02 PM
one is for equipped items and the second array is for just regular inventory slots
Avatar
Whatever i try it doesnt work, inventory->CanEquipItem(item) returns true
6:29 PM
but: item->EquippedItem();
6:29 PM
and item->AddToInventory(static_cast<APrimalStructureItemContainer*>(Stand)->MyInventoryComponentField(), true, false, nullptr, false, false, false);
6:29 PM
do not do anything
Avatar
none of those are to add to the slot
6:30 PM
to add the item to the inventory call inventory->AddItemObject
6:31 PM
equippedItem() is just an event that runs when an item is equipped
6:31 PM
doesn't actually equip it
Avatar
Adding to a slot simply does not work for me, tried it all
6:32 PM
if i add it w a line and manually equip it it works
6:32 PM
now im looking for a way to make it equip, as slots dont work at all
Avatar
Did you try adding it to slot 0?
6:38 PM
I've seen examples without the force bool
Avatar
I did
6:38 PM
Ive not tried without force bool
6:39 PM
I cannot try it rn sadly but i guess ill try that next
6:39 PM
Im fairly sure the trophy stand itself has flaws too tho, it isnt registered in all structures (i cannot find it by id for example)
6:40 PM
Now i dont mind it as it shows and it works fine but it might be a cause
Avatar
You could use AddItemObjectEx with bEquipItem true. That's what cryopods use to add + equip saddle (edited)
Avatar
Hmm, i fixed that issue
12:36 PM
now, how do i loop all inventories?
12:37 PM
tried to modify this: UGameplayStatics::GetAllActorsOfClass(ArkApi::GetApiUtils().GetWorld(), APrimalStructure::GetPrivateStaticClass(), &FoundActors);
12:37 PM
but it works different
12:38 PM
actually i try to loop every item on the server on startup
Avatar
You can change the class to APrimalStructureItemContainer
1:23 PM
So then you will only get structures with inventory, on each loop cast the AActor* pointer of the array to primal structure item container
Avatar
But what about player invs, item bags etc?
Avatar
You have various options which can use together 1) Primal Characters (players/dinos) 2) ShooterCharacters (only players) 3) Primal Dino Characters (only dinos) 4) Primal Structure Item Container (all structures, bags too)
1:34 PM
players/dinos will get also dead ones, so if you need to do anything other than checking inventory make sure they aren't dead
Avatar
I'm trying to use the CheatManager to give an item to a player but I'm not able to make it work. static bool MyGiveItemNum(unsigned long long steamId, int itemNumId, int quantity, float quality, bool forceBlueprint) { ArkApi::IApiUtils& utils = ArkApi::GetApiUtils(); AShooterPlayerController* aShooterPC = utils.FindPlayerFromSteamId(steamId); if (!aShooterPC) return false; UShooterCheatManager* cheatManager = utils.GetCheatManager(); // I tried with "GetCheatManagerByPC(aShooterPC);" it doesn't work either if (!cheatManager) return false; cheatManager->GiveItemNumToPlayer(aShooterPC->GetLinkedPlayerID(), itemNumId, quantity, quality, forceBlueprint); return true; } It works as expected on first call, but on subsequent calls nothing happens. If I drop the item obtained with first call and call my function again it is now working, but item I receive is the same item that I just dropped (if I pick the dropped item it vanishes as it is already in my inventory).
1:43 PM
Look like some item regeneration is not happening as I keep getting the same item over and over.
Avatar
why all this hassle lol
1:44 PM
PC->GiveItem(&SpawnedItems, &fBlueprint, Amount, Quality, IsBlueprint, false, 0);
1:44 PM
PC is PlayerController
Avatar
I tried this too
1:44 PM
same result
Avatar
this works 100%, it's used in every single plugin
Avatar
hmmm, I was almost sure to have tried this tho, let me give it another try
Avatar
is your PlayerController null?
Avatar
no the PlayerController is alright
1:46 PM
at least it seems OK (I don't enter the !aShooterPC condition)
Avatar
then this function will work (as long as you're not on the re spawn screen) 😄
Avatar
the function I copy pasted above ?
Avatar
no, the function i sent
Avatar
ah ok
1:46 PM
thanks
Avatar
I get the same result with PC->GiveItem() 😢 @WETBATMAN
2:16 PM
static bool MyGiveItemNum(unsigned long long steamId, FString* blueprint, int quantity, float quality, bool forceBlueprint) { ArkApi::IApiUtils& utils = ArkApi::GetApiUtils(); AShooterPlayerController* aShooterPC = utils.FindPlayerFromSteamId(steamId); if (!aShooterPC) return false; TArray<UPrimalItem*> spawnedItems; if (!aShooterPC->GiveItem(&spawnedItems, blueprint, quantity, quality, forceBlueprint, false, 0)) return false; return true; } First call works but subsequent call nothing happens (well actually I think I know what happens, it gives me the same item but the anti-dupe check is preventing the same item from getting added again) (edited)
2:18 PM
And I have the exact same problem with UPrimalItem::AddNewItem() which every times returns the same item to me instead of creating a new one. (edited)
2:20 PM
actually I enter the !aShooterPC->GiveItem( False condition on the 2nd call (edited)
Avatar
Avatar
OSubMarin
static bool MyGiveItemNum(unsigned long long steamId, FString* blueprint, int quantity, float quality, bool forceBlueprint) { ArkApi::IApiUtils& utils = ArkApi::GetApiUtils(); AShooterPlayerController* aShooterPC = utils.FindPlayerFromSteamId(steamId); if (!aShooterPC) return false; TArray<UPrimalItem*> spawnedItems; if (!aShooterPC->GiveItem(&spawnedItems, blueprint, quantity, quality, forceBlueprint, false, 0)) return false; return true; } First call works but subsequent call nothing happens (well actually I think I know what happens, it gives me the same item but the anti-dupe check is preventing the same item from getting added again) (edited)
do you get the anti dupe error in server console? (edited)
Avatar
ah no that's just a supposition
2:25 PM
I don't even check in game console
Avatar
if the server removes something for anti dupe, it always appears in server console
2:25 PM
i never had issues with this function
2:25 PM
what's the quantity you're spawning
2:26 PM
with quality 2
2:26 PM
force bp false (edited)
Avatar
are you sure the bp path is correct?
Avatar
yes
2:26 PM
Blueprint'/Game/PrimalEarth/CoreBlueprints/Weapons/PrimalItem_WeaponMetalHatchet.PrimalItem_WeaponMetalHatchet'
2:26 PM
otherwise it would not work I guess
Avatar
so you get the item added?
Avatar
yes on first call the item is added with proper quality, but on second call I enter the second if condition, and what is weird now if I call it a third time it works again
2:28 PM
but now I will enter two times the second if condition before next call is working
2:28 PM
then three times,
2:28 PM
etc
2:28 PM
so weird xD
Avatar
checking the function it seems to return false if the character or the inventory are null
2:29 PM
how do you call the function?
Avatar
I call it from a seperate thread that I create with std::thread
Avatar
ah
2:30 PM
you can't multi thread in this game
2:30 PM
😄
Avatar
lmao xD
Avatar
yeah that will crash 99% of the time
2:30 PM
maybe you'll get lucky that 1% 😄
2:30 PM
you can probably get away with multi threading if you lock the game tick
2:30 PM
but that's not really multi threading at that point 😄
2:30 PM
since you pause the game
Avatar
ok I will have another try on current thread next time
2:31 PM
is it safe to call it upons ChatMessage trigger from ArkApi ?
Avatar
in main thread?
2:32 PM
everything is safe in main thread
Avatar
in this function : bool ChatMessageCallback(AShooterPlayerController* _AShooterPlayerController, FString* Message, EChatSendMode::Type Mode, bool spam_check, bool command_executed) { // here }
Avatar
just nullptr check the variables you're using
2:32 PM
you can add your own chat message
2:32 PM
ArkApi::GetCommands().AddChatCommand("/bp", &GetIP);
2:32 PM
like this
2:32 PM
first param is the chat message it will intercept
2:33 PM
second param is the function invoked for that command
Avatar
ah ok I didn't know I was just parsing Message for /bp
Avatar
I guess it's doing same thing anyway x)
Avatar
API has callback binders for console commands, RCON commands and chat commands
Avatar
good
Avatar
Avatar
OSubMarin
I guess it's doing same thing anyway x)
yes but it's kinda unclean to hook it this way when the API can just manage it all for you 😄
Avatar
true I will make use of it
2:36 PM
can you pass arguments to the chat command?
Avatar
it has predefined params
2:37 PM
void GetIP(AShooterPlayerController* PC, FString* message, int mode)
Avatar
thanks
Avatar
It works way better without std::thread thanks again WETBATMAN
4:42 PM
it seems the item quality is always random w/e float value I set, but that's another problem ^^ (edited)
Avatar
Any game stuff don't multi thread it. I use threading quite a bit on MySQL caching for example. There's an example on that on the permissions plugin source
Avatar
Well my ZipSavegame RCON command was working nicely in a separate thread so I thought I could also manipulate the game from there
4:45 PM
my bad
4:46 PM
What are you multithreading? calls to MySQL or calls to game code?
Avatar
Calls to Mysql, doing queries to fetch the data
Avatar
ah ok that's why it works
Avatar
Then if I need to do anything I do it on the main thread
Avatar
ok
4:50 PM
regarding the item quality that seems random, I guess I will have to use one the method that expose the "min_random_quality" parameter
4:50 PM
correct?
Avatar
Avatar
OSubMarin
it seems the item quality is always random w/e float value I set, but that's another problem ^^ (edited)
you can set exact quality with the function i posted in examples
Avatar
thanks
Avatar
oh actually it's not posted in examples
Avatar
are you sure you posted it in exemples?
Avatar
my bad
Avatar
yeah ^^
4:52 PM
no problem
Avatar
void SetItemStatValue(UPrimalItem* item, EPrimalItemStat::Type item_stat_type, const float new_value) { float newStat = 0.f; if (item_stat_type == EPrimalItemStat::Armor || item_stat_type == EPrimalItemStat::MaxDurability) { item->ItemStatValuesField()()[item_stat_type] = 0; float old_stat_modifier = item->GetItemStatModifier(item_stat_type); item->ItemStatValuesField()()[item_stat_type] = 1; newStat = (new_value - old_stat_modifier) / (item->GetItemStatModifier(item_stat_type) - old_stat_modifier); } else if (item_stat_type == EPrimalItemStat::WeaponDamagePercent) { item->ItemStatValuesField()()[item_stat_type] = 0; float min_damage = item->GetItemStatModifier(item_stat_type); item->ItemStatValuesField()()[item_stat_type] = 65535; float max_damage = item->GetItemStatModifier(item_stat_type); float diff = max_damage - min_damage; float multiplier = 65535 / diff; newStat = new_value / 100.f - min_damage; newStat *= multiplier; newStat += 1.f; } if (newStat >= 65536.f) newStat = 65535; item->ItemStatValuesField()()[item_stat_type] = newStat; if (item_stat_type == EPrimalItemStat::MaxDurability) { if (item->bUseItemDurability()()) item->ItemDurabilityField() = item->GetItemStatModifier(item_stat_type); } #ifdef Ark item->UpdatedItem(false); #endif #ifdef Atlas item->UpdatedItem(); #endif }
4:52 PM
here
Avatar
ah, that's seems a bit big for my need (I don't need to set the exact stat) (edited)
4:53 PM
I'm fine with the random aspect, I just want to always have a Rare item if I set quality to 2, but you can get common and unusual item it seems
4:53 PM
I think the min_random_quality is supposed to prevent having common/unusual
4:56 PM
I will do some tests and fallback to set an exact value with your method if I don't succeed with the min_random_quality
Avatar
You can always try with UPrimalItem::AddNewItem or some other funcs (edited)
4:56 PM
Add new item has more properties to init the item (edited)
Avatar
yep that's what I wanted to do, because last time I tried them I was still in another thread and I was not understanding why everything was acting so weird (unpredictable function returns)
Avatar
Just threads 😄
Avatar
Avatar
OSubMarin
I call it from a seperate thread that I create with std::thread
As Batman said you can’t multithread
6:04 PM
A large amount of functions will throw an assert if they are not run on the game thread
Avatar
not when you do catch (...) { /*doNothing*/ } like me ^^ (edited)
6:07 PM
well, maybe it throws but I didn't deal with 😄
Avatar
Catch(...) is dangerous. We had some crash prevention in the base API and we ended up removing it because Michidu said it was very dangerous to catch exceptions like that
Avatar
yes I know it's bad
6:08 PM
it's just for quick tests purposes
6:08 PM
generally ^^
Avatar
Well then it's fine, just don't use for production
👌 1
Avatar
handling errors with exceptions is generally bad, not only the catch (...) { /*doNothing*/ } (but this one is the worst) (edited)
6:13 PM
it uses a lot of resources
Avatar
It works perfectly without std::thread, beautiful. (edited)
7:31 PM
You've done a great work on this API congrats.
🤟 1
Avatar
static bool MyGiveItem(uint64 targetSteamId, FString* blueprintPath, int quantity, float quality, bool forceBlueprint, float minRandomQuality) { // Get target player AShooterPlayerController* target = ArkApi::GetApiUtils().FindPlayerFromSteamId(targetSteamId); if (!target) return false; // Get target player's inventory UPrimalInventoryComponent* targetInventory = target->GetPlayerInventoryComponent(); if (!targetInventory) return false; // Get target player character AShooterCharacter* targetCharacter = target->GetPlayerCharacter(); if (!targetCharacter) return false; // Get item class UClass* bpUClass = UVictoryCore::BPLoadClass(blueprintPath); if (!bpUClass) return false; // Is item stackable? UPrimalItem* defaultItem = (UPrimalItem*)(bpUClass->GetDefaultObject(true)); int quantityOverride = 2; bool canStack = (targetInventory->bAllowItemStacking()() && defaultItem && defaultItem->CanStackWithItem(defaultItem, &quantityOverride)); // Create the item UPrimalItem* item = UPrimalItem::AddNewItem(TSubclassOf<UPrimalItem>(bpUClass), nullptr, false, !canStack, quality, false, quantity, forceBlueprint, 0.0F, false, nullptr, minRandomQuality); if (!item) return false; // Add the item to target's inventory if (!targetInventory->AddItemObjectEx(item, false, false, !canStack, true, !item->IsUsableConsumable(), false, targetCharacter, false, nullptr, false)) return false; // Return success return true; } (edited)
7:48 PM
I use this template now as it gives a lot of control on the spawned item (I didn't try all parameters yet, like the ClampStats boolean and MaxDifficultyClamp float value).
7:49 PM
But I tried the minRandomQuality and it works, I'm able to always get a Rare item by setting it to 2 (and still getting a random rare quality). (edited)
👍 2
Avatar
You could probably do this to reduce your temporary variables // Is item stackable? UPrimalItem* cdo = (UPrimalItem*)(bpUClass->GetDefaultObject(true)); //(UPrimalItem*)(bpUClass); int quantityOverride = 2; bool canStack = (targetInventory->bAllowItemStacking()() && cdo && cdo->CanStackWithItem(cdo, &quantityOverride));
8:00 PM
bpUClass->GetDefaultObject(true) should be returning the same pointer anyways for tmp and tmpB (edited)
Avatar
yep I was planning on checking pointers values
8:01 PM
but if you're confident enough I'll directly switch to that
Avatar
CDO is the class default object
8:01 PM
it should never change
👍 1
Avatar
Yeah, UClass keeps a pointer to the CDO, and always returns the same one which it has stored. If it doesn't have it created a new one and stores it. So it should be the same always
👌 1
Avatar
edited above ^^
👍 1
Avatar
For the function I posted above, would you recommend to add FORCEINLINE or not?
8:19 PM
static FORCEINLINE bool MyGiveItem(uint64 targetSteamId, FString* blueprintPath, int quantity, float quality, bool forceBlueprint, float minRandomQuality) { /*...*/ }
8:20 PM
I generally use inline for little function like arithmetic operations
Avatar
FORCEINLINE is a non standard macro
8:20 PM
Use inline
Avatar
alright, I'm asking this because I saw it everywhere on the API
8:21 PM
I don't even know if inline is worth in that case
8:21 PM
this function is kinda big
8:22 PM
I think I will leave it as a static func
8:22 PM
I'm not searching for that 1ms improvment anyway (edited)
Avatar
Recommend reading
8:23 PM
The C++ inline keyword can be used to suggest inline functions to the compiler.
8:23 PM
Avatar
yeah you can read straight from the beginning that this constraint causes inline functions to behave as if they were instantiated functions
8:24 PM
I don't need that I think
8:25 PM
and I'm too lazy to test performance difference
Avatar
If you put inline the compiler will decide
8:25 PM
The insertion, called inline expansion or inlining, occurs only if the compiler's cost-benefit analysis shows it's worthwhile.
Avatar
yeah I'm almost sure it will decide to not inline this huge function (edited)
8:26 PM
which itself has probably inlines
8:26 PM
it can easily go in inlining nightmare
8:26 PM
I don't know x)
8:26 PM
static will be good enough!
8:29 PM
and thank you Substitute
thumbs 1
8:34 PM
I like the Even with __forceinline, the compiler can't inline code in all circumstances. The compiler can't inline a function if: *Insert long list of things here* on the MS link you gave me ^^ (edited)
8:36 PM
good thing that compilers are making sure everything is ok tho
8:37 PM
I guess even if I put FORCEINLINE everywhere it will work, just with a longer compilation time (edited)
Avatar
jraServerAPI 8/29/2021 5:06 PM
Good Morning! It's not rocket science or anything.. but I thought of a very easy way to support multi languages in my plugins, and it's not something I've seen in any other configurations thus far, so I just figured I would share with the community (the snippet below is from my Offline Shaming plugin) // New Messaging config allows for multi language support. // In the example below you could add a Spanish group to Permissions and anyone within that group will see the messages in Spanish instead of Default (english) "Messages":{ "Groups":{ "Default": { "SenderNameInChat": "OFFLINE RAIDING ALERT", "Warning": "Warning", "LastWarning": "LAST WARNING", "WarningNotification": "You are Offline Raiding, if you continue, then your Name, Tribe and Location could be revealed to all players.", "msgMap": "Map", "msgPlayer": "Player", "msgIs": "is", "msgFromTribe": "from tribe", "msgOffliningTribe": "offlining tribe" }, "Spanish": { "SenderNameInChat": "ALERTA DE RAIDING SIN CONEXIÓN", "Warning": "Advertencia", "LastWarning": "ÚLTIMA ADVERTENCIA", "WarningNotification": "Estás incursionando sin conexión, si continúas, entonces tu nombre, tribu y ubicación podrían revelarse a todos los jugadores.", "msgMap": "Mapa", "msgPlayer": "Jugador", "msgIs": "es", "msgFromTribe": "de la tribu", "msgOffliningTribe": "tribu delineante" } } } 9130_comfy_blue_blanket (edited)
👍 2
Avatar
Is your repository on Github @jraServerAPI ? I could not find it for the little following pull-request: "French": { "SenderNameInChat": "ALERTE RAID HORS CONNEXION", "Warning": "Avertissement", "LastWarning": "DERNIER AVERTISSEMENT", "WarningNotification": "Vous êtes en train de faire un raid hors connexion, si vous continuez, alors votre Nom, Tribu et Position pourraient être révélés à l'ensemble des joueurs.", "msgMap": "Carte", "msgPlayer": "Joueur", "msgIs": "est", "msgFromTribe": "de la tribu", "msgOffliningTribe": "raid la tribu" } (edited)
Avatar
I'm searching the best hook for catching when a player dies. I used the Hook Creator app and found the following but I'm not sure it's the best candidate :
12:59 PM
I just need the SteamID (uint64) of the player who died basically.
12:59 PM
With the less resources consumption possible ^^
Avatar
AShooterCharacter::Die (edited)
Avatar
thanks I will look at it 👍
Avatar
I get this little warning but I guess it's normal:
1:18 PM
1:19 PM
DECLARE_HOOK definition not found but it compiles nicely without warnings.
Avatar
Avatar
OSubMarin
DECLARE_HOOK definition not found but it compiles nicely without warnings.
this is fine
Avatar
Avatar
OSubMarin
Click to see attachment 🖼️
wrong hook
1:19 PM
APrimalCharacter::Die triggers for dinos and players
1:19 PM
AShooterCharacter::Die triggers for only players
Avatar
ah my bad, thank you
Avatar
Avatar
OSubMarin
Is your repository on Github @jraServerAPI ? I could not find it for the little following pull-request: "French": { "SenderNameInChat": "ALERTE RAID HORS CONNEXION", "Warning": "Avertissement", "LastWarning": "DERNIER AVERTISSEMENT", "WarningNotification": "Vous êtes en train de faire un raid hors connexion, si vous continuez, alors votre Nom, Tribu et Position pourraient être révélés à l'ensemble des joueurs.", "msgMap": "Carte", "msgPlayer": "Joueur", "msgIs": "est", "msgFromTribe": "de la tribu", "msgOffliningTribe": "raid la tribu" } (edited)
jraServerAPI 8/30/2021 3:19 PM
I'm a bit slow.. I haven't set that up yet pepeold
👌 1
Avatar
Now I'm hesitating between: FString GetTribeName(AShooterPlayerController* playerController) { auto playerState = playerController->GetShooterPlayerState(); if (playerState) { FString playerOrTribeName; playerState->GetPlayerOrTribeName(&playerOrTribeName); return playerOrTribeName; } return L""; } and FString GetTribeName(AShooterPlayerController* playerController) { auto playerState = playerController->GetShooterPlayerState(); if (playerState) { auto tribeData = playerState->MyTribeDataField(); if (tribeData) return tribeData->TribeNameField(); } return L""; } Or maybe there is an easier way to get the tribe name?
3:27 PM
I suppose AShooterPlayerState::GetPlayerOrTribeName() returns the player name if he is not in a tribe, is it correct? (edited)
Avatar
Avatar
OSubMarin
I suppose AShooterPlayerState::GetPlayerOrTribeName() returns the player name if he is not in a tribe, is it correct? (edited)
FString *__fastcall AShooterPlayerState::GetPlayerOrTribeName(AShooterPlayerState *this, FString *result) { AShooterPlayerState *v3; // [rsp+40h] [rbp+8h] FString *v4; // [rsp+48h] [rbp+10h] v4 = result; v3 = this; if ( AShooterPlayerState::IsInTribe(this) ) TArray<wchar_t,FDefaultAllocator>::TArray<wchar_t,FDefaultAllocator>(&v4->Data, &v3->MyTribeData.TribeName.Data); else TArray<wchar_t,FDefaultAllocator>::TArray<wchar_t,FDefaultAllocator>(&v4->Data, &v3->PlayerName.Data); return v4; }
3:57 PM
correct
4:01 PM
if the player is alive you can also read the tribe name from the character
Avatar
thank you 👍
4:53 PM
btw, are you using IDA to get clean representations like this? when I tried with IDA I did not find the way to specify the pdb file so it looks very ugly ^^
Avatar
jraServerAPI 8/30/2021 4:58 PM
Yes, he did
Avatar
ok thank you, I'll have to search more for the proper configuration then
Avatar
jraServerAPI 8/30/2021 4:59 PM
I believe you just use IDA to disassemble the exe
4:59 PM
it's a long process, they actually sent me the files instead 🙂 (edited)
Avatar
well yes, but if it is not able to load the associated PDB file it won't put proper labels for function names and so on, only random aliases
Avatar
jraServerAPI 8/30/2021 5:00 PM
I'm not an IDA expert like though, I'm still learning too
Avatar
and in the .EXE, the path to the PDB is wrong, IDA tries to load it from a drive that do not even exist
5:00 PM
I'm sure there's an option in IDA to tell it where is the PDB file precisely
5:00 PM
I just did not find the option yet ^^
Avatar
jraServerAPI 8/30/2021 5:01 PM
When @WETBATMAN see this, he'll laugh at me and then remedy the situation with the correct responses 😆
Avatar
lol
Avatar
jraServerAPI 8/30/2021 5:01 PM
hmm i dont recall having to set that option, but i set it up a looong time ago
5:02 PM
and i'm old..so.. yeah
Avatar
Avatar
OSubMarin
and in the .EXE, the path to the PDB is wrong, IDA tries to load it from a drive that do not even exist
the path is correct
5:02 PM
because IDA scans the same folder for pdb
5:02 PM
but in case it doesn't find it, it will ask you to select it
Avatar
ah ok, I remember getting an error message saying it did not find it, asking if it should look in local and Microsoft PDB stores. I do not recall being asked the location, only to look for local/MS stores, but I will have to try again.
Avatar
the pdb link path won't match your drive ofc
5:04 PM
the link path is valid only for whoever compiled it (edited)
5:04 PM
however ida searches in the folder the .exe is in
Avatar
alright then it's probably my fault, didn't look proper sections or w/e, I will test again thank you
Avatar
you're decompiling ShooterGameServer right?
5:06 PM
it has to be a dedicated server install aswell
Avatar
yes I think at the time I download the server version for that
5:07 PM
yes that's what I used
5:07 PM
I've some knowledge of ASM and C but still a beginner with IDA
5:08 PM
hmmm
5:09 PM
maybe I used ShooterGame actually, I can't remember xD
5:09 PM
I need to test again now.
Avatar
both have pdb's
5:09 PM
it should have decompiled anyways lol
Avatar
yeah but I didn't find interesting code, but I only briefly looked
5:10 PM
I'll have to try again and get a deeper dive this time now that I know a little better the game function prototypes (edited)
5:11 PM
if I'm able to find the GetPlayerOrTribeName function myself with IDA I should be able to find others then.
Avatar
jraServerAPI 8/30/2021 5:36 PM
yes, you just need to search (ctrl+f) in the functions panel
5:36 PM
Avatar
Hello, I'm currently trying to make a simple points system for my cluster. Here's what I have so far:
1:14 AM
void GivePointsHandler() { // Static variables declaration and initialization. static std::map<unsigned long long, double> playersPoints = std::map<unsigned long long, double>(); static int loopCnt = 0; // Iterate connected players AShooterPlayerController* shooterPc; AShooterCharacter* pc; unsigned long long steamId; const auto& player_controllers = ArkApi::GetApiUtils().GetWorld()->PlayerControllerListField(); if (player_controllers.Num() > 0) for (TWeakObjectPtr<APlayerController> player_controller : player_controllers) if (shooterPc = static_cast<AShooterPlayerController*>(player_controller.Get())) if ((pc = shooterPc->GetPlayerCharacter()) && pc->IsConscious()) // If player is alive and conscious if ((steamId = shooterPc->GetUniqueNetIdAsUINT64()) > 0Ui64) // If Steam ID is valid { if (playersPoints.find(steamId) == playersPoints.end()) playersPoints[steamId] = 1.0; // Player just earned his first point. else playersPoints[steamId] = (playersPoints[steamId] + 1.0); // Add 1 point to player points. } if (++loopCnt >= 300) // Increment loop counter and check if it has been 5 minutes { // Make a local copy of current players points std::map<unsigned long long, double> playersPointsCopy = std::map<unsigned long long, double>(playersPoints); // Reset current players points playersPoints.clear(); // Reset loop counter loopCnt = 0; // TODO: Process/save players points local copy asynchronously here } } (edited)
1:15 AM
void Load() { ArkApi::GetCommands().AddOnTimerCallback("giveplayerpoints", &GivePointsHandler); // Call GivePointsHandler every second } void Unload() { ArkApi::GetCommands().RemoveOnTimerCallback("giveplayerpoints"); } PS: Edited code above with @WETBATMAN suggestions. . (edited)
1:16 AM
and the question: Is it the fastest way to iterate connected players?
1:16 AM
Because I know that AddOnTimerCallback() from the API will call the callback every seconds, so I need something very efficient there.
1:20 AM
Or maybe is there an equivalent of AddOnTimerCallback() that triggers every minute instead of every second? (edited)
Avatar
Avatar
OSubMarin
void GivePointsHandler() { // Static variables declaration and initialization. static std::map<unsigned long long, double> playersPoints = std::map<unsigned long long, double>(); static int loopCnt = 0; // Iterate connected players AShooterPlayerController* shooterPc; AShooterCharacter* pc; unsigned long long steamId; const auto& player_controllers = ArkApi::GetApiUtils().GetWorld()->PlayerControllerListField(); if (player_controllers.Num() > 0) for (TWeakObjectPtr<APlayerController> player_controller : player_controllers) if (shooterPc = static_cast<AShooterPlayerController*>(player_controller.Get())) if ((pc = shooterPc->GetPlayerCharacter()) && pc->IsConscious()) // If player is alive and conscious if ((steamId = shooterPc->GetUniqueNetIdAsUINT64()) > 0Ui64) // If Steam ID is valid { if (playersPoints.find(steamId) == playersPoints.end()) playersPoints[steamId] = 1.0; // Player just earned his first point. else playersPoints[steamId] = (playersPoints[steamId] + 1.0); // Add 1 point to player points. } if (++loopCnt >= 300) // Increment loop counter and check if it has been 5 minutes { // Make a local copy of current players points std::map<unsigned long long, double> playersPointsCopy = std::map<unsigned long long, double>(playersPoints); // Reset current players points playersPoints.clear(); // Reset loop counter loopCnt = 0; // TODO: Process/save players points local copy asynchronously here } } (edited)
your controller iteration is fine
1:24 AM
and yes there is a timer you can set that triggers every 1 min
1:25 AM
API::Timer::Get().RecurringExecute(&callback, 60, -1, false);
1:25 AM
like this
Avatar
I can only see one that triggers every frame and one that triggers every seconds
Avatar
be sure to include Timer.h
Avatar
Ah ok
Avatar
Avatar
OSubMarin
I can only see one that triggers every frame and one that triggers every seconds
you can check time delay on your own also
Avatar
This will execute &callback on the game's main thread right?
Avatar
yes
Avatar
ok
Avatar
that's what the last param is for
Avatar
thank you
Avatar
!playerCharacter->IsDead()
1:27 AM
does this work for you?
1:27 AM
i remember it always crashing for me
Avatar
I didn't test the above code yet
1:28 AM
I was expecting it to work
1:28 AM
now I will remove IsDead() check thanks ^^
Avatar
playerCharacter->IsAlive()
1:28 AM
this is also redundant
1:28 AM
because the player character will always be null if the player is dead
1:29 AM
so it doesn't even make it to that
Avatar
yeah I added it because I wanted to make sure he is not dead but I actually don't care that much, even if player is in dead state he can keep earning points. (edited)
1:29 AM
and yeah if the check is not even reached anyway...
1:29 AM
thanks!
1:31 AM
there is no need to unset the registered callback with the API::Timer method?
1:31 AM
like the RemoveOnTimerCallback()
Avatar
there is not
👌 1
1:31 AM
i'd check the time diff myself inside tick
Avatar
a tick callback is called every frame right?
Avatar
correct
Avatar
I don't need that
Avatar
OnTimerCallback is every second
Avatar
I can have every minute it's fine ^^
1:32 AM
yeah every second is okay too I guess
1:32 AM
but because I'm not sure of my connected players iteration you know
Avatar
you can count time wither either time(0) which returns unix epoch time
1:32 AM
or use the server time seconds field
1:32 AM
inside UWORLD
1:33 AM
the latter is dependent on the savefile
1:33 AM
it starts at 0 on server wipe
Avatar
no I don't need such precision either ^^
1:33 AM
if the callback fire at 1.05 sec instead of 1.0 it's okay too (edited)
Avatar
no, i meant that if you want to exec it every minute you can count the seconds until a minute has passed
Avatar
I just need 0 lags at all
1:34 AM
ok but I would prefer a more optimized way than counting myself
1:34 AM
by using API's method typically
Avatar
if you store the last check timestamp
1:35 AM
you can calculate the time difference
1:35 AM
but executing that every second should be fine anyway
Avatar
yeah exactly
1:35 AM
I don't even need the time difference
1:35 AM
if the code guarantee me it's been about a second it's fine
1:36 AM
I was just scared that my PlayerController iteration is too slow for being used every seconds
1:37 AM
i use it to drain player's health in our stof game mode
1:37 AM
once sudden death starts
1:37 AM
i've even used this while we were hosting tournaments and nobody noticed any performance difference (edited)
Avatar
that's perfect then, it's what I need
1:39 AM
you are calling GetPlayerCharacter() and GetCharacterStatusComponent() two times if you enter the second if ^^
1:40 AM
sorry I'm in optimisation mode haha
Avatar
true heh
1:40 AM
but it only reads a pointer
Avatar
yeah it's always a trade between memory and cpu
1:47 AM
what is that sudden death mode btw? you pick a random number and if you get unlucky you get suicided by the server? ^^
Avatar
Avatar
OSubMarin
what is that sudden death mode btw? you pick a random number and if you get unlucky you get suicided by the server? ^^
no, it's a survival of the fittest game mode
1:48 AM
the ring shrinks and once it reaches the middle of the map, players who are left inside drain health until they die
1:48 AM
kills give them hp back
1:48 AM
😄
Avatar
ah ok I see now
1:48 AM
fortnite famous for this mode x)
1:49 AM
so there's no russian roulette mod yet ^^
1:50 AM
/roulette
1:51 AM
that's something I could add, easy to do now that I have the proper setup
1:53 AM
now I'm thinking of an even more advanced "Russian roulette mod", which would first check if you're holding a charged weapon, and if the roulette finds the bullet it would fire the weapon before suiciding you (edited)
Avatar
Avatar
OSubMarin
yeah it's always a trade between memory and cpu
substitute 9/7/2021 2:40 AM
There is zero optimization issue there
2:40 AM
a smart compiler should inline the pointer read
Avatar
Avatar
OSubMarin
you are calling GetPlayerCharacter() and GetCharacterStatusComponent() two times if you enter the second if ^^
substitute 9/7/2021 2:40 AM
specifically this
2:42 AM
let's assume that we only have the eax register and that we only need to use mov to read from the pointer to keep things simple doing GetPlayerCharacter() should translate to something like enter 0,0 mov eax, ptr leave but a compiler that inlines this should produce mov eax, ptr which is the same as if you had read from the pointer directly. (edited)
Avatar
optimization issue I never said it was an issue tho
Avatar
Avatar
OSubMarin
now I'm thinking of an even more advanced "Russian roulette mod", which would first check if you're holding a charged weapon, and if the roulette finds the bullet it would fire the weapon before suiciding you (edited)
substitute 9/7/2021 2:44 AM
just spawn a particle emitter on the character's head.
Avatar
Avatar
OSubMarin
sorry I'm in optimisation mode haha
substitute 9/7/2021 2:44 AM
You said here. (edited)
2:44 AM
there is no optimization to be made.
Avatar
yes you could have a pointer allocated on stack to save function resolution and call times
Avatar
substitute 9/7/2021 2:45 AM
WetBatman wrote the most optimal code in his picture.
Avatar
Avatar
OSubMarin
yes you could have a pointer allocated on stack to save function resolution and call times
substitute 9/7/2021 2:45 AM
And that isn't true with a compiler that optimizes code.
2:45 AM
it should produce the same code
2:46 AM
no matter what you do, you need to read the previous level pointers before referencing the last one
2:46 AM
It should only produce a difference if you use -O0 for some reason
Avatar
I prefer to not rely on compilers because sometimes two function calls instead of one can have consequences, I never said here it was a problem tho.
Avatar
substitute 9/7/2021 2:47 AM
If you don't trust your compiler, then drop all languages other than assembly 😉
Avatar
if you prefer for me it's just more sane to have a pointer
2:47 AM
question of habbits I supposed
Avatar
Avatar
OSubMarin
I prefer to not rely on compilers because sometimes two function calls instead of one can have consequences, I never said here it was a problem tho.
substitute 9/7/2021 2:47 AM
You should also NEVER have this happen
2:47 AM
if that happens you either have undefined behavior
2:48 AM
or your code is impure and mutates the state
2:48 AM
both of which are generally frowned upon unless explicitly marked.
Avatar
not really
2:48 AM
you could just have a function dealing with static variables or threads
Avatar
substitute 9/7/2021 2:48 AM
Yes? There's entire languages now designed explicitly to prevent state mutation
Avatar
Avatar
OSubMarin
you could just have a function dealing with static variables or threads
substitute 9/7/2021 2:49 AM
These should be clearly marked
2:49 AM
properly written code should have zero surprises
Avatar
or you could do like me, and store a pointer to function returns to avoid any additional resolutions and call times x)
Avatar
substitute 9/7/2021 2:50 AM
until the pointer is invalidated
Avatar
two different way
2:50 AM
it is not in this context
Avatar
substitute 9/7/2021 2:50 AM
It could be actually
2:50 AM
as that value is being read from PC which could at any time become invalid
Avatar
storing and checking one instruction after so if this happens I'd better uninstall the game now
2:51 AM
specially in non multi threaded game (edited)
Avatar
Avatar
OSubMarin
storing and checking one instruction after so if this happens I'd better uninstall the game now
substitute 9/7/2021 2:51 AM
If you're storing it locally prior to the next check, then no, it should not invalidate, but your code isn't any more optimized than simply rereading the pointer and compiling with -O3
2:52 AM
and the game is threaded, the threads are just clearly marked (rendering, game, etc.)
2:52 AM
the rendering thread runs entirely separate from the game update thread.
Avatar
yep that's what I meant
2:52 AM
I prefer doing the O3 myself
2:53 AM
question of habbits I suppose
Avatar
substitute 9/7/2021 2:53 AM
I disagree with trying to -O3 by hand. The hundreds of extremely experience developers and the 30+ years of Computer Science is always going to beat whatever optimizations I can make.
2:53 AM
especially since I don't know all x86_64 intrinsics (edited)
Avatar
no I was talking about the additional function resolution and call times
2:55 AM
good to know the compiler does it on its own (edited)
2:59 AM
this is what I have:
3:00 AM
I don't have O3 anyway
3:00 AM
it's not in the dropdown menu
Avatar
substitute 9/7/2021 3:01 AM
O3 is part of GCC and Clang (edited)
3:01 AM
MSVC doesn't really follow the same standardization that most compilers do with their flags.
Avatar
MS following standardization ^^
3:02 AM
yeah, funny
3:02 AM
with all their fancy types all the time to reinvent the wheel
3:04 AM
I'm targetting Windows environment so the msvc should not be a problem tho
Avatar
Avatar
substitute
just spawn a particle emitter on the character's head.
Yes but this will not produce the shooting animation right?
3:22 AM
What does the particle emitter allow? producing a sound and a flash light effect maybe?
3:23 AM
this could be enough if so
3:25 AM
I'll have to check that thank you
Avatar
Hello, I'm having troubles to remove all items of given type from player's inventory. Here is the code I made: bool RemoveSeeds(AShooterPlayerController* PC) { // Get player's inventory UPrimalInventoryComponent* inventory = PC->GetPlayerInventory(); if (inventory == nullptr) return false; // Get berrybush-seed class FString berryBushSeedBP = "Blueprint'/Game/PrimalEarth/CoreBlueprints/Items/Consumables/Seeds/PrimalItemConsumable_Seed_Test.PrimalItemConsumable_Seed_Test'"; UClass* bpUClass = UVictoryCore::BPLoadClass(&berryBushSeedBP); if (bpUClass == nullptr) return false; TSubclassOf<UPrimalItem> bpSubClass = TSubclassOf<UPrimalItem>(bpUClass); // Get berrybush-seeds from inventory TArray<UPrimalItem*> berryBushSeedItems; inventory->FindAllItemsOfType(&berryBushSeedItems, bpSubClass, true, true, false, false, false, false, false); int nbBerryBushSeeds = (int)berryBushSeedItems.Num(); if (nbBerryBushSeeds <= 0) { FString Text = L"You don't have any berrybush seed!"; PC->ClientServerChatDirectMessage(&Text, FLinearColor(255, 0, 0), false); return false; } // Remove berrybush-seeds from inventory for (int i = 0; i < nbBerryBushSeeds; i++) { UPrimalItem* currentItem = berryBushSeedItems[i]; if (currentItem != nullptr) { FItemNetInfo itemNetInfo; if (currentItem->GetItemNetInfo(&itemNetInfo, false) != nullptr) { FItemNetID itemNetId = itemNetInfo.ItemIDField(); inventory->RemoveItem(&itemNetId, false, false, true, false); } } } return true; } (edited)
8:57 AM
It crashes the server when I enter the for loop at the end, not sure why.
8:57 AM
Any help appreciated.
Avatar
I just found an example on the Discord, I will try it right now for (int i = 0; i < nbBerryBushSeeds; i++) { UPrimalItem* currentItem = berryBushSeedItems[i]; if (currentItem != nullptr) currentItem->OwnerInventoryField()->RemoveItem(&currentItem->ItemIDField(), false, false, true, true); }
Avatar
Yep, with the code just above this line it works nicely.
9:42 AM
Forget me please x)
9:42 AM
And have a nice day/night (edited)
Avatar
Hello, I'm trying to increase the period before someone gets auto-kick for being AFK on my servers. I added the -EnableIdlePlayerKick in command line arguments. The KickIdlePlayersPeriod is set to 3600. The problem is that AFK players are getting auto-kicked before reaching the 3600 seconds. Some people tried to increase the 3600 seconds value here without success: https://www.reddit.com/r/ARKone/comments/jmwr47/possible_workaround_for_30m_disconnect_change_the/ They say it's because the timer is client-side managed. They say that players need to restart their game in order to properly reset this timer. I will assume that what they is true, so I need to handle a timer on server side. I can setup stuff in the PostLogin function, but I have no idea of how I can get the number of seconds elapsed since last player action. (edited)
Avatar
Avatar
OSubMarin
Hello, I'm trying to increase the period before someone gets auto-kick for being AFK on my servers. I added the -EnableIdlePlayerKick in command line arguments. The KickIdlePlayersPeriod is set to 3600. The problem is that AFK players are getting auto-kicked before reaching the 3600 seconds. Some people tried to increase the 3600 seconds value here without success: https://www.reddit.com/r/ARKone/comments/jmwr47/possible_workaround_for_30m_disconnect_change_the/ They say it's because the timer is client-side managed. They say that players need to restart their game in order to properly reset this timer. I will assume that what they is true, so I need to handle a timer on server side. I can setup stuff in the PostLogin function, but I have no idea of how I can get the number of seconds elapsed since last player action. (edited)
hook KickPlayer and check for the afk kick string 🙂
11:35 AM
that will tell you exactly when the server tried to kick the player
Avatar
Good idea, but I still need to know when was the last action.
Avatar
they probably store a field somewhere
Avatar
Yep, still searching ^^
Avatar
find KickPlayer
11:36 AM
press ctrl + x on it
11:36 AM
and it will show you refs to everything that calls it
11:37 AM
then find where it's called from with the afk string
11:37 AM
that will show you how they check that
Avatar
Alright thanks for the methodology, will try it right now.
Avatar
ah it might not be so easy
11:41 AM
i cannot find the string
11:41 AM
that you get when you're idle
Avatar
Avatar
WETBATMAN
i cannot find the string
Maybe because the guys on reddit are right and it's only client side?
Avatar
I've started a text search for "idle" in IDA but it's running since few minutes now, I guess I will have too much results ^^ (edited)
12:01 PM
I can see a lot of function related to IdleMode, mostly linked to CVarIdleWhenNotForeground
12:07 PM
I found the string WETBATMAN
12:07 PM
12:11 PM
It is used in this function : void __usercall AShooterPlayerController::TickActor(AShooterPlayerController *this@<rcx>, float DeltaTime@<xmm1>, ELevelTick TickType@<r8d>, FActorTickFunction *ThisTickFunction@<r9>, signed __int64 a5@<rax>)
12:12 PM
Not sure what do to with this info tho :/
Avatar
why does it not show me this in strings lol
12:16 PM
this->LastMultiUseInteractionTime
12:16 PM
ah
12:16 PM
here
12:16 PM
this is where they store the last activity
12:18 PM
you're right I can also see the v79 = UWorld::TimeSince(v78, v655->LastMultiUseInteractionTime); if ( v79 > v113 ) {
Avatar
if ( UWorld::TimeSince(v32, this->LastLargeMoveTime) > v50 || (v33 = this->GetWorld(this), UWorld::TimeSince(v33, this->LastNotOnUnriddenDinoTime) > v50) ) { v34 = this->GetWorld(this); if ( UWorld::TimeSince(v34, this->LastMultiUseInteractionTime) > v50 )
12:18 PM
this seems to be the driver code behind the kick
Avatar
Alright
12:19 PM
I think I can do something now
12:19 PM
Thanks for your help, will comeback when I have more details
Avatar
np 🙂
Avatar
I don't understand this variable name LastNotOnUnriddenDinoTime
12:35 PM
I suppose it's the last time the player went on/out of a dino? What a weird name ^^ (edited)
Avatar
Avatar
OSubMarin
I don't understand this variable name LastNotOnUnriddenDinoTime
i guess that means the last time player controlled a dino?
1:09 PM
so like passengers wouldn't count i guess
Avatar
Ok, that's also what I thought. (edited)
Avatar
🐨Dream Doctor🦘 9/23/2021 2:45 AM
Is there any way for us to access a character's explorer notes?
Avatar
What do you mean by accessing? You want to list unlocked explorer notes or modify them?
9:44 AM
I'll have a look with IDA to see if I can find something. (edited)
Avatar
Avatar
OSubMarin
What do you mean by accessing? You want to list unlocked explorer notes or modify them?
🐨Dream Doctor🦘 9/24/2021 2:36 AM
Both actually, yes 🙂 And thank you, that would be awesome.
Avatar
🐨Dream Doctor🦘 9/24/2021 7:09 AM
Apparently the explorer notes are stored in the player profile file. Do we have any access to that in the api?
Avatar
I think that you need to modify an array in the player's profile (you don't need to modify the profile file itself).
Avatar
Player profile might be primal player data, or the bytes array on the player data
5:35 PM
Nope, there's a UPrimalLocalProfile
5:35 PM
The most interesting parts of the class are these (not complete, it's too large to include here) struct UPrimalLocalProfile : UObject { TArray<TSubclassOf<UPrimalItem>,FDefaultAllocator> AchievementItemsCollectedList; TArray<FString,FDefaultAllocator> UnlockedAchievementsList; TArray<unsigned int,FDefaultAllocator> GlobalExplorerNoteUnlocks; TArray<FString,FDefaultAllocator> UnlockedAchievements; // ... }; (edited)
👍 1
5:37 PM
But by the looks of it and its variables it seems to be client side mostly?
Avatar
If it's client side only then you could teleport the player on the explorer note for a second and teleport him back. Not a pretty solution but that could do the trick. (edited)
Avatar
It would be useful for unlocking, but might not be the use case here
8:46 PM
I believe it was meant to be read and check if player has X explorer note most likely
👌 1
Avatar
maybe looking at the part that handles the "+10 levels if all explorer notes unlocked" could give additional insight (edited)
9:21 PM
that could be handled locally too, but because of anti cheats measures there's probably a way for the server to validate that. (edited)
9:22 PM
or maybe I just discovered a new cheat x)
Avatar
Hello, I'm trying to get the points score when someone rides an HoverSail and make tricks. (edited)
1:41 AM
The problem is that I don't find where are the trick-points handled. (edited)
1:42 AM
Also I don't find the word "CORK" in IDA for some reason, I guess it's client side only? (edited)
1:42 AM
Avatar
Avatar
OSubMarin
Hello, I'm trying to get the points score when someone rides an HoverSail and make tricks. (edited)
It’s probably all blueprint
2:30 AM
The string is probably in the uasset
Avatar
Thank you. I never played with blueprints/uassets yet tho. Does that mean that modifying the hoversail tricks behaviour cannot be done through Ark Server API? (edited)
2:38 AM
Actually I don't want to modify its behaviour, I just want to grab the trick-points to make an "hoversail points player ladder" ^^ (edited)
2:42 AM
Does someone has a good starting point for me to work with Ark blueprints/uassets (like a tutorial or some documentation link)? (edited)
Avatar
I suggest downloading the devkit
5:24 AM
You can hook the event from a c++ function
Avatar
Thanks again Substitute
9:29 PM
Does anyone know what can it be?
Avatar
Avatar
DEX
Click to see attachment 🖼️
One of your threads is hung
Avatar
i am trying to figure out how to teleport offline players to my position
11:47 PM
FVector& pos = player->RootComponentField()->RelativeLocationField(); Character->SetActorLocation(&pos, false); where is of type AShooterCharacter
11:47 PM
this does no work, neither ->TeleportTo()
11:47 PM
is not possible to change the position of AShooterCharacter?
Avatar
Avatar
Uaca
is not possible to change the position of AShooterCharacter?
void __fastcall AShooterPlayerController::SetPlayerPos(AShooterPlayerController *this, float X, float Y, float Z) { _BOOL8 v4; // r8 APawn *v5; // [rsp+20h] [rbp-48h] FVector NewLocation; // [rsp+28h] [rbp-40h] BYREF FVector v7[3]; // [rsp+40h] [rbp-28h] BYREF NewLocation.X = X; NewLocation.Y = Y; NewLocation.Z = Z; v5 = this->Pawn; if ( v5 ) { AActor::SetActorLocation(v5, &NewLocation, 0); LOBYTE(v4) = 1; v5->ResetCollisionSweepLocation(v5, &NewLocation, v4); } else if ( AShooterPlayerController::IsSpectator(this) ) { qmemcpy(v7, &NewLocation, 0xCui64); AShooterPlayerController::ClientSetSpectatorLocation(this, v7); } }
11:52 PM
this is how the game does it
Avatar
I am trying to figure out how to serialize object inside the plugin, so far I found a few classes that have a serialize method like APrimalCharacter->Serialize(FArchive * Ar), but I did no find something to unSerialize
3:07 AM
should I try to use something like the boost lib, or there is a way to serialize/unserialize using what the Ark Api have?
Avatar
lookin into boost and other serialization library's, looks like in c++ I have to provide my onw serializa/unserialize data
2:58 PM
that is so much work 😦
Avatar
@UacaUObjects have reflection info
4:21 PM
iterate the properties and serialize that
Avatar
Avatar
substitute
@UacaUObjects have reflection info
is this something from the unreal engine or native from c++, i am having a hard time finding about reflection using C++
Avatar
Avatar
Uaca
is this something from the unreal engine or native from c++, i am having a hard time finding about reflection using C++
UE4
2:49 AM
thank you very much for the help
Avatar
jraServerAPI 11/3/2021 3:24 PM
So I was looking for a way to tell if the Transmitter was turned on or not, in the API. I found it at APrimalStructureItemContainer->bContainerActivated Just wanted to share 🙂
Avatar
cool! thanks for sharing! 🙂
Avatar
I am using UKismetSystemLibrary::SphereOverlapActors_NEW to find structures nearby, it looks like it only works with player near the locations, is there any way to scan for structures without player near by?
Avatar
jraServerAPI 11/11/2021 8:11 PM
I think you can try UVictoryCore::ServerOctreeOverlapActors
8:12 PM
thats what I use
8:13 PM
oh wait.. i think i read that wrong ha
8:15 PM
let me try again.. this should work i think UGameplayStatics::GetAllActorsOfClass
Avatar
and for each position check if is in the Sphere?
Avatar
jraServerAPI 11/11/2021 8:17 PM
this will get all stuctures in the world c++ TArray<AActor*> FoundActors; UGameplayStatics::GetAllActorsOfClass(ArkApi::GetApiUtils().GetWorld(), APrimalStructure::GetPrivateStaticClass(), &FoundActors);
8:17 PM
then you can just loop thru FoundActors
Avatar
i see. Thank you!
Avatar
jraServerAPI 11/11/2021 8:18 PM
yw
8:19 PM
c++ for (const auto& actor : FoundActors) { APrimalStructure* myStructure = static_cast<APrimalStructure*>(actor); }
😄 1
Avatar
Avatar
Uaca
I am using UKismetSystemLibrary::SphereOverlapActors_NEW to find structures nearby, it looks like it only works with player near the locations, is there any way to scan for structures without player near by?
Yep, I just came accross the same exact issue recently. Using Octrees works better. There's also an api utils function to get nearby actors. You should avoid Get all actors of class unless necessary, if you need actors in range use octrees (GAAOC hangs the server for a moment)
Avatar
Avatar
Pelayori
Yep, I just came accross the same exact issue recently. Using Octrees works better. There's also an api utils function to get nearby actors. You should avoid Get all actors of class unless necessary, if you need actors in range use octrees (GAAOC hangs the server for a moment)
do you mean using ServerOctreeOverlapActors instead of SphereOverlapActors_NEW ?
Avatar
Yes, it's more reliable for non rendered structures and it's also faster
Avatar
will try, ty
Avatar
Avatar
Uaca
do you mean using ServerOctreeOverlapActors instead of SphereOverlapActors_NEW ?
Btw if you only need to know if a structure is within a sphere
9:38 PM
Just check the distance
9:38 PM
If sphere A is at point X and object B is at point Y
9:38 PM
Then distance(A,B) <= X.radius
9:38 PM
Then it is in the sphere
Avatar
this if I already have the structure? right?
Avatar
Yes
9:40 PM
If you know if structure B and have some point P and a known sphere radius R then Sphere A is obviously at P with radius R
9:40 PM
So if you know structure B you can do what I said above
Avatar
All points on the edge of the sphere are radius R from the center
9:40 PM
A sphere is just a 3D circle after all
Avatar
it make sense
9:41 PM
ty!
Avatar
One note!
9:41 PM
This will fail if the position of the structure is outside the radius
9:42 PM
So if it is a large object or near the edge it could fail
9:42 PM
You can adjust your radius by C where C is the size of the structure if you want to implement some fuzzy logic
9:43 PM
Basically if it is like 0.1 away from being inside … it probably is like 49% inside the sphere so a little leeway is ok
9:44 PM
You can calculate that exact amount given the look at vector between the sphere center, the object, and the object dimensions and rotation (if you want close to exact) (edited)
9:44 PM
But that is decently math heavy
9:45 PM
If your needs are that exact , use an overlap/octree
9:45 PM
It’s easier at that point 😉
Avatar
Avatar
substitute
You can calculate that exact amount given the look at vector between the sphere center, the object, and the object dimensions and rotation (if you want close to exact) (edited)
it is ark, you can’t be to exact or the player will think there is something wrong
9:58 PM
😅
9:58 PM
ty for the tips!
Avatar
I looks like there is 3 hooks for inventory dropped items:
UPrimalInventoryComponent_StaticDropNewItem UPrimalInventoryComponent_StaticDropNewItemWithInfo UPrimalInventoryComponent_StaticDropItem
Is there any advantage in using one over the other? I am just trying to know if the player dropped a fertilized egg
Avatar
jraServerAPI 11/13/2021 4:19 AM
Hook them and find out! 🙂
4:20 AM
I'm not sure, though
Avatar
Another approach is hooking ADroppedItem_BeginPlay or similar, and check the fields like dropped by player id, dropped by name (player name I guess), etc...
2:50 PM
FString & DroppedByNameField() { return *GetNativePointerField<FString*>(this, "ADroppedItem.DroppedByName"); } unsigned __int64& DroppedByPlayerIDField() { return *GetNativePointerField<unsigned __int64*>(this, "ADroppedItem.DroppedByPlayerID"); }
2:51 PM
Each time an item is dropped, a new ADroppedItem actor is spawned I believe (edited)
Avatar
Avatar
Pelayori
Another approach is hooking ADroppedItem_BeginPlay or similar, and check the fields like dropped by player id, dropped by name (player name I guess), etc...
i did not find the hook on the ADroppedItem_BeginPlay Server Api Hooker Creator
4:14 AM
and the static hooks wont fire
4:14 AM
but
4:14 AM
Hook_UPrimalInventoryComponent_DropItem work, well, kind works
4:15 AM
void Hook_UPrimalInventoryComponent_DropItem(UPrimalInventoryComponent* _this, FItemNetInfo* theInfo, bool bOverrideSpawnTransform, FVector* LocationOverride, FRotator* RotationOverride, bool bPreventDropImpulse, bool bThrow, bool bSecondryAction, bool bSetItemDropLocation) { Log::GetLog()->warn("Hook_UPrimalInventoryComponent_DropItem"); int index; auto itemNetID = theInfo->ItemIDField(); auto item = _this->FindItem(&itemNetID, false, false, &index); if (item != nullptr) { FString itemName; item->NameField().ToString(&itemName); Log::GetLog()->warn("found: {}", itemName.ToString()); } else { Log::GetLog()->warn("not found"); } UPrimalInventoryComponent_DropItem_original(_this, theInfo, bOverrideSpawnTransform, LocationOverride, RotationOverride, bPreventDropImpulse, bThrow, bSecondryAction, bSetItemDropLocation); }
4:15 AM
the item is always empty
4:16 AM
is the item is dropped, will UPrimalInventoryComponent still have reference to the item? Because it was like already removed?
Avatar
yeah, i used the dump from ark shop to check, the item is already out of the inventory
Avatar
hello is there any way to convert the uint64 to output per message c++ void IDSteam(AShooterPlayerController* player_controller, FString* /*unused*/, EChatSendMode::Type /*unused*/) { const uint64 steam_id = ArkApi::IApiUtils::GetSteamIdFromController(player_controller); ArkApi::GetApiUtils().SendChatMessage(player_controller, "ID: ", steam_id); }
Avatar
To add the arguments to the string add {} for each argument you want to output. You can put multiple times the same argument by using the arg's index: {0}, {1}, {2}, etc...
7:46 PM
ArkApi::GetApiUtils().SendChatMessage(player_controller, "ID: {}", steam_id);
Avatar
Crash c++ void IDSteam(AShooterPlayerController* player_controller, FString* /*unused*/, EChatSendMode::Type /*unused*/) { const uint64 steam_id = ArkApi::IApiUtils::GetSteamIdFromController(player_controller); FString myMessage = FString::Format(L"ID: {}", steam_id); ArkApi::GetApiUtils().SendChatMessage(player_controller, L"Server", ArkApi::Tools::Utf8Decode(myMessage.ToString()).c_str()); } (edited)
8:14 PM
@Pelayori
Avatar
What kind of crash
Avatar
by putting the command assigned example / id crash
Avatar
I repair
Avatar
BananaBread 11/25/2021 4:56 PM
I got a question to c++. How do I point to a function for a case of std::function. I would guess it wants something like &function or std::bind(&class::on_message_received). But that doesnt work for some reason :(. example: bool ChatListener::on_message_received(AShooterPlayerController* player_controller, FString* msg, EChatSendMode::Type t, bool x, bool y) { return true; } BOOL ChatListener::load() { Api::GetCommands().AddOnChatMessageCallback(chatMessageCallbackID, std::bind(&ChatListener::on_message_received, this)); return TRUE; } (edited)
5:00 PM
would appreciate some help
Avatar
Avatar
BananaBread
I got a question to c++. How do I point to a function for a case of std::function. I would guess it wants something like &function or std::bind(&class::on_message_received). But that doesnt work for some reason :(. example: bool ChatListener::on_message_received(AShooterPlayerController* player_controller, FString* msg, EChatSendMode::Type t, bool x, bool y) { return true; } BOOL ChatListener::load() { Api::GetCommands().AddOnChatMessageCallback(chatMessageCallbackID, std::bind(&ChatListener::on_message_received, this)); return TRUE; } (edited)
you aren't binding the params
5:06 PM
you're only binding the instance
5:06 PM
use std::placeholders
Avatar
BananaBread 11/25/2021 5:16 PM
ty sm ill try it out asap (edited)
Avatar
BananaBread 11/25/2021 5:54 PM
could you tell me how to do it correct, I tried std::bind(ChatListener::on_message_received( _1, _2, _3, _4,_5)) (edited)
5:55 PM
since yeah I am so lost
Avatar
Are you trying to point to a member function?
Avatar
Avatar
BananaBread
could you tell me how to do it correct, I tried std::bind(ChatListener::on_message_received( _1, _2, _3, _4,_5)) (edited)
placeholders are params for the bind function, not your function
6:06 PM
also you aren't binding the instance here anymore
Avatar
You can trick the compiler with like
6:07 PM
(*(void**) class::member)
Avatar
BananaBread 11/25/2021 6:07 PM
binding instance nowstd::bind(this,ChatListener::on_message_received( _1, _2, _3, _4,_5));
Avatar
But that’s highly not advised
Avatar
Avatar
BananaBread
binding instance nowstd::bind(this,ChatListener::on_message_received( _1, _2, _3, _4,_5));
remove params and pass them into std::bind instead
6:07 PM
not your function
6:08 PM
also instance goes after the function pointer
Avatar
I’m not really sure why they are making a reference to a member function
6:08 PM
Without passing a reference to “this” it’ll just crash
Avatar
std::bind(&ChatListener::on_message_received, this, placeholders...);
Avatar
BananaBread 11/25/2021 6:09 PM
got this now AddOnChatMessageCallback(chatMessageCallbackID, std::bind(ChatListener::on_message_received,this, _1, _2, _3, _4, _5));
Avatar
this should work but i would advise against using namespace std
6:10 PM
actually no
6:10 PM
that wont work
Avatar
BananaBread 11/25/2021 6:10 PM
it wont yeah ^^
Avatar
because you aren't passing a function pointer
Avatar
BananaBread 11/25/2021 6:10 PM
nwo it does
Avatar
you need & before function name
Avatar
BananaBread 11/25/2021 6:10 PM
ye I did
6:10 PM
I am using std::placeholders as namespace
6:10 PM
should i just write out infront of the placeholders instead?
Avatar
i would tbh
6:11 PM
personal preference thing though
6:11 PM
it doesn't really change anything other than code readability
Avatar
BananaBread 11/25/2021 6:11 PM
thx alot, is there a ressource i can read up on this again to learn what i did here
6:11 PM
or could you explain in short
6:11 PM
i come from c#
6:11 PM
and there i can just pass a function
Avatar
do you know what & before function name does?
Avatar
BananaBread 11/25/2021 6:11 PM
or with events i can just += f
Avatar
Avatar
WETBATMAN
do you know what & before function name does?
BananaBread 11/25/2021 6:11 PM
yes
6:11 PM
well sorta
Avatar
it's address of operator
6:12 PM
instead of passing function as value
6:12 PM
you pass it's address
Avatar
BananaBread 11/25/2021 6:12 PM
yeah
6:12 PM
the pointer to a func right
Avatar
this way it can invoke your callback from the provided address
6:12 PM
however
6:12 PM
since your function is a class member
6:12 PM
it uses the __thiscall calling convention
6:12 PM
so because of that you require a class instance
6:12 PM
with std::bind you bind the function to the instance you just passed
6:13 PM
and the placeholders act exactly like placeholders
Avatar
BananaBread 11/25/2021 6:13 PM
my mate told me to just not use classes here and that makes it easy (make it static) but i think that is a wrong convention and bad code
Avatar
once it calls the function params will be passed instead of placeholders
Avatar
Avatar
BananaBread
my mate told me to just not use classes here and that makes it easy (make it static) but i think that is a wrong convention and bad code
that's up to you
6:14 PM
i do the same tbh when making plugins i make classes for everything i use
Avatar
Avatar
WETBATMAN
and the placeholders act exactly like placeholders
BananaBread 11/25/2021 6:14 PM
this placeholder thing is new to me and confuses me a lil
Avatar
Avatar
WETBATMAN
i do the same tbh when making plugins i make classes for everything i use
BananaBread 11/25/2021 6:14 PM
i need the classes to follow SOLID, if not solid doesnt rly work
6:15 PM
but i might be wrong trying to use a c# principle in c++?
Avatar
Avatar
BananaBread
this placeholder thing is new to me and confuses me a lil
since your function takes parameters and you don't know what those parameters will be beforehand, you pass placeholders so when ArkApi invokes your callback it will pass arguments on runtime
Avatar
BananaBread 11/25/2021 6:17 PM
ah nvm
Avatar
what do you mean
Avatar
BananaBread 11/25/2021 6:17 PM
nvm, that was a stupid thought
6:17 PM
its weird that i didnt find any resource to read up on this
6:18 PM
thx!
Avatar
np 🙂
Avatar
Could you tell me if there is a function to broadcast in the ark api?
Avatar
Avatar
BananaBread
Could you tell me if there is a function to broadcast in the ark api?
broadcast what
Avatar
a message
11:43 PM
in game
11:43 PM
seems so simple, yet couldnt find it
Avatar
ArkApi::GetApiUtils().SendChatMessageToAll
Avatar
Ty good sir!
11:45 PM
now i also know were more functions are hidden
Avatar
They are the opposite of hidden though 😄
Avatar
well show me the wiki then <3 (edited)
11:53 PM
if i do click on wiki on the site, it do not work :D
Avatar
The wiki is source code 😇
11:54 PM
it's just a click away! (edited)
Avatar
that is true
Avatar
is there anything i got to do extra so i can run my plugin? I followed the guide in the tutorial channel hwo to setup everything and just created a build. When starting the server it says plugin test does not exist. I tried looking up what the permissions plugin has what mine doesnt, so i added arktestplugin.ddl, arktestplugin.pdb & PluginInfo.json. Sorry for asking so much, i am just new to everything :/ (edited)
Avatar
Avatar
BananaBread
is there anything i got to do extra so i can run my plugin? I followed the guide in the tutorial channel hwo to setup everything and just created a build. When starting the server it says plugin test does not exist. I tried looking up what the permissions plugin has what mine doesnt, so i added arktestplugin.ddl, arktestplugin.pdb & PluginInfo.json. Sorry for asking so much, i am just new to everything :/ (edited)
folder and dll name have to be the same
Avatar
is that a usual convention and common to dll applications?
12:38 AM
every application on windows loads dll's
12:38 AM
but not every application has a folder with them 🙂
Avatar
is there a resource where i couldve known / found this out myself? (edited)
Avatar
ArkApi source code
Avatar
okay, i realise i rly should go through it
Avatar
dll's are loaded by path, infact that is exactly what ArkApi itself exploits and why it's called version.dll
12:40 AM
it's because all windows applications load version.dll into themselves automatically
12:40 AM
however if version.dll is present in the same folder as the .exe it has load priority over the one present inside the win32 folder
12:40 AM
this is called a proxy dll injection
Avatar
and that is the reason we can inject the api before the server starts i guess? (edited)
Avatar
Avatar
BananaBread
and that is the reason we can inject the api before the server starts i guess? (edited)
it's loaded by windows very early during the server .exe startup
12:42 AM
ArkApi then proceeds to load the original version.dll file from the win32 folder and it creates jumps to all the proxy functions
12:43 AM
this way it still technically "contains" all functions from a legit version.dll
Avatar
do you have any good resource to read up on this?
12:43 AM
like a book or an article
Avatar
for proxy injection?
Avatar
to understand what you just explained a lil better
12:44 AM
to get more used to in this area
Avatar
Avatar
WETBATMAN
for proxy injection?
if that is it, i guess ill just google on it
Avatar
Some example of code for proxy dll. Contribute to advancedmonitoring/ProxyDll development by creating an account on GitHub.
12:45 AM
here are some examples
12:46 AM
the concept is simple you make your dll look like some other dll
12:46 AM
like i said before windows loads it's dll's into every application in order for them to run
12:46 AM
you can proxy any of those
Avatar
do you need this to bypass battle eye or something?
Avatar
battleye detects this
12:47 AM
and no, it's simply used for just loading ArkApi
12:47 AM
(in this case)
12:48 AM
you can certainly bypass game anti cheats with this though
12:48 AM
i've tested it for league of legends and it works 😛
Avatar
why does wildcard not implement an own api for ark liek league of legends does etc
12:48 AM
why does some cool guy need to do all this effort with injecting
Avatar
dunno
12:48 AM
devkit could easily have had c++ support too
Avatar
I slowly think i shouldve first started with the dev kit since i come from c#
12:49 AM
heh
12:49 AM
it's trash
Avatar
but i rly wanna expand my knowledge and kinda force myself with this to learn c++
Avatar
devkit is trash you can't do half of what you can do with plugins
Avatar
since they dont offer that many exposed functions to work with or how come? (edited)
Avatar
you can't connect to a mysql database
12:50 AM
you can't override a function without your mod having to be loaded first
12:51 AM
you can't access certain functions which are just not available in devkit
12:51 AM
and if you compare the performance, a plugin doing exactly the same as something made in devkit is always gonna be faster
OOF 1
Avatar
how did you start out with this? did you help developing the api
Avatar
i started out with 0 programming knowledge
Avatar
man that is crazy how far ya made it then
Avatar
developer of ArkApi (Michidu) helped me alot
12:53 AM
eventually i learned c++
Avatar
good job dude
Avatar
thank you 😛
Avatar
nah ty for taking your time and helping me on the simplest bs
Avatar
Server Plugins for ARK: Server API. Contribute to Michidu/Ark-Server-Plugins development by creating an account on GitHub.
12:54 AM
i recommend you read the source codes of some ark plugins
Avatar
already starred it :>
Avatar
yeah, it will help you out alot
Avatar
BananaBread 11/26/2021 1:05 AM
do you know a way to clean up the release folder (edited)
1:05 AM
so i can find the 2 files i need to pull over easier
1:06 AM
there is so much other things visual studio creates that is not needed
1:06 AM
like can i make vs put those 2 files in 1 folder
Avatar
with a regular dll project there should be at most 4 files in your release folder
1:13 AM
it is not much ofc just annoying
Avatar
that isn’t the output folder
1:13 AM
because there are object files inside
1:14 AM
the output folder should be inside project->X64->Release
Avatar
BananaBread 11/26/2021 1:14 AM
that is the release folder
1:14 AM
i dont have an output folder in there (edited)
Avatar
then something is misconfigured for sure
Avatar
BananaBread 11/26/2021 1:18 AM
found out why / what
1:18 AM
so my output directory was just simply the release folder itself
1:18 AM
i now created a sub folder
1:18 AM
and set the output directory inside (edited)
1:18 AM
i hope that doesnt cause errors later
Avatar
you can even output directly into the ArkApi folder and utilize the auto plugin reload feature
Avatar
BananaBread 11/26/2021 1:36 AM
ill have a look into that
1:36 AM
thx!
1:38 AM
Could you tell me what i need to setup to load and unload a plugin runtime?
1:42 AM
mb
1:42 AM
just found it
Avatar
jraServerAPI 11/26/2021 1:42 AM
If you rename your plugin: myplugin.dll to myplugin.dll.arkapi and drop it in your plugin folder when your server is running, it will detect that file and load it
Avatar
BananaBread 11/26/2021 1:43 AM
on the official website
1:43 AM
oh that is crazy
Avatar
Avatar
BananaBread
i need the classes to follow SOLID, if not solid doesnt rly work
You can make static class methods that don’t require an instance of the class
Avatar
Avatar
WETBATMAN
you can certainly bypass game anti cheats with this though
Proxy DLLs are trivial to detect
7:42 AM
Since ya know, no valid signature
7:42 AM
And even if signed, not signed by the same company
Avatar
Avatar
substitute
Proxy DLLs are trivial to detect
yeah i know, some games just choose not to detect them
11:47 AM
because it works in league of legends heh
11:48 AM
tried with version.dll d3d9.dll and d3d11.dll
Avatar
Heya all! Not sure if this is the right channel. I've been working on an ARK plugin for the past 5-6 days. i got most of my code working for my chat commands. and saving data to mysql. I managed to get around pretty well. Pluign builds and loads fine in the server. Now i'm trying to get the main element of my plugin working. I setup some debug logging to text files to help me debug a bit. The hook generator app made by OwnProx isnt working. so i'm using the hardway lookin into the files I want to edit the behavior of the Floating Damage Text if my player /dn off that player will not see any Floating Damage Text and if my player /dn on he will see it. The hook that seems right for the job... would be DECLARE_HOOK(AShooterGameMode_NotifyDamage, void, AShooterGameMode*, AActor*, FDamageEvent*, AController*, AActor*); but after some testing... this hook is triggered even with no players on the server. if i try to obtain a steam_id inside that hook my ark server crashes. been loooking / testing on the hook part for the last 2 days... thought someone could point me in the right direction. This is my very first plugin... so its super simple... I'm hoping to get into a few bigger projects next. Thanks in advance!! Cheers.
Avatar
I posted a working build of Ownprox's hook generator around, one sec
ooohhh_yeeeaahhh 1
💪 1
Avatar
Avatar
StiGMaT
Heya all! Not sure if this is the right channel. I've been working on an ARK plugin for the past 5-6 days. i got most of my code working for my chat commands. and saving data to mysql. I managed to get around pretty well. Pluign builds and loads fine in the server. Now i'm trying to get the main element of my plugin working. I setup some debug logging to text files to help me debug a bit. The hook generator app made by OwnProx isnt working. so i'm using the hardway lookin into the files I want to edit the behavior of the Floating Damage Text if my player /dn off that player will not see any Floating Damage Text and if my player /dn on he will see it. The hook that seems right for the job... would be DECLARE_HOOK(AShooterGameMode_NotifyDamage, void, AShooterGameMode*, AActor*, FDamageEvent*, AController*, AActor*); but after some testing... this hook is triggered even with no players on the server. if i try to obtain a steam_id inside that hook my ark server crashes. been loooking / testing on the hook part for the last 2 days... thought someone could point me in the right direction. This is my very first plugin... so its super simple... I'm hoping to get into a few bigger projects next. Thanks in advance!! Cheers.
7:19 PM
The hook is the following:
7:19 PM
DECLARE_HOOK(AShooterPlayerController_ClientAddFloatingDamageText, void, AShooterPlayerController*, FVector_NetQuantize, int, int); void Hook_AShooterPlayerController_ClientAddFloatingDamageText(AShooterPlayerController* _this, FVector_NetQuantize AtLocation, int DamageAmount, int FromTeamID) { if (_this) { const uint64 steam_id = ArkApi::GetApiUtils().GetSteamIdFromController(_this); if (players_disabled.Contains(steam_id)) { return; } } AShooterPlayerController_ClientAddFloatingDamageText_original(_this, AtLocation, DamageAmount, FromTeamID); } I did that to implement it, when players do /dmg off it adds their steamid to players_disabled (TArray<uint64>) (edited)
Avatar
ok sweet thank you very much 😄
Avatar
Avatar
StiGMaT
ok sweet thank you very much 😄
maybe instead of doing this send the floating text being set to off to players who switched it off?
7:21 PM
by multicasting the property only to players who have it off
Avatar
yeah i have a similar setup. my mysql is just to save the last state so when they log back in its like it was when they logged out.
7:26 PM
got a list of steam_ids that have it turned on
7:26 PM
im a little noob with C++. i come from a PHP/java background (edited)
7:27 PM
first time using C++ for real. Alot easyer than i thought so far (edited)
Avatar
Hello everyone and merry Christmas 🤶 🎄
6:18 PM
I have a little question, can I call this on a player that is not an admin: // AShooterPlayerController* PC; (not an admin) UCheatManager* cm = PC->CheatManagerField(); if (cm != nullptr) { FString className = L"SupplyCrate_Level60_Double_C"; cm->Summon(&className); } Trying to spawn some beacons for players (as a Christmas gift). (edited)
Avatar
ArkShop does this for beacons auto* cheatManager = static_cast<UShooterCheatManager*>(player_controller->CheatManagerField()); cheatManager->Summon(&fclass_name);
6:35 PM
What you have I think works but you may need to cast it to UShooterCheatManager
Avatar
Thank you Lethal 👍
Avatar
Hello, apologies in advance for asking this insanely stupid question...but where do I learn more about getting started? This is my first dedicated ark server to host and the tutorials I've seen have been for windows systems and seem to suggest you need .net dependencies for windows. But I'm running this on debian.
Avatar
Avatar
laser712
Hello, apologies in advance for asking this insanely stupid question...but where do I learn more about getting started? This is my first dedicated ark server to host and the tutorials I've seen have been for windows systems and seem to suggest you need .net dependencies for windows. But I'm running this on debian.
This software will not work on Linux
Avatar
Understood.
Avatar
anyone know why ArkShop doesnt give player's points. Everything is set and it has no errors when getting kits, buying stuff or even in server console. Somehow when players do /points there are no points. and no points given. I have an interval of 5 and 20 points
Avatar
This is not the discord to request support. However I'd encourage to join APS Discord (find link in arkshop page) and download the permissions beta. It might fix your issue.
Avatar
Avatar
Pelayori
This is not the discord to request support. However I'd encourage to join APS Discord (find link in arkshop page) and download the permissions beta. It might fix your issue.
Thank you
Avatar
Hello guys, happy holidays. a question. How can I make a code for a bot for streamers notifications ?. I don't want to use a ready-made one, I would like to create my own. any help?
Avatar
jraServerAPI 1/3/2022 6:05 PM
I've never messed with teleporting yet so please bear with me 🙂 But i'm trying to teleport from Location A to Location B and then back to Location A I record Location A before teleporting to Location B by using: shooterplayer_controller->RootComponentField()->RelativeLocationField(); But when I try to teleport back to Location A.. it's not the location I was expecting at all. Instead it's teleporting me back to my origin spawn point when I first joined the map. 🤷‍♂️
Avatar
show us your implementation please
Avatar
jraServerAPI 1/3/2022 6:28 PM
in a nutshell this is what I'm doing: c++ typedef std::map<uint64, FVector> SteamIdFVectorMap; SteamIdFVectorMap lastPlayerLocation{}; ... // teleport from A to B const FVector m1 = shooterplayer_controller->RootComponentField()->RelativeLocationField(); lastPlayerLocation.insert({ steam_id, m1 }); shooterplayer_controller->SetPlayerPos(newLoc.X, newLoc.Y, newLoc.Z); ... // teleport back to A if (lastPlayerLocation.size() > 0) { auto result = lastPlayerLocation.find(steam_id); if (result != lastPlayerLocation.end()) { auto playerLoc = result->second; shooterplayer_controller->SetPlayerPos(playerLoc.X, playerLoc.Y, playerLoc.Z); lastPlayerLocation.erase({ steam_id }); } } (edited)
6:30 PM
yeah i think i see it now
6:31 PM
i create a ref then delete it
Avatar
Avatar
jraServerAPI
i create a ref then delete it
yes but you have another issue
6:47 PM
const FVector& m1
Avatar
jraServerAPI 1/3/2022 6:47 PM
😦
Avatar
this doesn't do what you expect it to do
6:47 PM
this variable will change when shooterplayer_controller->RootComponentField()->RelativeLocationField()
6:47 PM
changes
Avatar
jraServerAPI 1/3/2022 6:47 PM
really
6:47 PM
whaaaaaat?
Avatar
it's a reference (edited)
Avatar
jraServerAPI 1/3/2022 6:48 PM
i removed the ref on that
6:48 PM
and it still does it
Avatar
a reference is just an alias for another memory address
Avatar
jraServerAPI 1/3/2022 6:50 PM
okay.. i just edited my code above.. that is what I tried just now and the same thing happend.. ughh i'm so confused lol (edited)
6:51 PM
(perhaps i shouldn't try to learn this stuff at 3am 😆 )
Avatar
get the position from the character
6:52 PM
not the controller
Avatar
jraServerAPI 1/3/2022 7:09 PM
@$%RYT@R#@!~
7:09 PM
hey that sounds like a good idea! lol
Avatar
I think getting World Location of the actor is better than relativelocation.
Avatar
jraServerAPI 1/3/2022 7:18 PM
what makes it better? and where is that called?
Avatar
Avatar
WETBATMAN
get the position from the character
jraServerAPI 1/3/2022 7:29 PM
Thank you it's working now using the character instead of the controller.. ugh why didnt I see that! lol
Avatar
I believe world location is treated like an absolute position. Relative location can give varying results depending on what you are checking the position of since it is relative to some other factor. However for players it may not matter which is used but I believe world location will always be accurate. FVector Location; _this->RootComponentField()->GetWorldLocation(&Location);
2:00 AM
You could probably check and see what location coordinates match up with the ccc ones to make sure there is no difference between world or relative as well.
Avatar
jraServerAPI 1/4/2022 3:03 AM
thank you , I appreciate the explanation, i will use that instead 🙂
Avatar
also by the way, if you do not require the sorting property of std::map it's better to use std::unordered_map instead
👍 3
10:14 AM
it's faster
Avatar
☭ bjdripley ☭ 1/6/2022 6:10 AM
hi hopefully i'm asking this in the right channel. how do i get permission to download the server api from the website?
Avatar
jraServerAPI 1/9/2022 6:10 PM
Q: is there a definitive way to determine if a dino is currently unconscious either by cryo sickness or due to taming? (edited)
6:10 PM
Do I check torpor value?
Avatar
Tried bIsSleeping?
Avatar
jraServerAPI 1/9/2022 11:22 PM
dangit, i never saw that.. I ended up checking topor value, but both work!
Avatar
Hi! I want to make simple command to deposit stone from my inventory to nearby vaults. I successfully did the first part. Here's my code:
8:10 PM
void Deposit(AShooterPlayerController* player_controller, FString* , EChatSendMode::Type ) { try { player_controller->GetPlayerInventory(); UPrimalInventoryComponent* inventory = player_controller->GetPlayerInventory(); if (inventory != nullptr) { FString Stone = "Blueprint'/Game/PrimalEarth/CoreBlueprints/Resources/PrimalItemResource_Stone.PrimalItemResource_Stone'"; UClass* bpUClass = UVictoryCore::BPLoadClass(&Stone); TSubclassOf<UPrimalItem> bpSubClass = TSubclassOf<UPrimalItem>(bpUClass); TArray<UPrimalItem*> Stoneitems; inventory->FindAllItemsOfType(&Stoneitems, bpSubClass, true, true, false, false, false, false, false); int nStone = (int)Stoneitems.Num(); if (nStone <= 0) { ArkApi::GetApiUtils().SendChatMessage(player_controller, *GetText("Sender"), *GetText("NoStone")); } else { int number = 0; for (size_t i = 0; i < nStone; i++) { number += Stoneitems[i]->GetItemQuantity(); UPrimalItem* currItem = Stoneitems[i]; if (currItem != nullptr) { currItem->OwnerInventoryField()->RemoveItem(&currItem->ItemIDField(), false, false, true, true); } } FString text = L"You have " + FString::FromInt(number) + L"stone in your inventory"; ArkApi::GetApiUtils().SendChatMessage(player_controller, *GetText("Sender"), *text); FVector position = player_controller->GetPlayerCharacter()->RootComponentField()->RelativeLocationField(); int foundation = 10;; } } } catch (const std::exception& error) { ArkApi::GetApiUtils().SendChatMessage(player_controller, *GetText("Sender"), *GetText("Error")); } } (edited)
8:10 PM
Can somebody help me with how can I get the nearby (for example 10 foundation) vaults and add items to their inventory?
Avatar
Avatar
KDB
Can somebody help me with how can I get the nearby (for example 10 foundation) vaults and add items to their inventory?
search for UKismetSystemLibrary::SphereOverlapActors_NEW on this discord for examples
Avatar
Hey all! I'm a veteran software engineer but new to c++ and the ins and outs of the ark api. Ended up here because I couldn't see any other way to get our cluster work the way I'd like it to. Currently in the process of figuring out a hello world or how to test/debug what I'm doing
Avatar
Got through the initial hurdle. Now the big question is: how do I figure out the correct hook to call? Been browsing the sources for hours but nothing screams at me. Is there a way to somehow step through execution with the ark dev kit to find what I'm looking for?
Avatar
Tons of opensource code here https://github.com/Michidu/Ark-Server-Plugins (edited)
Avatar
Avatar
meza
Got through the initial hurdle. Now the big question is: how do I figure out the correct hook to call? Been browsing the sources for hours but nothing screams at me. Is there a way to somehow step through execution with the ark dev kit to find what I'm looking for?
what is it that you're trying to do?
Avatar
Avatar
substitute
what is it that you're trying to do?
Trying to figure out how to stop the cross-ark functionality in supply drops (and not obelisks). Basically to replicate how the transfers work in single player. There is a mechanism somewhere in the code that tells the supply drops to not have the item/dino/player transfer options...
Avatar
If anyone can point me to the correct hooks, that'd be much appreciated. The main motivation in this is to make sure our aberration server has the in-lore experience where the challenge is to get to an obelisk before you can yoink your transmitter out of the uploaded items tab and then you can enable your tribe to have access to all the op stuff you've built up before you got to aberration. If supply drops give you access to everything, there's little-to-none challenge in the map.
3:48 PM
Disabling the drops isn't an option because that also removes a good gameplay loop from the map; going to the surface to get good gear.
Avatar
Avatar
Lethal
search for UKismetSystemLibrary::SphereOverlapActors_NEW on this discord for examples
Thx
Avatar
Avatar
meza
If anyone can point me to the correct hooks, that'd be much appreciated. The main motivation in this is to make sure our aberration server has the in-lore experience where the challenge is to get to an obelisk before you can yoink your transmitter out of the uploaded items tab and then you can enable your tribe to have access to all the op stuff you've built up before you got to aberration. If supply drops give you access to everything, there's little-to-none challenge in the map.
Check the UPrimalInventoryComponent of the supply crates if they have tribute properties set.
Avatar
I've been digging around there. Unfortunately the tribute is for the boss arena teleports. I'm looking for 3 things: ArkData, Creature Data and the transfer to other servers buttons. I think there's a way to hook into the item/creature download process itself and cancel it. somehow. Not sure how to prevent the tabs from showing though
Avatar
The buttons are going to be client side which you can't make hidden or anything.
5:12 PM
Some of the events you can intercept but handling of those may not be great and leave players locked in place until the client figures out the operation won't complete and shows a timeout error. But seems like you are on the right track.
Avatar
It would still be better to find that one setting that makes the entire system think that it shouldn't display those buttons in the first place
Avatar
99% sure that is client side only which you can't change from a plugin
Avatar
Hi! Can somebody help me what is the best way to add multiple stacks(for example 201 stone) of items to an inventory? Should I make a for a loop?
Avatar
Hello, is there a function to get the height of the floor (Z axis) from an AShooterPlayerController* PC? The call PC->GetPlayerCharacter()->RootComponentField()->RelativeRotationField(); gives me the correct player location but the point is not on the ground (it is in the air, half player's height from what I can see). (edited)
Avatar
Avatar
OSubMarin
Hello, is there a function to get the height of the floor (Z axis) from an AShooterPlayerController* PC? The call PC->GetPlayerCharacter()->RootComponentField()->RelativeRotationField(); gives me the correct player location but the point is not on the ground (it is in the air, half player's height from what I can see). (edited)
I’m sure there’s a more accurate function
11:42 PM
However you can also get the capsule half height and subtract that to the z calculation
Avatar
char __fastcall UVictoryCore::GetGroundLocation(UWorld *forWorld, FVector *theGroundLoc, FVector *StartLoc, FVector *OffsetUp, FVector *OffsetDown) just found this
11:43 PM
and other candidates ^^
12:36 AM
working code: bool GetGroundLocation(AShooterCharacter* shooterCharacter, FVector* outGroundLocation) { FVector offsetUp = FVector(0.0F, 0.0F, 160.0F); FVector offsetDown = FVector(0.0F, 0.0F, -5000.0F); return shooterCharacter->GetGroundLocation(outGroundLocation, &offsetUp, &offsetDown); } (edited)
Avatar
Interesting, never noticed some actors had the get ground loc on them 😄
Avatar
Any APrimalCharacter has it 😉
6:11 PM
And if you're not dealing with an APrimalCharacter, you can simply use the one from UVictoryCore namespace. Instead of an APrimalCharacter it needs a pointer to the UWorld and an FVector starting point (then it will search upside and downside for the ground, starting from this point). (edited)
Avatar
Is there a simple way to scale one specific dino (I can find the APrimalCharacter with the dino ID) permanently? (edited)
Avatar
To make it bigger you mean?
Avatar
yes
7:48 PM
I was thinking of something like this: void ScaleActor(AActor* actor, float ratio) { FVector currentScale; actor->GetActorScale3D(&currentScale); currentScale.X = currentScale.X * ratio; currentScale.Y = currentScale.Y * ratio; currentScale.Z = currentScale.Z * ratio; actor->SetActorScale3D(&currentScale); } But I don't know if it's the proper way to do it because I'm not even replicating state over network here. (edited)
Avatar
Yeah, it does not work
7:53 PM
Server will be aware, but client won't, and weird collisions and rubberbanding will happen
7:53 PM
Already tested it awhile ago
Avatar
I will keep searching with ida, hopefully I'll find something.
8:01 PM
Did you try calling actor->ForceReplicateNow(false, false); after scaling actor @Pelayori?
Avatar
Scale is not replicated, that will do nothing
Avatar
Ok thanks
Avatar
But I think I tried
8:02 PM
just in case lol
Avatar
^^
8:04 PM
For scaling, you also have to make sure that on your Mesh Component you set "Component Replicates" https://answers.unrealengine.com/questions/375098/actor-scale-not-replicating.html (edited)
8:05 PM
I need a way to grab Mesh Component then 🤔
8:12 PM
8:13 PM
but it's already ticked on Dodo character BP
Avatar
That's the status comp
8:13 PM
Not the mesh comp
Avatar
ah
8:13 PM
my bad
Avatar
If changing that bool works at runtime it's great
8:14 PM
the property is missing on Mesh element so I'm not sure what they mean by Mesh Component
Avatar
hoho...
8:37 PM
this doesn't look good, otherwise I can't find an easy "Replicate Transform" checkbox x)
Avatar
hey I managed to effectively scale the model at runtime for both server and clients (edited)
10:04 PM
Wrong code removed here, see below (edited)
10:07 PM
I tested it on a simple object with one SkeletalMesh. You need to adjust the meshComponentName parameter to target another type of mesh. Also my function stops when first mesh is found but for more complex objects you might need to repeat the SetIsReplicated(true) for every mesh component.
Avatar
Interesting
10:09 PM
Good find
10:09 PM
I might yoink that some time monocle
Avatar
got the explanation from UE documentation
10:11 PM
Avatar
Avatar
OSubMarin
hey I managed to effectively scale the model at runtime for both server and clients (edited)
jraServerAPI 1/12/2022 10:13 PM
nice!
Avatar
I think that is why I could not a find a "Enable Replication" checkbox on the devkit (edited)
10:14 PM
because it's a function (SetIsReplicated(true)) not a property 🤔
10:15 PM
well I don't know exactly I don't care that much anymore x)
Avatar
There will be some downside of setting extra replicated components though, not sure how much network overhead will add
10:17 PM
Not if you do it for a single actor, but if you do it for multiple ones
Avatar
no worries I'm making targetted changes
10:18 PM
just few actors controlled by ID
👍 1
10:23 PM
I will make some tests on a dino familly now, to see if it's not too big to track more meshes (edited)
10:24 PM
I forgot I closed the devkit, and I need it to grab every meshes that composes the dino (or at least the main one if there's a hierarchy in the model). (edited)
10:24 PM
well that will be another time
10:27 PM
on my screenshot above I notice dodo only has one mesh so hopefully it's like this for every dino and a single mesh component has to be targeted each time.
Avatar
jraServerAPI 1/12/2022 10:33 PM
"I forgot I closed the devkit" ~ what!!? you don't want to wait 2 hours for it to open again? 2236_keka
GOGCHECK 1
OOF 1
Avatar
I think it only works for skeletal meshes, trying to scale some static meshes and there is no success
Avatar
sorry
11:05 PM
I mistaken some tests...
11:05 PM
the above function does not work
11:05 PM
it's actually the previous test I did which worked
11:06 PM
bool EnableMeshCompReplicationAndScale(AActor* actor, float ratio) { USceneComponent* sceneComp = actor->RootComponentField(); if (sceneComp == nullptr) return false; sceneComp->SetIsReplicated(true); sceneComp->SetWorldScale3D(FVector(ratio, ratio, ratio)); return true; } There you go
11:06 PM
this works 👍 just double tested this time 😄
Avatar
Oh, I thought the root component was already replicated 🤔
Avatar
On the object I tried to scale it seems not (because after doing this it works) (edited)
11:07 PM
I didn't try on a dino yet
Avatar
jraServerAPI 1/12/2022 11:10 PM
there is a ChangeSize admin command
11:10 PM
Detailed information about the Ark command ChangeSize for all platforms, including PC, XBOX and PS4. Includes examples, argument explanation and an easy-to-use command builder. This command will change your character's size. A multiplier of 2 would double your size, 0.5 would half it.
11:10 PM
probably could find that in ida and see what they do 🤷‍♂️
Avatar
It's for characters, sets the capsule size (which is probably replicated by default)
Avatar
Avatar
OSubMarin
bool EnableMeshCompReplicationAndScale(AActor* actor, float ratio) { USceneComponent* sceneComp = actor->RootComponentField(); if (sceneComp == nullptr) return false; sceneComp->SetIsReplicated(true); sceneComp->SetWorldScale3D(FVector(ratio, ratio, ratio)); return true; } There you go
Trying to do it on a tek shield (for safezones plugin) and does not seem to work unfortunately 😦
Avatar
ok
11:23 PM
is your tek shield actor replicated itself @Pelayori?
Avatar
Uhm im not sure now
Avatar
because the actor itself needs to replicate otherwise replicating components cannot work
11:24 PM
to replicate actor: AActor* actor->SetReplicates(true);
Avatar
I think it is yes, it's a structure and has replicated properties
11:24 PM
but will give that a wirl
11:25 PM
Yeah it's the same
Avatar
then I don't know
11:25 PM
it works on the pirate treasure box (edited)
Avatar
No idea
Avatar
Does some weird stuff on dinos.
Avatar
it works!
Avatar
No longer walks on the ground
Avatar
yeah because the volumes are a bit buggy from scratch so it amplifies problems
11:28 PM
well
11:28 PM
might screw up from too much physics point of view (edited)
Avatar
Dodo seemed ok at 4x
Avatar
a good workaround would be to scale only the mesh part
11:29 PM
because the scene component is more a global object that regroups everything
11:30 PM
so the physics would remain the same (with the downside of being able to go through dino like in ghost mode since physics isn't touched and the model only appears bigger) (edited)
11:31 PM
or find ratios that don't screw too much with the physic volumes like you've started to do :p (edited)
Avatar
I'll play with it a bit more and see.
11:36 PM
Dodo looks good at 4x
👍 1
😆 1
11:37 PM
It doesn't move fast enough for its giant legs though 🙂
Avatar
xD
11:43 PM
Changed speed modifiers to match the scale modifier.
11:43 PM
might be too much though
Avatar
that big boi is fast!
11:48 PM
maybe make a gun to adjust size in game (primary attack => zoom x1.5, secondary attack => dezoom x-1.5), but that would require client side changes most probably (edited)
Avatar
Avatar
Lethal
Changed speed modifiers to match the scale modifier.
could maybe change the speed stat
11:48 PM
which does properly adjust animations iirc
Avatar
I'm testing speed ratios
11:56 PM
Avatar
with this size you can now also increase the meat and hide it gives 😋
Avatar
jraServerAPI 1/13/2022 1:12 AM
I know it's giving @Lethal some ideas for Server Events or Lethal Sightings.. lol find the Giant Dodo!
Avatar
jraServerAPI 1/13/2022 5:13 AM
nice!
Avatar
jraServerAPI 1/14/2022 9:30 PM
In my json config, i'm allowing for dynamic values to some of my settings. Meaning they can enter a number, string or and Array (of ints) as value and the plugin will figure it out. I have it working and I am now reviewing my code and wondering if there is a better way to do this without try/catch for (auto group_iter = groups_map.begin(); group_iter != groups_map.end(); ++group_iter) { std::string strFoundValue{}; int intFoundValue{}; std::vector<int> arrIntFoundValue{}; try { auto foundValue = group_iter.value().value("SomeSetting", ""); strFoundValue = foundValue; } catch (const std::exception&) { try { auto foundValue = group_iter.value().value("SomeSetting", -1); intFoundValue = foundValue; } catch (const std::exception&) { try { auto foundValue = group_iter.value().value("SomeSetting", std::vector<int>{}); arrIntFoundValue = foundValue; } catch (const std::exception&) { } } } if (!(strFoundValue == "")) { // string was found } else if (intFoundValue >= 0) { // int was found } else if (arrIntFoundValue.size() > 0) { // array was found } } any feedback is appreciated 🙂 (edited)
Avatar
json objects have methods for that
9:31 PM
search is_string, is_whateveryouneed
Avatar
jraServerAPI 1/14/2022 9:32 PM
🤦‍♂️
Avatar
for numbers you have is number (int or float I believe), is float
9:32 PM
for arrays, is_array
Avatar
jraServerAPI 1/14/2022 9:33 PM
oooh so like... bool bIsArray = group_iter.value()["SomeSetting"].is_array(); (edited)
9:34 PM
thank you!
Avatar
yeah, like if is array do a thing, else if is number do another...
Avatar
Avatar
Pelayori
yeah, like if is array do a thing, else if is number do another...
I would expect the ability to do a switch
3:23 AM
That’s one big win for functional languages, switch cases
👍 1
Avatar
jraServerAPI 1/18/2022 6:07 AM
Is there a way to detect if the server is actively running one of the official events? Winter Wonderland etc..
Avatar
Has anyone else had troubles when trying to register for ARK API .com because I cant get a registration email to send
Avatar
Avatar
Teach
Has anyone else had troubles when trying to register for ARK API .com because I cant get a registration email to send
jraServerAPI 1/18/2022 7:23 AM
7:26 AM
I'm also wondering how to get the distance Actor A(the character) is from Actor B(dino/structure). As I'd like to limit the range in which a command, that requires you to look at something, can be used at. Does anyone have experience with this before? tyvm
Avatar
use FVector::Distance()
Avatar
you can also use GetDistanceTo from one actor to another
Avatar
jraServerAPI 1/18/2022 2:05 PM
Thank you kindly, also is there a way to detect if the server is actively running one of the official events? Winter Wonderland etc..
Avatar
Avatar
jraServerAPI
Thank you kindly, also is there a way to detect if the server is actively running one of the official events? Winter Wonderland etc..
Did not check but there might be something in game mode or game state
👍 1
Avatar
I need some help with setting up my first plugin. Where I can find ARKApi libraries?
Avatar
jraServerAPI 1/19/2022 5:08 PM
Server plugins support for ARK. Contribute to Michidu/ARK-Server-API development by creating an account on GitHub.
Avatar
is the website link to the api dev wiki down?
12:53 AM
Server plugins for ARK
Avatar
Avatar
Pelayori
Did not check but there might be something in game mode or game state
jraServerAPI 1/20/2022 6:28 AM
ArkApi::GetApiUtils().GetShooterGameMode()->ActiveEventField(); 🙂
Avatar
is there somewhere i can see what each code means or all they just magic numbers when my plugin fails to load
Avatar
they're LoadLibrary error codes (edited)
6:00 PM
lmao
Avatar
it means your plugin threw something inside DLLMain and couldn't load
Avatar
yep
6:02 PM
i know how to fix this
Avatar
GetGameState is not going to be ready on dll load
6:03 PM
ty lol
Avatar
because the GameState is not loaded yet
Avatar
explains why it loads fine after initial crash
Avatar
also chat command verify is going to listen for verify
6:03 PM
not /verify
6:03 PM
if you wish it to be /verify the string needs to be /verify
Avatar
gotcha
6:04 PM
ty
Avatar
Also if you are init'ing log you can use the logging funcs
Avatar
for the unreal engine http stuff, why isnt there a method called OnProcessRequestComplete in the api but on unreals docs there is https://docs.unrealengine.com/4.26/en-US/API/Runtime/HTTP/Interfaces/IHttpRequest/OnProcessRequestComplete/
Delegate called when the request is complete. See FHttpRequestCompleteDelegate
8:40 PM
in the ark server api
8:41 PM
basically im trying to do a GET request and read the header contents of the response
Avatar
You are better off using the api requests
8:42 PM
they are using POCO lib
Avatar
i tried but kept getting 400 error
Avatar
#include "Requests.h"
8:42 PM
That's not issue of the library
Avatar
ill set it back up and show you what ive got
8:47 PM
ah the issue was that i had spaces in one of my parameters
8:47 PM
works in postman but not in the api
8:48 PM
the api says the response given in the callback shows headers as well but when i print it i get nothing?
8:48 PM
Avatar
not sure then, @WETBATMAN would be the one to answer (edited)
Avatar
void VerifyCallback(bool success, std::string response) { if (!success) { Log::GetLog()->error("Failed verifying with server."); } Log::GetLog()->info(response); } void VerifyCommand(AShooterPlayerController* playerController, FString* command, EChatSendMode::Type chatType) { uint64 steamID = ArkApi::GetApiUtils().GetSteamIdFromController(playerController); std::string url = "http://localhost:6100/?steam64id=" + std::to_string(steamID) + "&arkid=Ragnarok-PF"; // +ArkApi::GetApiUtils().GetGameState()->ServerSessionNameField().ToString(); API::Requests::Get().CreateGetRequest(url, &VerifyCallback); }
Avatar
headers are not returned in the callback atm
8:50 PM
it only returns the response as std::string
Avatar
Is there a way to get to the headers?
Avatar
not currently, it would require an update for ArkApi
Avatar
big brain moment
8:57 PM
8:57 PM
good enough for me lol
8:59 PM
it provides status code on failure
Avatar
i can put data in the status description
Avatar
you can do this with default requests too
Avatar
i just picked bad request
9:01 PM
if i give it the OK then it doesnt print anything in the response
Avatar
I use my own webserver and return json reponses in response body
Avatar
so I just load json from std string response
Avatar
oh duh
9:03 PM
i kept looking for something called body in the C# HttpResponse
9:03 PM
its called outputstream
Avatar
oh lol
9:04 PM
yup thats way better ty
Avatar
Avatar
WETBATMAN
GetGameState is not going to be ready on dll load
almost nothing will be ready in dll load
10:01 PM
you shouldn't even call other library function calls since there is no guarantee those libraries will be loaded and ready
Avatar
So I've started to extract some features of my personal mod to publish as standalone mods on the ARK Server API website, but I'm wondering what numbers should I put in "MinApiVersion": from the PluginInfo.json file if I want to target current ArkAPI version 🤔 (edited)
12:25 PM
"MinApiVersion": 3.53 ?
Avatar
Avatar
OSubMarin
So I've started to extract some features of my personal mod to publish as standalone mods on the ARK Server API website, but I'm wondering what numbers should I put in "MinApiVersion": from the PluginInfo.json file if I want to target current ArkAPI version 🤔 (edited)
current version is 3.54
12:31 PM
but yeah you can just put 3.54
Avatar
Thanks
Avatar
I want to know how to trigger something on member join or anything else?
Avatar
You could use this hook @SR bool Hook_AShooterGameMode_HandleNewPlayer(AShooterGameMode* _this, AShooterPlayerController* NewPlayer, UPrimalPlayerData* PlayerData, AShooterCharacter* PlayerCharacter, bool bIsFromLogin) { return AShooterGameMode_HandleNewPlayer_original(_this, NewPlayer, PlayerData, PlayerCharacter, bIsFromLogin); }
Avatar
Where's the ArkApi documentation? Developers Wiki link is dead
Avatar
In the source code only now I believe.
Avatar
I have never used any .json files... I am wondering if someone would have the time this weekend to help me set these up for my server cluster? I am completely new to this type of file, and would much appreciate any help received... I am able to find them for each plugin I am using, but I have no clue on what to change, what not to change, how to change it, etc...
Avatar
jraServerAPI 1/29/2022 4:16 AM
they are used to configure your plugin.. usually there's a copy with comments explaining what each setting does, or they are explained on the arkapi webpage
Avatar
I did look on the website, however I am finding it hard to find the explanations/or copy with comments... I am willing to work with someone who knows & hopefully understands these files... I should also mention that I have a generalized learning disability that makes it hard for me to figure things out at times... this is the reason why I am asking for help... (edited)
4:25 AM
Good night, and I will check in tomorrow...
Avatar
Is there anyone who has the time to help me configure the json files for my servers?
Avatar
I'm sure lots of people are willing to help, if you have an specific issue just post it on the plugin's discord server, or if said plugin doesn't have a discord server ask it on the general discussion channels. Alternatively you can also use #【📠】ᴄᴏɴꜰɪɢꜱ-ʙ channels 🙂
Avatar
Its not one specific issue, and I literally need someone to walk me through all of this, as this is my first time attempting to use plugins... should I perhaps copy and past my post from here to that channel? (edited)
Avatar
I want to make my first command to test if everything is ok, can I get any examples to do it?
Avatar
Avatar
SR
I want to make my first command to test if everything is ok, can I get any examples to do it?
Ark Suicide Plugin. Contribute to WETBATMAN/Suicide development by creating an account on GitHub.
6:52 PM
look at my Suicide plugin source code
Avatar
Avatar
SR
I want to make my first command to test if everything is ok, can I get any examples to do it?
https://github.com/Michidu/ARK-Server-API https://github.com/ownprox/ArkServerApi this also has a bunch of open source projects and examples of many kinds
Avatar
Avatar
Aora
Its not one specific issue, and I literally need someone to walk me through all of this, as this is my first time attempting to use plugins... should I perhaps copy and past my post from here to that channel? (edited)
If you lack some json knowledge, it would be better to read how do they work first, there are some courses online like https://www.w3schools.com/js/js_json_intro.asp (edited)
W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.
6:54 PM
After that you can read and understand it easily afterwards (edited)
Avatar
Is that free? I am asking due to the fact that I have little to no income...
Avatar
I'm trying to do one right now
6:55 PM
I wrote a simple "Hello World" thing
6:55 PM
Compiling it and testing
Avatar
Avatar
Aora
Is that free? I am asking due to the fact that I have little to no income...
It is free, yes. If you need some more help please move to #【📠】ᴄᴏɴꜰɪɢꜱ-ʙ channel
Avatar
Avatar
Pelayori
It is free, yes. If you need some more help please move to #【📠】ᴄᴏɴꜰɪɢꜱ-ʙ channel
Ok, thank you!
Avatar
is there anyway to force the creature to drop all inventory? something like dino->dropAll() ?
Avatar
jraServerAPI 1/30/2022 11:22 PM
I'm pretty sure you have to manually remove each item from the dino's inventory
Avatar
Avatar
Uaca
is there anyway to force the creature to drop all inventory? something like dino->dropAll() ?
UPrimalInventoryComponent::DropInventoryDeposit
lethalsus 1
Avatar
Avatar
Pelayori
UPrimalInventoryComponent::DropInventoryDeposit
ty very much!
Avatar
Avatar
Pelayori
UPrimalInventoryComponent::DropInventoryDeposit
is this like a transfer all? do i have to create the bag and transfer all items passing the point to DepositStructureResult?
Avatar
i did try to spaw a box and use it as DepositStructureResult, it also does not work. on the DropInventoryDeposit, if i try to bForceDrop = true it crashes the server
4:37 AM
the only thing left I can think of is to loop the inventory and remove the itens/add one by one
4:37 AM
somehow I think that will be slow
Avatar
jraServerAPI 1/31/2022 5:46 AM
I had a similar experience with DropInventoryDeposit and was unable to get it to work, which is why I assumed you had to remove them manually
Avatar
Avatar
jraServerAPI
I had a similar experience with DropInventoryDeposit and was unable to get it to work, which is why I assumed you had to remove them manually
Man, it is so hard to find out stuff on the api, I’ve tried using the IDA, but I was unable to get any code from the API dlls, the only thing left to find out is keep trying different ways. Most of the time I can only do something other devs shared here.
2:44 PM
Anyway, after a few hours of sleep, i found out how to do it:
2:44 PM
`inventory->DropInventoryDeposit(ArkApi::GetApiUtils().GetWorld()->TimeSecondsField() + 3600, false, false, nullptr, nullptr, nullptr, nullptr, FString(""), FString(""), -1, 300, false, -1, false, nullptr, false); dino->bDroppedInventoryDeposit() = true;`
👍 1
Avatar
Avatar
Uaca
Man, it is so hard to find out stuff on the api, I’ve tried using the IDA, but I was unable to get any code from the API dlls, the only thing left to find out is keep trying different ways. Most of the time I can only do something other devs shared here.
what do you mean get code from API dll's?
Avatar
Avatar
WETBATMAN
what do you mean get code from API dll's?
a few times when i asked for help here, somehow a few kind souls shared code from the game and used IDA to extract this code
2:52 PM
I was unable to do the same
Avatar
the way you wrote that was confusing lol, i thought you were trying to decompile a plugin
2:53 PM
but if you find the function by name in IDA you can click ctrl + x to see where it’s called from
2:54 PM
this way you can find out how the devs call the function
Avatar
no need for the plugins, the source code is on github
Avatar
Avatar
WETBATMAN
but if you find the function by name in IDA you can click ctrl + x to see where it’s called from
but what do I chose to decompile on IDA?
Avatar
hm?
Avatar
do I use the ShooterGameServer.exe? It looked like ASM to me, there was no source code on IDA
Avatar
you have to press yes when it asks to load pdb
2:57 PM
this way variables and functions will have names
2:57 PM
and yes, you need yo input ShooterGameServer.exe
Avatar
i see, will try. Thank you !
Avatar
Avatar
Uaca
is this like a transfer all? do i have to create the bag and transfer all items passing the point to DepositStructureResult?
The deposit structure is a double pointer (pointer to pointer), and it's likely to let you access the spawned bag after it's been dropped
4:30 PM
So like: void dropAll(UPrimalInventoryComponent* inv) { if (inv) { APrimalStructureItemContainer* deathCache = nullptr; inv->DropInventoryDeposit(ArkApi::GetApiUtils().GetWorld()->TimeSecondsField() + 3600, false, false, nullptr, nullptr, &deathCache, nullptr, FString(""), FString(""), -1, 300, false, -1, false, nullptr, false); if (deathCache) { // do stuff with the death cache } } }
👍 1
Avatar
i see, that makes sense!
Avatar
jraServerAPI 1/31/2022 4:33 PM
awesome, thank you!
3:00 AM
the cryopod does not show any information about the dino
3:00 AM
is this the way is supposed to work or there is something wrong with my code?
Avatar
jraServerAPI 2/1/2022 4:05 AM
That code may need to be updated. I think there's a better example in the current Ark Shop code https://github.com/Michidu/Ark-Server-Plugins/tree/master/ArkShop
Server Plugins for ARK: Server API. Contribute to Michidu/Ark-Server-Plugins development by creating an account on GitHub.
Avatar
I tried that one too, but is also does not show any information about the dino
Avatar
i am trying to use a web hook to discord so far it works but when i reach 200 characters (limit of the chat) it will crash. I saw online that a discord web hook support 2000. i tried using a catch but didn't stop the crash. i took the webhook from the ArkShop Plugin.
Avatar
i don't know what using a catch in that case is going to achieve?
9:16 AM
the 2000 char limit is a discord API limitation, you cannot send messages over this chat limit
9:16 AM
you have to split stings into sizes that are < 2000
Avatar
also sending a webhook over 2000 chars won't crash, it just won't send to discord, if it crashes you messed something up in your code
Avatar
Avatar
WETBATMAN
also sending a webhook over 2000 chars won't crash, it just won't send to discord, if it crashes you messed something up in your code
i see i use AddOnChatMessageCallback to check the Tribe/Alliance Chat and send the message to Discord.
9:38 AM
I use this code to check the tribe/alliance chat and send it to discord using the webhook https://github.com/ark-mod/ArkCrossServerChat/blob/master/ArkCrossServerChat/Hooks.cpp
Cross Server Chat support for ARK Survival Evolved servers. - ArkCrossServerChat/Hooks.cpp at master · ark-mod/ArkCrossServerChat
Avatar
hard to help without seeing any actual code
Avatar
Avatar
WETBATMAN
hard to help without seeing any actual code
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Avatar
um
9:46 AM
what is the post to discord function prototype?
Avatar
Avatar
WETBATMAN
what is the post to discord function prototype?
inline bool discord_enabled; inline std::string discord_sender_name = "TribeChat"; inline FString discord_webhook_url = "URL"; template <typename T, typename... Args> void PostToDiscord(T* msg, Args&&... args) { static_cast<AShooterGameState*>(ArkApi::GetApiUtils().GetWorld()->GameStateField())->HTTPPostRequest(discord_webhook_url, FString::Format(msg, std::forward<Args>(args)...)); }
9:48 AM
i removed the webhook to URL
Avatar
okay
9:48 AM
first of all
9:48 AM
you can construct the JSON you need for a webhook with the json lib
9:48 AM
instead of formatting a string
9:49 AM
which should be much easier
9:49 AM
secondly i don't know why you're converting an FString into a c style string and then into a wstring
9:49 AM
makes no sense, you're just wasting cpu cycles
9:50 AM
and also you should use API requests instead of game requests if you're going to be sending messages this often
9:52 AM
nlohmann::json request; FString MapName = GetMapName(); request["username"] = ArkApi::Tools::Utf8Encode(*MapName); request["content"] = ArkApi::Tools::Utf8Encode(*Data);
9:52 AM
you can do something like this
9:52 AM
with Data being your final string ofc
9:52 AM
in this case it's FString
9:53 AM
void PostDiscordWebhook(FString URL, nlohmann::json Content) { if (!URL.IsEmpty()) API::Requests::Get().CreatePostRequest(URL.ToString(), [](bool Sucess, std::string Result) {}, Content.dump(), "application/json"); }
9:53 AM
this is how i send a request in my plugin
Avatar
Ok thanks Wetbatman i will look into this today somewhere when i have time between work 😄
Avatar
using API requests you can get the response from discord API, which you can't really do with the requests you're using right now
9:55 AM
this way you can pinpoint your issue if you still encounter a problem after using this approach 🙂
9:59 AM
also when sending user messages to discord make sure to remove the @ sign
9:59 AM
(if any)
9:59 AM
if (Data.Contains(L"@")) Data = Data.Replace(L"@", L"");
9:59 AM
with something like this
9:59 AM
this is just so ppl can't tag everyone
Avatar
What include should i use for API::Requests ?
Avatar
Requests.h
Avatar
Avatar
WETBATMAN
Requests.h
Got it working thank you Wetbatman
Avatar
How can I prevent / stop drop all items on fast travel? I can't find the hook to do this (sorry if too simple, i'm newbie)
Avatar
i think ServerRequestFastTravelToPoint_Implementation just calls DropInventoryDeposit on InventoryComponent at some point in the function
10:14 PM
the playercharacter is destroyed though when someone fast travels, so the inventory items will vanish anyway unless u save them and re-add them back or something (edited)
Avatar
Original message was deleted or could not be loaded.
I updated github fixing an issue from the last ATLAS change that broke ARK compilation. You should look at the open source plugins for examples as well. https://github.com/Michidu/Ark-Server-Plugins
Avatar
jraServerAPI 2/6/2022 7:23 PM
Hello, I'm trying to make a player invisible from wild dino's (like the way leavemealone works). And I thought EnemyInVisible would do the trick, but it doesn't seem to work for me... 🤷‍♂️ c++ shooterplayer_controller->EnemyInVisible(true);
7:26 PM
oh i just noticed there is also c++ shooterplayer_controller->LeaveMeAlone(); i havent tested yet
7:26 PM
but how to turn it back on i wonder
7:29 PM
update: shooterplayer_controller->LeaveMeAlone(); did not work 😆
Avatar
jraServerAPI 2/6/2022 7:50 PM
welp, I found AShooterCharacter::bCanBeDamaged.. that's helpful
Avatar
LeaveMeAlone calls several cheat commands! bCanBeDamaged could be an option but also overwritten by other functions you could use the damage hook event and just return 0 damage for every case from wild (edited)
👍 1
Avatar
what should i use if i want to add items to a structure ?
Avatar
ingame structure?
9:39 PM
a c++ struct or an actual structure you place? 😄
Avatar
a structure i placed down auto* primal_structure = static_cast<APrimalStructure*>(new_actor); primal_structure->TargetingTeamField() = tribe;
Avatar
jraServerAPI 2/9/2022 6:40 AM
Does anyone know of there is a hook called when a player equips/removes a shoulder pet?
Avatar
jraServerAPI 2/9/2022 7:26 AM
Or do I need to use Hook_APrimalCharacter_TryMultiUse?
Avatar
jraServerAPI 2/9/2022 11:03 PM
Echo! (Echo...Echo...Echo...Echo...Echo...Echo...) 😆 So I been trying to prevent flying with the Sinomacrops, and there are two buffs that the player gets when the Sinomacrops is mounted: Blueprint'/Game/LostIsland/Dinos/Sinomacrops/Buff_Glider_Sino.Buff_Glider_Sino' Blueprint'/Game/LostIsland/Dinos/Sinomacrops/Buff_MountedSino.Buff_MountedSino' I can remove the Buff_MountedSino buff, but it seems that Buff_Glider_Sino will not remove, and as a result, you can still fly around. Okay, maybe I can prevent the Pick Up command from TryMultiUse... nope.. Ultimately I was able to use the APrimalCharacter_DinoMountOnMe hook to prevent mounting the Sinomacrops from the get go! It's not what I wanted, but it works. 🙂 (edited)
Avatar
Thanks @dougy How can i get all engrams including tek learned by player, because player->GetPlayerCharacter()->MyInventoryComponentField()->InventoryItemsField() seems not working, only print engrams of crafteable items in hand. Thanks
Avatar
Avatar
Neikira
Thanks @dougy How can i get all engrams including tek learned by player, because player->GetPlayerCharacter()->MyInventoryComponentField()->InventoryItemsField() seems not working, only print engrams of crafteable items in hand. Thanks
Avatar
i am looking at the NextAllowedMatingTimeField and ArkApi::GetApiUtils().GetWorld()->GetTimeSeconds()
8:36 PM
the NextAllowedMatingTimeField on the genesis 2 map does not look right
8:36 PM
Exmeple, on The center the same dino will have 862228 and on the genesis 2 it will have 23626.1
8:37 PM
does anyone know if all maps use the same time unit?
Avatar
also, can I have some tips on how to work with IDA? I've loaded the shootergame.exe and the .pdb but most of the time IDA is frozen and I all got is stuff like this:
9:10 PM
Avatar
it does not look possible to debug ARK with IDA. IDA is generating strings for a few hours now 😢
Avatar
Avatar
OSubMarin
working code: bool GetGroundLocation(AShooterCharacter* shooterCharacter, FVector* outGroundLocation) { FVector offsetUp = FVector(0.0F, 0.0F, 160.0F); FVector offsetDown = FVector(0.0F, 0.0F, -5000.0F); return shooterCharacter->GetGroundLocation(outGroundLocation, &offsetUp, &offsetDown); } (edited)
jraServerAPI 2/21/2022 12:44 AM
I keep trying to use this, but it only crashes for me ShooterGameServer.exe!APrimalCharacter::GetGroundLocation() (0x00007ff7126f7a01) + 62 bytes [f:\build\lostisland\projects\shootergame\source\shootergame\private\primalcharacter.cpp:8125] could you share a working example code snippet? 🙂 thx
Avatar
There is another function, it does not require a character: FVector GetGroundLocation(FVector* startLoc) { FVector result(0); auto* world = ArkApi::GetApiUtils().GetWorld(); if (world) { FVector offsetUp = { 0, 0, 0 }; FVector offsetDown = { 0, 0, INT_MIN }; UVictoryCore::GetGroundLocation(world, &result, startLoc, &offsetUp, &offsetDown); } return result; }
Avatar
Avatar
overmind
There is another function, it does not require a character: FVector GetGroundLocation(FVector* startLoc) { FVector result(0); auto* world = ArkApi::GetApiUtils().GetWorld(); if (world) { FVector offsetUp = { 0, 0, 0 }; FVector offsetDown = { 0, 0, INT_MIN }; UVictoryCore::GetGroundLocation(world, &result, startLoc, &offsetUp, &offsetDown); } return result; }
jraServerAPI 2/21/2022 3:53 PM
thank you very much, this worked perfectly
Avatar
Avatar
Neikira
Thanks @dougy How can i get all engrams including tek learned by player, because player->GetPlayerCharacter()->MyInventoryComponentField()->InventoryItemsField() seems not working, only print engrams of crafteable items in hand. Thanks
i think theyre stored in primalplayerdata
Avatar
Hello, does anyone have the problem of not receiving the account confirmation email?
Avatar
Avatar
JMonks13
Hello, does anyone have the problem of not receiving the account confirmation email?
Yes, make a ticket in #deleted-channel and they will help you. They may need your email/username so I would go ahead and post it in there.
💛 1
Avatar
Aaurizon (Ryan) 3/12/2022 8:39 PM
What's the admin command to load/unload a plugin ? (can't find the faq thread anymore :/)
8:41 PM
Ok, i found in the source code, it's plugins.load
Avatar
I am less than a novice, but I want to make a specific API... Is there anyone who could help me out by teaching me?
Avatar
I am looking for some help - I was just told that plugins & API's are made only using unreal engine and C++, but most of them have .json files, and I am looking to make one to keep items and be able to use them when Transferring from one server (i.e. pve) to another server (i.e. RP) even if the engrams are locked on the 2nd server, essentially, taking the Player Data and the Item Data for that player from one server that allows all engrams to the other server that has Engrams locked behind certain permissions, but allow them to keep what they have learned/made no matter what... I wanted to make a JSON script for it, but altho I have the necessary information, I need help in actually writing it out... I am using Visual Studio Code as the program to help write it all out...
Avatar
jraServerAPI 3/28/2022 12:46 AM
Plugins are written in c++ The JSON files are just your custom configuration files used to setup your plugins.
12:46 AM
The task you are trying to accomplish is a complicated one. I would focus on learning the basics of plugin development first, before you try to tackle that idea.
Avatar
Dang, ok, welp thanks anyways...
Avatar
jraServerAPI 3/28/2022 12:47 AM
use the #【💌】ʜᴇʟᴘꜰᴜʟ-ʟɪɴᴋꜱ
12:47 AM
there's plenty of free examples
12:48 AM
I need to make a script with Javascript or Python for a class I am in.. I thought I would kill 2 birds with one stone...
Avatar
jraServerAPI 3/28/2022 12:49 AM
Server Plugins for ARK: Server API. Contribute to Michidu/Ark-Server-Plugins development by creating an account on GitHub.
12:49 AM
ahhh
Avatar
I am not sure what to do with that link, and I apologize for the late reply... I had some family things to take care of... Also, I am looking at some resources to teach myself how to use C++. I will also be looking into resources for a few other programming languages. (edited)
Avatar
Can someone help me understand why it tells me Function Declaration for DECLARE_HOOK not found. I followed the basic plugin guide
Avatar
Avatar
CodingGuy
Can someone help me understand why it tells me Function Declaration for DECLARE_HOOK not found. I followed the basic plugin guide
Aaurizon (Ryan) 3/30/2022 3:43 AM
Share your code please
Avatar
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Avatar
Aaurizon (Ryan) 3/30/2022 6:11 AM
I don't see any problem in your source code You probably forgot to include the ArkApi header or a missconfig
6:12 AM
Add #include <API/ARK/Ark.h> (edited)
Avatar
I've been at this for a few hours I can't figure out the problem c++ #pragma once #include <API/ARK/Ark.h> #include <json.hpp> #include <string> #include <format> DECLARE_HOOK(AShooterGameSession_OnNumConnectedPlayersChanged, void, AShooterGameSession*, int); void Hook_AShooterGameSession_OnNumConnectedPlayersChanged(AShooterGameSession* _this, int NewPlayersCount) { AShooterGameSession_OnNumConnectedPlayersChanged_original(_this, NewPlayersCount); UShooterCheatManager* cm = ArkApi::GetApiUtils().GetCheatManager(); if (NewPlayersCount < 1) { cm->SetGlobalPause(true); printf("Pausing Server\n"); } else { cm->SetGlobalPause(false); printf("Pausing Server\n"); } } void InitHooks() { ArkApi::GetHooks().SetHook("AShooterGameSession.OnNumConnectedPlayersChanged", &Hook_AShooterGameSession_OnNumConnectedPlayersChanged, &AShooterGameSession_OnNumConnectedPlayersChanged_original); } void RemoveHooks() { ArkApi::GetHooks().DisableHook("AShooterGameSession.OnNumConnectedPlayersChanged", &Hook_AShooterGameSession_OnNumConnectedPlayersChanged); }
Avatar
Avatar
CodingGuy
I've been at this for a few hours I can't figure out the problem c++ #pragma once #include <API/ARK/Ark.h> #include <json.hpp> #include <string> #include <format> DECLARE_HOOK(AShooterGameSession_OnNumConnectedPlayersChanged, void, AShooterGameSession*, int); void Hook_AShooterGameSession_OnNumConnectedPlayersChanged(AShooterGameSession* _this, int NewPlayersCount) { AShooterGameSession_OnNumConnectedPlayersChanged_original(_this, NewPlayersCount); UShooterCheatManager* cm = ArkApi::GetApiUtils().GetCheatManager(); if (NewPlayersCount < 1) { cm->SetGlobalPause(true); printf("Pausing Server\n"); } else { cm->SetGlobalPause(false); printf("Pausing Server\n"); } } void InitHooks() { ArkApi::GetHooks().SetHook("AShooterGameSession.OnNumConnectedPlayersChanged", &Hook_AShooterGameSession_OnNumConnectedPlayersChanged, &AShooterGameSession_OnNumConnectedPlayersChanged_original); } void RemoveHooks() { ArkApi::GetHooks().DisableHook("AShooterGameSession.OnNumConnectedPlayersChanged", &Hook_AShooterGameSession_OnNumConnectedPlayersChanged); }
is InitHooks() and RemoveHooks() loaded at all?
Avatar
Avatar
Natsu
is InitHooks() and RemoveHooks() loaded at all?
you can see the hook invoked in the crash stack
11:15 AM
looks like SetGlobalPause is what crashes
11:16 AM
i see it sets some field within AWorldSettings but i can't see which
Avatar
oh I thought using the GameCheatManager is fool proof
Avatar
some game functions have unfixed internal crashes
Avatar
Hm any suggestions what I should try I've been going throught the source not finding a thing
Avatar
Avatar
WETBATMAN
some game functions have unfixed internal crashes
Turns out UShooterCheatManager* cm = ArkApi::GetApiUtils().GetCheatManager(); is NULL at player count change I Had to manually add RCONEnable=True to make this work (edited)
Avatar
Hello, does anyone knows which are the associated states for doors ? APrimalStructureDoor::GotoDoorState(this, X); with X being 0, 1 or 2, but I don't know if 0 = closed, 1 = open and why is there even a 2 there ^^ (edited)
2:18 PM
I'll test that at some point anyway but if anyone knows the answer that would be great 👍
Avatar
0 is closed, 1/2 are both open
2:19 PM
But each state is open to a different side
Avatar
ah for inwards and backwards
Avatar
Yah
Avatar
awesome thank you
Avatar
Hello, I have PreventTransferForClassName="TekStrider_Character_BP_C" in my Game.ini but players are still able to upload Tek Striders using Oblisks/Beacons/etc.. I guess I have to do that with a plugin, or is my Game.ini configuration wrong? 🤔 (edited)
Avatar
jraServerAPI 4/7/2022 9:12 PM
it's plural i think
9:12 PM
PreventTransferForClassNames
Avatar
hmmm there's no s on the wiki tho
9:13 PM
x)
Avatar
jraServerAPI 4/7/2022 9:13 PM
i came across this with my google fingers
9:13 PM
9:13 PM
thank you ^^
Avatar
jraServerAPI 4/7/2022 9:13 PM
yw!
9:15 PM
also looks like you dont need the double quotes.. but idk for sure if it matters or not (edited)
👌 1
Avatar
jraServerAPI 4/7/2022 9:27 PM
I'd been looking for the "collapse all" ability in VS for a while.. I finally found it.. just thought I would share 🙂 this makes life so much easier sometimes 🙂
Avatar
Hello, is there a way to prevent cryopod usage for a given player? I was able to prevent putting dino in cryopod thanks to CanCryo() hooking but I don't find any interesting function for releasing from cryopod (unable to find a function like "CanUncryo()"). (edited)
Avatar
For release you don't have a C++ function
4:11 PM
There's TryDeploy in blueprint, which can return a bool for success or not. But that needs process event hooking
Avatar
I'm not sure what is process event hooking
Avatar
void Hook_UObject_ProcessEvent(UObject* _this, UFunction* Function, void* Params)
4:12 PM
Basically hooking the c++ function that runs almost all bp functions 😛
Avatar
ouch x)
4:12 PM
not very optimisation friendly so I'll have to pay double attention to hooking code
Avatar
That's like the most direct solution, others would rely on spawn from dino data
4:14 PM
Oh actually, you could hook SpawnFromDinoDataEx and it should have a valid PC on TamerController parameter
Avatar
and you think SpawnFromDinoDataEx is not too late in the chain?
4:15 PM
how am I supposed to abort cryo release
Avatar
Spawn from dino data is what spawns the dino, if it fails cryopod is not erased
4:15 PM
Detecting if cryopod dino, another challenge 😄
Avatar
hmmm so I just make a return whatever;
4:15 PM
ah
4:17 PM
so if I setup the hook Hook_UObject_ProcessEvent(UObject* _this, UFunction* Function, void* Params) how do I know if it's a TryDeploy() invocation? and eventually get parameters because a void* is not very helpful ^^
Avatar
For parameters you gotta use devkit for easy finding
Avatar
ok
Avatar
The function's name field has the function name
4:18 PM
so Function->NameField().ToString().Equals("TryDeploy")
Avatar
awesome
4:18 PM
I'll open the devkit and check the tryDeploy params in bp
4:18 PM
thank you 👍
Avatar
Could also cache the function's id by having a global int for Function->InternalIndexField(), much more efficient than doing string compares
Avatar
ok I didn't know this trick thanks
Avatar
Yeah, the internal index of a function won't change during runtime, that way you dont have to run a string comparison every time, which is like hundreds a second 😄 (edited)
👌 1
Avatar
yes the runtime is why I try to avoid storing pointers x) (edited)
Avatar
Avatar
OSubMarin
Hello, is there a way to prevent cryopod usage for a given player? I was able to prevent putting dino in cryopod thanks to CanCryo() hooking but I don't find any interesting function for releasing from cryopod (unable to find a function like "CanUncryo()"). (edited)
Try using AShooterCharacter::OnWeaponEquipped
Avatar
Good idea thank you
Avatar
Avatar
Lethal
Try using AShooterCharacter::OnWeaponEquipped
how do you know if it's an equipped cryopod? with AShooterWeapon* NewWeapon->AssociatedPrimalItemField() and checking the class of returned UPrimalItem*? 🤔 (edited)
Avatar
ok thank you
Avatar
Ok I can get if it's an equipped crypod but don't know how to force removal of equipped cryo now ^^
5:25 PM
I guess I'll give a try at APrimalDinoCharacter* Hook_APrimalDinoCharacter_SpawnFromDinoDataEx(APrimalDinoCharacter* _this, FARKDinoData* InDinoData, UWorld* InWorld, FVector* AtLocation, FRotator* AtRotation, bool* dupedDino, int ForTeam, bool bGenerateNewDinoID, AShooterPlayerController* TamerController, bool beginPlay) { if (TamerController != nullptr) { if (!IsAllowedToCryo(TamerController)) // This function is mine but you can guess what it does. return nullptr; } return APrimalDinoCharacter_SpawnFromDinoDataEx_original(_this, InDinoData, InWorld, AtLocation, AtRotation, dupedDino, ForTeam, bGenerateNewDinoID, TamerController, beginPlay); } like Pelayori suggested (edited)
Avatar
NewWeapon->StartUnequip();
Avatar
thanks again 👍
Avatar
Just a heads up with that SpawnFromDinoDataEx() function. The definition for it in Actor.h uses "APrimalDinoCharacter.SpawnFromDinoData" instead of "APrimalDinoCharacter.SpawnFromDinoDataEx". I learned the hard way that calling APrimalDinoCharacter::SpawnFromDinoDataEx() from your own code gets ugly. Easy to fix if you need it. Don't think it matters if you're just hooking it the normal way.
Avatar
Avatar
TheMollusk
Just a heads up with that SpawnFromDinoDataEx() function. The definition for it in Actor.h uses "APrimalDinoCharacter.SpawnFromDinoData" instead of "APrimalDinoCharacter.SpawnFromDinoDataEx". I learned the hard way that calling APrimalDinoCharacter::SpawnFromDinoDataEx() from your own code gets ugly. Easy to fix if you need it. Don't think it matters if you're just hooking it the normal way.
It's a good catch though, are you able to submit a PR for that bit please?
Avatar
Sure, I can do that after work
Avatar
jraServerAPI 4/15/2022 6:01 PM
I'm trying to figure out if a TekCloningChamber is currently active and cloning a dino.. I found this in the Dev Kit.. But I'm not sure where this variable is bIsCloning or how to get to it (edited)
Avatar
Likely a bp variable
Avatar
jraServerAPI 4/15/2022 6:02 PM
can i read bp variables? just like functions? if found
Avatar
could do like: UProperty* bIsCloningProp = CloningChamber->FindProperty(FName("bIsCloning", EFindName::FNAME_Add)); if (bIsCloningProp) { bool bIsCloning = bIsCloningProp->Get<bool>(CloningChamber); // variable value }
Avatar
jraServerAPI 4/15/2022 6:03 PM
perfect.. I will give it a try.. thank you
Avatar
That snippet works for any bp variable, as long as you know its type
1136_ouch_my_pp 1
Avatar
jraServerAPI 4/15/2022 7:23 PM
Follow up.. It looks like the TekCloningChamber uses FARKDinoData to create the new dino. Is there some way of telling what kind of dino is being cloned from the DinoClass variable?
Avatar
Get its bp path / get its default object and extract some variables / use DinoName variable (Dino_Character_BP_C format)
Avatar
jraServerAPI 4/15/2022 7:25 PM
thank you .. i will look into that
7:30 PM
hmm i crashed trying to get the FARKDinoData from the blueprint.. does this look right?
7:30 PM
7:31 PM
c++ FARKDinoData dd{}; UProperty* myFARKDinoData = obj->FindProperty(FName("CloningDinoData", EFindName::FNAME_Add)); if (myFARKDinoData) { dd = myFARKDinoData->Get<FARKDinoData>(obj); // variable value Log::GetLog()->warn("Dino Name = {}", dd.DinoName.ToString()); } (edited)
7:34 PM
it crashed on the Get line
Avatar
What's the crash?
Avatar
jraServerAPI 4/15/2022 7:36 PM
U P r o p e r t y : : G e t < F A R K D i n o D a t a > ( ) ( 0 x 0 0 0 0 7 f f 9 0 2 3 b 9 a 4 a ) + 3 4 b y t e s [ C : \ p r o g r a m m i n g \ A R K - S e r v e r - A P I \ v e r s i o n \ C o r e \ P u b l i c \ A P I \ U E \ U E . h : 5 0 6 ]
Avatar
The top lines
Avatar
jraServerAPI 4/15/2022 7:36 PM
V E R S I O N : 3 4 5 . 6 K E R N E L B A S E . d l l ! U n k n o w n F u n c t i o n ( 0 x 0 0 0 0 7 f f 9 5 6 a 6 4 7 8 c ) + 0 b y t e s [ U n k n o w n F i l e : 0 ] V C R U N T I M E 1 4 0 . d l l ! U n k n o w n F u n c t i o n ( 0 x 0 0 0 0 7 f f 9 1 5 9 5 4 8 6 d ) + 0 b y t e s [ U n k n o w n F i l e : 0 ] (edited)
Avatar
Anything above that? Like "Property size does not match..."
Avatar
jraServerAPI 4/15/2022 7:36 PM
no, just Fatal Error
Avatar
hmm
Avatar
jraServerAPI 4/15/2022 7:37 PM
this is what happened on the server [2022.04.15-17.28.31:191][243]LogMemory: Platform Memory Stats for WindowsServer [2022.04.15-17.28.31:191][243]LogMemory: Process Physical Memory: 2558.43 MB used, 4624.01 MB peak [2022.04.15-17.28.31:194][243]LogMemory: Process Virtual Memory: 4670.13 MB used, 7899.34 MB peak [2022.04.15-17.28.31:194][243]LogMemory: Physical Memory: 32264.67 MB used, 65341.30 MB total [2022.04.15-17.28.31:194][243]LogMemory: Virtual Memory: 9472.39 MB used, 134217728.00 MB total [2022.04.15-17.28.55:684][243] - FPlatformMisc::RequestExit(1)
7:42 PM
hmm it looks like that may variable may not get created until the finish sequence, but i'm not a dev kit guru
7:43 PM
but it must be stored somewhere before that
Avatar
Is that a local variable?
Avatar
jraServerAPI 4/15/2022 7:44 PM
how do i tell?
7:45 PM
Avatar
It's not by the looks of it
7:51 PM
Local variables are just usable on an specific function
Avatar
jraServerAPI 4/15/2022 7:58 PM
hmm doesnt look like much is available then.. I'll see whats in CloningDescriptiveName
7:58 PM
Avatar
FARKDinoData is a struct if i'm not mistaken
Avatar
Try changing the log line to this. Log::GetLog()->warn("Dino Name = {}", GetBlueprintFromClass(dd.DinoClass).ToString());
10:33 PM
And add this FString GetBlueprintFromClass(UClass* object) { if (object != nullptr) { FString path_name; object->GetDefaultObject(true)->GetFullName(&path_name, nullptr); //ShowDebugMessage(fmt::format("GetBlueprintFromClass: {}",path_name.ToString())); if (int find_index = 0; path_name.FindChar(' ', find_index)) { path_name = "Blueprint'" + path_name.Mid(find_index + 1, path_name.Len() - (find_index + (path_name.EndsWith( "_C", ESearchCase:: CaseSensitive) ? 3 : 1))) + "'"; return path_name.Replace(L"Default__", L"", ESearchCase::CaseSensitive); } } return FString(""); }
10:34 PM
Did you debug and set a breakpoint to make sure you were getting data back etc?
Avatar
also seems the struct changed struct FARKDinoData { UClass* DinoClass; TArray<unsigned char> DinoData; FString DinoNameInMap; FString DinoName; bool bNetInfoFromClient; };
👍 1
Avatar
jraServerAPI 4/16/2022 12:41 AM
Okay with the correct structure, it's now working and I am getting data. Thank you.
lethalsalute 2
Avatar
jraServerAPI 4/19/2022 5:24 AM
i'm trying to remove cryosickness from a dino and wake it up without using the cheatmanager The following code works, however, when I cryopod the dino again and throw him out (while there is a cryosockness timer still running) It behaves properly and is under cryosickness, but seems to skip the sleeping stage (eg. it still has cryosickness while standing up). so when i try to use this command again, it wont work, because the dino is not sleeping when it really should be. Once the timer is up, it behaves normally again. Any clues as to what piece I might be missing? c++ // make sure dino is asleep first if (dino->bIsSleeping()()) { dino->SetSleeping(false, false); // this seems to wake the dino up from sleeping // remove cryo buff from dino FString classString = L"Blueprint'/Game/Extinction/CoreBlueprints/Buffs/Buff_SummoningSickness.Buff_SummoningSickness'"; UClass* classObj = UVictoryCore::BPLoadClass(&classString); if (dino != nullptr && classObj != nullptr) { TArray<APrimalBuff*> dino_buffs; dino->GetAllBuffs(&dino_buffs); for (APrimalBuff* dino_buff : dino_buffs) { const FString dino_bp_buff = ArkApi::GetApiUtils().GetBlueprint(dino_buff); if (dino_bp_buff.Contains("Buff_SummoningSickness")) { dino_buff->Destroy(true, false); break; } } } } (edited)
5:24 AM
dino standing with cryosickness after throwing him out of the cryopod again after waking him up the the above code (edited)
Avatar
ArkApi::GetApiUtils().GetShooterGameMode()->ActiveEventField().ToString() gives me "None" for some reason (I have Easter event enabled tho), any idea why? I'm calling this just after AShooterGameMode_InitGame_original().
Avatar
Solved, I had to wait for GameState to be ready and use GetGameState()->ActiveEventField() instead of GetShooterGameMode()->ActiveEventField().
👍 1
Avatar
Hey guys, I have a odd question, I am not even sure if its possible even with api, is there a way to block users from seeing certain maps when they open a transmitter to transfer? perhaps based on permission?
Avatar
jraServerAPI 4/29/2022 2:11 AM
I don't think that is possible. You can certainly auto kick players when they join an invalid map. (edited)
Avatar
Yeah I have a map like that, just looking for a way to prevent them from going. Tried through mod and found no solution either.
Avatar
Looks like using console commands is a good way to send information, but is that really a good idea for a list of 40+ items at once?
Avatar
jraServerAPI 4/30/2022 8:05 PM
You're talking about a plugin sending data to a mod?
Avatar
yes, sorry was at work.
Avatar
Avatar
Xeakial
yes, sorry was at work.
substitute 5/1/2022 7:55 AM
is it your mod?
Avatar
Yes it is my own mod
Avatar
Avatar
Xeakial
Yes it is my own mod
substitute 5/2/2022 1:51 AM
make a function that takes the data and then in the plugin invoke the function with your data directly
1:51 AM
it will be the most optimal
Avatar
so your saying I can make a function in the mod and invoke it with an api? That is pretty amazing I was not sure if it had that capabilities, but that was the exact answer I was looking for, thank you!
Avatar
Avatar
Xeakial
so your saying I can make a function in the mod and invoke it with an api? That is pretty amazing I was not sure if it had that capabilities, but that was the exact answer I was looking for, thank you!
substitute 5/2/2022 2:03 AM
Yes, with a little trickery
2:03 AM
you need to make sure you know the exact name of your function in the mod (the UFunction)
2:04 AM
and then you can take the instance of whatever the function is on and find the UFunction with findfunction and then you can call it with UFunction->ProcessEvent
2:04 AM
for the args, they (and return values) are passed as a structure
2:04 AM
but you pass them as void*
2:04 AM
so you need to define a structure for the parameters, and then do something like
2:05 AM
UFunction->ProcessEvent(this,func,(void*) args)
2:05 AM
you'll have to do a little legwork though -- it's been a little bit since I've worked with it.
👍 1
Avatar
Thank you, any point in the right direction is good. I am not new to coding, but have always actively stayed away from c++ whenever possible as its just to me not the fastest way to achieve the outcome I am looking for, but in this case it seems as I really don't have any other choices. I am sure I will be back with more questions.
Avatar
I have searched around here for the answer I am looking for, can I use the standard oracle MySQL lib to incorporate database usage into my plugin? Or should I be using something else?
Avatar
Get that shit out of here @rutyna (edited)
7:41 PM
Second I hit play antivirus picked something up
7:41 PM
Lol
7:42 PM
@[Council]
7:44 PM
Avatar
in some other channels too
Avatar
he is banned now
Avatar
nice, yeah figure his acct got hijacked or something
Avatar
He did the same on the APS discord so I banned him there and banned him from my discord even though he wasn't in there yet.
Avatar
Can we not use the latest connector ++ with the api? we have to use connector ++ 1.1?
5:34 AM
1>C:\plugins\mysql8.0.29-64\include\jdbc\cppconn\driver.h(74,21): error C2059: syntax error: 'function-style cast' 1>C:\plugins\mysql8.0.29-64\include\jdbc\cppconn\driver.h(74,26): error C2143: syntax error: missing ';' before '{' 1>C:\plugins\mysql8.0.29-64\include\jdbc\cppconn\driver.h(74,26): error C2447: '{': missing function header (old-style formal list?) 1>C:\plugins\mysql8.0.29-64\include\jdbc\cppconn\driver.h(75,26): warning C4002: too many arguments for function-like macro invocation 'check' 1>C:\plugins\mysql8.0.29-64\include\jdbc\cppconn\driver.h(75,21): error C2059: syntax error: 'function-style cast' 1>C:\plugins\mysql8.0.29-64\include\jdbc\cppconn\driver.h(75,26): error C2143: syntax error: missing ';' before '{' 1>C:\plugins\mysql8.0.29-64\include\jdbc\cppconn\driver.h(75,26): error C2447: '{': missing function header (old-style formal list?) 1>C:\plugins\mysql8.0.29-64\include\jdbc\cppconn\driver.h(83,3): warning C4002: too many arguments for function-like macro invocation 'check'
5:38 AM
I use the same connector in other c++ projects and it works fine for all of them even with c++17, just does not compile with the api.
Avatar
Avatar
Xeakial
I use the same connector in other c++ projects and it works fine for all of them even with c++17, just does not compile with the api.
substitute 5/7/2022 5:46 AM
Check your C++ version
5:46 AM
For your project
Avatar
I am using vs2019 with c++17 as c++20 did not get introduced until 2020 I believe it was.
Avatar
Do i maybe need to go back a couple of versions of the connector? perhaps the new on is for the newest VS
Avatar
solution was to go back to a earlier version. Now would I be better to build the source as a static library? or just put the dll files into the folder with the api to run connector8 ? so far I put the dll's in with the api and it seems to work just fine.
1:48 AM
Id rather not deal with cmake if possible, but If I have to, so be it.
Avatar
is there a flag on AShooterPlayerController that shows is the player is fighting or do I have to hook the takedamage and do my own version of it?
Avatar
jraServerAPI 5/8/2022 5:45 PM
I believe you answered your own question 🙂
Avatar
I was so hoping not to have to make my own
Avatar
Is it possible to remove creative mode buff in this fashion? FString classbp = "Buff_CreativeModeHelper_C_0"; TArray<APrimalBuff*> p_buffs; AShooterCharacter* Cplayer = static_cast<AShooterCharacter*>(player->CharacterField()); Cplayer->GetAllBuffs(&p_buffs); for (APrimalBuff* buffs : p_buffs) { const FString BP_buffs = ArkApi::GetApiUtils().GetBlueprint(buffs); if (BP_buffs.Contains(classbp)) { buffs->Destroy(true, false); } }
Avatar
You want to use this but I think what you have should work. FString classbp = "Buff_CreativeModeHelper"; (edited)
👍 1
Avatar
works perfect now, thank you!
Avatar
I am able to connect to mysql when the database is on the same machine, when I use IP to another machine, always fails. I remember seen somewhere that it was not possible connect to a database on another machine. Is this true?
Avatar
jraServerAPI 5/12/2022 4:48 AM
It's possible, I use the network name though, but it should work with IP too.. do you have a firewall? (edited)
Avatar
It definitely works with IP, I use it from multiple machines through plugins and a discord bot that are all hosted on different machines from different locations. It has to be a firewall issue.
Avatar
Avatar
Xeakial
It definitely works with IP, I use it from multiple machines through plugins and a discord bot that are all hosted on different machines from different locations. It has to be a firewall issue.
That or their sql server is either: bound to 127.0.0.1 instead of 0.0.0.0 Or Their login isn’t authenticated for their ip or %
Avatar
I found out, there was a type on the connection string, when the MySql IP is empty it defaults to localhost and it works on the local machine (edited)
👍 1
Avatar
Avatar
Uaca
I found out, there was a type on the connection string, when the MySql IP is empty it defaults to localhost and it works on the local machine (edited)
You can just set it to 0.0.0.0 to bind to all network interfaces (edited)
Avatar
that is nice!
Avatar
jraServerAPI 5/15/2022 1:50 AM
Is this value somewhere in the API? I'm trying to find it...
1:50 AM
Avatar
jraServerAPI 5/15/2022 2:22 AM
I found it at ArkApi::GetApiUtils().GetShooterGameMode()->MaxTamedDinosField();
Avatar
is API::Timer::Get().DelayExecute(&handleplayer, 5, player) asynchronous by default? or do we have to do something extra to use it on a separate thread?
Avatar
Avatar
Xeakial
is API::Timer::Get().DelayExecute(&handleplayer, 5, player) asynchronous by default? or do we have to do something extra to use it on a separate thread?
Everything in Ark is synchronous
10:10 AM
Everything runs in the game thread
10:10 AM
If what you are doing does not need game stuff then you can use std thread
10:11 AM
Otherwise you need to use game thread and some synchronization
Avatar
okay it is for the AShooterGameMode_HandleNewPlayer hook, I know you have to delay until the player is loaded to get the information, I was not sure if this would cause the plugin to stop completely while it was waiting if another player comes online, or if I should push it on its own thread to counteract it. (edited)
Avatar
Avatar
Xeakial
okay it is for the AShooterGameMode_HandleNewPlayer hook, I know you have to delay until the player is loaded to get the information, I was not sure if this would cause the plugin to stop completely while it was waiting if another player comes online, or if I should push it on its own thread to counteract it. (edited)
Instead you can queue the action and after x amount of time you can do the action
1:39 AM
Which is what delay execute does
Avatar
as long as there is no data loss I am fine with it delaying honestly, I mean we get a lot of traffic but I doubt enough users to cause that much of an issue coming online at once.
Avatar
jraServerAPI 5/20/2022 5:16 AM
Does anyone know why the last bullet does not trigger the Hook_APrimalStructure_TakeDamage hook? This is very weird... Where does it go? (edited)
Avatar
jraServerAPI 5/20/2022 7:56 AM
I just discovered, this is not the best way to check for handcuffs, and I notice this code is used in a lot of examples and etc: c++ FString WeaponName; character->CurrentWeaponField()->AssociatedPrimalItemField()->GetItemName(&WeaponName, false, true, nullptr); if (WeaponName.Contains(L"Handcuffs")) { // player is wearing handcuffs } INSTEAD you should test the blueprint path: c++ auto weaponBP = ArkApi::GetApiUtils().GetBlueprint(player_controller->GetPlayerCharacter()->CurrentWeaponField()->AssociatedPrimalItemField()); if (WeaponName.Contains(L"Handcuffs")) { // player is wearing handcuffs } Why? Because GetItemName() will return the weapon name in local language of the user.. So yeah, this works fine for English players.. everyone else..forgettaboutit!! 😆 I just thought I would share 🙂 (edited)
7:59 AM
Avatar
I would also use the NameField() if you know what you are looking for, as thay will never ever change. (edited)
Avatar
Avatar
jraServerAPI
I just discovered, this is not the best way to check for handcuffs, and I notice this code is used in a lot of examples and etc: c++ FString WeaponName; character->CurrentWeaponField()->AssociatedPrimalItemField()->GetItemName(&WeaponName, false, true, nullptr); if (WeaponName.Contains(L"Handcuffs")) { // player is wearing handcuffs } INSTEAD you should test the blueprint path: c++ auto weaponBP = ArkApi::GetApiUtils().GetBlueprint(player_controller->GetPlayerCharacter()->CurrentWeaponField()->AssociatedPrimalItemField()); if (WeaponName.Contains(L"Handcuffs")) { // player is wearing handcuffs } Why? Because GetItemName() will return the weapon name in local language of the user.. So yeah, this works fine for English players.. everyone else..forgettaboutit!! 😆 I just thought I would share 🙂 (edited)
this would be a nice addition to #【🔷】ᴘʟᴜɢɪɴ-ʀᴇꜰꜱ
Avatar
how dangerous is a do while loop in a plugin? wanting to use it for newplayer hook and loop until all information is available.
10:03 PM
I tried the api timer, but seems like it still misses information sometimes, or just crashes.
Avatar
Avatar
Xeakial
how dangerous is a do while loop in a plugin? wanting to use it for newplayer hook and loop until all information is available.
if you do a while loop inside a hook you'll pause everything the server is doing, so i'm not sure how the information should become available in this case? 😄
Avatar
well the hook calls a separate function try { uint64 steamid; FString uname; uint64 pid; AShooterPlayerState* state = static_cast<AShooterPlayerState*>(player->PlayerStateField()); FTribeData* tdata; int tmembers; std::time_t set_time = std::time(nullptr); do { steamid = ArkApi::GetApiUtils().GetSteamIdFromController(player); player->GetPlayerCharacterName(&uname); pid = ArkApi::GetApiUtils().GetPlayerID(player); tdata = state->MyTribeDataField(); tmembers = tdata->MembersPlayerDataIDField().Num(); } while (!uname.IsEmpty() && steamid != 0 && pid != 0); if (!check_for_info(fmt::format("SELECT * FROM users WHERE clusterid = '{}' AND steamdid = '{}' AND playerid = '{}'", clusterid, steamid, pid))) send_info(fmt::format("INSERT INTO users (clusterid, steamid, userid, username, lastlogin, lastmap) VALUES ('{}','{}','{}','{}','{}','{}')", clusterid, steamid, pid, escape(uname.ToString()), set_time, mapname)); else send_info(fmt::format("UPDATE users SET lastlogin = '{}', lastmap = '{}', username = '{}'", set_time, mapname, escape(uname.ToString()))); if (state) { if (tmembers > 0) { uint64 tribeid = tdata->TribeIDField(); FString tribename = tdata->TribeNameField(); if (tribeid != 0 && !tribename.IsEmpty()) { if (!check_for_info(fmt::format("SELECT * FROM tribe_info WHERE cluserid = '{}' AND mapid = '{}' AND tribeid = '{}'", clusterid, serverid, tribeid))) send_info(fmt::format("INSERT INTO tribe_info (clusterid, mapid, tribeid, tribename, count) VALUES ('{}','{}','{}','{}','{}')", clusterid, serverid, tribeid, escape(tribename.ToString()), tmembers)); else send_info(fmt::format("UPDATE tribe_info SET tribename = '{}', count = '{}' WHERE clusterid = '{}' AND mapid = '{}' AND tribeid = '{}'", escape(tribename.ToString()), tmembers, clusterid, serverid, tribeid)); if (!check_for_info(fmt::format("SELECT * FROM user_tribe WHERE steamid = '{}' AND clusterid = '{}' AND mapid = '{}' AND tribeid = '{}'", steamid, clusterid, serverid, tribeid))) send_info(fmt::format("INSERT INTO user_tribe (clusterid, steamid, mapid, tribeid, tribename, lastseen, count) VALUES ('{}','{}','{}','{}','{}','{}','1')", clusterid, steamid, serverid, tribeid, escape(tribename.ToString()), set_time)); else send_info(fmt::format("UPDATE user_tribe SET count = count + 1, lastseen = '{}', tribename = '{}' WHERE steamid = '{}' AND clusterid = '{}' AND mapid = '{}' AND tribeid = '{}'", set_time, escape(tribename.ToString()), steamid, clusterid, serverid, tribeid)); } } } return true; } catch (const std::exception& exception) { Log::GetLog()->error("({} {}) Unexpected error {}", __FILE__, __FUNCTION__, exception.what()); return false; } (edited)
Avatar
at least format this text with cpp syntax please
Avatar
returns true to the hook if it is good, false if not.
10:07 PM
sorry most is sql.
10:08 PM
oops i think see my error. its doing it while its NOT empty lol.
Avatar
regardless if you perform a while loop here you lock the server main thread
10:08 PM
the information won't become available this way because the server can't process the functions that load it
10:09 PM
void Hook_APlayerController_ServerReceivedPlayerControllerAck_Implementation(APlayerController* _this)
10:09 PM
try using this hook
10:09 PM
it's called very last in the connection chain
Avatar
I see.. so back to the drawing board on that one. I had it working but it would not get usernames.
10:09 PM
okay, I will try that, thank you.
Avatar
Avatar
Xeakial
I see.. so back to the drawing board on that one. I had it working but it would not get usernames.
it can be empty if the character is not created
Avatar
so newplayer will fire even if they are at the character creation screen?
Avatar
correct
Avatar
ahhh, okay. that explains the random crashes then.
10:11 PM
this one is the same? it will fire as well even without a character?
10:11 PM
so I need to set that value if its empty basically.
Avatar
yes, it fires as the very last function in the connection process
Avatar
okay, makes sense. I will set it to just Human or something, then next transfer or load in it will update it. thank you.
Avatar
there is a hook that gets triggered on character spawn too
Avatar
is that good for when they wakeup? or just when they spawn a new or after death?
10:15 PM
I will play with it, this is a great help, I though perhaps I was sending too much information and it could not keep up
Avatar
void Hook_AShooterCharacter_AuthPostSpawnInit(AShooterCharacter* _this)
10:15 PM
used by arkshop
10:16 PM
as far as i know it gets called by respawning from the death screen only
10:17 PM
oh actually
10:17 PM
you might want to use the possess hook
10:17 PM
because it gets called when you access your character
10:17 PM
and you're guaranteed to have player name and other data
10:18 PM
it gets called on login and respawn though but you can track this and only invoke your functions once
10:18 PM
void Hook_AShooterCharacter_PossessedBy(AShooterCharacter* _this, AController* InController)
10:18 PM
this one
Avatar
that sounds like a winner for what I need then.
10:20 PM
I also was not sure if its because I'm using a much newer connector++ than that of the arkshop and permissions. but I think it was all because of the new player. it would work great for a random amount of time.
Avatar
TArray<unsigned char> item_bytes; item->GetItemBytes(&item_bytes); For a few itens and only in few maps, this crashes the server. Is there a way around id? Can I catch exceptions for this kind of thing ? (edited)
Avatar
Avatar
Uaca
TArray<unsigned char> item_bytes; item->GetItemBytes(&item_bytes); For a few itens and only in few maps, this crashes the server. Is there a way around id? Can I catch exceptions for this kind of thing ? (edited)
What’s the crash?
Avatar
Avatar
substitute
What’s the crash?
Fatal error! VERSION: 345.37 ShooterGameServer.exe!UObjectProperty::SerializeItem() (0x00007ff75ceb3a1d) + 0 bytes [f:\build\lostisland\engine\source\runtime\coreuobject\private\uobject\propertyobject.cpp:47] ShooterGameServer.exe!UArrayProperty::SerializeItem() (0x00007ff75ceaa93d) + 38 bytes [f:\build\lostisland\engine\source\runtime\coreuobject\private\uobject\propertyarray.cpp:77] ShooterGameServer.exe!FPropertyTag::SerializeTaggedProperty() (0x00007ff75ce69f95) + 0 bytes [f:\build\lostisland\engine\source\runtime\coreuobject\public\uobject\propertytag.h:143] ShooterGameServer.exe!UStruct::SerializeTaggedProperties() (0x00007ff75ce76c8e) + 0 bytes [f:\build\lostisland\engine\source\runtime\coreuobject\private\uobject\class.cpp:1305] ShooterGameServer.exe!UStructProperty::SerializeItem() (0x00007ff75ceb448d) + 0 bytes [f:\build\lostisland\engine\source\runtime\coreuobject\private\uobject\propertystruct.cpp:138] ShooterGameServer.exe!UArrayProperty::SerializeItem() (0x00007ff75ceaa93d) + 38 bytes [f:\build\lostisland\engine\source\runtime\coreuobject\private\uobject\propertyarray.cpp:77] ShooterGameServer.exe!FPropertyTag::SerializeTaggedProperty() (0x00007ff75ce69f95) + 0 bytes [f:\build\lostisland\engine\source\runtime\coreuobject\public\uobject\propertytag.h:143] ShooterGameServer.exe!UStruct::SerializeTaggedProperties() (0x00007ff75ce76c8e) + 0 bytes [f:\build\lostisland\engine\source\runtime\coreuobject\private\uobject\class.cpp:1305] ShooterGameServer.exe!UPrimalItem::GetItemBytes() (0x00007ff75b7fea11) + 55 bytes [f:\build\lostisland\projects\shootergame\source\shootergame\private\primalitem.cpp:1564] KitMaker.dll!UnknownFunction (0x000001ae4936e669) + 0 bytes [UnknownFile:0]
Avatar
it starts from my plugin, in this case is the beehive from The Island
11:43 PM
there are other items with similar behavior
Avatar
Avatar
Uaca
it starts from my plugin, in this case is the beehive from The Island
I don’t believe the beehive can be serialized
9:12 AM
Perhaps there’s a flag you can check
Avatar
Avatar
substitute
Perhaps there’s a flag you can check
for now I made a array with items names to ignore, but this way I have to first way for the crash and try to guess the offending item
2:37 PM
i did not find any flags
2:40 PM
to make a worse, only tamed bee hive cant be serialized, if I spawn, it works
Avatar
Anyone come across a hook that will catch when a gen2 mission ends?
Avatar
Avatar
Xeakial
Anyone come across a hook that will catch when a gen2 mission ends?
Yep: DECLARE_HOOK(AMissionType_BPOnMissionComplete, void, AMissionType*, AShooterCharacter*, AShooterPlayerController*, bool, float, TArray<UPrimalItem*>*); void Hook_AMissionType_BPOnMissionComplete(AMissionType* _this, AShooterCharacter* ForPlayer, AShooterPlayerController* ForController, bool bLastPhaseSuccess, float XPRewarded, TArray<UPrimalItem*>* ItemsRewarded) { AMissionType_BPOnMissionComplete_original(_this, ForPlayer, ForController, bLastPhaseSuccess, XPRewarded, ItemsRewarded); }
12:31 PM
Gen1/2
Avatar
Dodo Enthusiast 6/6/2022 12:49 PM
Hey, I have a local Ark Server running and followed the Guide to setup Visual Studio for Plugin Development. Now I would like to create a really simple "hello world" like plugin to test if everything is working but I don't really know how to get started. Can someone help me or is there a guide somewhere I missed?
Avatar
Avatar
Dodo Enthusiast
Hey, I have a local Ark Server running and followed the Guide to setup Visual Studio for Plugin Development. Now I would like to create a really simple "hello world" like plugin to test if everything is working but I don't really know how to get started. Can someone help me or is there a guide somewhere I missed?
Server Plugins for ARK: Server API. Contribute to Michidu/Ark-Server-Plugins development by creating an account on GitHub.
Avatar
Avatar
Pelayori
Dodo Enthusiast 6/6/2022 2:03 PM
Thanks, I tried to understand and learn from the sourceCode but when I add the Line "#include <API/ARK/Ark.h>" I get like 100 Errors. Code C2011.
Avatar
Avatar
Dodo Enthusiast
Thanks, I tried to understand and learn from the sourceCode but when I add the Line "#include <API/ARK/Ark.h>" I get like 100 Errors. Code C2011.
What version of Visual Studio ?
Avatar
Avatar
Foppa
What version of Visual Studio ?
Dodo Enthusiast 6/6/2022 3:23 PM
Avatar
Ensure you are using C++ Lang Standard 17 !
Avatar
Avatar
Foppa
Ensure you are using C++ Lang Standard 17 !
Dodo Enthusiast 6/6/2022 3:26 PM
Jeah looks the same for me.
3:27 PM
I followed the plugin tutorial from wetbatman
Avatar
How did you set your paths and where did you do the include? (edited)
Avatar
Dodo Enthusiast 6/6/2022 3:29 PM
Avatar
What does the output tab say after build? (edited)
Avatar
Dodo Enthusiast 6/6/2022 3:36 PM
Avatar
Hmm, did you download latest sources?
Avatar
Avatar
Pelayori
Hmm, did you download latest sources?
Dodo Enthusiast 6/6/2022 3:42 PM
I used the ones from the Guide. I just downloaded it again from the Link you posted earlier and now it seems to work. Only 3 errors that are related to my Code it seems. Thanks everyone that helped.
Avatar
Avatar
Dodo Enthusiast
I used the ones from the Guide. I just downloaded it again from the Link you posted earlier and now it seems to work. Only 3 errors that are related to my Code it seems. Thanks everyone that helped.
Should always download them from here https://github.com/Michidu/ARK-Server-API
Server plugins support for ARK. Contribute to Michidu/ARK-Server-API development by creating an account on GitHub.
Avatar
Dodo Enthusiast 6/6/2022 3:53 PM
I will do that from now on^^. Thanks again.
Avatar
Avatar
Pelayori
Yep: DECLARE_HOOK(AMissionType_BPOnMissionComplete, void, AMissionType*, AShooterCharacter*, AShooterPlayerController*, bool, float, TArray<UPrimalItem*>*); void Hook_AMissionType_BPOnMissionComplete(AMissionType* _this, AShooterCharacter* ForPlayer, AShooterPlayerController* ForController, bool bLastPhaseSuccess, float XPRewarded, TArray<UPrimalItem*>* ItemsRewarded) { AMissionType_BPOnMissionComplete_original(_this, ForPlayer, ForController, bLastPhaseSuccess, XPRewarded, ItemsRewarded); }
Thank you, I could not find it in the hook generator.
Avatar
Avatar
Xeakial
Thank you, I could not find it in the hook generator.
It isn't there. I found it using IDA
Avatar
I thought that is what I was going to have to do, thank you for saving me that, just learning c++, was not sure I wanted to even dive into all of that yet.
Avatar
IDA is very easy once you learn, but most of the functions you want to use are in the hook generator
Avatar
Dodo Enthusiast 6/6/2022 7:20 PM
Its me again :X I still have some Problems. Whenever I do anything with FString I get Errors. Even the Example from the Unreal Engine documentation "FString TestHUDString = FString(TEXT("This is my test FString."));". Without FString it does succeed. I have selected an DLL Project and have the 2017 Language Standard active.
Avatar
jraServerAPI 6/6/2022 7:28 PM
did you c++ #include <API/ARK/Ark.h> ?
Avatar
Avatar
Dodo Enthusiast
Its me again :X I still have some Problems. Whenever I do anything with FString I get Errors. Even the Example from the Unreal Engine documentation "FString TestHUDString = FString(TEXT("This is my test FString."));". Without FString it does succeed. I have selected an DLL Project and have the 2017 Language Standard active.
Did you do the lib include? #pragma comment(lib, "ArkApi.lib")
6847_feelsglassesman 1
Avatar
Dodo Enthusiast 6/6/2022 7:38 PM
Nice, the lib include fixed the Error. I now get other Errors when I try to use the FString for AddChatCommand.
Avatar
Like which ones?
Avatar
Dodo Enthusiast 6/6/2022 7:39 PM
Avatar
For add chat command you can do: AddChatCommand("/command", &func);
7:41 PM
Also, any function from the api utils or the logger that you pass FString to, you have to use the * operator, like FuncWithArgs(*fstr); (which isn't the case for AddChatCommand, but the errors mention it) (edited)
Avatar
Dodo Enthusiast 6/6/2022 7:56 PM
Trying this I get the same Error as before.
Avatar
Dodo Enthusiast 6/6/2022 8:08 PM
Is the correct fix by any chance *(*message) in the call to sendservermessage? (edited)
8:09 PM
Avatar
The error isn't in the add chat command, so yeah the issue is you need to pass *message
8:10 PM
Just one * operator is enough, the * operator returns the character data which the fmt::format needs
Avatar
Dodo Enthusiast 6/6/2022 8:11 PM
If I use one * I get an error, maybe because the Pointer has the same name?
8:14 PM
On the other Hand, if its already a Pointer why doesn't it work in the first place xD I'm obviously a total noob but I'm happy it compiled without errors for the first Time 😄
Avatar
Ah yeah my bad, I didn't see it was a pointer
8:21 PM
Then yeah, double **
Avatar
Is there a limit at some point where to much database integration will cause issues that any one has noticed?
Avatar
Avatar
Xeakial
Is there a limit at some point where to much database integration will cause issues that any one has noticed?
Not really. I've come accross issues when I started doing multithreaded sql applications, you have to be careful of data management, using mutexes and such stuff. But doing too many sql queries will just depend on how many entries on db, and could potentially lag the server if the query takes too much.
10:49 PM
I'm not sure if I answered your question, though.
Avatar
okay, I know for sure I was having buffer overflow issues with players logging in and collecting information, but I solved that by delaying the queries for a bit to give it time to load the base.
Avatar
If you do sql operations on player login, and they take relatively too much time, they could overflow once its done, it's technically possible yes
Avatar
Yeah it certainly was for me, it was a constant issue, but I ended up splitting up the load from when they logged in, giving it 60 seconds before it started sending info to the database, and send the rest when they log out.
Avatar
Yah, when players log in the server sends pretty much big data to clients, if server stalls before sending them that info, server ends up sending the login data + other data that happened during the stall. Or at least that's what I can think of (edited)
Avatar
yeah, had to figure that out the hard way lol. but the new project I am working on is based off of the Config Manager, I want to use a database to store the config options so I can also access them via webpage, and discord bot, but I am worried that it could be too much and am debating going to a ini style file instead.
10:56 PM
but that brings a whole new issue of making sure the folder is shared for all the maps I want to effect, and having accessible from the bot and web server, so it would have to be a synced folder basically. decisions decisions lol.
Avatar
Dodo Enthusiast 6/6/2022 11:33 PM
I'm probably the worst beginner ever :X Now I get Error Code 126 from the ArkApi Plugin Manager when starting the Server with my simple plugin from above. I have installed the c++ redists and the Permission Plugin is loading without error.
Avatar
Avatar
Dodo Enthusiast
I'm probably the worst beginner ever :X Now I get Error Code 126 from the ArkApi Plugin Manager when starting the Server with my simple plugin from above. I have installed the c++ redists and the Permission Plugin is loading without error.
What is your plugin's name?
Avatar
Dodo Enthusiast 6/6/2022 11:49 PM
I tried so many times with different Names. "FirstPlugin" for Example. Folder and Dll with the same Name.
Avatar
If your plugin's name first letter is above "P" in alphabetical order, it will fail to load unless you delay load it. To Delay load it go to project settings -> Linker -> input -> delay load dll, write there Permissions.dll and recompile
Avatar
Dodo Enthusiast 6/6/2022 11:59 PM
Still doesn't work. I also named one Plugin "xxxx" and same result. Whats weird is that I have one super naked Plugin without include Ark.h and the pragma ArkApi.lib and that one is loading too.
Avatar
The api will attempt to load the dll, if it hasn't got any api code it just won't run any api code 😛
12:04 AM
126 is missing dependency, so something is up
Avatar
Avatar
Pelayori
126 is missing dependency, so something is up
Dodo Enthusiast 6/7/2022 12:43 AM
My Plugin is just this small. Cant wrap my head around why that would not load while the permission plugin is. Could the default files that Visual Studio creates affect that?
Avatar
Shouldn't need any permissions include then, you should remove the delay load as well
12:43 AM
Re install vc++ redistributables
Avatar
Avatar
Dodo Enthusiast
My Plugin is just this small. Cant wrap my head around why that would not load while the permission plugin is. Could the default files that Visual Studio creates affect that?
I don't see the Log::Get().Init("PluginName"); in your load.. You have to have this line in my experience.
7:49 AM
should look like this #include <Windows.h> #include <API/ARK/Ark.h> #include <Logger/Logger.h> #pragma comment(lib, "ArkApi.lib") void Load() { Log::Get().Init("YourPluginName"); <-- add commands here } void Unload() { } BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: Load(); break; case DLL_PROCESS_DETACH: Unload(); break; } return TRUE; } And the pluginInfo.json file in the folder "YourPluginName" should look like: { "FullName":"YourPluginName", "Description":"Description of your plugin here", "Version":1.0, "MinApiVersion":3.2 } (edited)
Avatar
Dodo Enthusiast 6/7/2022 8:57 AM
Thanks again everyone. I found my Issue. All Projects I did with the old file problem were set to release, but at some point after I fixed that issue I forgot to set it to release. Sometimes its better to sleep a night over it 😄
Avatar
Log Init should only be necessary if you are using the logger
1:22 PM
If you don't init the logger and try to use it, it will crash
Avatar
Sorry for newb question - is there a way to disable voice chat entirely server side? I would like to start a server, which our community has strict moderation guidelines that we would love to enforce. I am thinking that we turn on global voice, however, we could toggle this been on when staff are online, and then toggle off when we dont have moderation team joined.
4:48 PM
I have had a good read on the forums and nothing looks like they have tackeled this problem.
Avatar
I'm not really sure you can do that, might be since voice chat has to be sent back and forth to/from server
Avatar
I'd be happy to disable voice chat entirely and just rely on text (and logging of the text chats).
Avatar
Dodo Enthusiast 6/7/2022 9:01 PM
Hey, could anyone point me in the direction of gps coordinates? I can get the xyz without Problem but cant really find anything that resembles the gps coordinates. (edited)
Avatar
Avatar
Dodo Enthusiast
Hey, could anyone point me in the direction of gps coordinates? I can get the xyz without Problem but cant really find anything that resembles the gps coordinates. (edited)
9:12 PM
converting FVector to gps coordinates
9:13 PM
it's also an API function now, if you have the latest headers it will be already available for you
9:13 PM
Avatar
Avatar
WETBATMAN
it's also an API function now, if you have the latest headers it will be already available for you
Dodo Enthusiast 6/7/2022 9:17 PM
Ah, yes I got it. Thank you.
Avatar
Dodo Enthusiast 6/7/2022 9:44 PM
I feel kinda bad that I'm the only one asking so much in here. If its too much please tell me. I have one more Issue. I'm iterating over the GetWorld()->PersistentLevelField()->GetActorsField() and try to destroy some structures. The server just crashed everytime, even without error. I tried UVictoryCore::KillTargetCharacterOrStructure APrimalStructure->destroy() APrimalStructure->SetHealth(0). Does the destruction of one item in the GetActorsField basically kill the loop?
Avatar
Avatar
Dodo Enthusiast
I feel kinda bad that I'm the only one asking so much in here. If its too much please tell me. I have one more Issue. I'm iterating over the GetWorld()->PersistentLevelField()->GetActorsField() and try to destroy some structures. The server just crashed everytime, even without error. I tried UVictoryCore::KillTargetCharacterOrStructure APrimalStructure->destroy() APrimalStructure->SetHealth(0). Does the destruction of one item in the GetActorsField basically kill the loop?
Which crash are you getting? (call stack)
Avatar
Dodo Enthusiast 6/7/2022 9:47 PM
I'll try it again but I'm pretty sure I didnt get a Error Window it just closed the server-terminal
Avatar
jraServerAPI 6/7/2022 9:49 PM
Are you calling your function after game init?
9:50 PM
also could type another method like... c++ TArray<AActor*> FoundActors; UGameplayStatics::GetAllActorsOfClass(reinterpret_cast<UObject*>(ArkApi::GetApiUtils().GetWorld()), APrimalStructure::GetPrivateStaticClass(), &FoundActors); for (const auto& actor : FoundActors) { auto structure = static_cast<APrimalStructure*>(actor); if (structure && structure->IsA(APrimalStructureItemContainer::GetPrivateStaticClass())) { // do something with structure // structure->Destroy(); } } (edited)
Avatar
Dodo Enthusiast 6/7/2022 9:50 PM
For now I have a chatcommand I type in myself while on the server.
9:52 PM
Could my Problem be that i dont have a FoundActors but im doing the destroy inside the initial Loop over PersistentLevelField()->GetActorsField()?
Avatar
jraServerAPI 6/7/2022 9:53 PM
show us your code
9:53 PM
thats the easiest way
Avatar
Dodo Enthusiast 6/7/2022 10:02 PM
I basically comes down to this
Avatar
Dodo Enthusiast 6/7/2022 10:10 PM
If i dont do the kill/destroy but just Log the structures that satisfy the conditions it works
Avatar
Try using Destroy() or Suicide()
Avatar
Dodo Enthusiast 6/7/2022 11:34 PM
I just tried a completely new savegame and it suddenly worked destroy and suicide both. Thanks again everyone.
Avatar
Dodo Enthusiast 6/7/2022 11:54 PM
And the UVictoryCore function still kills the Server 😄 (edited)
Avatar
Hello, i am looking for documentation about plugin development but i did'n find anything, i would appreciate if anybody can help me
Avatar
Avatar
AlePingu
Hello, i am looking for documentation about plugin development but i did'n find anything, i would appreciate if anybody can help me
Dodo Enthusiast 6/9/2022 11:57 AM
Hi, I also started just some days ago. What helped my was doing the guide https://discord.com/channels/513432877904691202/513502790228639775/514540051615449089 from #【🔶】ᴘʟᴜɢɪɴ-ᴛᴜᴛꜱ but with the files from https://github.com/Michidu/ARK-Server-API. You First small plugin should look something like https://discord.com/channels/513432877904691202/745040316196847626/983608727854776330. After that you can look at https://github.com/Michidu/Ark-Server-Plugins for some inspiration.
12:00 PM
"How to install Ark plugins" from the #【🔶】ᴘʟᴜɢɪɴ-ᴛᴜᴛꜱ is also helpful. You Probably need to install the vc++ redistributables (edited)
Avatar
Really thanks
Avatar
So since i cant find a ORP mod that works i want to try doing plugins. I just got Visualstudio 2022 and i dont know what to pick to install
2:49 AM
any help?
Avatar
Avatar
Dragoon
So since i cant find a ORP mod that works i want to try doing plugins. I just got Visualstudio 2022 and i dont know what to pick to install
did you look at the #【🔶】ᴘʟᴜɢɪɴ-ᴛᴜᴛꜱ ? https://discord.com/channels/513432877904691202/513502790228639775/514540051615449089
Avatar
Trying to use either of these two hooks to ignore when a player is too close to another player to build for an event, is this even possible through hooks? Or should I try making a mod to do this? DECLARE_HOOK(APrimalStructure_IsAllowedToBuild, int, APrimalStructure*, APlayerController*, FVector, FRotator, FPlacementData*, bool, FRotator, bool); DECLARE_HOOK(APrimalStructure_CheckNotEncroaching, bool, APrimalStructure*, FVector, FRotator, AActor*, APrimalStructure*, APrimalStructure*, bool); (edited)
Avatar
jraServerAPI 6/11/2022 9:37 PM
it's possible, i think you'll need APrimalStructure_IsAllowedToBuild and in that hook you just scan the area of the structure position and look for other tribe structures using UVictoryCore::ServerOctreeOverlapActors
Avatar
I figured OctreeOverlap would come into play as it was what I seen on some mod examples. Thank you I will try that.
Avatar
jraServerAPI 6/11/2022 10:07 PM
no problem, there are plenty of examples on here as well
Avatar
Dodo Enthusiast 6/18/2022 5:25 PM
Is it normal that it seems I have to start the server twice to get a Hook working without crash or am I doing something wrong? Or is there a Problem with using the info Log from inside a Hook? (edited)
Avatar
verify server files and reinstall the ark api files.
Avatar
Avatar
Lethal
verify server files and reinstall the ark api files.
Dodo Enthusiast 6/18/2022 6:39 PM
Thanks its not crashing anymore although the api files seemed the same and there was no update in the Server Manager. I'm still kinda confused but I will take it 😄
Avatar
Does the hook creator not work anymore?
12:57 AM
I am just having trouble getting started
Avatar
jraServerAPI 6/19/2022 1:31 AM
what version are you using?
Avatar
Thank you this worked, if i am trying to make a plugin to stop pulling to turrets can this tool help with that?
Avatar
jraServerAPI 6/19/2022 4:08 AM
well sure, it's a great tool for looking up all the different hooks and getting the code easily
Avatar
I just am looking for a basis to venture off from and wasn't sure if this would offer any ideas
Avatar
jraServerAPI 6/20/2022 10:22 PM
i would spend some time in the free examples that are available
Avatar
void ShowM(int delay) { if (delay > 0) { DEBUG_INFO("Timer {} ", delay); delay-- API::Timer::Get().DelayExecute(&ShowM, 1, delay); return; } } I am trying to DelayExecute inside DelayExecute like the code above, This is crashing on the seconds execution. Is there a reason i cant call DelayExecute inside DelayExecute? I am trying to show a count down for the user something like 5, 4, 3, 2, 1.
Avatar
What’s the crash stack
Avatar
jraServerAPI 6/22/2022 6:30 AM
does that even compile? 😆 don't you need a semicolon after delay-- ?
Avatar
Avatar
jraServerAPI
does that even compile? 😆 don't you need a semicolon after delay-- ?
I removed my comments and removed a bit too much
Avatar
I've used nested delay execs without issues
Avatar
Somehow it is working now. I guess I just needed to sleep 😅
Avatar
c++ std::string url = "http://*****:3000/api/client"; std::vector<std::string> headers; headers.push_back("Content-type:application/json"); headers.push_back("Authorization : Bearer " + std::string("aaaa")); nlohmann::json request; request["id"] = "2"; request["product"] = "Carno"; request["female"] = "1"; API::Requests::Get().CreatePostRequest(url, &VerifyCallback, request.dump(), headers); {"status_code":400,"status_msg":"INVALID_REQUEST","status_overview":"failed"} (edited)
11:06 PM
for? no valid request
Avatar
Avatar
Fenix
c++ std::string url = "http://*****:3000/api/client"; std::vector<std::string> headers; headers.push_back("Content-type:application/json"); headers.push_back("Authorization : Bearer " + std::string("aaaa")); nlohmann::json request; request["id"] = "2"; request["product"] = "Carno"; request["female"] = "1"; API::Requests::Get().CreatePostRequest(url, &VerifyCallback, request.dump(), headers); {"status_code":400,"status_msg":"INVALID_REQUEST","status_overview":"failed"} (edited)
400 means the request invalid
11:09 PM
check to make sure it isn't a GET request (edited)
11:10 PM
what's the output of request.dump()
Avatar
they are json variables
11:14 PM
is to compare with a POST (edited)
Avatar
Avatar
substitute
400 means the request invalid
If I do it from this website https://reqbin.com it works for me
ReqBin is the world's most popular online API testing tool for REST, SOAP and HTTP APIs. Test your APIs right from your browser. No coding. No desktop app. See why 850'000 of users use ReqBin for testing their APIs online!
Avatar
Avatar
Fenix
c++ std::string url = "http://*****:3000/api/client"; std::vector<std::string> headers; headers.push_back("Content-type:application/json"); headers.push_back("Authorization : Bearer " + std::string("aaaa")); nlohmann::json request; request["id"] = "2"; request["product"] = "Carno"; request["female"] = "1"; API::Requests::Get().CreatePostRequest(url, &VerifyCallback, request.dump(), headers); {"status_code":400,"status_msg":"INVALID_REQUEST","status_overview":"failed"} (edited)
use the overload where you specify content type in the function param
11:34 PM
void PostDiscordWebhook(FString URL, nlohmann::json Content) { if (!URL.IsEmpty()) API::Requests::Get().CreatePostRequest(URL.ToString(), [](bool Sucess, std::string Result) {}, Content.dump(), "application/json"); }
Avatar
Avatar
WETBATMAN
use the overload where you specify content type in the function param
keep giving me [error] 400 Bad Request
Avatar
Avatar
Fenix
keep giving me [error] 400 Bad Request
you're doing something wrong
12:46 AM
try intercepting the request with something like Fiddler to see what's happening
Avatar
Avatar
substitute
you're doing something wrong
I have the advanced rest client and the POST for that application works perfectly
Avatar
Avatar
Fenix
I have the advanced rest client and the POST for that application works perfectly
Ok, and?
12:49 AM
you're doing something wrong in your C++ code
12:49 AM
intercept the request and look at what's being sent over the network
Avatar
c++ void PostDiscordWebhook(FString URL, nlohmann::json Content) { if (!URL.IsEmpty()) API::Requests::Get().CreatePostRequest(URL.ToString(), [](bool Sucess, std::string Result) {Log::GetLog()->error(Result.c_str()); }, Content.dump(), "application/json"); } nlohmann::json request1; request1["id","1"]; request1["product_name","Carno"]; request1["points",100]; PostDiscordWebhook(url.c_str(), request1.dump());
12:53 AM
@substitute
Avatar
I use this for sending webhooks: API::Requests::Get().CreatePostRequest(webhookUrl, [](bool, std::string) {}, webhookContent.dump(), "application/json");
12:55 AM
Are you dumping the json content twice?
Avatar
Avatar
Pelayori
Are you dumping the json content twice?
sure looks like it
12:57 AM
and he'd see that if he intercepted the request and looked at the content (edited)
kekw 1
12:57 AM
lul
Avatar
I'm not sure the json lib has an implicit ctor for strings, so I'd try passing request1 rather than the dumped content in the function call
Avatar
@Fenix
12:59 AM
I've highlighted the problematic areas
1:00 AM
void PostDiscordWebhook(const FString& URL, const nlohmann::json& Content) { if(URL.IsEmpty()) return; API::Requests::Get().CreatePostRequest(URL.ToString(), [](bool Sucess, std::string Result) { Log::GetLog()->error(Result.c_str()); }, Content.dump(), "application/json"); } nlohmann::json request1; request1["id","1"]; request1["product_name","Carno"]; request1["points",100]; PostDiscordWebhook(url.c_str(), request1);
1:00 AM
that should fix it
Avatar
Avatar
substitute
@Fenix
{"status_msg":"INVALID_REQUEST","status_overview":"failed","status_code":400}
Avatar
Avatar
Fenix
{"status_msg":"INVALID_REQUEST","status_overview":"failed","status_code":400}
Get Fiddler and grab what's actually being sent to your api
Avatar
I'm also not sure that the operator [] is overloaded with 2 args, I usually do it like json["key"] = val;
Avatar
Avatar
Pelayori
I'm also not sure that the operator [] is overloaded with 2 args, I usually do it like json["key"] = val;
holy hell lmao
1:06 AM
how didn't I see that
Avatar
hehe
Avatar
void PostDiscordWebhook(const FString& URL, const nlohmann::json& Content) { if(URL.IsEmpty()) return; API::Requests::Get().CreatePostRequest(URL.ToString(), [](bool Sucess, std::string Result) { Log::GetLog()->error(Result.c_str()); }, Content.dump(), "application/json"); } nlohmann::json request1; request1["id"] = 1; request1["product_name"] = "Carno"; request1["points"] = 100; PostDiscordWebhook(url.c_str(), request1);
Avatar
Avatar
substitute
void PostDiscordWebhook(const FString& URL, const nlohmann::json& Content) { if(URL.IsEmpty()) return; API::Requests::Get().CreatePostRequest(URL.ToString(), [](bool Sucess, std::string Result) { Log::GetLog()->error(Result.c_str()); }, Content.dump(), "application/json"); } nlohmann::json request1; request1["id"] = 1; request1["product_name"] = "Carno"; request1["points"] = 100; PostDiscordWebhook(url.c_str(), request1);
keep giving me {"status_msg":"INVALID_REQUEST","status_overview":"failed","status_code":400}
Avatar
You really tested it in 1 minute?
Avatar
3 screen
Avatar
Ok I guess
1:08 AM
Then try intercepting the request as Substitute said
1:08 AM
Further than that I don't see anything wrong
1:09 AM
That's how most devs send webhooks nowadays
Avatar
and tools like Fiddler are how most devs debug api calls
Avatar
when loading the plugins it does not load the process with the Fiddler
Avatar
Avatar
substitute
and tools like Fiddler are how most devs debug api calls
I need authorization for this 400 error
2:34 AM
I need authorization and json application that's why 400 error
Avatar
jraServerAPI 6/23/2022 2:35 AM
what webserver is it? (edited)
Avatar
Avatar
jraServerAPI
what webserver is it? (edited)
c++ void PostDiscordWebhook(const FString& URL, const nlohmann::json& Content) { if(URL.IsEmpty()) return; API::Requests::Get().CreatePostRequest(URL.ToString(), [](bool Sucess, std::string Result) { Log::GetLog()->error(Result.c_str()); }, Content.dump(), "application/json"); } nlohmann::json request1; request1["id"] = 1; request1["product_name"] = "Carno"; request1["points"] = 100; PostDiscordWebhook(url.c_str(), request1);
2:36 AM
need "application/json" and authorization
Avatar
jraServerAPI 6/23/2022 2:37 AM
the webserver you are talking to, probably needs to have json configured?
2:37 AM
just throwing out ideas
Avatar
works fine with other POST and GET but in C++ ARKAPI it doesn't
Avatar
Avatar
jraServerAPI
the webserver you are talking to, probably needs to have json configured?
with javascripts it works for me but not in c++
Avatar
I am trying to improve um teleport plugin, right now a timer is displayed and after that I just set the player position. I would like to improve two things: The timer uses SendNotification every second, it looks like the message is blinking. Is there a way to display a fixed text on screen that updates just one part of the text? Another thing that I think would be cool is to show a teleport bubble similar to when the player start boss or the genesis teleport feature. Is such thing possible with just plugins?
Avatar
Avatar
Uaca
I am trying to improve um teleport plugin, right now a timer is displayed and after that I just set the player position. I would like to improve two things: The timer uses SendNotification every second, it looks like the message is blinking. Is there a way to display a fixed text on screen that updates just one part of the text? Another thing that I think would be cool is to show a teleport bubble similar to when the player start boss or the genesis teleport feature. Is such thing possible with just plugins?
For the first you should use AShooterPlayerController::ClientServerNotificationSingle. The last parameter is a message id, if you make it the same for your every second notifications, the text will be updated rather than resent (might as well add 1.5 seconds of display time so it doesn't blink either way) About the latter I'm not sure.
4:37 PM
Example: player->ClientServerNotificationSingle( &msg, disp_color, disp_scale, disp_time, nullptr, nullptr, 6349 );
4:37 PM
Being 6349 a random id for my message that is constantly on screen (edited)
Avatar
will try, thanks!
Avatar
anyone else notice since Fjordur this hook no longer works? DECLARE_HOOK(ReportCrash, int, void*); Not sure if its just stuff I added to the plugin or if it just changed or something. (edited)
Avatar
It should work afaik, do you have any issue with it?
Avatar
It was working great until Fjordur Launched, I have not updated the plugin I use it in since before the launch, but it has failed to catch a single crash since the new map launched, before that it was about 90% successful.
Avatar
In my experience it only works with crashes that output a crashlog, if they don't have a crash log (silent crash), it will fail to do anything
Avatar
yeah, that was about the right situation it was working before. I was just wondering if any one else was experiencing the same issue. All I know is it has not caught a single crash since the update. Which was starting to make me think they changed the way it hooked or something. 🤷‍♂️
Avatar
I haven't had any reports of that feature not working, but it's fairly easy to test. I will get back to you if I get the chance to test it today
Avatar
Okay, I will also test it on my test server, just figured I would ask before I did that as im sure quite a few people use it, its an amazing hook that was saving me a lot of trouble.
Avatar
I have tried several different ways to crash the server and it for sure is not picking any of them up...
Avatar
I am going to take it I cannot use the freeware IDA to find what I am looking for?
Avatar
IDA 7.7 Free can decompile it correctly.
👍 1
Avatar
I will play with it, see if I can figure out how it operates, have never used such software before.
Avatar
WafflePlaysFps 6/25/2022 8:33 PM
so i have tried to add the API in order to add the necessary plug ins for mx-e shop ui but my game fails to boot. so i have deleted all and followed the steps as i understand them again. and still wont boot. so im here to ask for anyone that can help my dumb a*s figure this out lol
Avatar
Avatar
WafflePlaysFps
so i have tried to add the API in order to add the necessary plug ins for mx-e shop ui but my game fails to boot. so i have deleted all and followed the steps as i understand them again. and still wont boot. so im here to ask for anyone that can help my dumb a*s figure this out lol
wdym game won't load
8:36 PM
where did you install it?
Avatar
WafflePlaysFps 6/25/2022 8:37 PM
in my local files? i watched a video on the website? i'll be honest, i am completely clueslees on how to do this
Avatar
local files where
8:38 PM
in your steam folder?
Avatar
WafflePlaysFps 6/25/2022 8:38 PM
games-steamapps-common-ark-shootergame-binaries-win64
Avatar
yeah that won't work lol
8:39 PM
you need a dedicated server
Avatar
WafflePlaysFps 6/25/2022 8:39 PM
i have one rented via gportal
8:39 PM
i want to put the mod on there and therefore the plug ins but i just dont really know how
Avatar
then install them on your server and not on your client
Avatar
WafflePlaysFps 6/25/2022 8:40 PM
how do i do that?
8:40 PM
i can do the mod bit. i just dont get how to do the plug ins
Avatar
i don't know how GPortal handles plugin installation you should ask their support
8:44 PM
maybe you can upload the files manually via ftp
Avatar
WafflePlaysFps 6/25/2022 8:45 PM
would i use ftp to access the necessary files for the server to install the plugins?
8:45 PM
oh nevermind lol
Avatar
Fix APrimalDinoCharacter::SpawnFromDinoDataEx() line 7090 - static APrimalDinoCharacter* SpawnFromDinoDataEx(FARKDinoData* InDinoData, UWorld* InWorld, FVector* AtLocation, FRotator* AtRotation, bool* dupedDino, int ForTeam, bool bGenerateNewDinoID, AShooterPlayerController* TamerController, bool beginPlay) { return NativeCall<APrimalDinoCharacter*, FARKDinoData*, UWorld*, FVector*, FRotator*, bool*, int, bool, AShooterPlayerController*, bool>(nullptr, "APrimalDinoCharacter.SpawnFromDinoData", InDinoData, InWorld, AtLocation, AtRotation, dupedDino, ForTeam, bGenerateNewDinoID, TamerController, beginPlay); } + static APrimalDinoCharacter* SpawnFromDinoDataEx(FARKDinoData* InDinoData, UWorld* InWorld, FVector* AtLocation, FRotator* AtRotation, bool* dupedDino, int ForTeam, bool bGenerateNewDinoID, AShooterPlayerController* TamerController, bool beginPlay) { return NativeCall<APrimalDinoCharacter*, FARKDinoData*, UWorld*, FVector*, FRotator*, bool*, int, bool, AShooterPlayerController*, bool>(nullptr, "APrimalDinoCharacter.SpawnFromDinoDataEx", InDinoData, InWorld, AtLocation, AtRotation, dupedDino, ForTeam, bGenerateNewDinoID, TamerController, beginPlay); } in version/Core/Public/API/ARK/Actor.h (edited)
Avatar
Avatar
Fenix
Fix APrimalDinoCharacter::SpawnFromDinoDataEx() line 7090 - static APrimalDinoCharacter* SpawnFromDinoDataEx(FARKDinoData* InDinoData, UWorld* InWorld, FVector* AtLocation, FRotator* AtRotation, bool* dupedDino, int ForTeam, bool bGenerateNewDinoID, AShooterPlayerController* TamerController, bool beginPlay) { return NativeCall<APrimalDinoCharacter*, FARKDinoData*, UWorld*, FVector*, FRotator*, bool*, int, bool, AShooterPlayerController*, bool>(nullptr, "APrimalDinoCharacter.SpawnFromDinoData", InDinoData, InWorld, AtLocation, AtRotation, dupedDino, ForTeam, bGenerateNewDinoID, TamerController, beginPlay); } + static APrimalDinoCharacter* SpawnFromDinoDataEx(FARKDinoData* InDinoData, UWorld* InWorld, FVector* AtLocation, FRotator* AtRotation, bool* dupedDino, int ForTeam, bool bGenerateNewDinoID, AShooterPlayerController* TamerController, bool beginPlay) { return NativeCall<APrimalDinoCharacter*, FARKDinoData*, UWorld*, FVector*, FRotator*, bool*, int, bool, AShooterPlayerController*, bool>(nullptr, "APrimalDinoCharacter.SpawnFromDinoDataEx", InDinoData, InWorld, AtLocation, AtRotation, dupedDino, ForTeam, bGenerateNewDinoID, TamerController, beginPlay); } in version/Core/Public/API/ARK/Actor.h (edited)
I submitted a pull request with that change a couple months ago at @Pelayori's request. Never got reviewed. You can hook the function normally, just can't call it safely with the current definition in the header. There's also a SpawnFromDinoData (no Ex) that could be added.
Avatar
Avatar
TheMollusk
I submitted a pull request with that change a couple months ago at @Pelayori's request. Never got reviewed. You can hook the function normally, just can't call it safely with the current definition in the header. There's also a SpawnFromDinoData (no Ex) that could be added.
i saw him i just want to remind him
Avatar
Avatar
TheMollusk
I submitted a pull request with that change a couple months ago at @Pelayori's request. Never got reviewed. You can hook the function normally, just can't call it safely with the current definition in the header. There's also a SpawnFromDinoData (no Ex) that could be added.
I honestly forgot about the PR for a while 😅
Avatar
a 2 character change that doesn't affect the version.dll build. I'm not too concerned over it
Avatar
hotmustard8339 6/27/2022 7:03 PM
Hi all. Very new to Ark Server API and super curious: How do you get the game to load your DLL? Does itjust hotload every dll it finds in Binaries\Win64?
Avatar
Avatar
hotmustard8339
Hi all. Very new to Ark Server API and super curious: How do you get the game to load your DLL? Does itjust hotload every dll it finds in Binaries\Win64?
version.dll is a windows library
8:10 PM
The game links against it
8:10 PM
The internal linker in windows searches the directory of an executable before falling back to system path
8:11 PM
By placing this library in the same directory, windows loads this instead of the dll from system32
Avatar
Avatar
substitute
version.dll is a windows library
hotmustard8339 6/27/2022 8:17 PM
I'll be ding danged. Clever clever clever.
Avatar
Avatar
hotmustard8339
I'll be ding danged. Clever clever clever.
A simple wrapper for version.dll that supports x32 and x64 out of box. (Public Repo) - GitHub - SubstituteR/DllWrapper: A simple wrapper for version.dll that supports x32 and x64 out of box. (Publi...
8:22 PM
is basically 1:1 how the api works with proxying the windows api
8:22 PM
just adapted to support x32 and x64 instead of just x64
Avatar
hotmustard8339 6/27/2022 8:24 PM
Ha! I think i see - probably the masm is doing it somehow. Nice trick. version.dll doesn't change much with new Windows versions?
8:24 PM
or service packs or whatever
Avatar
don't think it has changed in a decade lol
Avatar
Avatar
hotmustard8339
Ha! I think i see - probably the masm is doing it somehow. Nice trick. version.dll doesn't change much with new Windows versions?
8:30 PM
an interesting article as well about the concept
Avatar
hotmustard8339 6/27/2022 8:31 PM
Tyvm. I never even knew that was a thing
Avatar
side note, RVA (and VA) stands for relative virtual address (and virtual address)
8:33 PM
addresses in userspace are all virtual
8:33 PM
RVA can be seen as basically the offset in the library from the virtual base
Avatar
Avatar
TheMollusk
a 2 character change that doesn't affect the version.dll build. I'm not too concerned over it
11:07 AM
Also that's the new ark api repo.
Avatar
I would like to tap into the tek forcefield and remove the need to use elements and force turn on/off and range, is that something that is possible with plugins? Can I have some general directions on how to do it?
Avatar
Avatar
Uaca
I would like to tap into the tek forcefield and remove the need to use elements and force turn on/off and range, is that something that is possible with plugins? Can I have some general directions on how to do it?
Force turn on/off is just the APrimalStructureItemContainer::SetContainerActive function For removing the need of elements you could do something like add 1 element when the structure is placed, force turn on and set the fuel burn rate of the structure to very high values (practically making it infinite lasting) For the range, there is a formula. I decoded it from the devkit and it can be found in the safe zones plugin source code, on the bubble spawn function
Avatar
The burn rate, can you give general directions on how to do it?
Avatar
I think it's a hook
Avatar
will try to find, ty!
Avatar
Avatar
Uaca
will try to find, ty!
APrimalStructureItemContainer::BPGetFuelConsumptionMultiplier
10:02 PM
that is, hook that function, and if _this is a forcefield return a very low value (since that function takes a multiplier) Example: 0.00000000001 or something.
10:03 PM
Also might have to set bUseBPGetFuelConsumptionMultiplier to true on the forcefields
Avatar
will try, thank you
Avatar
Avatar
Pelayori
that is, hook that function, and if _this is a forcefield return a very low value (since that function takes a multiplier) Example: 0.00000000001 or something.
Why not 0
Avatar
Oh yeah lol
Avatar
x - a*b where b is 0 is just x - a0 = x
10:15 PM
😛
Avatar
Yeah but you never know if wildcard decided to do a division or whatever they sometimes do 😛
Avatar
You’ll also want to block people from removing the element too
Avatar
But yeah, 0 is probs the wanted value
Avatar
Avatar
Pelayori
Yeah but you never know if wildcard decided to do a division or whatever they sometimes do 😛
x/0.0000001 >>>> big value
10:16 PM
So that could be dangerous too
Avatar
If you add and turn on on the same func it shouldn't give time to remove it from inv
Avatar
Avatar
substitute
x/0.0000001 >>>> big value
I know basic math, even though it doesn't seem like it 😛
Avatar
Avatar
Pelayori
I know basic math, even though it doesn't seem like it 😛
10:18 PM
This works, just freaks out intellisense. In the real version printName would be the callback itself (static function on the type) and the reset call would be internal and would use the pdb and the string in the type definition to find the address
10:18 PM
For doing plugins that don’t need to install their own hooks
10:18 PM
And can have pre and post call handling
10:18 PM
I’m hiding the implementation on purpose here 😉
Avatar
©️
Avatar
Avatar
Pelayori
Yep: DECLARE_HOOK(AMissionType_BPOnMissionComplete, void, AMissionType*, AShooterCharacter*, AShooterPlayerController*, bool, float, TArray<UPrimalItem*>*); void Hook_AMissionType_BPOnMissionComplete(AMissionType* _this, AShooterCharacter* ForPlayer, AShooterPlayerController* ForController, bool bLastPhaseSuccess, float XPRewarded, TArray<UPrimalItem*>* ItemsRewarded) { AMissionType_BPOnMissionComplete_original(_this, ForPlayer, ForController, bLastPhaseSuccess, XPRewarded, ItemsRewarded); }
So im using this hook, Been working on and off on this project for a few weeks, but I cannot for the life of me get it to give me anything when the missions end, this is how I have it in the plugin (Top with other Hooks) DECLARE_HOOK(AMissionType_BPOnMissionComplete, void, AMissionType*, AShooterCharacter*, AShooterPlayerController*, bool, float, TArray<UPrimalItem*>*); void Hook_AMissionType_BPOnMissionComplete(AMissionType* _this, AShooterCharacter* ForPlayer, AShooterPlayerController* ForController, bool bLastPhaseSuccess, float XPRewarded, TArray<UPrimalItem*>* ItemsRewarded) { Log::GetLog()->info("Mission Complete"); if (bLastPhaseSuccess) { FString Mission_Complete = _this->MissionDisplayNameField(); Log::GetLog()->info(Mission_Complete.ToString()); } AMissionType_BPOnMissionComplete_original(_this, ForPlayer, ForController, bLastPhaseSuccess, XPRewarded, ItemsRewarded); } (Load with other hooks) ArkApi::GetHooks().SetHook("AMissionType_BPOnMissionComplete", &Hook_AMissionType_BPOnMissionComplete, &AMissionType_BPOnMissionComplete_original); (Unload with other hooks) ArkApi::GetHooks().DisableHook("AMissionType_BPOnMissionComplete", &Hook_AMissionType_BPOnMissionComplete); Just seeing If I am missing something, or on the right track? I have not tried it on Gen1 as of yet. (edited)
Avatar
what library to force command via rcon (Node.js)
Avatar
Avatar
Xeakial
So im using this hook, Been working on and off on this project for a few weeks, but I cannot for the life of me get it to give me anything when the missions end, this is how I have it in the plugin (Top with other Hooks) DECLARE_HOOK(AMissionType_BPOnMissionComplete, void, AMissionType*, AShooterCharacter*, AShooterPlayerController*, bool, float, TArray<UPrimalItem*>*); void Hook_AMissionType_BPOnMissionComplete(AMissionType* _this, AShooterCharacter* ForPlayer, AShooterPlayerController* ForController, bool bLastPhaseSuccess, float XPRewarded, TArray<UPrimalItem*>* ItemsRewarded) { Log::GetLog()->info("Mission Complete"); if (bLastPhaseSuccess) { FString Mission_Complete = _this->MissionDisplayNameField(); Log::GetLog()->info(Mission_Complete.ToString()); } AMissionType_BPOnMissionComplete_original(_this, ForPlayer, ForController, bLastPhaseSuccess, XPRewarded, ItemsRewarded); } (Load with other hooks) ArkApi::GetHooks().SetHook("AMissionType_BPOnMissionComplete", &Hook_AMissionType_BPOnMissionComplete, &AMissionType_BPOnMissionComplete_original); (Unload with other hooks) ArkApi::GetHooks().DisableHook("AMissionType_BPOnMissionComplete", &Hook_AMissionType_BPOnMissionComplete); Just seeing If I am missing something, or on the right track? I have not tried it on Gen1 as of yet. (edited)
Your function name on the set/remove hooks are not correct.
1:37 PM
AMissionType.BPOnMissionComplete, replace _ with .
👍 1
Avatar
i am trying to figure out how many free slots the player has and right now I am doing: pc->GetPlayerInventoryComponent()->GetCurrentNumInventoryItems() - 299
7:44 PM
but GetCurrentNumInventoryItems also counts engrans the player has
7:46 PM
is there any other way to get the free slots of the player inventory besides looping each item and ignore bIsEngram ?
Avatar
Let me check what that function does in ida, because if it's looping you would do the same 😛
7:47 PM
__int64 __fastcall UPrimalInventoryComponent::GetCurrentNumInventoryItems(UPrimalInventoryComponent *this) { return (unsigned int)(this->InventoryItems.ArrayNum - this->DefaultInventoryItems.ArrayNum); } (edited)
7:47 PM
That might not be exact for players
7:48 PM
As players' inventory has only note and pick as default inv items
Avatar
to get the players items I usually do items = inventory->InventoryItemsField(); and do a loop ignoring item->bIsEngram()() and item->bIsInitialItem()()
7:51 PM
I find very odd that engrams are returned on InventoryItemsField
Avatar
They are items itselves
7:52 PM
They are just treated different
7:53 PM
Try this: int GetInvCount(AShooterPlayerController* pc) { AShooterPlayerState* sps = pc->GetShooterPlayerState(); return pc->GetPlayerInventoryComponent()->GetCurrentNumInventoryItems() + sps->EngramItemBlueprintsField().Num(); }
7:54 PM
About the actual slot count, I think it might be located in UPrimalInventoryComponent::AbsoluteMaxInventoryItems (only on players, though)
Avatar
I see, that looks like a nice solution, will try!
Avatar
I'm not so sure that EngramItemBlueprintsField is the learned engrams, but after looking some ida code seems reasonable that is the field
Avatar
wait, can you go pass the limit ?
Avatar
Inventory's max slots are in MaxInventoryItemsField, however there are a few more extra slots that are defined in AbsoluteMaxInventoryItems. These extra slots that the player can't use are for things like spoling meat, etc. So the inventory can store them but players can't add more items until the count is below the normal max inv items
Avatar
man, I played this game for 7 years and did not knew that
Avatar
You can see that if you leave a full inventory say a smithy full of raw meat, and let them spoil one time, you will have overcap of slots, something like 101/100 and such
Avatar
the containers I know you can go pass the limit, but the players inventory I never took notice of it
8:00 PM
and from what I can remember you could put 430 slots
Avatar
Player inventory is different, I believe it only uses the absolute count, ignoring the normal max
Avatar
now is it only 300
Avatar
Avatar
Pelayori
About the actual slot count, I think it might be located in UPrimalInventoryComponent::AbsoluteMaxInventoryItems (only on players, though)
this does not work, somehow I end with -462, will go with the loop. Ty!
👍 1
Avatar
Is there any info somewhere on how to get started with Permissions plugin? When I try to use Permissions:: from my plugin, the namespace is not found. (edited)
Avatar
You haven't imported the header properly then
Avatar
Yes haha
2:04 PM
That's specifically what I'm asking for 😄
2:04 PM
I need the basic documentation like header location etc please
2:06 PM
https://ark-server-api.com/forums/resources/ark-permissions.20/ More information about the plugin: https://wiki.arkserverapi.com/index.php?title=Permissions Link is dead :/ (edited)
2:07 PM
That's one of the problem of migrating to new website, all wiki links are dead.
2:13 PM
Okay I think I found sources on your repository @Pelayori: https://github.com/Pelayori/Ark-Server-Plugins/tree/master/Permissions But that's a very shady way of getting it, it would be better to restore the wiki link or add the documentation on plugin page here: https://ark-server-api.com/forums/resources/ark-permissions.20/
Server Plugins for ARK: Server API. Contribute to Pelayori/Ark-Server-Plugins development by creating an account on GitHub.
https://discord.gg/hDP7ghz Permissions Original Author: @Michidu Maintainer: @Lethal @Pelayori @Foppa @WETBATMAN Default plugin for ArkApi that allows you to manage group permissions. It's mostly used by other plugins and controls which...
Avatar
There is no documentation for it on your Github as well. Or maybe I missed it?
2:29 PM
But at least I can get started with the sources now ^^
Avatar
Wiki was dead long before the site was migrated. Looking at example code is shady? I'm so confused.
Avatar
I think I missed the example code 🤔
3:16 PM
And I didn't know the wiki was already dead.
3:17 PM
Can you give me the link to the example Lethal? Thank you
Avatar
Nvm I just found out that the plugin Max-Imprint shared in #Plugins channel is using Permissions plugin so I will use that as example (https://github.com/barnwellrd/Max-Imprint/blob/master/MaxImprint/MaxImprint.h). (edited)
Avatar
Any idea why the call to Permissions::GetGroupMembers("Admins"); freeze my server? I call it from AFC_LoadPermissionsArrays() function that is called every 30 seconds like seen in Max-Imprint plugin: API::Timer::Get().RecurringExecute(&AFC_LoadPermissionsArrays, 30, -1, true); // Continuously updates the admins and allowed players arrays.
Avatar
Why not look at something like ArkShop that is updated and was built using the current permissions.
7:18 PM
Copying old code you have no idea why it was done that way is not a good approach
Avatar
Ok I will have a look there as well, thank you 👍
Avatar
Yep, definitely works way better without the cached array initialisation and recurring refresh. Using Permissions::IsPlayerInGroup( instead of Permissions::GetGroupMembers(. Thanks again ^^
Avatar
Dodo Enthusiast 7/4/2022 7:44 PM
Hey, I'm trying to get a MysqlConnection going. I used the files from Michudu ark shop and included the Libs Folder in my Project and the includes Folder. No Matter what I try i get 100+ errors. Maybe someone has an idea or can point me to the most simple way to get startet with mysql in plugins. I feel like its kinda hard to extract it from a whole project. (edited)
7:44 PM
Avatar
help me please I'm giving a permission and it's not granting access anyway could someone explain it better permissions.grant Vip DinoColorCommand
Avatar
Avatar
Dodo Enthusiast
Hey, I'm trying to get a MysqlConnection going. I used the files from Michudu ark shop and included the Libs Folder in my Project and the includes Folder. No Matter what I try i get 100+ errors. Maybe someone has an idea or can point me to the most simple way to get startet with mysql in plugins. I feel like its kinda hard to extract it from a whole project. (edited)
What have you done to include the mysql?
Avatar
Avatar
Pelayori
What have you done to include the mysql?
Dodo Enthusiast 7/5/2022 12:40 PM
1. downloaded arkshop source from michidu 2. installed the mysqlc++ connector 3. arkshop includes as additional includes 4. arkshop Lib as additonal library (the lib folder where the mysqlclient.lib is inside) 5. as a first step I only included the mysql++11.h and the mysqlclient.lib and try to compile it and the errors already start (edited)
Avatar
Are you using the C++17 standard?
Avatar
Dodo Enthusiast 7/5/2022 12:46 PM
yes
12:47 PM
I added the things above to a small plugin that already worked correctly ingame.
Avatar
Could we see your includes and the libs?
Avatar
Dodo Enthusiast 7/5/2022 12:54 PM
12:55 PM
Avatar
Did you link both arkshop and mysqlclient libs in your code?
Avatar
Dodo Enthusiast 7/5/2022 12:59 PM
only mysqlclient
1:01 PM
1:01 PM
the only two lines I added
Avatar
Did you include Windows or winsock in any of your source files?
Avatar
Dodo Enthusiast 7/5/2022 1:05 PM
No its only a super small one file plugin so far.
1:05 PM
1:06 PM
Thats all I include
Avatar
Dodo Enthusiast 7/5/2022 2:10 PM
I figured the Problem out. It helped me that it seemed I wasn't totally on the wrong track. Seems like the mysql include has to be at the top of the includes. (edited)
Avatar
Dodo Enthusiast 7/5/2022 3:09 PM
Now I get the Error 126 when loading the plugin. The c++ redistributables are installed and Other Plugins like Permissions get loaded without Problem. Is there anything besides the things I posted above that I need to do? If I just remove the Part that tries to connect to the Database the Plugin does load without Problems. (edited)
Avatar
Avatar
Dodo Enthusiast
Now I get the Error 126 when loading the plugin. The c++ redistributables are installed and Other Plugins like Permissions get loaded without Problem. Is there anything besides the things I posted above that I need to do? If I just remove the Part that tries to connect to the Database the Plugin does load without Problems. (edited)
substitute 7/5/2022 5:33 PM
Did you include the sql dll?
5:33 PM
What does your main method look like in your plugin?
5:33 PM
DLLAttach needs to spawn a thread for doing basically anything
Avatar
Avatar
substitute
Did you include the sql dll?
Dodo Enthusiast 7/5/2022 5:40 PM
I dont really know who you mean so I guess not^^. Where can I find that and where do I include it? I atm only include the mysqlclient.lib and mysql++11.h and have both the respective folders added to my project under add. libs/ add. includes (edited)
5:45 PM
My Load() function under DLL_ATTACH does just register a command which I use for testing atm and triggers my "main logic" if that makes sense.
Avatar
Avatar
Dodo Enthusiast
I dont really know who you mean so I guess not^^. Where can I find that and where do I include it? I atm only include the mysqlclient.lib and mysql++11.h and have both the respective folders added to my project under add. libs/ add. includes (edited)
substitute 7/5/2022 6:03 PM
do you see something like mysqlclient.dll or similar?
6:03 PM
you probably need to put that with your plugin
Avatar
Dodo Enthusiast 7/5/2022 6:08 PM
I use the files from https://github.com/Michidu/Ark-Server-Plugins/tree/master/ArkShop Libs and Includes folder. I cant find a dll in there. (edited)
Server Plugins for ARK: Server API. Contribute to Michidu/Ark-Server-Plugins development by creating an account on GitHub.
Avatar
I usually have the include and the pragma comment like this: #include "mysql+++.h" #pragma comment(lib, "mysqlclient.lib") (mysql+++.h is a newer version, but shouldn't matter.)
Avatar
Avatar
Pelayori
I usually have the include and the pragma comment like this: #include "mysql+++.h" #pragma comment(lib, "mysqlclient.lib") (mysql+++.h is a newer version, but shouldn't matter.)
Dodo Enthusiast 7/5/2022 6:18 PM
Is there anything else you do besides adding the respective folders to the additional includes and additional libraries?
Avatar
No, I don't think so
6:19 PM
It's hard to debug at this point without more info about the plugin solution.
Avatar
Dodo Enthusiast 7/5/2022 6:21 PM
I can maybe stream it some time if someone got a little bit of time. I would just say that i didnt do anything crazy. The small plugin works if i just remove the 1 line of mysql connection
Avatar
I am available for DMs, but not streaming.
Avatar
Avatar
Pelayori
I am available for DMs, but not streaming.
Dodo Enthusiast 7/5/2022 6:24 PM
So its ok if I write you a PM now for further problem solving?
Avatar
Sure, anyone can PM me whenever (edited)
Avatar
Avatar
Dodo Enthusiast
Now I get the Error 126 when loading the plugin. The c++ redistributables are installed and Other Plugins like Permissions get loaded without Problem. Is there anything besides the things I posted above that I need to do? If I just remove the Part that tries to connect to the Database the Plugin does load without Problems. (edited)
RIO (Александр) 7/7/2022 8:11 PM
hello. I have exactly the same error. tell me pls, did you manage to solve it?
Avatar
Avatar
RIO (Александр)
hello. I have exactly the same error. tell me pls, did you manage to solve it?
Dodo Enthusiast 7/7/2022 9:09 PM
Hi. Yes, I used https://docs.microsoft.com/en-us/sysinternals/downloads/procmon to see which files it was unable to load and for me it was libcrypto-1_1-x64.dll and libssl-1_1-x64.dll. I copied them in the Servers ShooterGame\Binaries\Win64 Folder and its loading the plugin now. Maybe it was missing because I use xampp and not the windows mysql server. But there is probably a better explanation / solution.
Monitor file system, Registry, process, thread and DLL activity in real-time.
Avatar
Ensure to always put other plugins your plugin is depending on as delayed dll's
11:56 PM
Avatar
TheMollusk 7/8/2022 3:54 AM
ArkServerAPI's PluginManager reads plugin "Dependencies" from each plugin's PluginInfo.json, but it doesn't do a lot with that info. Could be nice to do something like build a dependency graph and adjust load order.
Avatar
Avatar
Dodo Enthusiast
Hi. Yes, I used https://docs.microsoft.com/en-us/sysinternals/downloads/procmon to see which files it was unable to load and for me it was libcrypto-1_1-x64.dll and libssl-1_1-x64.dll. I copied them in the Servers ShooterGame\Binaries\Win64 Folder and its loading the plugin now. Maybe it was missing because I use xampp and not the windows mysql server. But there is probably a better explanation / solution.
RIO (Александр) 7/8/2022 5:12 PM
Thanks. It helped me a lot
Avatar
I am getting Error code: 126 after adding ArkShop as a dependency to my plugin, I understand that this is a missing dependency, but how do you make a dependency optional?
Avatar
Avatar
Uaca
I am getting Error code: 126 after adding ArkShop as a dependency to my plugin, I understand that this is a missing dependency, but how do you make a dependency optional?
Has you added: if (ArkApi::Tools::IsPluginLoaded("ArkShop")) {}
Avatar
Yes, and also have the #pragma comment(lib, "ArkApi.lib") on my cpp file. When i have the ArkShop plugin loaded is working as expected, but i would like to make the arkshop plugin optional
Avatar
Avatar
Uaca
Yes, and also have the #pragma comment(lib, "ArkApi.lib") on my cpp file. When i have the ArkShop plugin loaded is working as expected, but i would like to make the arkshop plugin optional
then you have to invoke ArkShop functions using GetProcAddress
2:34 PM
and run IsPluginLoaded before invoking such functions
2:34 PM
then you can remove ArkShop as a dependency
2:37 PM
Retrieves the address of an exported function or variable from the specified dynamic-link library (DLL).
2:38 PM
you pass a module handle to it, which in this case will be a handle to ArkShop.dll (if loaded)
2:38 PM
and you pass the function name you want to call as the second param
2:38 PM
it will return the function address
2:38 PM
then you can call the function
2:38 PM
this way you don't have to hard link with ArkShop
Avatar
I see, that might be a bit hard to do it. Will try. Thanks!
3:00 PM
i dont supose there is some of this on the Michidu plugins? (edited)
Avatar
i cant get it to work
4:36 PM
using T = bool(*) (int, uint64); HMODULE hmodule = GetModuleHandle(TEXT("ArkShop.dll")); if (!hmodule) return false; T addr = (T)GetProcAddress(hmodule, "SpendPoints"); if (!addr) Log::GetLog()->error("SpendPoints not found");
4:37 PM
what I am missing?
Avatar
jraServerAPI 7/14/2022 5:45 PM
In my plugins I do this by just testing if the plugin is loaded and setting a bool MyPlugin::UseArkShop = true; if (!ArkApi::Tools::IsPluginLoaded("ArkShop")) { MyPlugin::UseArkShop = false; } And it works fine for me
5:46 PM
if ((iPrice > 0) && MyPlugin::UseArkShop) { if (ArkShop::Points::GetPoints(steam_id) >= (iPrice)) { .... etc...
Avatar
Avatar
Uaca
i cant get it to work
That might be due to C++ name mangling, as the shop exported functions do not have extern "C" in their def/decl. I'd work out why it isn't working. Is your plugin name loading before arkshop is, or do you have any other dependency?
Avatar
The mangled function name is: ?SpendPoints@Points@ArkShop@@YA_NH_K@Z
Avatar
Avatar
jraServerAPI
In my plugins I do this by just testing if the plugin is loaded and setting a bool MyPlugin::UseArkShop = true; if (!ArkApi::Tools::IsPluginLoaded("ArkShop")) { MyPlugin::UseArkShop = false; } And it works fine for me
that is odd, when I try to load my plugin with arkshop dependency it gives me error 106
Avatar
Avatar
Pelayori
That might be due to C++ name mangling, as the shop exported functions do not have extern "C" in their def/decl. I'd work out why it isn't working. Is your plugin name loading before arkshop is, or do you have any other dependency?
ArkShop is loading before my plugin and there is a dependency to Permissions
Avatar
Do you have both plugins in delay load in your plugin? (edited)
Avatar
Avatar
Pelayori
Do you have both plugins in delay load in your plugin? (edited)
yes
Avatar
Avatar
Pelayori
The mangled function name is: ?SpendPoints@Points@ArkShop@@YA_NH_K@Z
Try using this name then, instead of just SpendPoints
Avatar
Avatar
Pelayori
Try using this name then, instead of just SpendPoints
this one the addr is not null
6:10 PM
will try to call and see if it works
6:10 PM
how do I get the real name of the function?
Avatar
There's a program called Dependency Walker, it's old but easy to use
Avatar
I see, will try to find it
6:12 PM
but that looks odd, I mean, if the name is ?SpendPoints@Points@ArkShop@@YA_NH_K@Z, can it change between versions?
Avatar
Avatar
Uaca
but that looks odd, I mean, if the name is ?SpendPoints@Points@ArkShop@@YA_NH_K@Z, can it change between versions?
It will only change if that function is ever changed again (when a new .lib needs to be used) (edited)
6:18 PM
Those are all the names of arkshop functions, notice how Plugin_Unload isn't mangled since it uses the extern "C" construction
Avatar
yeah, it makes sense
6:19 PM
it worked, I was able to call the SpendPoints
6:19 PM
many thanks!
Avatar
Avatar
Pelayori
That might be due to C++ name mangling, as the shop exported functions do not have extern "C" in their def/decl. I'd work out why it isn't working. Is your plugin name loading before arkshop is, or do you have any other dependency?
I disagree
11:39 PM
C++ name mangling shouldn't destroy exported functions
Avatar
It doesn't destroy them, but if you need to find them you have to use the full name
Avatar
anything that is mangled....you shouldn't use the mangled name bign_kirby_pengu_lol
Avatar
My knowledge on those fields is limited peepoChat
Avatar
if it is exported, then you need to link against the library properly
11:40 PM
set it as a delay loaded DLL
Avatar
I agree, but I'm not even sure why would give error 126 for him
Avatar
ArkApi::Tools::IsPluginLoaded("ArkShop") + delay loading is all you need
👍 1
11:42 PM
if they are getting error 126 then they are probably doing something in DLLMain that isn't entirely supported
Avatar
If you can read above and check if we missed something would be great
Avatar
if I had to guess, they didn't set it to delay loaded dll properly?
Avatar
@Uaca could you verify this?
Avatar
Avatar
substitute
if I had to guess, they didn't set it to delay loaded dll properly?
he wants to make it a non dependency
12:08 AM
as in, if ArkShop is not present the plugin won't use it's features
Avatar
Avatar
Pelayori
@Uaca could you verify this?
1:33 AM
like this?
1:34 AM
It works only if ArkShop is loaded, when I remove the ArkShop plugin it starts with error 106
1:36 AM
The DLL main is a copy from others plugins: BOOL APIENTRY DllMain(HMODULE /*hModule*/, DWORD ul_reason_for_call, LPVOID /*lpReserved*/) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: Load(); break; case DLL_PROCESS_DETACH: Unload(); break; } return TRUE; }
Avatar
Avatar
Uaca
It works only if ArkShop is loaded, when I remove the ArkShop plugin it starts with error 106
Error 106 isn't dependency issue I think?
Avatar
sorry, i meant "Error code: 126"
Avatar
Avatar
WETBATMAN
he wants to make it a non dependency
Yes, use delay loaded dll
3:11 PM
That’s the entire point of that feature
Avatar
Avatar
Uaca
The DLL main is a copy from others plugins: BOOL APIENTRY DllMain(HMODULE /*hModule*/, DWORD ul_reason_for_call, LPVOID /*lpReserved*/) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: Load(); break; case DLL_PROCESS_DETACH: Unload(); break; } return TRUE; }
What is your load function
Avatar
Avatar
substitute
What is your load function
void Load() { Log::Get().Init("uStuck"); try { ReadConfig(); } catch (const std::exception& error) { Log::GetLog()->error(error.what()); throw; } try { ArkApi::GetHooks().SetHook("AGameMode.InitGame", &Hook_AGameMode_InitGame, &AGameMode_InitGame_original); ArkApi::GetHooks().SetHook("APrimalCharacter.TakeDamage", &Hook_APrimalCharacter_TakeDamage, &APrimalCharacter_TakeDamage_original); auto& commands = ArkApi::GetCommands(); commands.AddChatCommand(uStuck::GetCmd("teleport"), &uStuckCmd); commands.AddChatCommand(uStuck::GetCmd("location"), &PrintLocation); } catch (const std::exception& error) { Log::GetLog()->error(error.what()); throw; } }
8:52 PM
07/15/22 15:34 [API][warning] (API::PluginManager::LoadAllPlugins) Failed to load plugin - uStuck Error code: 126 this is the error I get when ArkShop is not loaded
Avatar
Does anyone have experience running a windows10/xbox crossplay dedicated server? Is it possible to run a custom binary on a Nitrado server? (edited)
Avatar
Avatar
Uaca
void Load() { Log::Get().Init("uStuck"); try { ReadConfig(); } catch (const std::exception& error) { Log::GetLog()->error(error.what()); throw; } try { ArkApi::GetHooks().SetHook("AGameMode.InitGame", &Hook_AGameMode_InitGame, &AGameMode_InitGame_original); ArkApi::GetHooks().SetHook("APrimalCharacter.TakeDamage", &Hook_APrimalCharacter_TakeDamage, &APrimalCharacter_TakeDamage_original); auto& commands = ArkApi::GetCommands(); commands.AddChatCommand(uStuck::GetCmd("teleport"), &uStuckCmd); commands.AddChatCommand(uStuck::GetCmd("location"), &PrintLocation); } catch (const std::exception& error) { Log::GetLog()->error(error.what()); throw; } }
I recommend first moving your load into a separate thread from DLLMain
12:47 AM
If DLLMain has any exception your DLL is unloaded
12:47 AM
Some functions are also not available in that thread
12:48 AM
What does read config look like?
Avatar
Avatar
substitute
What does read config look like?
void ReadConfig() { const std::string config_path = ArkApi::Tools::GetCurrentDir() + "/ArkApi/Plugins/uStuck/config.json"; std::ifstream file{ config_path }; if (!file.is_open()) { throw std::runtime_error("Can't open config.json"); } file >> uStuck::config; file.close(); }
3:45 AM
do you recommend moving to a a thread even when it is file load to json?
Avatar
Avatar
Uaca
do you recommend moving to a a thread even when it is file load to json?
Yes
3:51 AM
I usually do nothing in DLLMain
3:51 AM
An optional entry point into a dynamic-link library (DLL). When the system starts or terminates a process or thread, it calls the entry-point function for each loaded DLL using the first thread of the process.
3:51 AM
See the big warning section
3:53 AM
Creating a thread isn’t inherently safe either
3:54 AM
A better solution in the future would to have plugins export a load and unload function
3:54 AM
So that the api can call that after loading the library
3:54 AM
But that’s life
3:56 AM
How are you checking for permissions?
Avatar
Avatar
substitute
A better solution in the future would to have plugins export a load and unload function
This can be done now by exporting Plugin_Init(), right? I haven't actually tried it but I was looking at the plugin manager the other day and noticed that LoadPlugin() tries to call that function if found after loading the library. (edited)
1:57 PM
and Plugin_Unload()
Avatar
Avatar
TheMollusk
This can be done now by exporting Plugin_Init(), right? I haven't actually tried it but I was looking at the plugin manager the other day and noticed that LoadPlugin() tries to call that function if found after loading the library. (edited)
Oh, then perfect
6:06 PM
Just use those two functions instead of DLLMain
Avatar
Is there any guide on how to use/search when using IDA? im trying to find a hook for when/before a gen 2 mission starts.
Avatar
on host havoc how do i change exp multiplyer and such
Avatar
Avatar
Dodo
on host havoc how do i change exp multiplyer and such
Dude, this isn’t the discord for that
Avatar
Deleted User 7/29/2022 2:09 AM
So i have no idea where to start with making a ASI plugin. Is there a quick start guide somewhere that im not seeing so far?
2:10 AM
Nvm had to verify with the bot and now I see the channel. Sorry!
Avatar
Avatar
Deleted User
So i have no idea where to start with making a ASI plugin. Is there a quick start guide somewhere that im not seeing so far?
Contribute to SubstituteR/ArkServerAPI-Template development by creating an account on GitHub.
👍 2
2:38 AM
Here's an updated template
Avatar
Avatar
substitute
Here's an updated template
Deleted User 7/29/2022 2:56 AM
I appreciate it, thnx
Avatar
Looking for a way to determine if APrimalDinoCharacter* is attacking a player, have tried using Dino->IsAttacking() and Dino->TargetingTeamField() < 50000 but both seem to return as if the dino is not attacking.
Avatar
Avatar
Xeakial
Looking for a way to determine if APrimalDinoCharacter* is attacking a player, have tried using Dino->IsAttacking() and Dino->TargetingTeamField() < 50000 but both seem to return as if the dino is not attacking.
Might be worth getting its ai controller and checking if target Field is nullptr
Avatar
hello everybody I want to create a plugin ,Some dino were not allowed to be cloned, I tried a lot of hook, such as:GetDinoData BPOverrideAllowStructureAccess ,But none of them worked, i found StartCloneDino, But I don't know how to hook him, I hope to get yours help, Thanks🙂
Avatar
Avatar
Pelayori
Might be worth getting its ai controller and checking if target Field is nullptr
okay, I get where your going, if its not null they must be targeted on something. I will give that a shot, thank you.
Avatar
Avatar
Pelayori
Might be worth getting its ai controller and checking if target Field is nullptr
Well getting the ai controller did not work, but just using your suggestion with APrimalDinoCharacter* and checking if (Dino->TargetField() != nullptr) does work. I did not even think to check and see if target is nothing, so thank you again for the help
Avatar
Avatar
Xeakial
Well getting the ai controller did not work, but just using your suggestion with APrimalDinoCharacter* and checking if (Dino->TargetField() != nullptr) does work. I did not even think to check and see if target is nothing, so thank you again for the help
Np (edited)
Avatar
Any luck on getting a hook for before a genesis mission starts so I can stop it from starting? or would I have to use a mod for this on the client side? And has anyone else noticed that ArkApi::GetApiUtils().GetShooterGameMode()->EggHatchSpeedMultiplierField() does not seem to work? If I pull the information from the server it says it changes, but in game eggs do not hatch any faster no matter what I set it to. (edited)
Avatar
Avatar
Xeakial
Any luck on getting a hook for before a genesis mission starts so I can stop it from starting? or would I have to use a mod for this on the client side? And has anyone else noticed that ArkApi::GetApiUtils().GetShooterGameMode()->EggHatchSpeedMultiplierField() does not seem to work? If I pull the information from the server it says it changes, but in game eggs do not hatch any faster no matter what I set it to. (edited)
Any server setting on the game mode is present on the shooter game state which is the responsible of actually applying the settings to the game, and replicate them to players
Avatar
hi there. I want to check the saddle build. We will block a specific 'Structure'. I used this way. I do the APrimalStructure_IsAllowedToBuild Hook. I want to check the saddle build using the value in FPlacementData. However, they all return null . How do I get the value 'FPlacementData* OutPlacementData'? Is there a way?
8:57 AM
#pragma once #include "init.h" struct FPlacementData { FVector AdjustedLocation; FRotator AdjustedRotation; bool bSnapped; bool bDisableEncroachmentCheck; int MySnapToIndex; int TheirSnapToIndex; AActor* FloorHitActor; APrimalStructure* ParentStructure; APrimalStructure* ForcePlacedOnFloorParentStructure; APrimalStructure* ReplacesStructure; APawn* AttachToPawn; FName AttachToBone; APrimalDinoCharacter* DinoCharacter; }; int Hook_APrimalStructure_IsAllowedToBuild(APrimalStructure* _this, APlayerController* PC, FVector AtLocation, FRotator AtRotation, FPlacementData* OutPlacementData, bool bDontAdjustForMaxRange, FRotator PlayerViewRotation, bool bFinalPlacement) { if (bFinalPlacement && PC != nullptr && PC->IsA(AShooterPlayerController::GetPrivateStaticClass())) { if (!OutPlacementData->DinoCharacter) { Log::GetLog()->info("1 is null"); } if (!OutPlacementData->ParentStructure) { Log::GetLog()->info("2 is null"); } if (!OutPlacementData->ForcePlacedOnFloorParentStructure) { Log::GetLog()->info("3 is null"); } } return APrimalStructure_IsAllowedToBuild_original(_this, PC, AtLocation, AtRotation, OutPlacementData, bDontAdjustForMaxRange, PlayerViewRotation, bFinalPlacement); } (edited)
Avatar
is there a way to get steamid or uid from UPrimalInventoryComponent? ArkApi::GetApiUtils().GetPlayerID(inventoryComponent->GetOwner()); ArkApi::IApiUtils::GetSteamIdFromController(inventoryComponent->GetOwner()); both return 0 when the player is offline (edited)
Avatar
Cause most likely the Owner is nullptr at this moment
Avatar
Avatar
Uaca
is there a way to get steamid or uid from UPrimalInventoryComponent? ArkApi::GetApiUtils().GetPlayerID(inventoryComponent->GetOwner()); ArkApi::IApiUtils::GetSteamIdFromController(inventoryComponent->GetOwner()); both return 0 when the player is offline (edited)
you could try this: inventoryComponent->GetOwner()->TargetingTeamField() then try loop characters in the world and get the player id that way maybe
Avatar
nah, might be a very bad idea lol
Avatar
Avatar
Foppa
Cause most likely the Owner is nullptr at this moment
🐨Dream Doctor🦘 8/15/2022 12:11 PM
It's an issue we've discussed at length in the past, but a solution hasn't been forthcoming as yet.
Avatar
Well first to get a steamid or playerid there is demands. But first you want to look at the inventory component if it's owned by a AShooterPlayerController
12:13 PM
i see why this is a tricky nut to crack tbh (edited)
Avatar
🐨Dream Doctor🦘 8/15/2022 12:14 PM
Accessing certain information when players are offiline is a very common issue people run up against. My suggestion in the past was that the API itself cache that information and make it available even when they are offline, as it does for some other things, but that seemed to be a contentious idea. lol
Avatar
It's better to make a plugin handle that part tbh
12:15 PM
and make an API for plugin to request against
12:15 PM
I might do that with my player activity and make the plugin for free
12:16 PM
as that plugin is already storing like everything by a player
Avatar
🐨Dream Doctor🦘 8/15/2022 12:17 PM
What I said previously was that any kind of functionality that involves basic aspects of UE and that is done over and over again by many plugins should be considered for inclusion in the API. I don't understand why it wouldn't be. (edited)
Avatar
Sorry to interrupt, As soon as the api becomes more complex, it will start to become endlessly complex. And caching is a feature that some plugins don't need. This makes the api a bit heavy. I think that the api should only provide the api, but not extend the function.
Avatar
My goal was to prevent items from transferring and equipping, it would be better to catch when it is happing, but looks like also fire for each player when the map starts and I can use that. But makes no sense to be that hard to find out to who the body belongs, the game has to do that when the player connects.
Avatar
If so, there is a solution. Hook_AShooterGameMode_HandleNewPlayer Use this hook. Called when the user has access to the character (online, character creation, etc.).
Avatar
Hey everyone, I am still having a issue with changing this setting bellow. I have tried several different ways and actively use GetShooterGameMode to change about 10-12 game settings on the fly, but for some reason EggHatchSpeed just will not change, is anyone else having this issue? Every other setting works fine except egg hatch speed. const auto SGame_Mode = ArkApi::GetApiUtils().GetShooterGameMode(); const auto SGame_State = ArkApi::GetApiUtils().GetGameState(); AShooterGameState* Sh_Game_State = static_cast<AShooterGameState*>(ArkApi::GetApiUtils().GetShooterGameMode()->GameStateField()); SGame_Mode->EggHatchSpeedMultiplierField() = fval; SGame_State->EggHatchSpeedMultiplierField() = fval; Sh_Game_State->EggHatchSpeedMultiplierField() = fval;
Avatar
I would assume your most likely cause is due to replication, you will have to force the client to accept and notice this change, there is a nice open source on github called Improved Commands that can probably help. Specifically the MyDinoStats one or the respec ones. There is a section that uses "reinterpret_cast<UActorComponent *">"then use that to RescaleAllStats which is how it is usually done in the DevKit. (edited)
Avatar
I am trying to set item->BlueprintAllowMaxCraftingsField to limit the number of crafts, it has no effect. Does anyone know if it possible to limit the craft this way? I think I saw a plugin that limit the craft of bps, but I cant remember the name.
Avatar
Lethal’s Items+ plug-in has that ability I believe!
Avatar
I found it, but is limits for the server, I wanted for only on BP
Avatar
hello ,How to force players to join a tribe(tribeId)?
2:32 PM
ForceAddPlayerToTribe() not working
Avatar
Did you try doing it from AShooterPlayerState->AddToTribe option, usually everything I do for tribes needs to be from PlayerState as apposed to the player controller.
Avatar
Avatar
Xeakial
Did you try doing it from AShooterPlayerState->AddToTribe option, usually everything I do for tribes needs to be from PlayerState as apposed to the player controller.
thanks . emmm I have no idea how to get FTribeData with tribeID(offline? tribesDataField() All found are online)😀
Avatar
Only way you can get that information while the tribe is offline is with GetOrLoadTribeData but do a little searching as you will have to pre-allocate memory for it and free it when your done.
Avatar
jraServerAPI 9/6/2022 6:51 PM
here's some code i found: c++ AShooterGameMode* gameMode = ArkApi::GetApiUtils().GetShooterGameMode(); static int tribeDataStructSize = GetStructSize<FTribeData>(); FTribeData* tribeData = static_cast<FTribeData*>(FMemory::Malloc(tribeDataStructSize)); RtlSecureZeroMemory(tribeData, tribeDataStructSize); gameMode->GetOrLoadTribeData(player_controller->TargetingTeamField(), tribeData); // do something with tribe data const auto iDinoCount = tribeData->NumTribeDinosField(); FMemory::Free(tribeData);
Avatar
thank you 😃
Avatar
Avatar
Donsora
ForceAddPlayerToTribe() not working
it wont add the player if the tribe is empty
Avatar
Avatar
Uaca
it wont add the player if the tribe is empty
A player offline,but still does not work.
Avatar
Avatar
Donsora
A player offline,but still does not work.
FTribeData* CreatedTribeData = static_cast<FTribeData*>(FMemory::Malloc(0x128 + 0x28)); RtlSecureZeroMemory(CreatedTribeData, 0x128 + 0x28); if (GameMode->GetOrLoadTribeData(tribe_id, CreatedTribeData)) { PC->GetShooterPlayerState()->AddToTribe(CreatedTribeData, false, true, false, nullptr); } else { Log::GetLog()->info("no tribe data"); } FMemory::Free(CreatedTribeData);
8:51 PM
this works for me, but not when ther is no player on tribe (edited)
Avatar
hi guys,I want to disable deploy cryopod in place,can i hook this function?
Avatar
Is there a tutorial page about starting developing plugins?
Avatar
Avatar
MR_OldY
hi guys,I want to disable deploy cryopod in place,can i hook this function?
I've hooked it before to prevent Cryopods from releasing in certain areas. It's a script UFunction that gets called through UObject::CallFunction(). Hooking it and modifying its outputs is a little tricky with ArkServerAPI, but possible. You can intercept it in UObject::ProcessInternal() like this: https://discord.com/channels/513432877904691202/513432877904691205/1007000413196787822 A little more information about accessing script UFunction parameters here: https://discord.com/channels/513432877904691202/513822106639794196/968219440497954856 And you can see the plugin I put together here (my CryopodBlock plugin depends on my BlueprintHooks plugin for hooking script UFunctions. But I don't use that method any more, just stick to intercepting CanDeploy in ProcessInternal()): https://github.com/MolluskARK/MolluskARK-Plugins/blob/master/Projects/CryopodBlock/CryopodBlock.cpp#L27
MolluskARK's plugins for ARK: Survival Evolved. Contribute to MolluskARK/MolluskARK-Plugins development by creating an account on GitHub.
👍 3
Avatar
Avatar
TheMollusk
I've hooked it before to prevent Cryopods from releasing in certain areas. It's a script UFunction that gets called through UObject::CallFunction(). Hooking it and modifying its outputs is a little tricky with ArkServerAPI, but possible. You can intercept it in UObject::ProcessInternal() like this: https://discord.com/channels/513432877904691202/513432877904691205/1007000413196787822 A little more information about accessing script UFunction parameters here: https://discord.com/channels/513432877904691202/513822106639794196/968219440497954856 And you can see the plugin I put together here (my CryopodBlock plugin depends on my BlueprintHooks plugin for hooking script UFunctions. But I don't use that method any more, just stick to intercepting CanDeploy in ProcessInternal()): https://github.com/MolluskARK/MolluskARK-Plugins/blob/master/Projects/CryopodBlock/CryopodBlock.cpp#L27
thanks,is cool
Avatar
Is there a channel or website with tutorials?
Avatar
There is a whole category called Tutorials | Guides and you can go to github and search ark server api for some opensource that honestly have about anything you could want or need to get started with the basics of creating plugins.
Avatar
Avatar
Xeakial
There is a whole category called Tutorials | Guides and you can go to github and search ark server api for some opensource that honestly have about anything you could want or need to get started with the basics of creating plugins.
I cannot see that category if it is on this discord.
Avatar
It says I do not have access to that link.
Avatar
Thanks whoever added the roles.
GOGCHECK 1
Avatar
hey does anyone know how you can retrieve all dinos currently on the map (tamed and not tamed), inside a plugin?
Avatar
jraServerAPI 9/15/2022 5:58 PM
c++ TArray<AActor*> FoundActors; UGameplayStatics::GetAllActorsOfClass(ArkApi::GetApiUtils().GetWorld(), APrimalDinoCharacter::GetPrivateStaticClass(), &FoundActors); for (const auto& actor : FoundActors) { auto dino = static_cast<APrimalDinoCharacter*>(actor); if (dino) { // do the thing } } (edited)
Avatar
This is not needed. reinterpret_cast<UObject*>(ArkApi::GetApiUtils().GetWorld()) Just do ArkApi::GetApiUtils().GetWorld()
👍 1
Avatar
Avatar
Lethal
This is not needed. reinterpret_cast<UObject*>(ArkApi::GetApiUtils().GetWorld()) Just do ArkApi::GetApiUtils().GetWorld()
jraServerAPI 9/15/2022 6:14 PM
fixed it, thank you
Avatar
hello a,I want to create a custom tribe ID.
5:49 PM
I tried Hook_ AShooterGameMode_GenerateTribeId(), But I don't know which usercontroller
5:49 PM
Is there any other way?
Avatar
When taming a dino, you can enable that marker on the HUD to display a location of where the dino is. Does anyone have an example of how to do that, or know the function that can do something like that?
Avatar
Avatar
Donsora
hello a,I want to create a custom tribe ID.
That will not generate a tribe id, it will just be called when the server generates a tribe id.
9:44 PM
You would have use the hook to catch before the information is returned and assign an id, but I don't even know if it is possible tbh.
Avatar
It is, if you modify the return on that hook the next tribe Id will be the one you return.
9:55 PM
You can combine create new tribe hook and generate id hook to create a tribe with your own tribe id
Avatar
That is good to know, and gives me an idea.
9:57 PM
could basically sync all tribe ID's across maps like that.
Avatar
There's also another method, like creating the tribe manually first then adding players. There's a function in the game mode to force create a tribe with preset tribe id
Avatar
I was just looking at that oneDECLARE_HOOK(AShooterGameMode_ForceCreateTribe, int, AShooterGameMode*, FString*, int);
Avatar
Is there a reason that BattleEye is now preventing ark from opening and blocking version.dll?
2:01 PM
This is with the 3.55 version from the website
Avatar
Avatar
Onslauth
Is there a reason that BattleEye is now preventing ark from opening and blocking version.dll?
Ark or the Server? (edited)
2:46 PM
BattlEye blocks loading version.dll in Ark (NOT the Ark Server) as it is an unsigned library file
2:46 PM
which usually indicates a cheat
2:46 PM
which is why BattlEye proactively blocks it
Avatar
Sorry, I see now. The documentation said to start the game, not the server. Thank you.
Avatar
Avatar
Onslauth
Sorry, I see now. The documentation said to start the game, not the server. Thank you.
Which documentation?
Avatar
https://ark-server-api.com/forums/resources/ark-server-api.12/ - but I read it wrong, I see it says "Game server".
Ark Server API Original Author: @Michidu Maintainer: @Lethal @Pelayori @Foppa @WETBATMAN Product Description: This tool allows you to load plugins into your gaming communities; this is an open-source community-supported "API" required for...
thumbsUp 1
Avatar
Avatar
Onslauth
https://ark-server-api.com/forums/resources/ark-server-api.12/ - but I read it wrong, I see it says "Game server".
Should probably have extra clarity on not starting the game with the dll in the directory
2:54 PM
if it were to be loaded into the game while BattlEye was running, you would like receive a BattlEye ban
Avatar
Avatar
Pelayori
There's also another method, like creating the tribe manually first then adding players. There's a function in the game mode to force create a tribe with preset tribe id
what's the another method?ForceCreateTribe?I'm not sure the “teamOverride<int>” what's mean
6:57 PM
I call the method but nothing happened
Avatar
Avatar
Donsora
what's the another method?ForceCreateTribe?I'm not sure the “teamOverride<int>” what's mean
Team override means create a new tribe with X tribe id
Avatar
then load the tribe by this id?
Avatar
Yeah, that'd be
Avatar
and join the tribe
Avatar
The server creates it, but just empty and no data other than the tribe id
Avatar
thank you , I'm going to try
Avatar
is there a hook for map save?
Avatar
jraServerAPI 9/22/2022 9:32 PM
AShooterGameMode_SaveWorld
Avatar
Avatar
jraServerAPI
AShooterGameMode_SaveWorld
ty
Avatar
hello ! is there a hook when the character created?
Avatar
Found in the Hook Creator DECLARE_HOOK(AShooterPlayerState_ServerRequestCreateNewPlayer_Implementation, void, AShooterPlayerState*, FPrimalPlayerCharacterConfigStructReplicated); void Hook_AShooterPlayerState_ServerRequestCreateNewPlayer_Implementation(AShooterPlayerState* _this, FPrimalPlayerCharacterConfigStructReplicated PlayerCharacterConfig) { AShooterPlayerState_ServerRequestCreateNewPlayer_Implementation_original(_this, PlayerCharacterConfig); } ArkApi::GetHooks().SetHook("AShooterPlayerState.ServerRequestCreateNewPlayer_Implementation", &Hook_AShooterPlayerState_ServerRequestCreateNewPlayer_Implementation, &AShooterPlayerState_ServerRequestCreateNewPlayer_Implementation_original); ArkApi::GetHooks().DisableHook("AShooterPlayerState.ServerRequestCreateNewPlayer_Implementation", &Hook_AShooterPlayerState_ServerRequestCreateNewPlayer_Implementation); (edited)
Avatar
Hello, I was wondering if someone can explain to me how to set up Visual Studio 2022 or Visual Studio code to build plugins. briefly about me: i just started this week with C++ and i have downloaded other plugins as sample code but i can't manage to compile them cleanly all the tutorials i have found so far are for older versions of visual studio
Avatar
ok it was a classic "60cm in front of the monitor" error if I specify a lib in the code I should also make sure that the system finds it under the specified path.
Avatar
Hello, is there a way to remove a world buff on gen2 with the end mission hook? 🥺
Avatar
Hi, I'm looking for info on how to access Dino stats/buffs and how that data is stored. Where can I find it?
Avatar
jraServerAPI 10/13/2022 4:37 AM
search this discord for the word: buff 👍
👍 1
Avatar
It is possible to gell all tribes and its members steamid? or this info is available only when players are online?
Avatar
jraServerAPI 10/15/2022 7:51 PM
you can do that by tracking players that join your map and you keep the data stored in a db
Avatar
yeah, I was hooping that it would not be the case. The player can join a tribe, a tribe can merge, the player cant leave out be kicked out of the tribe. It would be much better to just get this info from the server
Avatar
Avatar
Uaca
yeah, I was hooping that it would not be the case. The player can join a tribe, a tribe can merge, the player cant leave out be kicked out of the tribe. It would be much better to just get this info from the server
you can use GetOLoadTribeData to load a tribe's data by inputting the tribe id as the argument
3:36 PM
it returns a struct with tribe data such as all members and stuff
3:37 PM
3:37 PM
this is how i do it
3:38 PM
i load all tribe data on plugin load and then make my own cache for it so i don't have to call GetOrLoadTribeData every time
3:38 PM
since the function leaks memory
Avatar
that is nice. ty!
Avatar
How do I call this. it`s in Primate->Commands.h
4:39 PM
help me!
Avatar
You don't need to call that
6:20 PM
It's handled automatically by the api
Avatar
oh thank u
6:22 PM
I find the ChatMessageCallback
Avatar
jraServerAPI 10/19/2022 7:26 PM
If I have a pointer to a structure in the world, like a foundation, what is the easiest way to get a UPrimalItem reference of that structure?
Avatar
jraServerAPI 10/19/2022 9:25 PM
after much investigation, I'm conceding that there probably isn't a way to do this in the API, and I'm resorting to making a hardcoded lookup list instead 😆 🤦‍♂️
Avatar
APrimalStructure* _this; _this->ConsumesPrimalItemField(); Perhaps?
Avatar
jraServerAPI 10/19/2022 9:30 PM
oh man.. i did not see that!
9:30 PM
i'll give it a try..ty!
Avatar
Hey, can anyone recommend a tutorial on how to set up Visual studio for developing Plugins?
Avatar
Avatar
Luki
Hey, can anyone recommend a tutorial on how to set up Visual studio for developing Plugins?
Avatar
I been looking at doing the tutorials for plugins, however the links just get redirected to the download page, does anyone have an updated link for Hooks? Trying to work out how to and where to put them in Code etc. "trying to create a hook to beaver dams eventually, guess I need container in general and only do stuff if == to beaver dam."
Avatar
Avatar
SarahWild
I been looking at doing the tutorials for plugins, however the links just get redirected to the download page, does anyone have an updated link for Hooks? Trying to work out how to and where to put them in Code etc. "trying to create a hook to beaver dams eventually, guess I need container in general and only do stuff if == to beaver dam."
What, specifically, are you wanting to do with the beaver dams?
Avatar
When you open them anything you don't take will be dropped and dam destroyed.
Avatar
I managed to find the hook tool via google as only the first Tutorial link works for me.
Avatar
Dodo Enthusiast 10/27/2022 6:07 PM
struct FHordeCrateNPCGroup { TArray<UClass> NPCClasses; // devkit says Array of Primal Dino Character Class? TArray<UClass> NPCAssets; // devkit says Array of Primal Dino Character Class? TArray<float> NPCWeights; TArray<int> MinLevels; TArray<int> MaxLevels; }; struct FHordeCrateWave { int MinNumOfNPCs; int MaxNumOfNPCs; float TimeToPrepareForWave; FHordeCrateNPCGroup NPCsToSpawn; }; struct FHordeCrateDifficultyLevel { bool bEnabled; int MaxNumOfEventsForDifficulty; int DifficultyLevel; int MinNPCsToStart; int MaxNPCsToStart; FHordeCrateNPCGroup StartingNPCs; TArray<FHordeCrateWave> NPCWavesToComplete; float MinTimeBeforeSelfDestruct; float MaxTimeBeforeSelfDestruct; AActor ActorTemplate; //Dev Kit says "Actor Class"? float MinQualityMultiplier; float MaxQualityMultiplier; int MinAmtRewardItems; int MaxAmtRewardItems; FLinearColor DifficultyColor; float MainNodeElementPct; }; UProperty* hordeParams = actor->FindProperty(FName("HordeParams", EFindName::FNAME_Add)); if (hordeParams != nullptr) { try { FHordeCrateDifficultyLevel hordeCrateDifficultyLevel = hordeParams->Get<FHordeCrateDifficultyLevel>(actor); sendChatMessage(player_controller, "it worked for: " + path.ToString()); } catch (std::invalid_argument ex) { sendChatMessage(player_controller, "size error for: " + path.ToString()); } } Hi, I'm trying to deconstruct a Property from the Extinction Drops. For now I got most of the information from the Devkit. The Property gets found but I always run into the size error. First of all can I even get and set such a property? If yes how would you go about to figure out where the Problem is? I also don't really know what is meant with "Actor Class" and "Primal Dino Class" in this context.
Avatar
It depends, if the property is only exposed in BP then you will need to use the reflection system in UE4 to get or set it
7:19 PM
There are helpers in the API to do this.
7:20 PM
Actually the size error is a guardrail that the helper uses
7:21 PM
The type you are reading as is not the same size in bytes as the type UE4 says it is
7:21 PM
Ex: reading 8 byte property into 4 byte storage
7:22 PM
I should probably make the error more clear and show the size difference with something like
Size error x bytes being read into y bytes, wrong type passed
7:23 PM
In your case though I think you are using it wrong … I’m on mobile so I can’t read the code very well
7:24 PM
If you are reading a property of a property you will need to find the UProp of the nested property and .Get that
7:25 PM
I’ll probably rewrite the helper to be easier to use in the future at some point
7:28 PM
The way Get works though is on UProp you call Get with the arg being the instance of a class that contains the UProp
7:28 PM
And then it reads the size of the type T that you passed in as the type arg bytes as a T
7:29 PM
Basically at the offset of UProp in Class it reads sizeof(T) bytes as an instance of T
7:29 PM
ArkServerAPI is open source software you can install directly into windows versions of Ark Survival Evolved this software allows you to manage and create plugins to enhance your video game servers....
Avatar
I am pretty sure this should be a pointer to AActor though, AActor* ActorTemplate; //Dev Kit says "Actor Class"?
Avatar
Avatar
Pelayori
I am pretty sure this should be a pointer to AActor though, AActor* ActorTemplate; //Dev Kit says "Actor Class"?
I think adding a get and set to UObject that takes the name and uses reflection is how I’ll improve the user experience for this
7:31 PM
The original on UProp can be left as the “fast” version since it’s just using pointer arithmetic
Avatar
Dodo Enthusiast 10/27/2022 7:31 PM
I just tested it just for fun with AActor* and UClass* and there is no error anymore. But I cant believe it does really work xD. Need to test it further.
Avatar
I see a bit of room for optimization, but it ain't the worst thing tbh, I use it a lot without issues
Avatar
Avatar
Dodo Enthusiast
I just tested it just for fun with AActor* and UClass* and there is no error anymore. But I cant believe it does really work xD. Need to test it further.
The error you were getting wasn’t an issue with Ark per say
Avatar
Because the AActor of the api is not the correct size, plus it was expecting a pointer there to get the size correct
Avatar
The error was from the API being defensive about mis-sized storage
7:32 PM
Since your original one was the wrong size in bytes
7:33 PM
Anything that has non-pointer classes and structs is going to most likely throw the wrong size error since the types in the API aren’t 1:1 to the game (edited)
Avatar
Dodo Enthusiast 10/27/2022 7:34 PM
I assume there are still problems but need to test it first.
Avatar
Avatar
Pelayori
Because the AActor of the api is not the correct size, plus it was expecting a pointer there to get the size correct
I could fix that though by having an overload that accepts T where T has a getSize that compute the size using reflection
7:34 PM
However that would be unsafe since you would also need x bytes of data storage
7:34 PM
Perhaps we could also internally allocate a buffer of memory as storage
Avatar
Could use a helper class to save the data you need to refer to later
7:35 PM
A bit more of mem tho
Avatar
Dodo Enthusiast 10/27/2022 7:35 PM
Thats all way beyond my understanding 😄
Avatar
Avatar
Dodo Enthusiast
Thats all way beyond my understanding 😄
You’ll get there eventually
7:35 PM
Probably
Avatar
Avatar
Dodo Enthusiast
Thats all way beyond my understanding 😄
If you search my very first messages here you'll see where I came from, from zero 😛
Avatar
I just sure do love template meta programming
7:38 PM
You’d probably never touch C++ again if you saw the Eldrich horrors I’ve come up with.
Avatar
Dodo Enthusiast 10/27/2022 7:39 PM
Thanks for the answers. I will do some testing. I used a Template for the first time like 2 days ago :X
Avatar
I templated function hooking to the point where I can generically hook a function while providing an interface for pre and post callbacks
7:40 PM
It was total wizardry
7:40 PM
I’m still prototyping v3 of it before I push it to GitHub
7:41 PM
I’ll eventually release this
7:42 PM
Eventually 😛
7:42 PM
@Pelayori imagine Tebex integration with THAT
7:42 PM
Now that’d be a in game shop
Avatar
jraServerAPI 10/27/2022 7:42 PM
pepewow
Avatar
Avatar
substitute
I’ll eventually release this
Dodo Enthusiast 10/27/2022 7:45 PM
Are you using rcon commands for that?
Avatar
Substitute using rcon commands, pfft
7:51 PM
😂
7:51 PM
Think it's some sockets library for http calls or similar
Avatar
Avatar
Dodo Enthusiast
Are you using rcon commands for that?
No rcon
9:17 PM
It’s a web server running inside of the game
9:18 PM
The http file is making api calls to the web server
Avatar
Dodo Enthusiast 10/27/2022 9:34 PM
Ok thats next level^^ The structs from above seem to work so far with the small changes to pointers. I can even set it again with changed dinos and levels. Thanks again for taking the time to answer.
Avatar
What is the best way to use the Hooker Creator? Looking to get the state of a beaver dam, but I guessing at this stage it is going to be a mod job.
Avatar
Avatar
SarahWild
What is the best way to use the Hooker Creator? Looking to get the state of a beaver dam, but I guessing at this stage it is going to be a mod job.
Depends, what’s your specific want with wanting to drop the items
9:51 PM
If it’s drop all unclaimed items regardless of item type
9:52 PM
Then you need to hook when an inventory is opened, check if the type of the inventory container is a beaver dam, and track that a specific dam was opened
9:52 PM
I don’t think there’s a method for when something is closed
9:52 PM
So you’ll have to make your own detection for that
Avatar
Avatar
substitute
I don’t think there’s a method for when something is closed
If there is, then hook this instead and check if it is a dam and drop everything
Avatar
Avatar
SarahWild
When you open them anything you don't take will be dropped and dam destroyed.
If it helps, I have code for a simple plugin that drops everything from a beaver dam when a player closes the inventory with only wood remaining. https://github.com/MolluskARK/MolluskARK-Plugins/blob/master/Projects/TidyDams/TidyDams.cpp
MolluskARK's plugins for ARK: Survival Evolved. Contribute to MolluskARK/MolluskARK-Plugins development by creating an account on GitHub.
Avatar
Avatar
TheMollusk
If it helps, I have code for a simple plugin that drops everything from a beaver dam when a player closes the inventory with only wood remaining. https://github.com/MolluskARK/MolluskARK-Plugins/blob/master/Projects/TidyDams/TidyDams.cpp
your hook on Hook_UPrimalInventoryComponent_ServerCloseRemoteInventory is why I want to finish my autohooking prototype
9:48 PM
if another plugin hooks it and runs before yours (and doesn't call the original) then your plugin would break
9:48 PM
it's such an annoying problem lol
Avatar
Avatar
substitute
if another plugin hooks it and runs before yours (and doesn't call the original) then your plugin would break
When I wrote my own plugin loader / hook manager, I toyed around a little with allowing hooks to be registered as pre-hooks or post-hooks. And the original function would always be executed in the middle. I ended up using the same style of hooking as ArkApi though, where each hook that's registered gets an "original" pointer. I've had one or two instances in the past where I just wanted to replace the original function without it ever getting called. Plugins failing to call "original" was always less of an issue for me because even when I use ArkApi I tend to only use plugins I have source code for.
Avatar
Avatar
TheMollusk
When I wrote my own plugin loader / hook manager, I toyed around a little with allowing hooks to be registered as pre-hooks or post-hooks. And the original function would always be executed in the middle. I ended up using the same style of hooking as ArkApi though, where each hook that's registered gets an "original" pointer. I've had one or two instances in the past where I just wanted to replace the original function without it ever getting called. Plugins failing to call "original" was always less of an issue for me because even when I use ArkApi I tend to only use plugins I have source code for.
You can do it with an event handler
2:50 AM
If event handled then don’t run original/post
Avatar
Avatar
TheMollusk
If it helps, I have code for a simple plugin that drops everything from a beaver dam when a player closes the inventory with only wood remaining. https://github.com/MolluskARK/MolluskARK-Plugins/blob/master/Projects/TidyDams/TidyDams.cpp
This does help a lot, a great starting point. Thank you.
Avatar
after this , only Hook_AShooterGameMode_UpdateTribeData is called but Hook_AShooterPlayerState_UpdateTribeData is not called
2:08 PM
if I call player_state_updateTribeData,player not in tribe when re login to the game
Avatar
You could check if asps->MyTribeDataField() is not null and is same tribe id as you created, and then you could call asps->MulticastProperty(FName("MyTribeData", EFindName::FNAME_Add));
Avatar
oo,asps->MulticastProperty(FName("MyTribeData", EFindName::FNAME_Add)); I tried , although I don't know what means
Avatar
Did it crash the client?
3:35 PM
Multicast basically mean force update the property to clients, so it is known to them almost instantly
Avatar
yes,crash the client
Avatar
Interesting
3:40 PM
Try asps->ForceReplicateNow(false, false) or asps->ForceNetUpdate(false, false, false)
Avatar
both of these can be run correctly,but player still not in the tribe when re login
3:51 PM
Avatar
oh, if asgm->GetOrLoadTribeData(tid, tribeData) first is false, this func is right.
4:04 PM
but if true, player not in tribe when re login
Avatar
pelayori do you know if the gogplugins files are damaged? I am trying to run them on a server and they only give this error
Avatar
I compiled those yesterday as well
Avatar
Avatar
Pelayori
I compiled those yesterday as well
Well, I used the files that were in the rar that were sent to the gog server and they don't work
Avatar
Avatar
x3R07YP3
Click to see attachment 🖼️
Did you select the Ark build config, or the Release one?
Avatar
Avatar
Pelayori
Did you select the Ark build config, or the Release one?
yes. gogautodecay-master\GogAutoDecay\Out\Ark
Avatar
I mean in visual studio
Avatar
There are different builld configs, change from Debug to Ark or Release.
Avatar
Avatar
Pelayori
There are different builld configs, change from Debug to Ark or Release.
same errors on goglootboxes
Avatar
I do not get errors but I will look into the issues
Avatar
It's weird, with the decay project if I get the ark option when compiling
8:31 PM
but i still get the same error in the console
Avatar
@Pelayori Is there any other way to join the tribe?🥺
Avatar
Last time I was tackling that force create tribe function I didn't get it to work fast so I switched to another approach. What I did is hook game mode::generate tribe id and when I wanted, I would use a global var with the tribe id I wanted, then you can call player state->serverrequest create tribe and that new tribe will have the wanted tribe id
Avatar
create tribe is run right,but make a player to offline tribe(AddToTribe) has a problem
Avatar
It's ark quirks, and I do not know if any dev has overcome then, from what I know that is a bug that isn't fixable
Avatar
AddToTribe and asps->ForceNetUpdate(false, false, false); ,I find Player in tribe,but re login its not in tribe.
Avatar
What I know it works is: Call player_state->ServerRequestCreateTribe_Implementation() Hook gameMode::GenerateTribeId and return the tribe id you want (must handle post return var states, etc...) if you want to add any other player to tribe, wait till they are online and use add to tribe after get or load data
Avatar
emmm
8:51 PM
I have successfully created a tribe. The problem now is to join the player
8:53 PM
so hard😟
Avatar
I know what have you done and I have told you why it doesn't work
8:53 PM
I don't know if we are doing something wrong, or how can we do it but I was not successful doing what you want, and I don't know if other were able to do it
Avatar
Thank you very much for your answer.
9:02 PM
I thought that developing plugins only needs to simply call the API😀
Avatar
Avatar
Pelayori
I don't know if we are doing something wrong, or how can we do it but I was not successful doing what you want, and I don't know if other were able to do it
I can look into it at some point
9:54 PM
It should be possible
9:54 PM
We are probably making a mistake
Avatar
I downloaded the plugin to test and when loading this error pops up (the db is well set)
Avatar
Avatar
x3R07YP3
I downloaded the plugin to test and when loading this error pops up (the db is well set)
Avatar
Avatar
x3R07YP3
I downloaded the plugin to test and when loading this error pops up (the db is well set)
Disable ssl in db (edited)
9:06 AM
ssl=0 in the end of my.ini
Avatar
I have that disabled since I started
9:15 AM
It's a dll problem
Avatar
ADroppedItem.bAssignedToTribePickupOnly Any hook can mark this?
Avatar
Try with the combination of this hook: DECLARE_HOOK(ADroppedItem_IsAllowedToPickupItem, bool, ADroppedItem*, APlayerController*); bool Hook_ADroppedItem_IsAllowedToPickupItem(ADroppedItem* _this, APlayerController* PC) { return ADroppedItem_IsAllowedToPickupItem_original(_this, PC); } ArkApi::GetHooks().SetHook("ADroppedItem.IsAllowedToPickupItem", &Hook_ADroppedItem_IsAllowedToPickupItem, &ADroppedItem_IsAllowedToPickupItem_original); ArkApi::GetHooks().DisableHook("ADroppedItem.IsAllowedToPickupItem", &Hook_ADroppedItem_IsAllowedToPickupItem);
Avatar
Thank you
Avatar
Someone can tell me how to judge whether the ADroppedItem is generated by player or AI? Please
Avatar
actor will never be a controller
10:49 PM
You can use actor->GetOwnerController(), if it's a APlayerController it's a player, else is AI
Avatar
Thank you!😄
Avatar
Hmm,I think my question is wrong. I want to know ADroppedItemEgg dropped from wild Wyvern or Player?
Avatar
jraServerAPI 11/7/2022 4:10 AM
you check the TargetingTeamField, if it's >= 50000 it's a player
Avatar
Avatar
jraServerAPI
you check the TargetingTeamField, if it's >= 50000 it's a player
Ty!
Avatar
I've been trying to remove all the auth for a while and now I have these errors, does anyone know how to solve them?
Avatar
Is there any hook about claimdino?I just found APrimalDinoCharacter.UnclaimDino
Avatar
Avatar
Donsora
Is there any hook about claimdino?I just found APrimalDinoCharacter.UnclaimDino
DECLARE_HOOK(APrimalDinoCharacter_BPAllowClaiming, bool, APrimalDinoCharacter*, AShooterPlayerController*); bool Hook_APrimalDinoCharacter_BPAllowClaiming(APrimalDinoCharacter* _this, AShooterPlayerController* forPlayer) { return APrimalDinoCharacter_BPAllowClaiming_original(_this, forPlayer); } ArkApi::GetHooks().SetHook("APrimalDinoCharacter.BPAllowClaiming", &Hook_APrimalDinoCharacter_BPAllowClaiming, &APrimalDinoCharacter_BPAllowClaiming_original); ArkApi::GetHooks().DisableHook("APrimalDinoCharacter.BPAllowClaiming", &Hook_APrimalDinoCharacter_BPAllowClaiming);
Avatar
Avatar
Foppa
DECLARE_HOOK(APrimalDinoCharacter_BPAllowClaiming, bool, APrimalDinoCharacter*, AShooterPlayerController*); bool Hook_APrimalDinoCharacter_BPAllowClaiming(APrimalDinoCharacter* _this, AShooterPlayerController* forPlayer) { return APrimalDinoCharacter_BPAllowClaiming_original(_this, forPlayer); } ArkApi::GetHooks().SetHook("APrimalDinoCharacter.BPAllowClaiming", &Hook_APrimalDinoCharacter_BPAllowClaiming, &APrimalDinoCharacter_BPAllowClaiming_original); ArkApi::GetHooks().DisableHook("APrimalDinoCharacter.BPAllowClaiming", &Hook_APrimalDinoCharacter_BPAllowClaiming);
I hook this ,but its not work when I claim dino.
7:41 PM
7:42 PM
Only these two
Avatar
Send your code
7:54 PM
ArkApi::GetHooks().SetHook("APrimalDinoCharacter.BPAllowClaiming", &Hook_APrimalDinoCharacter_BPAllowClaiming, &APrimalDinoCharacter_BPAllowClaiming_original);
Avatar
@Foppa Hello?
Avatar
Are you loading the hook on plugin attach?
Avatar
You can also use the multi use hook and check what multi use index is being used
Avatar
Avatar
Foppa
Are you loading the hook on plugin attach?
DECLARE_HOOK(APrimalDinoCharacter_BPAllowClaiming, bool, APrimalDinoCharacter*, AShooterPlayerController*); bool Hook_APrimalDinoCharacter_BPAllowClaiming(APrimalDinoCharacter* _this, AShooterPlayerController* forPlayer) { Log::GetLog()->info("BPAllowClaiming"); return APrimalDinoCharacter_BPAllowClaiming_original(_this, forPlayer); } DECLARE_HOOK(APrimalDinoCharacter_BPNotifyClaimed, void, APrimalDinoCharacter*); void Hook_APrimalDinoCharacter_BPNotifyClaimed(APrimalDinoCharacter* _this) { Log::GetLog()->info("BPNotifyClaimed"); APrimalDinoCharacter_BPNotifyClaimed_original(_this); } DECLARE_HOOK(APrimalDinoCharacter_GetForceClaimTime, long double, APrimalDinoCharacter*); long double Hook_APrimalDinoCharacter_GetForceClaimTime(APrimalDinoCharacter* _this) { Log::GetLog()->info("GetForceClaimTime"); return APrimalDinoCharacter_GetForceClaimTime_original(_this); } I tried this three,only BPAllowClaiming no printing
10:59 AM
I dont know how to use multi use.
11:02 AM
I find useIndex(122) in Hook_AShooterPlayerController_ServerMultiUse_Implementation
11:04 AM
Then do I operate in this method?No need to use BPAllowClaiming?
Avatar
Oh,I think I found out why it didn't work.😄
Avatar
Another question,Can I get "hook_name" by useIndex(param from ServerMultiUse_Implementation)?
Avatar
Does anyone know where the error is?
Avatar
Avatar
Arxon
Does anyone know where the error is?
line 561
👌 1
7:03 PM
Store.cpp
Avatar
ArkApi::GetApiUtils().SendChatMessage(player_controller, GetText("Sender"), *GetText("ShopFindUsage")); Check so your sender and and "ShopFindUsage" isn't containing any thing wierd
Avatar
Is there any way to prevent fjordhawr picking up death item cache?
Avatar
Hello guys
9:45 PM
i just want to ask is there is any way to develop ark plugins using js ?
9:45 PM
or its just c++ ?
Avatar
Just c++
Avatar
and if it is just c++ can i have any link for documentations of the functions that i can right
9:46 PM
i mean how can i register specific command to make specific is there is any documentation for this things
9:46 PM
sry if i am looking silly xD but i used to develop fiveM/RedM and websites
9:46 PM
so dont know alot on ark
9:51 PM
or at least some open source plugins to show this for me
Avatar
Avatar
NT Diesel
or at least some open source plugins to show this for me
This will be used to release open source products created by the gameservershub community. - Game Servers Hub
Avatar
ok thanks bro
10:01 PM
c++ ArkApi::GetCommands().AddChatCommand(command->command, [&command](AShooterPlayerController* player_controller, FString* message, EChatSendMode::Type) { TArray<FString> parsed; message->ParseIntoArray(parsed, L" ", true); if (!message->RemoveFromStart(parsed[0])) return; // Bypass spam check player_controller->LastChatMessageTimeField() -= 3.0; FString cmd = command->exec + *message; player_controller->ServerSendChatMessage_Implementation( &cmd, EChatSendMode::GlobalChat); }); so this for add chat command right ?
Avatar
Yes, but that isn't the best practice
10:02 PM
I would extract the command function to its own function, and then just register the callback with &FunctionName
Avatar
Avatar
Pelayori
I would extract the command function to its own function, and then just register the callback with &FunctionName
wait a sec i think i have to recap and watch any C++ tutorial again because i think dealing with js and lua makes me forget it
10:04 PM
so any recommendation ?
10:04 PM
for good C++ course
10:04 PM
and if it is related to games or ark it would be nice
Avatar
I do not have any recommendation tbh, just basic C++ and going trough open source plugins was what I did at first, and worked out well if you put the time it needs into learning
Avatar
so u dont have any recommendation for any c++ basics course
10:06 PM
for me to recab from it ?
Avatar
I do not, no
Avatar
thanks bro ❤️
Avatar
hello
3:27 PM
3:27 PM
i am getting this error when i try to build my first plugin ever
3:28 PM
3:28 PM
this is my file tree (edited)
3:28 PM
the header
3:29 PM
c++ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: ArkApi::GetCommands().AddOnChatMessageCallback("DieselFirstPlugin", &FirstCommandEver); break; case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: case DLL_PROCESS_DETACH: ArkApi::GetCommands().RemoveOnChatMessageCallback("DieselFirstPlugin"); break; } return TRUE; }
3:29 PM
main function
3:30 PM
my custom function
3:31 PM
my hello world function with the includes
3:31 PM
any one may have any ideas why i getting the error
3:31 PM
it says that it is something with the ARKAPI
3:31 PM
this is my properties
3:32 PM
3:32 PM
3:32 PM
3:33 PM
Avatar
Avatar
NT Diesel
c++ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: ArkApi::GetCommands().AddOnChatMessageCallback("DieselFirstPlugin", &FirstCommandEver); break; case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: case DLL_PROCESS_DETACH: ArkApi::GetCommands().RemoveOnChatMessageCallback("DieselFirstPlugin"); break; } return TRUE; }
Ehm don't put external stuff in dllmain
Avatar
Avatar
NT Diesel
i am getting this error when i try to build my first plugin ever
https://github.com/ServersHub Tons of example plugins here that work correctly already. When you can compile these plugins then your environment is setup properly, then use them to learn from.
✅ 1
Avatar
Contribute to SubstituteR/ArkServerAPI-Template development by creating an account on GitHub.
Avatar
So the whole err is pull API INside dll attach ?
Avatar
Avatar
Lethal
https://github.com/ServersHub Tons of example plugins here that work correctly already. When you can compile these plugins then your environment is setup properly, then use them to learn from.
Thanks bro i already used one to learn from
Avatar
Avatar
SR
Ehm don't put external stuff in dllmain
But i saw a plugin which used the api inside the dll main thats why i did this but i will give this template a try
Avatar
your problem is that you didn’t link the .lib file
6:09 PM
therefore the compiler can’t find the API function definitions
Avatar
Avatar
NT Diesel
But i saw a plugin which used the api inside the dll main thats why i did this but i will give this template a try
this is fine you can call API funcs from dllmain
Avatar
Avatar
WETBATMAN
therefore the compiler can’t find the API function definitions
How can i do this
Avatar
I did load it in the settings
6:11 PM
Linker
Avatar
yes, you can set hooks and commands from dllmain no problem
Avatar
Avatar
WETBATMAN
yes, you can set hooks and commands from dllmain no problem
Ok (edited)
Avatar
Avatar
WETBATMAN
your problem is that you didn’t link the .lib file
6:13 PM
Shall i make any thing more ?
Avatar
Avatar
NT Diesel
Click to see attachment 🖼️
Just use the template @SR linked
6:14 PM
it should build without any user configuration
Avatar
Avatar
substitute
Just use the template @SR linked
Ok thanks i will give it try
Avatar
jraServerAPI 11/21/2022 7:42 PM
Seasons greetings everyone! Where are the items (or kit) a player is currently wearing, stored in the API? like the flak leggings and cloth shirt etc... Thanks! (edited)
Avatar
jraServerAPI 11/21/2022 8:10 PM
A: it's part of the players inventory under EquippedItemsField 🙂
Avatar
Avatar
SR
Ehm don't put external stuff in dllmain
Just putting it out there: You don't even have to define DllMain() in your plugins or worry about its potential safety issues. If your DLL exports Plugin_Init() or Plugin_Unload(), ArkServerApi calls them for you after loading your DLL or on unloading it. c++ extern "C" __declspec(dllexport) void Plugin_Init() { ... } extern "C" __declspec(dllexport) void Plugin_Unload() { ... } (edited)
Avatar
Avatar
TheMollusk
Just putting it out there: You don't even have to define DllMain() in your plugins or worry about its potential safety issues. If your DLL exports Plugin_Init() or Plugin_Unload(), ArkServerApi calls them for you after loading your DLL or on unloading it. c++ extern "C" __declspec(dllexport) void Plugin_Init() { ... } extern "C" __declspec(dllexport) void Plugin_Unload() { ... } (edited)
Oh nice to know
9:00 PM
Thanks
9:00 PM
Is there is a command i can run to reload my plugin ?
Avatar
ArkApi has commands to load and unload your plugin on demand. That was discussed recently in one of these channels. If you want a reload command, you have to implement it yourself.
Avatar
Avatar
TheMollusk
ArkApi has commands to load and unload your plugin on demand. That was discussed recently in one of these channels. If you want a reload command, you have to implement it yourself.
Basically unload my plugin and then remove it and copy another version of it then load the new plugin
9:03 PM
Will be enough for me
9:05 PM
But if i did this will the plugin be updated to the latest version
9:05 PM
Or the old one will still in cache ?
Avatar
Yeah you can unload your plugin, replace the DLL with your new build. Then load the new version without restarting the server.
Avatar
Avatar
TheMollusk
Just putting it out there: You don't even have to define DllMain() in your plugins or worry about its potential safety issues. If your DLL exports Plugin_Init() or Plugin_Unload(), ArkServerApi calls them for you after loading your DLL or on unloading it. c++ extern "C" __declspec(dllexport) void Plugin_Init() { ... } extern "C" __declspec(dllexport) void Plugin_Unload() { ... } (edited)
in fact, you should have the smallest DLLMain possible
9:26 PM
as doing a lot of stuff in DLLMain is considered anywhere from bad practice to straight up unsafe
9:27 PM
if for some reason you want to write everything inside of DLLMain, you can create a thread inside of DLLMain (this is considered kinda unsafe) and you won't have any issues
9:27 PM
because that thread won't begin executing until DLLMain releases the loader lock
Avatar
Avatar
substitute
if for some reason you want to write everything inside of DLLMain, you can create a thread inside of DLLMain (this is considered kinda unsafe) and you won't have any issues
the reason it works (but is unsafe) is because Windows always loads kernel32.dll by the time your dll is loaded.
9:28 PM
but Windows does not guarantee this behavior
9:28 PM
you also risk deadlocking DLLMain if you're not careful
Avatar
Avatar
TheMollusk
Just putting it out there: You don't even have to define DllMain() in your plugins or worry about its potential safety issues. If your DLL exports Plugin_Init() or Plugin_Unload(), ArkServerApi calls them for you after loading your DLL or on unloading it. c++ extern "C" __declspec(dllexport) void Plugin_Init() { ... } extern "C" __declspec(dllexport) void Plugin_Unload() { ... } (edited)
more plugins should be utilizing this behavior, including my template.
9:30 PM
I will try to update it with better practices soon
Avatar
@substitutei am really sorry for mentioning is it best to use ur template on vs 2022 right ?
9:33 PM
and open this file ArkServerAPI-Template.vcxproj (edited)
Avatar
Yes
9:33 PM
I updated it for VS 2022
Avatar
bec i tried to use it with vs 2017 (edited)
9:33 PM
but i got bunch of errors (edited)
Avatar
?
9:34 PM
It was updated for 2022, the readme wasn't updated
9:34 PM
as that's the IDE I use
Avatar
its ok i will try the older version then
9:34 PM
till the 2022 install
9:35 PM
i think its better to wait
9:35 PM
xD
Avatar
so when i make the build
10:36 PM
the setting is for the debug mode (edited)
10:36 PM
or for the release mode (edited)
10:36 PM
in ur template ?
10:38 PM
bec it works good in the debug but on the release i got some errors related to windows SDK
10:38 PM
i have the sdk 11
10:38 PM
and the setting is set to 10
10:38 PM
so i am going to download 10
10:38 PM
and try again
Avatar
this is the err i got when i changeed from debug to release
11:04 PM
in the template
11:04 PM
while the debug has no problems
Avatar
I'm more of a Linux guy not a Visual Studio expert at all, you probably want to look through the config options and check out the differences between the debug and release build. For me personally, a recent Visual Studio update seemed to break ArkServerApi headers from compiling on v143 and I had to switch it back to v142, but I didn't look into what the issue was. (edited)
Avatar
so we cannot use the debug build in the server right ?
Avatar
You might be able to, it might be slower or have side effects depending on how it was written and compiled
Avatar
finally solved
11:15 PM
11:15 PM
best message in my day
11:15 PM
OMG
11:16 PM
i will just have to test it tomorrow and start working my way to the mysql stuff that will be linked to the plugin
11:16 PM
thanks all guys
11:16 PM
@TheMollusk@SR and special thanks for @substitute for ur awesome template ❤️ (edited)
Avatar
Avatar
Donsora
Is there any way to prevent fjordhawr picking up death item cache?
You want to stop Fjordhawk from picking up and returning its owner's death cache to them when they respawn? Or you want to prevent Fjordhawk from carrying other creatures' item caches to the player? You can probably prevent either one from happening with plugins, but there may be some things you can't disable without mods, like the death cache return cool down icon on the player's screen.
Avatar
blackandbuewolf 11/23/2022 12:28 AM
dont know where else to ask but after i installed the arkserverapi i get this message when loading
12:28 AM
[INFO] Blocked loading of file: "G:\SteamLibrary\steamapps\common\ARK\ShooterGame\Binaries\Win64\version.dll".
Avatar
Avatar
blackandbuewolf
[INFO] Blocked loading of file: "G:\SteamLibrary\steamapps\common\ARK\ShooterGame\Binaries\Win64\version.dll".
you cannot run the API on a client
12:29 AM
read the FAQ next time, please
Avatar
blackandbuewolf 11/23/2022 1:14 AM
i just followed the video on installing it
Avatar
Avatar
blackandbuewolf
i just followed the video on installing it
The video is for the server, not the client
Avatar
jraServerAPI 11/23/2022 8:03 PM
Hello again I'm struggling with the basics here 😂 I'm building a string with a space in front, parsing in a variable: strText Now I want to replace all occurrences of that string with a space " " What kind of wizardry do I need to get this done? tbh I'm not sure what the L in front of the " is actually doing. (message is an FString) c++ std::string strText = "test"; FString message2{}; auto m1 = fmt::format(" {}", strText); message2 = message->Replace(m1, L" "); // wont work c++ FString message2{}; message2 = message->Replace(L" test", L" "); // this works Thanks for your help! (edited)
Avatar
Avatar
jraServerAPI
Hello again I'm struggling with the basics here 😂 I'm building a string with a space in front, parsing in a variable: strText Now I want to replace all occurrences of that string with a space " " What kind of wizardry do I need to get this done? tbh I'm not sure what the L in front of the " is actually doing. (message is an FString) c++ std::string strText = "test"; FString message2{}; auto m1 = fmt::format(" {}", strText); message2 = message->Replace(m1, L" "); // wont work c++ FString message2{}; message2 = message->Replace(L" test", L" "); // this works Thanks for your help! (edited)
The L means the string uses wide characters instead of the usual 8 bits.
Avatar
Avatar
jraServerAPI
Hello again I'm struggling with the basics here 😂 I'm building a string with a space in front, parsing in a variable: strText Now I want to replace all occurrences of that string with a space " " What kind of wizardry do I need to get this done? tbh I'm not sure what the L in front of the " is actually doing. (message is an FString) c++ std::string strText = "test"; FString message2{}; auto m1 = fmt::format(" {}", strText); message2 = message->Replace(m1, L" "); // wont work c++ FString message2{}; message2 = message->Replace(L" test", L" "); // this works Thanks for your help! (edited)
try this FString m1 = FString(fmt::format(" {}", strText));
Avatar
jraServerAPI 11/23/2022 8:23 PM
I did that, this is the error
Avatar
m1 is an FString?
8:24 PM
You need the inner c string buffer
8:25 PM
Also if you’re going to use wide chars
8:25 PM
You need wstring not string
Avatar
Use your original line then use m1.c_str() I believe
Avatar
Avatar
substitute
m1 is an FString?
jraServerAPI 11/23/2022 8:26 PM
yes
Avatar
Then use c_str()
Avatar
jraServerAPI 11/23/2022 8:26 PM
nothign seems to work.. i may just use std:: string replace instead
Avatar
The api doesn’t have all conversions defined for string and fstring so you don’t get this for free
Avatar
Avatar
substitute
Then use c_str()
jraServerAPI 11/23/2022 8:27 PM
tried that
Avatar
Avatar
jraServerAPI
tried that
Post your exact code
8:27 PM
The entire method and I’ll download my template and make it work
Avatar
Avatar
substitute
The api doesn’t have all conversions defined for string and fstring so you don’t get this for free
@Lethal this is something we could also do to improve the api
8:28 PM
Adding conversions between STL strings and FStrings
Avatar
Oh it’s TCHAR and not wchar_t
8:29 PM
Honestly I’d just use the STL for this
Avatar
FString m1 = FString(fmt::format(" {}", strText)); message2 = message.Replace(*m1, L" ");
Avatar
jraServerAPI 11/23/2022 8:29 PM
this is what i got thus far c++ std::string strText = " random"; FString m1 = FString(fmt::format(" {}", strText)); FString m2 = FString(fmt::format(" ")); bool isRandom = message->Contains(m1); if (isRandom) { message2 = message->Replace(m1, L" "); }
Avatar
Convert the FString to wstring
8:29 PM
Do all your operations
8:29 PM
Convert to FString
Avatar
jraServerAPI 11/23/2022 8:30 PM
i just want to look for a flag on the chat "command line" and remove it from the FString
8:30 PM
Replace is picky lol
Avatar
Yeah, it might be easier to do that on a wstring
Avatar
jraServerAPI 11/23/2022 8:31 PM
okay.. thank you for all you help 🙂 happy holidays everyone
Avatar
Also don’t use std::string
8:31 PM
Use std::wstring
8:31 PM
I’m fairly certain UE4 is UTF-16
lethaltrue 1
Avatar
jraServerAPI 11/23/2022 8:32 PM
Can you elaborate?
Avatar
Did you try my last code?
Avatar
jraServerAPI 11/23/2022 8:33 PM
what happens if use std::string? Oh lethal i didnt see it.. gonna try it now
8:35 PM
I didnt get any red squiggley lines Lethal
8:35 PM
I'm gonna compile and test
Avatar
I thought ArkApi's FString::ToString() was smart enough to give you a std::string regardless of which format the FString used. I'd have to double check though. I hate working with strings.
Avatar
It does do that but FString::Replace() wants Const TCHAR
Avatar
I see
Avatar
Avatar
Donsora
Is there any way to prevent fjordhawr picking up death item cache?
Well I took a shot at preventing the Fjordhawk from returning a player's items on respawning because it sounded fun. In any case, all this Fjordhawk stuff is defined in Blueprint graphs that you can view in the ARK Dev Kit. That's where you should go to figure out what you need to change. Open the Fjordhawk_Character_BP_C blueprint in the dev kit. Note the package name when you hover over the blueprint in the Content Browser (/Game/Fjordur/Dinos/Fjordhawk/Fjordhawk_Character_BP), we'll use that in our plugin.
👍 1
8:39 PM
Looking through the Fjordhawk's functions (under Graphs, once you open the blueprint), Check for Player Death and On Player Died are both interesting, and they're both called by BPOn Clear Mounted Dino. When the Fjordhawk is removed from your shoulder, it checks if you're dead and retrieves your inventory. Check for Player Death runs on the server and kicks off a chain of events that makes the Fjordhawk retrieve your inventory and bring it back to you. On Player Died runs on the client and just removes the player's equipped items, which I don't think matters to us. So if we prevent Check for Player Death from running on the server, the Fjordhawk won't return our inventory. Functions defined by graphs in the dev kit can't be directly hooked natively, but we have other options.
8:39 PM
Inside our plugin, we need to find a couple of Unreal Engine objects: The UClass that represents the Fjordhawk class, and the Check for Player Death UFunction. UVictoryCore::BPLoadClass() is one option for looking up Blueprint classes. This function takes an FString that includes the blueprint's package plus the blueprint's name: c++ FString path = "Blueprint'/Game/Fjordur/Dinos/Fjordhawk/Fjordhawk_Character_BP.Fjordhawk_Character_BP'"; UClass* hawkClass = UVictoryCore::BPLoadClass(&path); Note: BPLoadClass() shouldn't be called until after the server has initialized. Classes aren't initialized yet when ArkServerApi first loads plugins. To find the UFunction, we want the function's actual name in the game engine, which doesn't always completely match the names we see on the graphs. One option is to get the real name from the dev kit by hovering your cursor over the function name in the "My Blueprint" tab (left hand side of the previous image). Or you can use something like this to dump a class's UFunction names from a plugin: c++ void ListFunctions(UClass* Class) { if (!Class) return; for (TPair<FName, UFunction*> pair : Class->FuncMapField()) Log::GetLog()->info(pair.Key.ToString().ToString().c_str()); } It turns out that Check for Player Death in the dev kit is called CheckForPlayerDeath in the game.
8:39 PM
So in our plugin, we're going to: 1. Hook AShooterGameMode::BeginPlay(). This function is called once after the game has been initialized, this is where ArkServerApi sets ServerStatus::Ready. At this point we can look up the UClass and UFunction we need and save the UFunction's unique InternalIndex to compare against later. 2. Hook UObject::ProcessInternal(). This function is used by Unreal Engine to execute UFunctions that are defined by graphs in the dev kit. One of the arguments passed into ProcessInternal() is an FFrame*, the current UFunction's call stack frame. We can use the FFrame to get a pointer to the UFunction that is being executed, and then block CheckForPlayerDeath from executing. ArkServerApi doesn't provide FFrame, we need to define it ourselves (I've posted a more complete definition of it before in this Discord).
8:39 PM
c++ #include "API/ARK/Ark.h" #pragma comment(lib, "ArkApi.lib") struct FFrame : FOutputDevice { UFunction*& NodeField() { return *GetNativePointerField<UFunction**>(this, "FFrame.Node"); } }; int FunctionIndex = -1; void ServerReadyInit() { FString path = "Blueprint'/Game/Fjordur/Dinos/Fjordhawk/Fjordhawk_Character_BP.Fjordhawk_Character_BP'"; UClass* hawkClass = UVictoryCore::BPLoadClass(&path); if (!hawkClass) return; UFunction* function = hawkClass->FindFunctionByName(FName("CheckForPlayerDeath", EFindName::FNAME_Find), EIncludeSuperFlag::ExcludeSuper); if (!function) return; FunctionIndex = function->InternalIndexField(); } DECLARE_HOOK(AShooterGameMode_BeginPlay, void, AShooterGameMode*); void Hook_AShooterGameMode_BeginPlay(AShooterGameMode* _this) { AShooterGameMode_BeginPlay_original(_this); ServerReadyInit(); } DECLARE_HOOK(UObject_ProcessInternal, void, UObject*, FFrame*, void* const); void Hook_UObject_ProcessInternal(UObject* _this, FFrame* Stack, void* const Result) { // Don't execute the UFunction we found in ServerReadyInit() if (Stack->NodeField()->InternalIndexField() == FunctionIndex) return; UObject_ProcessInternal_original(_this, Stack, Result); } extern "C" __declspec(dllexport) void Plugin_Init() { Log::Get().Init("FjordhawkExample"); ArkApi::GetHooks().SetHook("AShooterGameMode.BeginPlay", &Hook_AShooterGameMode_BeginPlay, &AShooterGameMode_BeginPlay_original); ArkApi::GetHooks().SetHook("UObject.ProcessInternal", &Hook_UObject_ProcessInternal, &UObject_ProcessInternal_original); if (ArkApi::GetApiUtils().GetStatus() != ArkApi::ServerStatus::Ready) return; ServerReadyInit(); } extern "C" __declspec(dllexport) void Plugin_Unload() { ArkApi::GetHooks().DisableHook("AShooterGameMode.BeginPlay", &Hook_AShooterGameMode_BeginPlay); ArkApi::GetHooks().DisableHook("UObject.ProcessInternal", &Hook_UObject_ProcessInternal); }
Avatar
jraServerAPI 11/23/2022 8:41 PM
Nice work
Avatar
Wouldn't say BP manipulation is a beginner topic though 🙂
Avatar
jraServerAPI 11/23/2022 8:42 PM
lmao
8:42 PM
Oh this discord is organized??
8:42 PM
2236_keka
Avatar
General Discussion, Plugin Topics, and the Beginner/Intermediate/Advanced discussion are all pretty much the same in my mind haha
Avatar
jraServerAPI 11/23/2022 8:43 PM
I find most my complex answers in General Chat 😛
Avatar
I think that was the original channel lots of things were shared in before all the channel organization changes happened.
Avatar
Avatar
Lethal
Did you try my last code?
jraServerAPI 11/23/2022 8:50 PM
thank you that does work, but I don't understand why lol Adding a * in front of the FString turns it into a TCHAR? whaaaaaaa pepewow
Avatar
Avatar
jraServerAPI
thank you that does work, but I don't understand why lol Adding a * in front of the FString turns it into a TCHAR? whaaaaaaa pepewow
c++ /** * Get pointer to the string * * @Return Pointer to Array of TCHAR if Num, otherwise the empty string */ FORCEINLINE const TCHAR* operator*() const { return Data.Num() ? Data.GetData() : TEXT(""); } The * operator gives you a pointer to the beginning of the TCHAR array. (edited)
Avatar
jraServerAPI 11/23/2022 8:57 PM
ty
Avatar
blackandbuewolf 11/23/2022 10:05 PM
can i use api when renting server or only dedi servers u can use them on ?
Avatar
blackandbuewolf 11/24/2022 1:55 AM
never mind
Avatar
hello guys i was just now try to check some api files
2:34 PM
to learn more about its structure
2:35 PM
and i found its based on structs i think
2:35 PM
not classes
2:37 PM
i mean why is it is there is any specific reaseon ?
2:37 PM
bec from what i know there is no tech difference between them other than the backward compatibilty with C and the visibilty things
Avatar
Avatar
NT Diesel
i mean why is it is there is any specific reaseon ?
Best guess I got: Maybe it's just to slightly reduce the size of all that generated header code. All those public:s that would be required for classes really add up lol, especially if additional game classes were to be added to the API
Avatar
blackandbuewolf 11/24/2022 4:31 PM
trying to learn this plugin coding, can someone see if this is correct and why i get the error on "kits", the error is: expected '.' instead of ' " '
4:31 PM
"Kits": { "starter": { "DefaultAmount": 2, "Price": 0, "Description": "Starter kit ", "OnlyFromSpawn": true, "Items": ["Quality": 11, "ForceBlueprint": false, "Amount": 1, "Blueprint": "Blueprint'/Game/PrimalEarth/CoreBlueprints/Weapons/PrimalItem_WeaponMetalPick.PrimalItem_WeaponMetalPick'"], "Dinos": [ { "Level": 200, "Blueprint": "Blueprint'/Game/PrimalEarth/Dinos/Argentavis/Argent_Character_BP.Argent_Character_BP'", "SaddleBlueprint": "Blueprint'/Game/PrimalEarth/CoreBlueprints/Items/Armor/Saddles/PrimalItemArmor_ArgentavisSaddle.PrimalItemArmor_ArgentavisSaddle'" 1 100 0, },
Avatar
jraServerAPI 11/24/2022 4:37 PM
use https://jsonlint.com/ to validate your json
JSONLint is the free online validator and reformatter tool for JSON, a lightweight data-interchange format.
Avatar
blackandbuewolf 11/24/2022 4:39 PM
thx
Avatar
blackandbuewolf 11/24/2022 5:15 PM
dont understand this error on the coding
5:16 PM
"Items": "Dinos": [{ "Level": 200, "Blueprint": "Blueprint'/Game/PrimalEarth/Dinos/Argentavis/Argent_Character_BP.Argent_Character_BP'", "SaddleBlueprint": "Blueprint'/Game/PrimalEarth/CoreBlueprints/Items/Armor/Saddles/PrimalItemArmor_ArgentavisSaddle.PrimalItemArmor_ArgentavisSaddle'", },
5:16 PM
Error: Parse error on line 48: ... "Items": "Dinos": [{ "Level": 2 ----------------------^ Expecting 'EOF', '}', ',', ']', got ':'
Avatar
jraServerAPI 11/24/2022 5:57 PM
i would suggest you compare your "kit" config, to the default "kit" config that came with the plugin.. character by character, and you will discover what is wrong.. Are you familiar with json? if not, i would learn that first (edited)
Avatar
blackandbuewolf 11/24/2022 5:59 PM
thx, i love learnings this so thx for the link
Avatar
jraServerAPI 11/24/2022 5:59 PM
google and youtube should be your best friend
5:59 PM
before you come here and ask
5:59 PM
👍
Avatar
blackandbuewolf 11/24/2022 6:01 PM
yeah i do that and fixed the problem i got, only problem i have now is the end of coding, havent touched that either from original, so dont now why i get a error on that one XD
Avatar
ok guys i am justt want to know where does all world objects are stored
6:03 PM
and how can i retrive them back
6:03 PM
if i want to loop over them or so
Avatar
c++ TArray<AActor*> FoundTurrets; UGameplayStatics::GetAllActorsOfClass(ArkApi::GetApiUtils().GetWorld(), APrimalStructureTurret::GetPrivateStaticClass(), &FoundActors); for (const auto& Turret : FoundTurrets) { auto TheTurret= static_cast<APrimalStructureTurret*>(Turret); if (TheTurret) { // do the thing } }
6:17 PM
i think this will work
Avatar
jraServerAPI 11/24/2022 6:33 PM
3389_peepoDetective
Avatar
Avatar
jraServerAPI
3389_peepoDetective
actually i found the function but it was for dinos
6:35 PM
so i will try my luck with it on the turret
6:35 PM
xD
Avatar
jraServerAPI 11/24/2022 6:37 PM
i know haha "do the thing" is what i wrote hahaha
Avatar
I am curious about how to connect the plugin I made to the ark api server
Avatar
jraServerAPI 11/24/2022 6:38 PM
that will work tho
Avatar
xDDDDD omg
6:38 PM
thats huge
6:38 PM
hahaha
Avatar
Avatar
I am curious about how to connect the plugin I made to the ark api server
u have to copy it and put it in the plugins folder of the ark api
Avatar
I downloaded the ark template file from Github, do I have to put all of them in?
Avatar
u have to build it first
Avatar
Can you tell me how to build it..?
Avatar
and get the .dll file and the GxFirstPlugin.pdb
Avatar
where do you get that from?
Avatar
oh i think u have to start learn C++ first
6:41 PM
so u can do it
Avatar
I am new to API connection
6:41 PM
I know how to do c++
Avatar
then just build ur project as u are building c++ dll file
Avatar
Avatar
blackandbuewolf
yeah i do that and fixed the problem i got, only problem i have now is the end of coding, havent touched that either from original, so dont now why i get a error on that one XD
You dropped a closing } or ] most likely
Avatar
Avatar
where do you get that from?
When you build the project you’ll get a dll.
Avatar
so basically when i get the turrets
6:47 PM
how can i get the amount of ammo in the turret ?
Avatar
Should I put the dll inside the plugin folder?
Avatar
Avatar
TheMollusk
Well I took a shot at preventing the Fjordhawk from returning a player's items on respawning because it sounded fun. In any case, all this Fjordhawk stuff is defined in Blueprint graphs that you can view in the ARK Dev Kit. That's where you should go to figure out what you need to change. Open the Fjordhawk_Character_BP_C blueprint in the dev kit. Note the package name when you hover over the blueprint in the Content Browser (/Game/Fjordur/Dinos/Fjordhawk/Fjordhawk_Character_BP), we'll use that in our plugin.
Got it thank you very much.
Avatar
blackandbuewolf 11/24/2022 10:40 PM
this show up on me and server wnt start, yes my coding have no errors on it. tried google and everything.
10:40 PM
[ArkShop][error] [json.exception.type_error.306] cannot use value() with null
Avatar
jraServerAPI 11/24/2022 10:56 PM
something in your config.json is wrong or missing
Avatar
blackandbuewolf 11/24/2022 11:00 PM
yeah but whaaaat XD sent it to a friend who is better than me, if not someone her could see over it
Avatar
hello guys
12:05 PM
i need some help how to know the reason of the crashes ?
12:05 PM
12:05 PM
this is the crash i got
12:05 PM
is there is any way to analyze it
12:06 PM
any tool
12:06 PM
or somthing
12:06 PM
that tell me whats wrong
12:06 PM
and this crash is happens to any player who attemp to join this map
12:06 PM
and only this map
Avatar
blackandbuewolf 11/25/2022 2:43 PM
im playing a little around with the shop coding, but dont get this one : "ascendgen1": { "Type": "playercommand", "Description": "Ascend Genesis 1", "Price": 200000, "MinLevel": 100, "MaxLevel": 190, "Items": [ { "Command": "Genascend3", "DisplayAs": "Gives U Ascension From Genesis 1" } ] },
2:43 PM
cant find any info on this on google or yotube
Avatar
blackandbuewolf 11/26/2022 1:16 PM
do someone here know where i can remove engrams from a mod, tried the game.ini but dont work
Avatar
blackandbuewolf 11/27/2022 5:38 AM
why is this a beginner chat when no one is answering ? this discord channel is not good for any. dont write beginner and no one wanna help the beginners. damn. but dont worry, got a friend that helped me and i understand more now.
Avatar
why are you in a developer's discord and asking on how to setup a plugin's config? Beginners chat is for coders not for issues you have with you fine working plugin that we gave you for you to manage. (edited)
Avatar
is there is a way that i can make a plugin runs specific RCON Command ? (edited)
Avatar
i mean if i have a RCON command that is registred in another plgin
3:32 PM
and i want when i player type specific command in chat
3:32 PM
to execute this RCON command
3:32 PM
after some check that i will create
3:33 PM
what is the way that i can do this ?
Avatar
Avatar
NT Diesel
is there is a way that i can make a plugin runs specific RCON Command ? (edited)
Just to make sure I'm understanding, do you need to run an RCON command (handled through the game's RCON server) or is running a console command (normally typed into the client's game console) sufficient? ArkServerApi handles them differently. It's not uncommon for plugins to register the same commands for RCON and the client console.
Avatar
Avatar
TheMollusk
Just to make sure I'm understanding, do you need to run an RCON command (handled through the game's RCON server) or is running a console command (normally typed into the client's game console) sufficient? ArkServerApi handles them differently. It's not uncommon for plugins to register the same commands for RCON and the client console.
listen i am using certain plugin which makes the orb the plugin wrote by @Lethal
6:12 PM
but i dont want the admin to write the command for the tribe
6:13 PM
i want the player to write the player by him self
6:13 PM
and he will be able to take the protection for only one time
6:13 PM
which i will handle through tribe_id and database
6:13 PM
but the plgin uses RCON command
6:13 PM
lethalorp.raidprotection <add/remove> <tribeid> <hours>
6:14 PM
so i want to execute this rcon command from my plugin whenever a player is typed another chat command
6:14 PM
for example when any playe write eg:- /getmyorb
6:14 PM
it will check on its tribe id which i already did
6:14 PM
if he deserve the protection so trigger this RCOn command
6:15 PM
lethalorp.raidprotection <add/remove> <tribeid> <hours>
Avatar
This is a developer discord not end user support. You cannot do what you are asking for currently as RCON commands are meant for admins not users since you need to be authenticated.
Avatar
Avatar
Lethal
This is a developer discord not end user support. You cannot do what you are asking for currently as RCON commands are meant for admins not users since you need to be authenticated.
if i do my own route handler as if i am using external web server and i made this server send the rcon command it will work right ?
Avatar
I could add a console command which would allow selling a 1 time protection command or something maybe but you can put in a suggestion for it on my discord.
6:18 PM
Sure, but seems like a lot for a simple thing.
Avatar
cannot u share ur source code with us ?
6:19 PM
i mean ur plugin is already open source
Avatar
Avatar
Lethal
Sure, but seems like a lot for a simple thing.
yup
6:19 PM
ok i will post this to ur discord now
Avatar
Free does not mean open source
Avatar
Avatar
Lethal
Free does not mean open source
yup mb but i mean its just for educational purpose xDD
7:03 PM
its ok i am gonna wait ur feature till then i will make my own route for the rcon command
Avatar
I'm not going to comment on specific plugins, but developers certainly have legitimate uses for invoking console/RCON commands based on player actions. I've done both. RCON was a little more involved, I didn't use any shortcuts, just regular RCON protocol. Console commands are easy though. Chat command in Plugin1 invoking console command in Plugin2: c++ // Plugin1.cpp #include "API/ARK/Ark.h" #pragma comment(lib, "ArkApi.lib") void FooCmd(AShooterPlayerController* spc, FString* input, EChatSendMode::Type) { ArkApi::GetApiUtils().SendServerMessage(spc, FColorList::Green, "FOO"); FString result; FString cmd = "bar"; spc->ConsoleCommand(&result, &cmd, false); } extern "C" __declspec(dllexport) void Plugin_Init() { Log::Get().Init("Plugin1"); ArkApi::GetCommands().AddChatCommand("/foo", FooCmd); } extern "C" __declspec(dllexport) void Plugin_Unload() { ArkApi::GetCommands().RemoveChatCommand("/foo"); } c++ // Plugin2.cpp #include "API/ARK/Ark.h" #pragma comment(lib, "ArkApi.lib") void BarCmd(APlayerController* pc, FString*, bool) { ArkApi::GetApiUtils().SendServerMessage((AShooterPlayerController*)pc, FColorList::Green, "BAR"); } extern "C" __declspec(dllexport) void Plugin_Init() { Log::Get().Init("Plugin2"); ArkApi::GetCommands().AddConsoleCommand("bar", BarCmd); } extern "C" __declspec(dllexport) void Plugin_Unload() { ArkApi::GetCommands().RemoveConsoleCommand("bar"); } After typing "/foo" into chat:
Avatar
Avatar
TheMollusk
I'm not going to comment on specific plugins, but developers certainly have legitimate uses for invoking console/RCON commands based on player actions. I've done both. RCON was a little more involved, I didn't use any shortcuts, just regular RCON protocol. Console commands are easy though. Chat command in Plugin1 invoking console command in Plugin2: c++ // Plugin1.cpp #include "API/ARK/Ark.h" #pragma comment(lib, "ArkApi.lib") void FooCmd(AShooterPlayerController* spc, FString* input, EChatSendMode::Type) { ArkApi::GetApiUtils().SendServerMessage(spc, FColorList::Green, "FOO"); FString result; FString cmd = "bar"; spc->ConsoleCommand(&result, &cmd, false); } extern "C" __declspec(dllexport) void Plugin_Init() { Log::Get().Init("Plugin1"); ArkApi::GetCommands().AddChatCommand("/foo", FooCmd); } extern "C" __declspec(dllexport) void Plugin_Unload() { ArkApi::GetCommands().RemoveChatCommand("/foo"); } c++ // Plugin2.cpp #include "API/ARK/Ark.h" #pragma comment(lib, "ArkApi.lib") void BarCmd(APlayerController* pc, FString*, bool) { ArkApi::GetApiUtils().SendServerMessage((AShooterPlayerController*)pc, FColorList::Green, "BAR"); } extern "C" __declspec(dllexport) void Plugin_Init() { Log::Get().Init("Plugin2"); ArkApi::GetCommands().AddConsoleCommand("bar", BarCmd); } extern "C" __declspec(dllexport) void Plugin_Unload() { ArkApi::GetCommands().RemoveConsoleCommand("bar"); } After typing "/foo" into chat:
u use any external plugin for the RCON ?
7:24 PM
i mean any external library ?
7:24 PM
C++ Source RCON implementation. Contribute to Phil25/SourceRCON development by creating an account on GitHub.
Avatar
Behind the scenes ARK executes console commands when an RCON command is received IIRC.
7:32 PM
That is for the built in ARK commands anyways. That doesn't apply to plugin commands.
Avatar
Avatar
Lethal
That is for the built in ARK commands anyways. That doesn't apply to plugin commands.
u mean that triggering ConsoleCommand Can act as RCON command ?
7:33 PM
for native ark commands ?
Avatar
Avatar
NT Diesel
i mean any external library ?
That's what I used. On a separate thread to avoid potential hangs. It was in a Linux plugin though, the GitHub page says it's Unix only.
Avatar
Avatar
TheMollusk
That's what I used. On a separate thread to avoid potential hangs. It was in a Linux plugin though, the GitHub page says it's Unix only.
do u put them in the plugin folder or just include them as the api ?
Avatar
Avatar
NT Diesel
do u put them in the plugin folder or just include them as the api ?
It was compiled directly into my plugin. Like I said though, you'll need a different solution or different library on Windows for ArkServerApi plugins.
Avatar
Avatar
NT Diesel
u mean that triggering ConsoleCommand Can act as RCON command ?
I'm saying native ARK rcon commands are translated and trigger an associated console cheat command behind the scenes.
Avatar
Avatar
TheMollusk
It was compiled directly into my plugin. Like I said though, you'll need a different solution or different library on Windows for ArkServerApi plugins.
how can i make post or put request and wait its response with api is this possible ?
Avatar
Avatar
Lethal
I'm saying native ARK rcon commands are translated and trigger an associated console cheat command behind the scenes.
oh i see
7:42 PM
i can handle the rcon on my node.js server
7:42 PM
there is a package for this
Avatar
Plugin RCON commands do not map like that and the plugin needs to create handlers for both RCON and Console and can make the RCON code execute the console version of it. But not all commands make sense to use as both so for instance I have some commands that are console only and some that are rcon only and others that are both.
✅ 1
Avatar
Avatar
Lethal
Plugin RCON commands do not map like that and the plugin needs to create handlers for both RCON and Console and can make the RCON code execute the console version of it. But not all commands make sense to use as both so for instance I have some commands that are console only and some that are rcon only and others that are both.
oh i got it noww
7:43 PM
i have another problem
7:43 PM
API::Requests::Get().CreateGetRequest this function
7:43 PM
gives me error
7:44 PM
does it changed by any means ?
Avatar
What error?
Avatar
#include <Requests.h>
Avatar
same error
7:47 PM
7:48 PM
Avatar
Try API::Requests::Get().CreateGetRequest()
Avatar
Avatar
Lethal
Try API::Requests::Get().CreateGetRequest()
yup it works thanks
Avatar
guys does Turret.stasis() make the turret inactive or in off state ? (edited)
10:27 PM
which means wont attack any target ?
Avatar
jraServerAPI 11/27/2022 10:28 PM
turret targeting is actually controlled on the Players and dinos, what are you trying to do?
Avatar
i want to set the turret to sleep state
10:28 PM
which will make them wont attack any target
10:29 PM
i am creating my own turret manager
10:29 PM
with help of great guy @dougy open source filler turret i managed to get some ideas that helped with the auto filler
Avatar
jraServerAPI 11/27/2022 10:29 PM
You need to turn off targetting on the players/dinos etc...
Avatar
u mean using BPTurretPreventsTargeting ?
Avatar
A lot of the turret stuff is implemented in Blueprint, might need to investigate in the dev kit. I believe the Stasis() function is called on actors that go into stasis when there are no players within render distance (some distance at least, idk the details) of the turret, which probably isn't what you want. (edited)
Avatar
Avatar
NT Diesel
u mean using BPTurretPreventsTargeting ?
jraServerAPI 11/27/2022 10:32 PM
no, bPreventTargetingByTurrets
Avatar
Avatar
jraServerAPI
no, bPreventTargetingByTurrets
but this will apply the state on all turrets in the game right ?
10:34 PM
not only specific turrets
Avatar
Avatar
NT Diesel
but this will apply the state on all turrets in the game right ?
jraServerAPI 11/27/2022 10:34 PM
this is a boolean on the player and dinos
10:35 PM
it tells the turrets not to shoot at it
Avatar
Avatar
jraServerAPI
it tells the turrets not to shoot at it
but it tells all turrets
10:35 PM
not specific turret
Avatar
jraServerAPI 11/27/2022 10:35 PM
I'm not aware of a way to stop the turrets from shooting any other way.. unless you remove the ammo
Avatar
Avatar
NT Diesel
but it tells all turrets
jraServerAPI 11/27/2022 10:36 PM
yup
Avatar
give alook into BPTurretPreventsTargeting
10:37 PM
TheTurret->BPTurretPreventsTargeting()
10:38 PM
but it takes APrimalCharacter which means i have to pass all dinos and all players or is there is any way to pass all struct members at once
Avatar
jraServerAPI 11/27/2022 10:39 PM
i would test it out on 1 dino first..
10:39 PM
to make sure it works
Avatar
i dont think its the one i need
10:43 PM
bec it will only disable it
10:43 PM
and there is no way to enable it
10:43 PM
there is an option in the native game
10:43 PM
when press to E to set the turret to on and off
10:44 PM
oh i found it (edited)
10:44 PM
c++ TheTurret->IsValidToFire(true) // to make it on TheTurret->IsValidToFire(false) // to make it off (edited)
10:47 PM
and for selecting specific targets to be valid
10:47 PM
i think i can use hook
10:49 PM
c++ DECLARE_HOOK(APrimalStructureTurret_SetTarget, void, APrimalStructureTurret*, AActor*); void Hook_APrimalStructureTurret_SetTarget(APrimalStructureTurret* _this, AActor* aTarget) { if(){// check if the target is within specific class eg dino return APrimalStructureTurret_SetTarget_original(_this, aTarget); } else{ return 0; } } ArkApi::GetHooks().SetHook("APrimalStructureTurret.SetTarget", &Hook_APrimalStructureTurret_SetTarget, &APrimalStructureTurret_SetTarget_original);
Avatar
jraServerAPI 11/27/2022 11:03 PM
you can try it, but i think that hook gets called every tick, so it's pretty busy
Avatar
bPreventTargetingByTurrets you set on each turret.
Avatar
Avatar
Lethal
bPreventTargetingByTurrets you set on each turret.
Example please
11:06 PM
If i have turret stored in Turret variable
Avatar
Turret->bPreventTargetingByTurrets().Set(true);` (edited)
Avatar
jraServerAPI 11/27/2022 11:08 PM
but that's not a property for turrets or structures, only players and dinos
Avatar
oh true
Avatar
Its for characters only i think
Avatar
jraServerAPI 11/27/2022 11:09 PM
Just grab all the player and dino actors in the world and set that bool when you want to disable and enable turrets
Avatar
Avatar
jraServerAPI
you can try it, but i think that hook gets called every tick, so it's pretty busy
Every tick ?
11:10 PM
Thats bad
Avatar
jraServerAPI 11/27/2022 11:10 PM
it is
Avatar
Avatar
jraServerAPI
Just grab all the player and dino actors in the world and set that bool when you want to disable and enable turrets
What if new player join
11:10 PM
Then i have to use hook for this
Avatar
jraServerAPI 11/27/2022 11:11 PM
there's a hook for that
Avatar
And add this player to the TArray
11:11 PM
Or wait
Avatar
jraServerAPI 11/27/2022 11:11 PM
also when dinos spawn..Begin Play hook
Avatar
Just prevent its targeting
Avatar
jraServerAPI 11/27/2022 11:11 PM
yep
11:11 PM
start coding
11:11 PM
get your hands dirty
11:11 PM
test test test
Avatar
I hate C++ xD
Avatar
jraServerAPI 11/27/2022 11:12 PM
thats what we all do.. gatta figure it out 🙂
Avatar
Avatar
jraServerAPI
thats what we all do.. gatta figure it out 🙂
But i will try C++c++ TheTurret->IsValidToFire(true) // to make it on TheTurret->IsValidToFire(false) // to make it off First
Avatar
jraServerAPI 11/27/2022 11:15 PM
good luck! 😆
😂 1
Avatar
Avatar
jraServerAPI
good luck! 😆
Really thanks for ur time bro ❤️
Avatar
guys i just wanna ask question but i think its silly one
12:36 PM
c++ //this is my .h file TArray<ProtectedBase> AllProtectedBases = TArray<ProtectedBase>();
12:37 PM
how to add a new element to this array in my init.cpp and make this element exist in all other .cpp files
12:37 PM
shall i do c++ AllProtectedBases.Emplace(MyBase);
12:37 PM
only ?
12:37 PM
or shall i use the reference operator ?
12:38 PM
c++ &AllProtectedBases.Emplace(MyBase);
12:38 PM
like this
Avatar
Can we nest TMaps ?
Avatar
Avatar
NT Diesel
Can we nest TMaps ?
Yes
✅ 1
6:06 PM
A TMap is just a map of any Types
Avatar
Avatar
NT Diesel
shall i do c++ AllProtectedBases.Emplace(MyBase);
Use this
Avatar
Avatar
substitute
Use this
Thanks bro
Avatar
Avatar
substitute
A TMap is just a map of any Types
Nvm i am gonna create TMap of TArray of struct i think it will do the job for me
9:02 PM
Not Tmap of Tmap
Avatar
Avatar
NT Diesel
its ok i am gonna wait ur feature till then i will make my own route for the rcon command
I posted an update to ORP
❤️ 1
Avatar
Avatar
Lethal
I posted an update to ORP
Thanks bro
Avatar
whats wrong here ?
Avatar
I don’t know, you didn’t post anything
Avatar
oh sry
5:38 PM
i removed it
5:38 PM
xD
Avatar
Avatar
substitute
I don’t know, you didn’t post anything
will u update ur template to not use the dll main method ? (edited)
5:39 PM
and use this instead ?
5:39 PM
c++ extern "C" __declspec(dllexport) void Plugin_Init() { ... } extern "C" __declspec(dllexport) void Plugin_Unload() { ... }
5:43 PM
is there a way to check if the damage causer is NPC or wild character or not ?
5:45 PM
and what is the EventInstigrator is ?
5:45 PM
5:45 PM
here
Avatar
Avatar
NT Diesel
will u update ur template to not use the dll main method ? (edited)
I will eventually but that’s not really a priority to me
6:03 PM
You’re welcome to make a PR
Avatar
Avatar
NT Diesel
and what is the EventInstigrator is ?
No that’s the controller
6:04 PM
Use the damage causer arg
Avatar
Avatar
substitute
No that’s the controller
So u mean i shouldnt take it on my mind ?
Avatar
c++ float Hook_AActor_TakeDamage(AActor* _this, float DamageAmount, FDamageEvent* DamageEvent, AController* EventInstigator, AActor* DamageCauser) { //how to get the location of the _this ? }
8:17 PM
is there is a way to get the location of an AActor ?
8:21 PM
c++ float Hook_AActor_TakeDamage(AActor* _this, float DamageAmount, FDamageEvent* DamageEvent, AController* EventInstigator, AActor* DamageCauser) { Log::GetLog()->info(" {} Triggered ", "Hook"); if (_this) { AShooterPlayerController* DamagedPlayer; FVector PPosition; if (_this->IsA(AShooterPlayerController::StaticClass())) { Log::GetLog()->info(" damage reciever is Player "); DamagedPlayer = (AShooterPlayerController*)_this; PPosition = ArkApi::GetApiUtils().GetPosition(DamagedPlayer); } else { PPosition = _this->DefaultActorLocationField(); Log::GetLog()->info(" damage reciever is Not Player "); } } } (edited)
8:21 PM
what is wrong here ?
8:21 PM
its printing that the damage reciever is not player
8:22 PM
while the damage reciever actually is a player
8:24 PM
_this might not be a AShooterPlayerController? did you try AShooterCharacter?
Avatar
Avatar
jraServerAPI
_this might not be a AShooterPlayerController? did you try AShooterCharacter?
i tried with APlayerController
8:25 PM
same issue
Avatar
let me ask if the _this was dino or any animal will this c++ auto player = static_cast<AShooterCharacter*>(player_controller->CharacterField());
8:28 PM
wont replicate error ?
8:28 PM
as far as my info i think it will
8:28 PM
right ?
Avatar
The damage maker isn't the player 😉
1:29 AM
I mean...sure if he use his fists (edited)
Avatar
Avatar
Foppa
The damage maker isn't the player 😉
What do u mean?
Avatar
any help ?
12:10 PM
12:10 PM
while i try to build the plugin using mysql
12:10 PM
i copied the premission mysql files and includes
12:11 PM
12:12 PM
12:12 PM
12:12 PM
12:13 PM
12:13 PM
12:13 PM
thats the files i include and the lib files
12:13 PM
but it gives me strange err
12:13 PM
any help ?
Avatar
Avatar
NT Diesel
Click to see attachment 🖼️
this is the err
Avatar
or does any one have a good template with ark api and the mysql like the one that @substitute have ?
2:17 PM
so i can use it
2:18 PM
but it will be better if its for vs2022
Avatar
You will need to look at ArkShop for that.
Avatar
Avatar
Lethal
You will need to look at ArkShop for that.
Actually i copied all ark shop includes and lib folder
2:43 PM
And copied the structure of the IDatabase and MySql
2:43 PM
And i got this error
2:43 PM
It only appear on building
Avatar
Include mysql++11.h to your project
Avatar
Avatar
Foppa
Include mysql++11.h to your project
actually i did include it
7:22 PM
let me show u
7:22 PM
7:22 PM
i am including this file
7:22 PM
7:23 PM
and in it i include the mysql++11.h
Avatar
include it as a part of files
Avatar
Avatar
Foppa
include it as a part of files
u mean in the headers option in workspace properties ?
7:28 PM
as in your solution of files 🙂
Avatar
same error
Avatar
printscreen?
Avatar
And your solution settings
7:34 PM
Avatar
any one got any idea ?
Avatar
Well first you should put the Ark header include in your IDB header
8:55 PM
also look in arkshop or permission plugin for reference
Avatar
the problem is i am using the same build for every thing as permission
8:56 PM
but my vs is 2022
8:56 PM
i also tried to lower my setting of my vs to 2019
Avatar
That's not a problem
Avatar
and still same error
8:57 PM
can u make template with arkapi and mysql or something like this ?
Avatar
you already have them?
Avatar
i have the template of @substitute
8:58 PM
but my problem is in mysql
8:58 PM
cannot get it to work
8:58 PM
but i have created some plugins without mysql
8:58 PM
and its working
Avatar
well it indicates an error in a file from the mysql includes, perhaps tidy up your includes (edited)
9:00 PM
Also another thing, try drag the whole folder of files for mysql
9:00 PM
could solve some cases 🙂
Avatar
omg
9:02 PM
the problem was in the order of includes
9:02 PM
wtf
Avatar
yes, it can confuse the compiler sometimes 🙂
Avatar
thanks bro ❤️
Avatar
guys what is the best way to store FVector to mysql database? (edited)
Avatar
is there is any other way than saving the x, y, z each indvidually ?
Avatar
Easiest way is to save a string with x,y,z separated with a comma each, so then you can split with , separator and parse the floats with std::stof, for example
Avatar
Avatar
Pelayori
Easiest way is to save a string with x,y,z separated with a comma each, so then you can split with , separator and parse the floats with std::stof, for example
the problem is the FVector compononets are large
11:12 PM
i cant even print them with ARK API Log (edited)
Avatar
That doesn't matter. You could truncate them to 2 decimal places
11:12 PM
FVector::ToString does it, for example
Avatar
FVector::ToString separate them with commas or spaces or what ?
Avatar
ToString formats it like: X=xxx Y=yyy Z=zzz or so, you can look it up
11:14 PM
FString::Printf("X=%3.3f Y=%3.3f Z=%3.3f", X, Y, Z); that's what it does (edited)
Avatar
so i can replace the white spaces with commas
11:16 PM
and then remove X, Y, Z and equals
11:16 PM
and save this value to the database
11:16 PM
then on i will split on the commas
Avatar
Yes, you could. I would as well remove X=, Y= and Z= strings so you don't have excess characters
Avatar
Avatar
NT Diesel
then on i will split on the commas
Basically, that'd be an easy implementation
Avatar
let me write the code and check if i could write or not
Avatar
Avatar
Pelayori
Basically, that'd be an easy implementation
c++ FString pos = position.ToString(); pos.Replace(L"x", L""); pos.Replace(L"y", L""); pos.Replace(L"z", L""); pos.Replace(L"=", L""); pos.Replace(L" ", L",");
11:26 PM
what do u think?
Avatar
c++ db_.query(fmt::format("SELECT steamid, position, radius, startdate, enddate FROM {}", table_protections_)).each([](int tribeid, const FString* position, FString radius, time_t startdate, time_t enddate) { // there might be problem bec of FString of position and radius here TArray<FString> parsed; position->ParseIntoArray(parsed, L",", true); FVector BPosition = FVector(FCString::Atof(*parsed[0]), FCString::Atof(*parsed[1]), FCString::Atof(*parsed[2])); ProtectedBase MyBase(BPosition, FCString::Atof(*radius), tribeid, startdate, enddate); AllProtectedBases.Emplace(MyBase); return true; });
11:41 PM
is this good way to do this ?
11:42 PM
note the position and radius are of type varchar in data base
11:47 PM
i am new to mysql in c++
11:47 PM
but i dont know how to set the type of the coming values
Avatar
Avatar
Pelayori
Easiest way is to save a string with x,y,z separated with a comma each, so then you can split with , separator and parse the floats with std::stof, for example
I would store them as three decimal numbers
5:58 AM
Truncating reduces accuracy
5:59 AM
Strings are also slow in database terms
Avatar
Avatar
substitute
I would store them as three decimal numbers
Does this reduce will be visible to players ?
Avatar
And will be more enough
Avatar
Dude, there’s this incredible feature called “search” and “google”
4:47 PM
We’ve helped a ton but you gotta put in the leg work to figure stuff out on your own too
Avatar
Avatar
substitute
Dude, there’s this incredible feature called “search” and “google”
Bro i actually finished the job
4:53 PM
Its my bad that i dont remove the question when i find the answer
Avatar
Avatar
NT Diesel
Its my bad that i dont remove the question when i find the answer
If you found an answer to your question, you should mention that you were able to solve it and share your solution for future readers
Avatar
Avatar
substitute
If you found an answer to your question, you should mention that you were able to solve it and share your solution for future readers
ok i will post what the problems that i remember now
5:13 PM
how can i get the steam id from the playerstate Edited: This is How I did it c++ bool Hook_AShooterPlayerState_AddToTribe(AShooterPlayerState* _this, FTribeData* MyNewTribe, bool bMergeTribe, bool bForce, bool bIsFromInvite, APlayerController* InviterPC) { AShooterPlayerController* playercontroller = static_cast<AShooterPlayerController*>(_this->GetOwnerController()); uint64 steamid = ArkApi::IApiUtils::GetSteamIdFromController(playercontroller); return AShooterPlayerState_AddToTribe_original(_this, MyNewTribe, bMergeTribe, bForce, bIsFromInvite, InviterPC); } (edited)
Avatar
jraServerAPI 12/7/2022 4:39 PM
Stack Size Overrides: Are these values stored somewhere separately and not in the item? Because when I check the UPrimalItem::MaxItemQuantityField() of one of these items in my inventory, it returns the default/vanilla values for some reason (100) and not 1000 like I would expect. Thanks 🙂 (edited)
Avatar
Avatar
jraServerAPI
Stack Size Overrides: Are these values stored somewhere separately and not in the item? Because when I check the UPrimalItem::MaxItemQuantityField() of one of these items in my inventory, it returns the default/vanilla values for some reason (100) and not 1000 like I would expect. Thanks 🙂 (edited)
it might be a game setting, so probably not stored in the item itself
Avatar
Avatar
jraServerAPI
Stack Size Overrides: Are these values stored somewhere separately and not in the item? Because when I check the UPrimalItem::MaxItemQuantityField() of one of these items in my inventory, it returns the default/vanilla values for some reason (100) and not 1000 like I would expect. Thanks 🙂 (edited)
ArkServerApi provides TArray<FItemMaxItemQuantityOverride>& AShooterGameState::OverrideItemMaxQuantityField(), which I would guess is where the Game.ini overrides are held. FItemMaxItemQuantityOverride isn't defined though, so you've got a little extra work to do. (edited)
Avatar
Avatar
TheMollusk
ArkServerApi provides TArray<FItemMaxItemQuantityOverride>& AShooterGameState::OverrideItemMaxQuantityField(), which I would guess is where the Game.ini overrides are held. FItemMaxItemQuantityOverride isn't defined though, so you've got a little extra work to do. (edited)
jraServerAPI 12/7/2022 6:21 PM
nice, i will investigate..tyvm
Avatar
Avatar
jraServerAPI
nice, i will investigate..tyvm
Or there's also TArray<FConfigMaxItemQuantityOverride>& AShooterGameMode::ConfigOverrideItemMaxQuantityField()
Avatar
Avatar
jraServerAPI
Stack Size Overrides: Are these values stored somewhere separately and not in the item? Because when I check the UPrimalItem::MaxItemQuantityField() of one of these items in my inventory, it returns the default/vanilla values for some reason (100) and not 1000 like I would expect. Thanks 🙂 (edited)
UPrimalItem::GetMaxItemQuantity(UWorld* world) does that too
👍 1
Avatar
Avatar
Pelayori
UPrimalItem::GetMaxItemQuantity(UWorld* world) does that too
jraServerAPI 12/7/2022 7:19 PM
I almost tried that earlier, but assumed it was just going to give me the same value as MaxItemQuantityField so i didnt try
7:19 PM
🤦‍♂️
Avatar
It does not
7:19 PM
It takes in account overrides, at least that is what I had tested
Avatar
jraServerAPI 12/7/2022 7:19 PM
son of a .. thank you very much
Avatar
Let me re-verify it but I'm pretty confident
Avatar
jraServerAPI 12/7/2022 8:21 PM
no worries, I can verify for you 🙂 It Works!
Avatar
i am trying to find all eggs on the map using GetAllActorsOfClass
2:25 PM
UGameplayStatics::GetAllActorsOfClass(world, ADroppedItemEgg::StaticClass(), FoundActors); only fiends one egg
2:26 PM
those are not found. Does eggs dropped by matting need something especial?
Avatar
I think I had to use ADroppedItem because item egg wouldn’t find eggs properly
Avatar
i've used ADroppedItem, it also does not find those eggs
2:27 PM
i've used ADroppedItem in the past and it worked
2:28 PM
I don't know when it stopped
2:29 PM
do you knwo if it is possible to use ServerOctreeOverlapActors to find eggs? EServerOctreeGroup does not have a enum for eggs!
Avatar
hello friends
2:49 PM
i was missing with Damage Hook making something like kill feed
2:50 PM
is there there is any way that i can get the item that has been used to damage the player (edited)
2:50 PM
eg:- weapon name
2:50 PM
or weapon blueprint
2:50 PM
or something like this (edited)
2:53 PM
ok got it
2:53 PM
c++ AShooterCharacter* playerChar = player->LastControlledPlayerCharacterField(); AShooterWeapon* weapon = playerChar->CurrentWeaponField(); (edited)
Avatar
hello guys is there is any way for Getting the blue print of the item that respawned specific structure
Avatar
structure->ConsumesPrimalItemField().uClass will give you the class of the item
2:08 PM
then you can just call api utils get class blueprint function
Avatar
thank u very much
Avatar
regarding Hook_AActor_TakeDamage is there is any huge diff between the event instigator and damage causer ?
2:21 PM
or just use the damage causer ?
2:21 PM
bec based on what i have understood there is no huge difference and there are some time where event inst is null but the damage causer is never null
Avatar
The event instigator can be null if the damage wasn't caused by a controller (player/ai controller). The damage causer could also be null, but in less cases. It depends on what you need. If you need the actor of the damage go with the damage causer, if you need the player who did it (like steamId, etc) go with event instigator
Avatar
Avatar
Pelayori
The event instigator can be null if the damage wasn't caused by a controller (player/ai controller). The damage causer could also be null, but in less cases. It depends on what you need. If you need the actor of the damage go with the damage causer, if you need the player who did it (like steamId, etc) go with event instigator
so u mean the instigator is null if the damage was eg from turret right ?
2:28 PM
if i want to get all things for example turrets, c4 players and dino
2:28 PM
i should relay on the damage causer
2:28 PM
bec its wider
Avatar
Yes, the damage causer tends to be wider
✅ 1
Avatar
Avatar
Pelayori
Yes, the damage causer tends to be wider
Pelayori do you know matisse?
11:04 PM
and also is there someone who knows an good plugin for kill rewards that worksv
Avatar
I know him, yes
Avatar
Ah he told me about you is it right you made the subzero server watermark mod?
Avatar
Could you actually help me a bit with that because from the point that you buff it the buff automatically closes it i think
11:20 PM
And do you know an good stats/ killrewards system that works?
Avatar
Yes, sure dm me
Avatar
Avatar
aapje
And do you know an good stats/ killrewards system that works?
Lethal Quests you can look at on my discord which may be what you are looking for.
👍 1
Avatar
50 dollar 🙂
lul 1
Avatar
void TestRconDestroy(RCONClientConnection* rcon_connection, RCONPacket* rcon_packet, UWorld* world) { int tribeTeamId = 1231188679; UShooterCheatManager* scm = ArkApi::GetApiUtils().GetCheatManager(); //scm->DestroyStructures();// work scm->DestroyTribeIdStructures(tribeTeamId); // not work } DestroyTribeIdStructures can't be used here?
Avatar
The syntax looks good, are you sure that tribe is is attached to something?
7:08 PM
Its works
7:10 PM
🤔 I'm curious
Avatar
Avatar
Pelayori
The syntax looks good, are you sure that tribe is is attached to something?
jraServerAPI 12/20/2022 7:43 PM
i think they have to be set to admin via code first
7:44 PM
like the shop does
Avatar
He's executing it from the global cheat manager
7:44 PM
But yeah it seems it can only be executed from a player
7:45 PM
Avatar
You could do something like: APlayerController* PC = ArkApi::GetApiUtils().GetWorld()->GetFirstPlayerController(); if (!PC) return; UShooterCheatManager* scm = ArkApi::IApiUtils::GetCheatManagerByPC((AShooterPlayerController*)PC); scm->DestroyTribeIdStructures(tribeTeamId);
7:51 PM
That will get the first online player it found, and execute it from there, if you want to avoid doing the loop yourself
Avatar
Thank you!
Avatar
Is there a way to get the unique id of an Actor(structure or dino) and use this id in another command such RCON to destroy it?
Avatar
You can get the structure Id, but I don't think there's an already made rcon command to destroy an structure by id (edited)
Avatar
Avatar
Pelayori
You can get the structure Id, but I don't think there's an already made rcon command to destroy an structure by id (edited)
AddRconCommand?
5:49 PM
I didn't find any way to find Actor by id.(ShooterGameMode or UWorld ?)
5:52 PM
Do not use loops.
5:58 PM
Oh ! I'll try this
5:58 PM
Avatar
🤔 nullptr
7:07 PM
structure->StructureIDField(); I get id from this, APrimalStructure* ps = APrimalStructure::GetFromID(ArkApi::GetApiUtils().GetWorld(), sid); 'ps' is nullptr
Avatar
do we have hook for survival of the fittest that fired when the match is ended ? (edited)
Avatar
FString result; player->ConsoleCommand(&result, &fcommand, true); For command I execute using ConsoleCommand the result is always empty. Is there any other way to execute commands and get the output?
Avatar
jraServerAPI 1/2/2023 4:39 AM
what is the command? are you sure there is a result passed back from the command?
Avatar
Avatar
jraServerAPI
what is the command? are you sure there is a result passed back from the command?
command from the ark shop like "AddPoints 76561198045819962 10000" there is a output on rcon, i dont know if there is a output in console. maybe that is the problem
Avatar
yep, just check ark shop source, console version does no return anything, rcon version does
Avatar
I am trying to find a way to execute RCON commands from the API. Perhaps some kind soul can point me in the right direction? The only alternative I've could think of is to make a RCON client inside the plugin.
Avatar
You can actually make ur own webserver and send a request via api to it so u can make rcon command
8:26 PM
U can easily make it with express js and nodejs as backend server
8:27 PM
And use any plugin that allow u to contact with rcon through node js
8:29 PM
A good module for ur express is node-rcon (edited)
8:30 PM
This is the only way i know that allows you executing rcon command
Avatar
I want to execute rcon commands from inside the plugin
8:57 PM
i thing the URCONServer on ark api is no complete, I am trying figure it out on the dev kit
Avatar
Avatar
Uaca
I want to execute rcon commands from inside the plugin
i have looked about those things before and the only way i found is through making the plugin send some request to my web server and from the web server i can then execute the rcon command
Avatar
Avatar
NT Diesel
You can actually make ur own webserver and send a request via api to it so u can make rcon command
Don’t do this
11:01 PM
This is a security nightmare
Avatar
i think not if u did it right way with right encrypted changing security tokens
Avatar
I already have a rcon client that executes the commands, but that is outside the plugins, I want to execute any command on the plugin and log the output
Avatar
using UShooterCheatManager as exemple, the struct has a declaration void GMBuff() { NativeCall<void>(this, "UShooterCheatManager.GMBuff"); } my understand from other languages is that I can extend the UShooterCheatManager and override the GMBuff method. Does this works when using de Ark Api?
Avatar
Avatar
Uaca
using UShooterCheatManager as exemple, the struct has a declaration void GMBuff() { NativeCall<void>(this, "UShooterCheatManager.GMBuff"); } my understand from other languages is that I can extend the UShooterCheatManager and override the GMBuff method. Does this works when using de Ark Api?
I'm not sure with a void function, the original function may already been returned.
Avatar
Avatar
Uaca
using UShooterCheatManager as exemple, the struct has a declaration void GMBuff() { NativeCall<void>(this, "UShooterCheatManager.GMBuff"); } my understand from other languages is that I can extend the UShooterCheatManager and override the GMBuff method. Does this works when using de Ark Api?
substitute 1/7/2023 2:50 PM
You should be able to hook it
Avatar
I was able to hook. I was trying to mock a few functions
11:26 PM
Will the ARK Server API work on a system other than windows? https://ark-server-api.com/forums/resources/ark-server-api.12/ (edited)
11:26 PM
Avatar
No. ARK Server API relies on using the windows PDB
11:29 PM
Thx
Avatar
hey ho Guys .. can anybody tell me what is the last version from ARKApi? i have load the 3.54 and i see on Gameserverhub 3.55 but when i show in the zip file the files are older as the 3.54 what i have
Avatar
It's incorrectly showing 3.54, but if you have the updating function running before api start, you should have the latest
Avatar
yes its enable 🙂
10:28 PM
thx
Avatar
Hi, I have a small question I am sending a HttPostRequest and I need to evaluate the response of this request but I am not quite sure how to do this, any ideas would be of great help.
Avatar
Avatar
Berus
Hi, I have a small question I am sending a HttPostRequest and I need to evaluate the response of this request but I am not quite sure how to do this, any ideas would be of great help.
What have you tried
Avatar
Avatar
Berus
Hi, I have a small question I am sending a HttPostRequest and I need to evaluate the response of this request but I am not quite sure how to do this, any ideas would be of great help.
Do you have an example on what you are trying to do?
Avatar
Hi, sorry I just got off work. I recently made a mod that does the same thing I want to do now with the plugin I don't know if it will work for you as an example. However, a bit of context would be that I am using HTTPPostRequest to send something to an api, this api when it receives the data returns a status to inform the user if the process was successful, then I want to somehow evaluate that status in the request response so I can return to the player a message that the process was successful or otherwise an error occurred.
Avatar
Dodo Enthusiast 1/29/2023 12:10 AM
Hey, I'm trying to give better taming to single players. The only real approach i could come up with was to change the affinity a dino needs but I can only tell which team knocked it out not the specific player. Before I try to build something more complicated that would try to track who attacks what I just wanted to ask if I maybe overlooked some simpler solution.
Avatar
Dodo Enthusiast 1/29/2023 12:44 AM
In case someone is wondering, there is an OwningPlayerIDField and OwningPlayerNameField on APrimalDinoCharacter but that was empty for me if the player is in a tribe.
Avatar
jraServerAPI 1/29/2023 12:54 AM
I'm not sure if it tracks the player that knocked it down
Avatar
Dodo Enthusiast 1/29/2023 1:20 AM
Maybe there is another way to achieve my goal but I could not really find other ways to influence the taming process which would not be server wide.
Avatar
Avatar
jraServerAPI
I'm not sure if it tracks the player that knocked it down
You could probably figure out the person that KO'ed a dino based on when the dino switches to KO'ed state and the last damage causer
👍 1
Avatar
Avatar
substitute
You could probably figure out the person that KO'ed a dino based on when the dino switches to KO'ed state and the last damage causer
Dodo Enthusiast 1/29/2023 3:47 AM
That works and is exactly what I needed. Thank you.
Avatar
Why can’t I see the tutorial section anymore?
Avatar
Avatar
Wanheda
Why can’t I see the tutorial section anymore?
Check #deleted-channel
Avatar
Avatar
Pelayori
Check #deleted-channel
I don’t see it? I only see beg, int and adv
Avatar
That channel is unlocked for all roles
Avatar
I can send ss there isn’t one for me?
Avatar
Avatar
Pelayori
That channel is unlocked for all roles
Avatar
Try selecting ark
Avatar
Avatar
Pelayori
Try selecting ark
It removed role
Avatar
@GSH | MrOwlSky
Avatar
Added it back and nothing
Avatar
Avatar
Wanheda
Added it back and nothing
GSH | MrOwlSky 1/30/2023 4:44 PM
Check now
Avatar
Avatar
GSH | MrOwlSky
Check now
Thank you
Avatar
GSH | MrOwlSky 1/30/2023 4:44 PM
No problem, Did that fix it?
4:45 PM
awe member role
Avatar
cowboy1999 2/1/2023 1:48 AM
so it says on my server i need to enable the server api how and where do i find where to enable it
Avatar
Does anyone know why only Korean servers are not showing up in the server list?
Avatar
Avatar
돌드민
Does anyone know why only Korean servers are not showing up in the server list?
everyone has this problem Eu players dont see eu servers only usa/asian
Avatar
Avatar
Natsu
everyone has this problem Eu players dont see eu servers only usa/asian
Aha thank you
Avatar
Avatar
돌드민
Aha thank you
Ark seems to have changed a setting in the last update 😦
Avatar
Avatar
Natsu
Ark seems to have changed a setting in the last update 😦
Well, that's an error, right?
Avatar
Avatar
돌드민
Well, that's an error, right?
haha i hope so
Avatar
haha me too
Avatar
can someone give me a example of player_controller->GiveItem?
Avatar
Avatar
Loki
can someone give me a example of player_controller->GiveItem?
try using CTRL+F
Avatar
Avatar
SR
try using CTRL+F
i have another dude, i cant find the answer, how i can call a void when do a command like /dropinv with for example void test(UPrimalInventoryComponent * inv){} if i do ArkApi::GetCommands().AddChatCommand("/t", &test); i get
Avatar
This is why a strong knowledge of C++ is a requirement.
1:56 AM
The function signature of your test function does not match what is expected.
Avatar
Avatar
Frigoff
The function signature of your test function does not match what is expected.
i know how i can call a func with UPrimalInventoryComponent * inv when player do a command
1:59 AM
or how i can use UPrimalInventoryComponent * inv
Avatar
jraServerAPI 2/8/2023 2:00 AM
Look at the examples, and how chat commands work.. You do not have the correct function signature for test, as explained previously.
Avatar
Any knows how i can "TransferAllItemsToInventory" from a dead player bag to my inv?
Avatar
jraServerAPI 2/8/2023 3:52 AM
sure, basically you must retrieve a pointer to the death bag that exists in the world, then read it's inventory component/items and transfer those items to your target inventory component
3:53 AM
search for MyInventoryComponentField you'll find many uses in here..
Avatar
Avatar
jraServerAPI
sure, basically you must retrieve a pointer to the death bag that exists in the world, then read it's inventory component/items and transfer those items to your target inventory component
And how exactly i can find death bag inventory? I maked it with player inventory but i cant reference a player own death bag
5:49 AM
and i dont find answer in cntrl+f
Avatar
jraServerAPI 2/8/2023 5:52 AM
search for UGameplayStatics::GetAllActorsOfClass
catok 1
Avatar
hello, on ARK DEV KIT i want create a buttom to get a item to the player inventory who can help me ? i have creat the menu and the buttom i juste want to click and get item (for exemple pickaxe) to the player inventory
Avatar
(AllEngrams is the name of the plugin)
Avatar
jraServerAPI 2/8/2023 6:23 PM
Before you use a value.. you should probably test it first to make sure you got a value and not a nullptr
Avatar
Avatar
jraServerAPI
Before you use a value.. you should probably test it first to make sure you got a value and not a nullptr
how i can check the type of a value? sorry for the a lot of questions.
6:39 PM
also in case of it is null, how i can get the CurrentResourceCount of a bag?
Avatar
Original message was deleted or could not be loaded.
TheMollusk 2/8/2023 6:41 PM
APrimalStructureItemContainer doesn't have a property named "CurrentResourceCount". You want to get the UPrimalInventoryComponent associated with the bag and get the item count from that. Something like int count = bag->MyInventoryComponentField()->GetCurrentNumInventoryItems(); where "bag" is a APrimalStructureItemContainer. Also, there's no reason to use UObject::FindProperty() or UProperty::Get()/Set() unless you're working with Blueprint generated classes. APrimalStructureItemContainer and UPrimalInventoryComponent are native classes. Just use the definitions in the API headers to access properties, those accessor functions are faster.
Avatar
Really thanx for your answer
6:43 PM
belugahappy
Avatar
Avatar
warneur
hello, on ARK DEV KIT i want create a buttom to get a item to the player inventory who can help me ? i have creat the menu and the buttom i juste want to click and get item (for exemple pickaxe) to the player inventory
substitute 2/8/2023 7:48 PM
This isn’t the discord for the devkit
7:48 PM
Please use the modding discord
Avatar
Avatar
Loki
Really thanx for your answer
substitute 2/8/2023 7:50 PM
You should avoid get all actors of class if you can
7:50 PM
It’s extremely slow
7:50 PM
The better option is to track the structures via beginplay and destroy
Avatar
Avatar
substitute
You should avoid get all actors of class if you can
yes i doed that
Avatar
Avatar
substitute
You should avoid get all actors of class if you can
yk what is the Primal for dead bodies? i cant find dead bodys in APrimalStructureItemContainer
Avatar
Avatar
Loki
yk what is the Primal for dead bodies? i cant find dead bodys in APrimalStructureItemContainer
TheMollusk 2/8/2023 9:51 PM
Player characters are AShooterCharacter, dino characters are APrimalDinoCharacter. Both inherit from APrimalCharacter, which has a MyInventoryComponent field.
Avatar
Avatar
TheMollusk
Player characters are AShooterCharacter, dino characters are APrimalDinoCharacter. Both inherit from APrimalCharacter, which has a MyInventoryComponent field.
AShooterCharacter too are the dead corposes with inv?
Avatar
Avatar
Loki
AShooterCharacter too are the dead corposes with inv?
yes, alive or dead, it's still AShooterCharacter
Avatar
Avatar
TheMollusk
yes, alive or dead, it's still AShooterCharacter
and has MyInventoryComponentField?
Avatar
right
10:15 PM
although it could be null, like I think wild dinos don't have an inventory component
10:17 PM
you should be able to check if it's alive with APrimalCharacter::IsAlive(). I recommend looking over the API header files to see what fields and functions commonly used classes have.
Avatar
ty ❤️
10:22 PM
it works now
Avatar
There you go. Technically the player character is either a APlayerPawnTest_Male_C or APlayerPawnTest_Female_C. The full inheritance is APlayerPawnTest_Male_C > APlayerPawnTest_Child_C > APlayerPawnTest_C > AShooterCharacter > APrimalCharacter > ACharacter > APawn > AActor > UObject. Classes that end in a "_C" are blueprint generated. ArkServerAPI headers just have definitions for native classes like AShooterCharacter.
Avatar
Avatar
TheMollusk
There you go. Technically the player character is either a APlayerPawnTest_Male_C or APlayerPawnTest_Female_C. The full inheritance is APlayerPawnTest_Male_C > APlayerPawnTest_Child_C > APlayerPawnTest_C > AShooterCharacter > APrimalCharacter > ACharacter > APawn > AActor > UObject. Classes that end in a "_C" are blueprint generated. ArkServerAPI headers just have definitions for native classes like AShooterCharacter.
is there any way to see who is the ower of the corpse?
10:33 PM
maybe Bag->GetOwner()?
Avatar
Avatar
Loki
is there any way to see who is the ower of the corpse?
Try AShooterCharacter::LastControllerField() to get the AShooterPlayerController
10:39 PM
that probably won't work if the player has gone offline though
Avatar
Avatar
TheMollusk
Try AShooterCharacter::LastControllerField() to get the AShooterPlayerController
how i can print "Bag->LastControllerField()" in console? auto Test = Bag->LastControllerField(); Log::GetLog()->warn(Test);
10:44 PM
sorry for the lot of stupids questions , i dont have a lot of cpp knowledge
Avatar
Pretty much every object is a UObject, UObject has FName& NameField(). You can use NameField().ToString().ToString() to get an std::string
Avatar
Avatar
TheMollusk
Pretty much every object is a UObject, UObject has FName& NameField(). You can use NameField().ToString().ToString() to get an std::string
i cant do .NameField()
11:05 PM
if i doTheTurret->LastControllerField().Get()->NameField() if works, but if i add .get() arg it will give owner of corpose too?
Avatar
LastControllerField() gives you a TWeakObjectPtr<AController>. Which you need to use either Get() or -> on. You should read the code in the ArkServerApi headers to figure some of this stuff out and probably become a little more familiar with C++ (edited)
Avatar
Avatar
TheMollusk
APrimalStructureItemContainer doesn't have a property named "CurrentResourceCount". You want to get the UPrimalInventoryComponent associated with the bag and get the item count from that. Something like int count = bag->MyInventoryComponentField()->GetCurrentNumInventoryItems(); where "bag" is a APrimalStructureItemContainer. Also, there's no reason to use UObject::FindProperty() or UProperty::Get()/Set() unless you're working with Blueprint generated classes. APrimalStructureItemContainer and UPrimalInventoryComponent are native classes. Just use the definitions in the API headers to access properties, those accessor functions are faster.
All works nice thanks for the help, just one thing more, with GetCurrentNumInventoryItems i get 611 aditional items, its any whey to fix it?
12:23 AM
For example, i have 6 items in my inventory, but i get 617
12:23 AM
Avatar
Avatar
Loki
All works nice thanks for the help, just one thing more, with GetCurrentNumInventoryItems i get 611 aditional items, its any whey to fix it?
The count includes things like learned engrams. Maybe that's it?
Avatar
Avatar
TheMollusk
The count includes things like learned engrams. Maybe that's it?
any ideas from remove the learned engrams and just left the items?
Avatar
Avatar
Loki
any ideas from remove the learned engrams and just left the items?
One option could be to use UPrimalInventoryComponent::InventoryItemsField() instead, which gives you a TArray<UPrimalItem*>. You could iterate over that list and ignore things you don't want to count. (edited)
Avatar
Yes the item count includes engrams in your crafting tab
Avatar
Is there a hook that fires when overwriting user? I've been looking for it, but I can't find it. help.
Avatar
Avatar
돌드민
Is there a hook that fires when overwriting user? I've been looking for it, but I can't find it. help.
substitute 2/9/2023 6:19 AM
Like when making their character?
Avatar
Avatar
substitute
Like when making their character?
no, and thank you i found the value i was looking for
Avatar
Is there a hook that works when a character is regenerated or deleted?
Avatar
@substitute
4:25 AM
are you here?}
4:26 AM
can you open dm?
Avatar
Avatar
izLoki
can you open dm?
You can ask me here
Avatar
He left the server.
4:40 AM
And all his messages got tagged with spammer lol
Avatar
Avatar
substitute
You can ask me here
its a problem with verification
5:20 AM
pls
5:20 AM
i cant verify
5:20 AM
bot kicks me every 2 minutes (edited)
Avatar
Verification to what
5:21 AM
i cant verify
Avatar
I have never seen that in my life
5:21 AM
And I don’t have any control over it
Avatar
@Double Counter
5:21 AM
the bot kicks me from the server if i dont verify (edited)
Avatar
Are you using a VPN or duplicate account?
5:21 AM
Outside of that I can’t really help you
Avatar
yes, because i lost my main account
5:21 AM
@Loki
Avatar
I only work on developing the api
Avatar
i got hacked
5:22 AM
i created new one account but i cant verify
Avatar
@GSH | MrOwlSky
Avatar
Avatar
substitute
@GSH | MrOwlSky
okay, so i will say you my problem rejoining to server XD how i can get owner character from AShooterCharacter of is a dead bag? [DeathItemCache] i cant do LastControllerField()
Avatar
Avatar
izLoki
okay, so i will say you my problem rejoining to server XD how i can get owner character from AShooterCharacter of is a dead bag? [DeathItemCache] i cant do LastControllerField()
I’m not on a computer right now
5:24 AM
You should be able to just read the headers to figure stuff out though
5:25 AM
You’re going to have a really tough time if everything is a struggle
Avatar
Avatar
substitute
You should be able to just read the headers to figure stuff out though
yes i doing it, but i cant find way to do LastControllerField() in a AShooterCharacter()
3:30 PM
if i do auto test = TheTurret->LastControllerField().Get()->NameField().ToString().ToString(); Log::GetLog()->warn("LastControllerField: {}", test); server crash
3:30 PM
("TheTurret" is AShooterCharacter)
Avatar
Well turrets aren't people.
5:54 PM
And there's a very good chance that if they are logged out their controller isn't valid and you'd be dereferencing a nullptr.
5:54 PM
Not to be that guy, but you seriously don't seem to have the minimum requirements required to make a plugin.
5:55 PM
It would probably do you a lot of good to pick up a C++ book and give that a read through first.
Avatar
Avatar
izLoki
i created new one account but i cant verify
GSH | MrOwlSky 2/10/2023 6:10 PM
Resolved
Avatar
Avatar
GSH | MrOwlSky
Resolved
Thx
GOGCHECK 1
Avatar
Avatar
돌드민
Is there a hook that works when a character is regenerated or deleted?
help. Is there really no hook when deleting a character?
6:43 AM
I looked... but couldn't find it.
Avatar
I think "deleting" a character is just overwriting your current character on server with a new one.
6:47 AM
You might be able to hook the function responsible for creating a new character and check the data passed in there
6:47 AM
I believe it's AShooterPlayerState*
6:47 AM
But I can't recall for sure off the top of my head
6:48 AM
I don't think AShooterPlayerState has a way back to a controller or character though so you might have to compare ID's on server or something like that. (edited)
GOGCHECK 1
Avatar
thank you If not, I'll go with the method of comparing by player ID.
Avatar
how i can get the APrimalStructure than player are targeting (aiming)? (edited)
Avatar
jraServerAPI 2/15/2023 6:41 PM
search for GetAimedActor 🙂
Avatar
Avatar
jraServerAPI
search for GetAimedActor 🙂
thanks so much
9:04 PM
it worked
Avatar
BattleEye have Hooks?
Avatar
BattlEye should not affect your Plugin at all for the server.
Avatar
Avatar
Frigoff
BattlEye should not affect your Plugin at all for the server.
i want to do a battleeye check to player in server, like re-check if has player has battleeye starter
6:24 AM
because ares a new exploit than can bypass onlogin battleeye check (edited)
Avatar
There's no way to do that. They will be kicked by BattlEye eventually.
Avatar
Avatar
Frigoff
There's no way to do that. They will be kicked by BattlEye eventually.
okay, one dude more is there any way to modify RandomMutationChanceField() and MaxAllowedRandomMutationsField() from a Fertilized egg?
Avatar
I've never tried nor do I know the effects of what happens if you do but you should be able to overwrite it on the server with a plugin.
Avatar
If i am using the following code in case DLL_PROCESS_ATTACH: if (ArkApi::GetApiUtils().GetStatus() == ArkApi::ServerStatus::Ready) { Log::GetLog()->info("Called Load_Something"); Load_Something(); } load(); break; it should run load_something() after the server is booted up, but it never called it, am i missing something? i also tried to != and return it within the load();
Avatar
Solved just hooked into begin play to call the method 🙂
Avatar
Avatar
Natsu
If i am using the following code in case DLL_PROCESS_ATTACH: if (ArkApi::GetApiUtils().GetStatus() == ArkApi::ServerStatus::Ready) { Log::GetLog()->info("Called Load_Something"); Load_Something(); } load(); break; it should run load_something() after the server is booted up, but it never called it, am i missing something? i also tried to != and return it within the load();
no, this will only run if you load the plugin after the server has booted
Avatar
what files do i delete when wiping server all .PDB?
Avatar
how i can do like verify system in my plugin? For example: before load plugin, it do a request to my own page to check if ares a new version of the plugin, in case true plugin just dont load. i tried with API::Requests::Get().CreateGetRequest("https://examplepage.com/api/version", &response); but the "response" function runs after server starts completely and plugins load anyways. (edited)
Avatar
Avatar
Loki
how i can do like verify system in my plugin? For example: before load plugin, it do a request to my own page to check if ares a new version of the plugin, in case true plugin just dont load. i tried with API::Requests::Get().CreateGetRequest("https://examplepage.com/api/version", &response); but the "response" function runs after server starts completely and plugins load anyways. (edited)
Consider your question
5:36 PM
How can you run your update check in your code
5:36 PM
If you also don’t want to load your code until after you run your update check
5:36 PM
See the issue?
5:36 PM
You could instead write a plugin that loads your plugins and updates them
5:36 PM
And not load your plugins as part of the standard loading phase (edited)
Avatar
Avatar
substitute
Consider your question
but, i can just load plugin, so do the verification, and in case is false, force unload plugin?
5:45 PM
I don't need update automatically, i just need than plugin doesn't start
Avatar
Avatar
Loki
but, i can just load plugin, so do the verification, and in case is false, force unload plugin?
I wouldn’t
5:48 PM
And I also wouldn’t do this kind of behavior either
5:48 PM
It could really fuck up a server admin’s day
5:48 PM
There’s no harm in letting someone use an outdated version
Avatar
Avatar
substitute
I wouldn’t
and if i want to add like licenses to my plugin? how i can do to check the licence with api and if is invalid unload plugin?
Avatar
jraServerAPI 2/20/2023 6:19 PM
there's no need to unload the plugin, you can disable it in other ways
Avatar
Avatar
jraServerAPI
there's no need to unload the plugin, you can disable it in other ways
how i can "disable" it?
Avatar
jraServerAPI 2/20/2023 6:23 PM
Like, in your code.. check for auth.. if no auth? then do not run function A, do not run function B etc...
Avatar
oh okay thanks GOGHEART1
Avatar
How do people check for a server wipe?
Avatar
We don't.
6:45 PM
Wrongfully detecting a wipe and then wiping all data would be very bad for a cluster's health.
Avatar
Ha ok thanks , i did notice that some plugins do detect a map wipe.
Avatar
Avatar
Loki
and if i want to add like licenses to my plugin? how i can do to check the licence with api and if is invalid unload plugin?
use API requests or if that doesn't suit your needs include something like cpp httplib to have your own requests library
5:49 PM
but in this case you'll have to write the threading code for your requests yourself, since performing the request itself inside the main thread will hang the server for a considerable amount of time
Avatar
How would one solve the buffer overflow error when transferring with to many items/engrams to another server? did not test if the problem is still here but i assume it is.
Avatar
E0135 class "UProperty" has no member "NameField" void Hook_UObject_ProcessInternal(UObject* _this, FFrame* Stack, void* const Result) { if (Stack->NodeField()->InternalIndexField() != FunctionIndex) { // Process the function normally and return if this is not the function we're looking for UObject_ProcessInternal_original(_this, Stack, Result); return; } for (UProperty* prop = Stack->NodeField()->PropertyLinkField(); prop; prop = prop->PropertyLinkNextField()) { Log::GetLog()->error("field: {}", prop->NameField().ToString()); } (edited)
11:28 PM
any know how to fix it?
Avatar
Do you have any PVP detection hooks (tribal structures are broken or tribal members are damaged)?
Avatar
Avatar
Urang
Do you have any PVP detection hooks (tribal structures are broken or tribal members are damaged)?
DECLARE_HOOK(APrimalStructure_TakeDamage, float, APrimalStructure*, float, FDamageEvent*, AController*, AActor*); float Hook_APrimalStructure_TakeDamage(APrimalStructure* _this, float Damage, FDamageEvent* DamageEvent, AController* EventInstigator, AActor* DamageCauser) { return APrimalStructure_TakeDamage_original(_this, Damage, DamageEvent, EventInstigator, DamageCauser); } ArkApi::GetHooks().SetHook("APrimalStructure.TakeDamage", &Hook_APrimalStructure_TakeDamage, &APrimalStructure_TakeDamage_original); ArkApi::GetHooks().DisableHook("APrimalStructure.TakeDamage", &Hook_APrimalStructure_TakeDamage);
3:12 AM
That hook detects any damage than recive a structure, (wild or tamed dinos, proyectile, etc)
Avatar
Avatar
Loki
DECLARE_HOOK(APrimalStructure_TakeDamage, float, APrimalStructure*, float, FDamageEvent*, AController*, AActor*); float Hook_APrimalStructure_TakeDamage(APrimalStructure* _this, float Damage, FDamageEvent* DamageEvent, AController* EventInstigator, AActor* DamageCauser) { return APrimalStructure_TakeDamage_original(_this, Damage, DamageEvent, EventInstigator, DamageCauser); } ArkApi::GetHooks().SetHook("APrimalStructure.TakeDamage", &Hook_APrimalStructure_TakeDamage, &APrimalStructure_TakeDamage_original); ArkApi::GetHooks().DisableHook("APrimalStructure.TakeDamage", &Hook_APrimalStructure_TakeDamage);
Thank you. Is there an effective way not to detect the damage caused by wild dinosaurs? I only want to detect players or Tamed dinos, etc.
Avatar
Avatar
Urang
Thank you. Is there an effective way not to detect the damage caused by wild dinosaurs? I only want to detect players or Tamed dinos, etc.
nop, but you can check if "DamageCauser" is a wild dino
4:50 AM
and if it is, then just return APrimalStructure_TakeDamage_original(_this, Damage, DamageEvent, EventInstigator, DamageCauser); (edited)
👍 1
Avatar
Avatar
Natsu
How would one solve the buffer overflow error when transferring with to many items/engrams to another server? did not test if the problem is still here but i assume it is.
def still an issue, eating me alive tonight. but might not be possible to fix as i assume the issue is the client has a smaller expected max buffer size than the serverfor total data payload is what triggers the issue, and client needs to sync to match possibilities from the server, but of course its ark, they wont fix simple things like that. (edited)
7:48 AM
or net code has to be rewritten to chunk the data, like ark data has a play in it too, so i assume they are just allocating 1 giant packet.
7:50 AM
this data is loaded early too, as i once boosted the # of items you can store in arkdata, and a player filled it with fert eggs, and totally broke his ability to even login, not just transfer. the only way i could recover him was to set the max expiration time to a short time to cause some of his items to expire.
Avatar
Avatar
Aikar
def still an issue, eating me alive tonight. but might not be possible to fix as i assume the issue is the client has a smaller expected max buffer size than the serverfor total data payload is what triggers the issue, and client needs to sync to match possibilities from the server, but of course its ark, they wont fix simple things like that. (edited)
Lethal fixed it in items+ plugin
Avatar
ohh really, nice
Avatar
Dodo Enthusiast 2/27/2023 3:39 AM
Hi, I was wondering if there is a way to do something with blueprint functions like trigger the execution. I assume the local variables inside a bp function are off limits, but some bp functions change properties which are accessible. Hence something like "trigger bp function" -> "read property" could be possible. No idea how to do it tho^^ If it isn't a little hint as to why would be appreciated.
Avatar
Avatar
Dodo Enthusiast
Hi, I was wondering if there is a way to do something with blueprint functions like trigger the execution. I assume the local variables inside a bp function are off limits, but some bp functions change properties which are accessible. Hence something like "trigger bp function" -> "read property" could be possible. No idea how to do it tho^^ If it isn't a little hint as to why would be appreciated.
you are able to call blueprint functions
9:21 PM
you find it by name inside an object pointer and then you use ProcessEvent to invoke the function with any parameters you want to pass into it
Avatar
Avatar
Dodo Enthusiast
Hi, I was wondering if there is a way to do something with blueprint functions like trigger the execution. I assume the local variables inside a bp function are off limits, but some bp functions change properties which are accessible. Hence something like "trigger bp function" -> "read property" could be possible. No idea how to do it tho^^ If it isn't a little hint as to why would be appreciated.
You can call and hook Blueprint functions. You can also access input/output arguments and local variables inside your hook. Blueprint functions (and many native functions) are represented as UFunction objects. We can find UFunctions by calling UVictoryCore::BPLoadClass(FString* PathName) to get the UClass the function is defined in, then find the function itself with UClass::FindFunctionByName(FName InName, EIncludeSuperFlag::Type IncludeSuper). Here's an example that uses the Blueprint function Buff_Companion_HLNA_C::Get Glitch Mission Complete Count(). This function returns the number of glitches that a player has collected in a given Gen1 biome. It has FName MissionTag and AShooterCharacter* Player input arguments, an int32 Count output argument, and an int32 ret count local variable.
9:57 PM
The example code installs a /test chat command that calls Buff_Companion_HLNA_C::Get Glitch Mission Complete Count() to get the number of glitches the player has collected in the Bog biome. To call a Blueprint function, we call [UObject,AActor]::ProcessEvent(UFunction* Function, void* Parameters). Function points to the function we want to call. Parameters points to memory that has the input/output arguments all packed together (defined by struct GetMissionCompleteCountParms in the example). The example also hooks the Buff_Companion_HLNA_C::Get Glitch Mission Complete Count() Blueprint function by hooking UObject::ProcessInternal(UObject* _this, FFrame* Stack, void* const Result). Unreal Engine uses ProcessInternal() to execute the bytecode of a Blueprint function. When ProcessInternal() is hooked, we can hook specific Blueprint functions by checking which UFunction ProcessInternal() is being called on. Each Blueprint function that is executed has its own FFrame stack frame object. We can use ProcessInternal()'s Stack argument to access input/output arguments and local variables inside our Blueprint function hook. When the Buff_Companion_HLNA_C::Get Glitch Mission Complete Count() hook in the example is executed, it prints the name of the AShooterCharacter* Player input character and the value of the int32 ret count local variable. We can also examine previous function's frames on the stack. For example, we can see which Blueprint function called the hooked function and access the caller's variables. The example code demonstrates this by hooking the native function AMissionType::FindMissionsMatchingTag(), and the Blueprint function AMissionType_GlitchCounter_Base_C::GetCompletedGlitchCount(), both of which are called by Buff_Companion_HLNA_C::Get Glitch Mission Complete Count(). These hooks print input and local variable values from the calling Buff_Companion_HLNA_C::Get Glitch Mission Complete Count() function.
Avatar
@TheMollusk if anyone is prepared for this it would be you
10:08 PM
you can step a FFrame
10:08 PM
I believe, so you can read the bytecode instruction by instruction
10:09 PM
there is also ::GetScriptCallstack
10:09 PM
and ::PeekCode()
Avatar
Yeah if you want to get fancy you can modify the Blueprint UFunction bytecode and do things like change the values of const local vars. Or insert a UFunction call at a specific offset.
Avatar
the uint8* code is the current instructions
10:14 PM
/** Returns the current script op code */ const uint8 PeekCode() const { return *Code; } /** Skips over the number of op codes specified by NumOps */ void SkipCode(const int32 NumOps) { Code += NumOps; }
10:14 PM
I'm very curious what sentinel value it uses for EOF
10:15 PM
might just be a null
10:15 PM
Avatar
There's EExprToken::EX_EndOfScript at the end of every function bytecode
Avatar
0x53
10:17 PM
10:20 PM
this EX_ComputedJump = 0x4E, // Goto a local address in code, specified by an integer value.
10:20 PM
makes me think that it could be possible to create a malicious mod
10:21 PM
these are also bothersome
10:21 PM
EX_PushExecutionFlow = 0x4C, // push an address on to the execution flow stack for future execution when a EX_PopExecutionFlow is executed. Execution continues on normally and doesn't change to the pushed address. EX_PopExecutionFlow = 0x4D, // continue execution at the last address previously pushed onto the execution flow stack.
10:22 PM
maybe I dump some code from the game to see what the bytecode format is
10:22 PM
I assume it is single value instructions similar to IL (edited)
Avatar
The instructions are actually the EExprToken enum values. Each value is an index into the global Native GNatives[EX_Max] array. This array has pointers to native functions that execute the virtual machine instruction. c++ void FFrame::Step(UObject *Context, RESULT_DECL) { int32 B = *Code++; (Context->*GNatives[B])(*this,Result); }
Avatar
yeah, my concern is escaping the virtual environment for native code execution
10:26 PM
like is EX_ComputedJump sanitized for example
10:26 PM
and obviously there is some barrier traversal for BP functions that call into native code that is exposed to BP functions (edited)
Avatar
Avatar
substitute
and obviously there is some barrier traversal for BP functions that call into native code that is exposed to BP functions (edited)
The way that works is the bytecode has a EX_VirtualFunction or EX_FinalFunction instruction that calls UObject::CallFunction(FFrame& Stack, RESULT_DECL, UFunction* Function ) with a UFunction address that was evaluated by name or read from the bytecode. Then for native UFunctions, CallFunction() calls the UFunctions Func field, which points to a native void execFoo(UObject* Object, FFrame* Stack, void* const Result), which processes any native function arguments out of the calling functions bytecode and then calls the C++ Foo().
10:42 PM
So if you could modify a native UFunctions Func field, that would be one way to redirect native control.
10:42 PM
But I'm not sure a mod could do that.
Avatar
Avatar
TheMollusk
You can call and hook Blueprint functions. You can also access input/output arguments and local variables inside your hook. Blueprint functions (and many native functions) are represented as UFunction objects. We can find UFunctions by calling UVictoryCore::BPLoadClass(FString* PathName) to get the UClass the function is defined in, then find the function itself with UClass::FindFunctionByName(FName InName, EIncludeSuperFlag::Type IncludeSuper). Here's an example that uses the Blueprint function Buff_Companion_HLNA_C::Get Glitch Mission Complete Count(). This function returns the number of glitches that a player has collected in a given Gen1 biome. It has FName MissionTag and AShooterCharacter* Player input arguments, an int32 Count output argument, and an int32 ret count local variable.
Dodo Enthusiast 2/27/2023 10:44 PM
Wow. Thank you very much for this detailed answer.
Avatar
@TheMollusk on an unrelated note
10:47 PM
did you know, that the ... is NOT part of a function signature in C++?
10:47 PM
specifically, std::function can not store variadic functions
Avatar
Maybe it's possible somehow to get a reference to a UFunction in your bytecode and modify its Func field.
Avatar
__stdcall void(void) is fine
10:47 PM
as the attribute (calling convention) is part of the signature (edited)
10:48 PM
but you can't do void(...)
10:48 PM
I'm not sure why syntactically as calling conventions aren't even in the standards
Avatar
No I guess I didn't know all that lol
Avatar
I take it back actually, __stdcall wouldn't work
10:49 PM
cdecl only worked because the macro was defining it to nothing, thanks Microsoft (edited)
10:49 PM
but I can understand that
10:49 PM
can't understand why ... is disallowed
10:53 PM
10:53 PM
improving on my moar_ptr stuff
10:53 PM
might be able to vastly simplify the higher order interfaces
10:53 PM
(function_ptr holds function_signature)
Avatar
how i can modify the tek armor element usage? (i want to remove it) For example, APrimalStructureTurrets has "NumBulletsPerShotField" so i can set it 0 _this->NumBulletsPerShotField() = 0; Is there a way to do something similar with the consumption of tek armor (with UPrimalItem)? (edited)
Avatar
Its probably "fuel" something
10:26 PM
might be at the blueprint level though not 100% sure
Avatar
Avatar
Lethal
Its probably "fuel" something
I searched with "fuel"/"element" and nothing
10:39 PM
and with "GetWeaponClipAmmo" crash
Avatar
Element is stored on the buff
Avatar
Avatar
Frigoff
Element is stored on the buff
How i can modify the Element values?
Avatar
in function "TryDoDecreaseElement" (Blueprint'/Game/PrimalEarth/CoreBlueprints/Items/Armor/Base/PrimalItemArmor_Base_Tek.PrimalItemArmor_Base_Tek'') i found condition, it check if armor has "Infinite Ammo" ¿ How i can set infinite ammo ?
Avatar
Avatar
Loki
How i can modify the Element values?
These are BP variables
12:58 AM
You can use get/set on the buff
Avatar
Avatar
substitute
These are BP variables
the variables arent in the buff, it ares in Blueprint'/Game/PrimalEarth/CoreBlueprints/Items/Armor/Base/PrimalItemArmor_Base_Tek.PrimalItemArmor_Base_Tek''
12:59 AM
and buff calls it
1:00 AM
how can i get/set them ?
1:01 AM
Sorry for the basic questions, I'm not uses ussualy the devkit
Avatar
substitute 3/1/2023 1:01 AM
That is located on the armor piece itself
1:02 AM
Which should be a child of that base class
1:02 AM
Just make them 0
Avatar
Avatar
substitute
That is located on the armor piece itself
i can "FindProperty" from a "UPrimalItem"? i try with: UObject* obj = static_cast<UObject*>(item); UProperty* bInfiniteAmmo = obj->FindProperty(FName("bInfiniteAmmo", EFindName::FNAME_Add)); but crash, crash too if i do UProperty* bInfiniteAmmo = item->FindProperty(FName("bInfiniteAmmo", EFindName::FNAME_Add));
Avatar
jraServerAPI 3/1/2023 2:17 AM
maybe because you're casting is as a UObject and not a UPrimalItem?
Avatar
Avatar
jraServerAPI
maybe because you're casting is as a UObject and not a UPrimalItem?
2:20 AM
maybe because i define variable item with "FindItem"? auto item = _this->FindItem(&itemNetID, false, false, &index);
Avatar
Avatar
jraServerAPI
maybe because you're casting is as a UObject and not a UPrimalItem?
item is a UPrimalItem
2:29 AM
if i do UProperty* bInfiniteAmmo = item->FindProperty(FName("bInfiniteAmmo", EFindName::FNAME_Add)); too crash
Avatar
jraServerAPI 3/1/2023 3:13 AM
Why are you casting it to a UObject?
3:13 AM
just try item->FindProperty
3:15 AM
also you should test it before using it c++ UProperty* bInfiniteAmmo = item->FindProperty(FName("bInfiniteAmmo", EFindName::FNAME_Add)); if(bInfiniteAmmo) bInfiniteAmmo->Set<bool>(item, true);
Avatar
Avatar
jraServerAPI
also you should test it before using it c++ UProperty* bInfiniteAmmo = item->FindProperty(FName("bInfiniteAmmo", EFindName::FNAME_Add)); if(bInfiniteAmmo) bInfiniteAmmo->Set<bool>(item, true);
crash too UPrimalItem* Hook_UPrimalInventoryComponent_AddItem(UPrimalInventoryComponent* _this, FItemNetInfo* theItemInfo, bool bEquipItem, bool AddToSlot, bool bDontStack, FItemNetID* InventoryInsertAfterItemID, bool ShowHUDNotification, bool bDontRecalcSpoilingTime, bool bForceIncompleteStacking, AShooterCharacter* OwnerPlayer, bool bIgnoreAbsoluteMaxInventory) { if (bEquipItem) { int index; auto itemNetID = theItemInfo->ItemIDField(); auto item = _this->FindItem(&itemNetID, false, false, &index); UProperty* bInfiniteAmmo = item->FindProperty(FName("bInfiniteAmmo", EFindName::FNAME_Add)); if (bInfiniteAmmo) { bInfiniteAmmo->Set<bool>(item, true); } } return UPrimalInventoryComponent_AddItem_original(_this, theItemInfo, bEquipItem, AddToSlot, bDontStack, InventoryInsertAfterItemID, ShowHUDNotification, bDontRecalcSpoilingTime, bForceIncompleteStacking, OwnerPlayer, bIgnoreAbsoluteMaxInventory); }
Avatar
jraServerAPI 3/1/2023 3:22 AM
how do yo know if item is valid?
3:22 AM
you aren't testing it
3:23 AM
what is line 92?
3:24 AM
Avatar
Avatar
jraServerAPI
how do yo know if item is valid?
i added if (item) {} and crash too
Avatar
jraServerAPI 3/1/2023 3:30 AM
what r u equiping?
Avatar
Avatar
jraServerAPI
what r u equiping?
tek chestplate
Avatar
substitute 3/1/2023 3:33 AM
Can you attach a debugger
3:33 AM
And show me the crash
3:33 AM
If you do it from VS with the project open it should show the specific line
3:33 AM
As the crash is coming from the dll directly
Avatar
It seems you are trying to get the item before it gets added to the inventory
11:49 AM
So the item will return null, or some garbage
11:49 AM
Also, you can get the item directly without having to get it from item id in that book
11:51 AM
You could do auto item = original hook call, and then in the return you do return item
Avatar
also you should use FNAME_Find since this string should already exist (edited)
Avatar
Dodo Enthusiast 3/1/2023 10:31 PM
Hi, I continued my journey with ufunction/properties and I thought it was going well until I stumbled across "Buff_CryoCooldown". Acording to the devkit every bpFunction uses a variable TimeLeft which is also a default property. But somehow this property is never set. I tried it inside the hooks APrimalBuff_BeginPlay and APrimalBuff_AddBuff. I checked the class default object and made a test chatcommand that goes through all the characterbuffs and checks for the right buffclass and if the property is set. To check for the property I use (I also tried "Time Left" with space) and its never found. UProperty* theProperty = buffCryoCooldownObj->FindProperty(FName("TimeLeft", EFindName::FNAME_Find)); if (!theProperty) { Dodo::Logg::writeToLogFile(pluginName, "prop TimeLeft not found"); } There is another Property "DeactivateAfterTime" which I did successfully set in all the methods above and it did deactivate the buff early, although the timer for the player is still 300 seconds it just ends after whatever I set. Now the question is what is going on with this one property, what am I missing^^ (edited)
Avatar
Avatar
Dodo Enthusiast
Hi, I continued my journey with ufunction/properties and I thought it was going well until I stumbled across "Buff_CryoCooldown". Acording to the devkit every bpFunction uses a variable TimeLeft which is also a default property. But somehow this property is never set. I tried it inside the hooks APrimalBuff_BeginPlay and APrimalBuff_AddBuff. I checked the class default object and made a test chatcommand that goes through all the characterbuffs and checks for the right buffclass and if the property is set. To check for the property I use (I also tried "Time Left" with space) and its never found. UProperty* theProperty = buffCryoCooldownObj->FindProperty(FName("TimeLeft", EFindName::FNAME_Find)); if (!theProperty) { Dodo::Logg::writeToLogFile(pluginName, "prop TimeLeft not found"); } There is another Property "DeactivateAfterTime" which I did successfully set in all the methods above and it did deactivate the buff early, although the timer for the player is still 300 seconds it just ends after whatever I set. Now the question is what is going on with this one property, what am I missing^^ (edited)
You aren't missing anything. TimeLeft is the only property in ABuff_CryoCooldown_C. The released version of ArkServerApi has a bug in UObject::FindProperty() where the first property is not included in the search. It's fixed in GitHub, so you can rebuild ArkServerApi from source yourself and it will work. But your plugin wouldn't work for other users using 3.54/3.55. One option is to just compile the fixed FindProperty() in your plugin and use that. c++ UProperty* FindProperty(FName name) { for (UProperty* Property = ClassField()->PropertyLinkField(); Property != nullptr; Property = Property->PropertyLinkNextField()) if (Property->NameField().Compare(&name) == 0) return Property; return nullptr; } (edited)
Avatar
Avatar
TheMollusk
You aren't missing anything. TimeLeft is the only property in ABuff_CryoCooldown_C. The released version of ArkServerApi has a bug in UObject::FindProperty() where the first property is not included in the search. It's fixed in GitHub, so you can rebuild ArkServerApi from source yourself and it will work. But your plugin wouldn't work for other users using 3.54/3.55. One option is to just compile the fixed FindProperty() in your plugin and use that. c++ UProperty* FindProperty(FName name) { for (UProperty* Property = ClassField()->PropertyLinkField(); Property != nullptr; Property = Property->PropertyLinkNextField()) if (Property->NameField().Compare(&name) == 0) return Property; return nullptr; } (edited)
Dodo Enthusiast 3/1/2023 10:45 PM
Thanks again for the answer. I basically just define "my own" (your fixed^^) findproperty function inside the plugin and use that?
Avatar
Avatar
Dodo Enthusiast
Thanks again for the answer. I basically just define "my own" (your fixed^^) findproperty function inside the plugin and use that?
Yeah just define it yourself and call that instead of the exported UObject::FindProperty()
Avatar
Dodo Enthusiast 3/1/2023 11:32 PM
One little followup. Everything works now with the property. The only thing interesting is that the client still starts at 300 seconds, even if I set it (on the class default object) to like 20 seconds. It does still work and gets updated "on the fly". I assume its some replication issue. I'm just wondering where the client gets the 300 seconds from because there is as far as I can tell nothing serverside that has 300 seconds as a value I also set the property "DeactivateAfterTime" to 20 seconds. Is the reason that the client uses some local version of the bp in the beginning? (edited)
Avatar
Avatar
Dodo Enthusiast
One little followup. Everything works now with the property. The only thing interesting is that the client still starts at 300 seconds, even if I set it (on the class default object) to like 20 seconds. It does still work and gets updated "on the fly". I assume its some replication issue. I'm just wondering where the client gets the 300 seconds from because there is as far as I can tell nothing serverside that has 300 seconds as a value I also set the property "DeactivateAfterTime" to 20 seconds. Is the reason that the client uses some local version of the bp in the beginning? (edited)
The TimeLeft value is set to 300 in the class default object. Every UClass has a class default object (CDO) that has default values, the default values are copied from the CDO UObject to other instances of the UClass when they are created. The TimeLeft property is not replicated, so the client still thinks the value is still 300 after you change it on the server. c++ FString buffPath = "Blueprint'/Game/Extinction/CoreBlueprints/Buffs/Buff_CryoCooldown.Buff_CryoCooldown'"; UClass* buffClass = UVictoryCore::BPLoadClass(&buffPath); if (!buffClass) { Log::GetLog()->error("UClass not found - ABuff_CryoCooldown_C"); return; } FName timeLeftName("TimeLeft", EFindName::FNAME_Find); UProperty* timeLeftProp = nullptr; for (UProperty* prop = buffClass->PropertyLinkField(); prop != nullptr; prop = prop->PropertyLinkNextField()) { if (prop->NameField().Compare(&timeLeftName) == 0) { timeLeftProp = prop; break; } } if (!timeLeftProp) { Log::GetLog()->error("UProperty not found - TimeLeft"); return; } APrimalBuff* cdo = reinterpret_cast<APrimalBuff*>(buffClass->ClassDefaultObjectField()); float timeLeft = 0; try { timeLeft = timeLeftProp->Get<float>(cdo); } catch (std::invalid_argument e) { Log::GetLog()->error("UProperty::Get() - {}", e.what()); return; } Log::GetLog()->info("TimeLeft = {}", timeLeft); [info] TimeLeft = 300
Avatar
Avatar
TheMollusk
The TimeLeft value is set to 300 in the class default object. Every UClass has a class default object (CDO) that has default values, the default values are copied from the CDO UObject to other instances of the UClass when they are created. The TimeLeft property is not replicated, so the client still thinks the value is still 300 after you change it on the server. c++ FString buffPath = "Blueprint'/Game/Extinction/CoreBlueprints/Buffs/Buff_CryoCooldown.Buff_CryoCooldown'"; UClass* buffClass = UVictoryCore::BPLoadClass(&buffPath); if (!buffClass) { Log::GetLog()->error("UClass not found - ABuff_CryoCooldown_C"); return; } FName timeLeftName("TimeLeft", EFindName::FNAME_Find); UProperty* timeLeftProp = nullptr; for (UProperty* prop = buffClass->PropertyLinkField(); prop != nullptr; prop = prop->PropertyLinkNextField()) { if (prop->NameField().Compare(&timeLeftName) == 0) { timeLeftProp = prop; break; } } if (!timeLeftProp) { Log::GetLog()->error("UProperty not found - TimeLeft"); return; } APrimalBuff* cdo = reinterpret_cast<APrimalBuff*>(buffClass->ClassDefaultObjectField()); float timeLeft = 0; try { timeLeft = timeLeftProp->Get<float>(cdo); } catch (std::invalid_argument e) { Log::GetLog()->error("UProperty::Get() - {}", e.what()); return; } Log::GetLog()->info("TimeLeft = {}", timeLeft); [info] TimeLeft = 300
Dodo Enthusiast 3/2/2023 12:49 AM
Tbh I'm probably not grasping the whole picture. Can I somehow tell the client the new values? I update the CDO on server start/plugin reload. I just tried to buff->ForceReplicateNow(false, false); on the hooks APrimalBuff_BeginPlay and APrimalBuff_AddBuff with check for the correct classes. Both didn't work but than again I probably don't get the full picture^^
Avatar
If a property isn’t replicated then there isn’t really a way to change it
Avatar
Avatar
substitute
If a property isn’t replicated then there isn’t really a way to change it
Dodo Enthusiast 3/2/2023 1:01 AM
Does that mean that ForceReplicateNow for example only replicates "stuff" that would get replicated sooner or later anyway but there still is some "stuff" that never will be?
Avatar
substitute 3/2/2023 1:02 AM
I believe so
1:02 AM
for example, stuff like UI is entirely client sided
1:02 AM
so you can't ever replicate that
Avatar
TheMollusk 3/2/2023 1:03 AM
Yeah I one time I tried to replicate stuff that won't normally replicate. You can use a plugin to make the server send out replication notices for properties that don't normally replicate, but the client will reject them.
Avatar
Avatar
Dodo Enthusiast
Tbh I'm probably not grasping the whole picture. Can I somehow tell the client the new values? I update the CDO on server start/plugin reload. I just tried to buff->ForceReplicateNow(false, false); on the hooks APrimalBuff_BeginPlay and APrimalBuff_AddBuff with check for the correct classes. Both didn't work but than again I probably don't get the full picture^^
TheMollusk 3/2/2023 1:04 AM
I lied before though lol. I just looked at it again and TimeLeft does replicate. So you see the value change on the client eventually, right? It just takes a few seconds or something to change from 300?
Avatar
Avatar
TheMollusk
I lied before though lol. I just looked at it again and TimeLeft does replicate. So you see the value change on the client eventually, right? It just takes a few seconds or something to change from 300?
Dodo Enthusiast 3/2/2023 1:07 AM
Yes. As I said it does it "on the fly" I was just wondering where it gets the 300 seconds from when nothing serverside (as far as i can tell) has 300seconds as a property.
Avatar
Avatar
Dodo Enthusiast
Yes. As I said it does it "on the fly" I was just wondering where it gets the 300 seconds from when nothing serverside (as far as i can tell) has 300seconds as a property.
substitute 3/2/2023 1:07 AM
from the CDO
Avatar
Avatar
substitute
from the CDO
Dodo Enthusiast 3/2/2023 1:09 AM
the cdo should have nothing with 300 seconds because i set both properties that have value 300 to 20 for example
Avatar
I believe the time left does control the buff. But the timer clients see is DeactivatesAfterTime which is a non replicated var.
1:10 AM
DeactivatesAfterTime is what controls the buff's lifetime from the parent APrimalBuff
Avatar
Avatar
Dodo Enthusiast
the cdo should have nothing with 300 seconds because i set both properties that have value 300 to 20 for example
substitute 3/2/2023 1:10 AM
the CDO exists on the client
1:10 AM
I don't think CDO's are replicated
1:10 AM
as they're not supposed to be modified at run-time
Avatar
Avatar
Dodo Enthusiast
Yes. As I said it does it "on the fly" I was just wondering where it gets the 300 seconds from when nothing serverside (as far as i can tell) has 300seconds as a property.
TheMollusk 3/2/2023 1:10 AM
c++ UClass* BuffClass; UProperty* TimeLeftProp; DECLARE_HOOK(APrimalBuff_AddBuff, APrimalBuff*, APrimalBuff*, APrimalCharacter*, AActor*); APrimalBuff* Hook_APrimalBuff_AddBuff(APrimalBuff* _this, APrimalCharacter* ForCharacter, AActor* DamageCauser) { APrimalBuff* ret = APrimalBuff_AddBuff_original(_this, ForCharacter, DamageCauser); if (!BuffClass || !TimeLeftProp || !_this->IsA(BuffClass)) return ret; try { TimeLeftProp->Set<float>(ret, 20); } catch (std::invalid_argument e) { Log::GetLog()->error("UProperty::Set() - {}", e.what()); return ret; } ret->ForceReplicateNow(false, false); return ret; } // Called when the server is ready void OnServerReady() { FString buffPath = "Blueprint'/Game/Extinction/CoreBlueprints/Buffs/Buff_CryoCooldown.Buff_CryoCooldown'"; BuffClass = UVictoryCore::BPLoadClass(&buffPath); if (!BuffClass) { Log::GetLog()->error("UClass not found - ABuff_CryoCooldown_C"); return; } FName timeLeftName("TimeLeft", EFindName::FNAME_Find); for (UProperty* prop = BuffClass->PropertyLinkField(); prop != nullptr; prop = prop->PropertyLinkNextField()) { if (prop->NameField().Compare(&timeLeftName) == 0) { TimeLeftProp = prop; break; } } if (!TimeLeftProp) { Log::GetLog()->error("UProperty not found - TimeLeft"); return; } } Seems to work.
Avatar
substitute 3/2/2023 1:11 AM
just a heads up void OnServerReady() { FString buffPath = "Blueprint'/Game/Extinction/CoreBlueprints/Buffs/Buff_CryoCooldown.Buff_CryoCooldown'"; BuffClass = UVictoryCore::BPLoadClass(&buffPath); if (!BuffClass) { Log::GetLog()->error("UClass not found - ABuff_CryoCooldown_C"); return; } FName timeLeftName("TimeLeft", EFindName::FNAME_Find); for (UProperty* prop = BuffClass->PropertyLinkField(); prop != nullptr; prop = prop->PropertyLinkNextField()) { if (prop->NameField().Compare(&timeLeftName) == 0) { TimeLeftProp = prop; break; } } if (!TimeLeftProp) { Log::GetLog()->error("UProperty not found - TimeLeft"); return; } }
Avatar
TheMollusk 3/2/2023 1:11 AM
The 300 comes from the CDO. The first code I posted prints the value from the CDO
Avatar
substitute 3/2/2023 1:11 AM
is for optimization reasons @Dodo Enthusiast
1:11 AM
instead of searching the property each time the buff is added
1:12 AM
Mollusk searches it at start up and caches it
Avatar
Avatar
TheMollusk
c++ UClass* BuffClass; UProperty* TimeLeftProp; DECLARE_HOOK(APrimalBuff_AddBuff, APrimalBuff*, APrimalBuff*, APrimalCharacter*, AActor*); APrimalBuff* Hook_APrimalBuff_AddBuff(APrimalBuff* _this, APrimalCharacter* ForCharacter, AActor* DamageCauser) { APrimalBuff* ret = APrimalBuff_AddBuff_original(_this, ForCharacter, DamageCauser); if (!BuffClass || !TimeLeftProp || !_this->IsA(BuffClass)) return ret; try { TimeLeftProp->Set<float>(ret, 20); } catch (std::invalid_argument e) { Log::GetLog()->error("UProperty::Set() - {}", e.what()); return ret; } ret->ForceReplicateNow(false, false); return ret; } // Called when the server is ready void OnServerReady() { FString buffPath = "Blueprint'/Game/Extinction/CoreBlueprints/Buffs/Buff_CryoCooldown.Buff_CryoCooldown'"; BuffClass = UVictoryCore::BPLoadClass(&buffPath); if (!BuffClass) { Log::GetLog()->error("UClass not found - ABuff_CryoCooldown_C"); return; } FName timeLeftName("TimeLeft", EFindName::FNAME_Find); for (UProperty* prop = BuffClass->PropertyLinkField(); prop != nullptr; prop = prop->PropertyLinkNextField()) { if (prop->NameField().Compare(&timeLeftName) == 0) { TimeLeftProp = prop; break; } } if (!TimeLeftProp) { Log::GetLog()->error("UProperty not found - TimeLeft"); return; } } Seems to work.
Dodo Enthusiast 3/2/2023 1:19 AM
Does this also take like 10 seconds to update the buff clientside? Which is fine and I can test myself just wondering. I mean it basically works I was just wondering about he clientside stuff.
Avatar
TheMollusk 3/2/2023 1:19 AM
No. That shows the correct value immediately on the client.
Avatar
Avatar
substitute
is for optimization reasons @Dodo Enthusiast
Dodo Enthusiast 3/2/2023 1:19 AM
I also cache it already because I copied Mollusk example to my first question about this general topic 😄
Avatar
Dodo Enthusiast 3/2/2023 1:49 AM
Thanks everyone for the answers. I think I need some time to make sense of it all. I don't want to claim some wrong things and waste people's time.
Avatar
Mr. Alpaca 3/6/2023 4:03 PM
whare are the api docs
catconfused 1
Avatar
There are none.
Avatar
is there any hook to check player movement (and if i "return;" i can prevent the movement)? i found DECLARE_HOOK(USceneComponent_MoveComponentImpl, bool, USceneComponent*, FVector*, FQuat*, bool, FHitResult*, EMoveComponentFlags, bool); but i cant stop the player movement.
Avatar
You'd be using the ServerMove fns
Avatar
Avatar
Frigoff
You'd be using the ServerMove fns
in what structure? AShooterCharacter?
Avatar
UCharacterMovementComponent
Avatar
Avatar
Frigoff
UCharacterMovementComponent
and how i can update the player character position? if i do void Hook_UCharacterMovementComponent_ServerMove_Implementation(UCharacterMovementComponent* _this, float TimeStamp, FVector_NetQuantize100 InAccel, FVector_NetQuantize100 ClientLoc, char MoveFlags, char ClientRoll, unsigned int View, UPrimitiveComponent* ClientMovementBase, FName ClientBaseBoneName, char ClientMovementMode) { return; } i can move, but cant interact away from my starting position, and if i unload the plugin i got teleported to the original position.
Avatar
You could try setting bCanMove or something similar on the AShooterCharacter (edited)
3:42 AM
I think that worked fairly well
Avatar
So your client is basically desynced away from where the server has your character's stored position?
Avatar
Avatar
Frigoff
So your client is basically desynced away from where the server has your character's stored position?
yes
Avatar
Instead of just returning from the function, you may have to set the location so the client updates it. I would have to reverse more to discover how that works.
3:45 AM
That ClientLoc might be relevant
Avatar
Avatar
Frigoff
So your client is basically desynced away from where the server has your character's stored position?
you know how i can get the server player position?
4:37 AM
bc with RelativeLocationField() / GetPosition() / GetWorldLocation are updating when i move.
Avatar
Avatar
Pelayori
You could try setting bCanMove or something similar on the AShooterCharacter (edited)
any examples?
4:41 AM
"bCanMove" dont exist in AShooterCharacter
Avatar
Avatar
Frigoff
That ClientLoc might be relevant
if i do, for example FVector player_pos = _this->MoveStartLocationField(); if (//Check if player is in certain zone) { PC->SimpleTeleportTo(&player_pos, &rotation); return; } player get stucked and cant leave, because because it goes too inside xD (im using ClientLoc for calculate player location)
4:46 AM
if i use RelativeLocationField() instead of ClientLoc happens too (edited)
Avatar
Dodo Enthusiast 3/14/2023 3:42 AM
Hi, I try to use FExplorerNoteEntry but cant get it to work. According to IDA it should be (the fields I want to use) FExplorerNoteEntry { int ExplorerNoteIndex; int ExplorerNoteType; FString ExplorerNoteDescription; FName DossierTameableDinoNameTag; } I tried both of those defintions struct FExplorerNoteEntry { int& ExplorerNoteIndexField() { return *GetNativePointerField<int*>(this, "FExplorerNoteEntry.ExplorerNoteIndex"); } int& ExplorerNoteTypeField() { return *GetNativePointerField<int*>(this, "FExplorerNoteEntry.ExplorerNoteType"); } FString& ExplorerNoteDescriptionField() { return *GetNativePointerField<FString*>(this, "FExplorerNoteEntry.ExplorerNoteDescription"); } FName& DossierTameableDinoNameTagField() { return *GetNativePointerField<FName*>(this, "FExplorerNoteEntry.DossierTameableDinoNameTag"); } }; //only either one is uncommented at a time struct FExplorerNoteEntry { int ExplorerNoteIndex; int ExplorerNoteType; FString ExplorerNoteDescription; FName DossierTameableDinoNameTag; }; with the code for either of the variants UPrimalGameData* gameData = ArkApi::GetApiUtils().GetGameData(); TArray<FExplorerNoteEntry> notes = gameData->ExplorerNoteEntriesField(); Dodo::Logg::writeToLogFile(pluginName, fmt::format("entrys NUM :{}", notes.Num())); for (auto& note : notes) { // does work for one note Dodo::Logg::writeToLogFile(pluginName, fmt::format("index: {} ExplorerNoteDescription: {}", note.ExplorerNoteIndexField(), note.ExplorerNoteDescriptionField().ToString())); // does not work at all //Dodo::Logg::writeToLogFile(pluginName, fmt::format("index: {} ExplorerNoteDescription: {}", note.ExplorerNoteIndex, note.ExplorerNoteDescription.ToString())); } The weird thing is that the first variant does work for one note and logs the description "dilo dossier". But crashes on the next one. The second variant crashes without logging. (edited)
Avatar
Avatar
Dodo Enthusiast
Hi, I try to use FExplorerNoteEntry but cant get it to work. According to IDA it should be (the fields I want to use) FExplorerNoteEntry { int ExplorerNoteIndex; int ExplorerNoteType; FString ExplorerNoteDescription; FName DossierTameableDinoNameTag; } I tried both of those defintions struct FExplorerNoteEntry { int& ExplorerNoteIndexField() { return *GetNativePointerField<int*>(this, "FExplorerNoteEntry.ExplorerNoteIndex"); } int& ExplorerNoteTypeField() { return *GetNativePointerField<int*>(this, "FExplorerNoteEntry.ExplorerNoteType"); } FString& ExplorerNoteDescriptionField() { return *GetNativePointerField<FString*>(this, "FExplorerNoteEntry.ExplorerNoteDescription"); } FName& DossierTameableDinoNameTagField() { return *GetNativePointerField<FName*>(this, "FExplorerNoteEntry.DossierTameableDinoNameTag"); } }; //only either one is uncommented at a time struct FExplorerNoteEntry { int ExplorerNoteIndex; int ExplorerNoteType; FString ExplorerNoteDescription; FName DossierTameableDinoNameTag; }; with the code for either of the variants UPrimalGameData* gameData = ArkApi::GetApiUtils().GetGameData(); TArray<FExplorerNoteEntry> notes = gameData->ExplorerNoteEntriesField(); Dodo::Logg::writeToLogFile(pluginName, fmt::format("entrys NUM :{}", notes.Num())); for (auto& note : notes) { // does work for one note Dodo::Logg::writeToLogFile(pluginName, fmt::format("index: {} ExplorerNoteDescription: {}", note.ExplorerNoteIndexField(), note.ExplorerNoteDescriptionField().ToString())); // does not work at all //Dodo::Logg::writeToLogFile(pluginName, fmt::format("index: {} ExplorerNoteDescription: {}", note.ExplorerNoteIndex, note.ExplorerNoteDescription.ToString())); } The weird thing is that the first variant does work for one note and logs the description "dilo dossier". But crashes on the next one. The second variant crashes without logging. (edited)
1. The second only works if you know for a fact that those are the exact symbol names. 2. Are you sure that the fields aren't null? You aren't checking before calling .ToString()
5:12 AM
I suggest attaching your Visual Studio debugger to the server executable to see where exactly the crash is
5:13 AM
3. FName& is not FName*
5:13 AM
the first is a reference value, the second is a raw pointer.
5:14 AM
FName& DossierTameableDinoNameTagField() { return *GetNativePointerField<FName*> it doesn't make sense to return FName* as FName&
5:15 AM
so make sure that you are actually reading out FName and not FName*
5:16 AM
I mention this because return *GetNativePointerField<T*> returns T If the field is actually FName then FName& DossierTameableDinoNameTagField() { return *GetNativePointerField<FName*> should be fine if it is actually FName* then FName& DossierTameableDinoNameTagField() { return *GetNativePointerField<FName*> would need to be FName* DossierTameableDinoNameTagField() { return *GetNativePointerField<FName**>
Avatar
jraServerAPI 3/14/2023 5:20 AM
Hi @substitute I was testing that new line in the compiler and I think it needs ** in front too return **GetNativePointerField<FName**> (edited)
Avatar
Avatar
jraServerAPI
Hi @substitute I was testing that new line in the compiler and I think it needs ** in front too return **GetNativePointerField<FName**> (edited)
no, you don't want that
Avatar
jraServerAPI 3/14/2023 5:21 AM
it was giving a red squiggly 🙂
Avatar
GetNativePointerField<FName**> would return FName**, which is turned into FName* with first dereference
5:21 AM
did you update the return type of DossierTameableDinoNameTagField to FName*
5:21 AM
and not FName&
Avatar
jraServerAPI 3/14/2023 5:21 AM
5:22 AM
oh wait
Avatar
Avatar
jraServerAPI
Click to see attachment 🖼️
Yes, you didn't do that
Avatar
jraServerAPI 3/14/2023 5:23 AM
yes you are correct, the error is gone now (in the compiler) (edited)
Avatar
Avatar
substitute
FName& DossierTameableDinoNameTagField() { return *GetNativePointerField<FName*> it doesn't make sense to return FName* as FName&
Dodo Enthusiast 3/14/2023 5:26 AM
Tbh, I just copied it from other code like FVector& LastDeathLocationField() { return *GetNativePointerField<FVector*>(this, "AShooterPlayerController.LastDeathLocation"); } Is there a way to tell what it actually is if IDA just says FName DossierTameableDinoNameTag; for example.
Avatar
Avatar
Dodo Enthusiast
Tbh, I just copied it from other code like FVector& LastDeathLocationField() { return *GetNativePointerField<FVector*>(this, "AShooterPlayerController.LastDeathLocation"); } Is there a way to tell what it actually is if IDA just says FName DossierTameableDinoNameTag; for example.
which may not be wrong
5:27 AM
what does the type look like in IDA?
Avatar
Avatar
Dodo Enthusiast
Hi, I try to use FExplorerNoteEntry but cant get it to work. According to IDA it should be (the fields I want to use) FExplorerNoteEntry { int ExplorerNoteIndex; int ExplorerNoteType; FString ExplorerNoteDescription; FName DossierTameableDinoNameTag; } I tried both of those defintions struct FExplorerNoteEntry { int& ExplorerNoteIndexField() { return *GetNativePointerField<int*>(this, "FExplorerNoteEntry.ExplorerNoteIndex"); } int& ExplorerNoteTypeField() { return *GetNativePointerField<int*>(this, "FExplorerNoteEntry.ExplorerNoteType"); } FString& ExplorerNoteDescriptionField() { return *GetNativePointerField<FString*>(this, "FExplorerNoteEntry.ExplorerNoteDescription"); } FName& DossierTameableDinoNameTagField() { return *GetNativePointerField<FName*>(this, "FExplorerNoteEntry.DossierTameableDinoNameTag"); } }; //only either one is uncommented at a time struct FExplorerNoteEntry { int ExplorerNoteIndex; int ExplorerNoteType; FString ExplorerNoteDescription; FName DossierTameableDinoNameTag; }; with the code for either of the variants UPrimalGameData* gameData = ArkApi::GetApiUtils().GetGameData(); TArray<FExplorerNoteEntry> notes = gameData->ExplorerNoteEntriesField(); Dodo::Logg::writeToLogFile(pluginName, fmt::format("entrys NUM :{}", notes.Num())); for (auto& note : notes) { // does work for one note Dodo::Logg::writeToLogFile(pluginName, fmt::format("index: {} ExplorerNoteDescription: {}", note.ExplorerNoteIndexField(), note.ExplorerNoteDescriptionField().ToString())); // does not work at all //Dodo::Logg::writeToLogFile(pluginName, fmt::format("index: {} ExplorerNoteDescription: {}", note.ExplorerNoteIndex, note.ExplorerNoteDescription.ToString())); } The weird thing is that the first variant does work for one note and logs the description "dilo dossier". But crashes on the next one. The second variant crashes without logging. (edited)
The issue is that FExplorerNoteEntry isn't sized correctly in either of your definitions. UPrimalGameData::ExplorerNoteEntriesField() gives you a TArray<FExplorerNoteEntry>. TArray only works with types that are sized correctly at compile time (TArrays of pointers always work because the compiler knows the size of a pointer). We can see in IDA that the actual size of a FExplorerNoteEntry is 0xA8 bytes.
Avatar
Dodo Enthusiast 3/14/2023 5:28 AM
As I posted is just says "FName DossierTameableDinoNameTag;"
Avatar
So you could do: c++ struct FExplorerNoteEntry { uint8 _padding[0xA8]; int& ExplorerNoteIndexField() { return *GetNativePointerField<int*>(this, "FExplorerNoteEntry.ExplorerNoteIndex"); } int& ExplorerNoteTypeField() { return *GetNativePointerField<int*>(this, "FExplorerNoteEntry.ExplorerNoteType"); } FString& ExplorerNoteDescriptionField() { return *GetNativePointerField<FString*>(this, "FExplorerNoteEntry.ExplorerNoteDescription"); } FName& DossierTameableDinoNameTagField() { return *GetNativePointerField<FName*>(this, "FExplorerNoteEntry.DossierTameableDinoNameTag"); } };
Avatar
Avatar
TheMollusk
The issue is that FExplorerNoteEntry isn't sized correctly in either of your definitions. UPrimalGameData::ExplorerNoteEntriesField() gives you a TArray<FExplorerNoteEntry>. TArray only works with types that are sized correctly at compile time (TArrays of pointers always work because the compiler knows the size of a pointer). We can see in IDA that the actual size of a FExplorerNoteEntry is 0xA8 bytes.
Why would that matter? Does UE4 store the items of a TArray as a contiguous block of memory?
5:29 AM
if so, then wild, because I'm pretty sure TArray can be resized, lol what a waste of copies
Avatar
Yeah the reason his first definition works once and then fails on the second iteration is that he has sizeof(FExplorerNoteEntry) = 1, so when he accesses the "second" element of the array, he's only accessing "address of first element + 1 byte" (edited)
Avatar
yea I get it
5:30 AM
it's using pointer arithmetic
5:30 AM
and falling on the wrong address
5:30 AM
it's not making me happy though
5:32 AM
5:32 AM
yughck
5:32 AM
yeah, that's completely the issue @Dodo Enthusiast
Avatar
Dodo Enthusiast 3/14/2023 5:35 AM
Tbh, I again dont really know whats going on and feel like a complete beginner, but I'm starting the server now with the new definition.
Avatar
The problem is that the sizeof your definition wasn't exactly the same size as the one used by the game
5:36 AM
so when you tried to read the second item in the array, it was reading the wrong address
5:37 AM
A debugger would've been a big help here 😆
Avatar
Avatar
substitute
A debugger would've been a big help here 😆
Dodo Enthusiast 3/14/2023 5:39 AM
I actually used remote debugging but I seem to not be able to get informations from it. It usually crashes in some function I have never heard of with an error like "access violation". (edited)
Avatar
Avatar
Dodo Enthusiast
I actually used remote debugging but I seem to not be able to get informations from it. It usually crashes in some function I have never heard of with an error like "access violation". (edited)
Access Violation is the first sign
5:39 AM
it means you accessed memory that was invalid
5:41 AM
@Dodo Enthusiast when you finish creating your definition, and you have confirmed that it works
5:41 AM
you can make a PR for it.
5:42 AM
@TheMollusk I might rewrite the TArray code
5:42 AM
to instead pull the size of the structure from the UE4 reflection stuff
5:42 AM
that way it isn't a problem anymore
Avatar
Avatar
TheMollusk
The issue is that FExplorerNoteEntry isn't sized correctly in either of your definitions. UPrimalGameData::ExplorerNoteEntriesField() gives you a TArray<FExplorerNoteEntry>. TArray only works with types that are sized correctly at compile time (TArrays of pointers always work because the compiler knows the size of a pointer). We can see in IDA that the actual size of a FExplorerNoteEntry is 0xA8 bytes.
Dodo Enthusiast 3/14/2023 5:44 AM
"We can see in IDA that the actual size of a FExplorerNoteEntry is 0xA8 bytes" how do I know that the size isnt right?
Avatar
your first clue is that it was crashing LOL
5:44 AM
your second is by checking the sizeof the structure against what IDA states the size is
Avatar
Avatar
substitute
your second is by checking the sizeof the structure against what IDA states the size is
Dodo Enthusiast 3/14/2023 5:48 AM
I think stuff like that is not as obvious to some people as you might think^^
Avatar
Avatar
substitute
@TheMollusk I might rewrite the TArray code
That could be a good idea. UArrayProperty has a UProperty* Inner; that you can use to get the size of the element type.
Avatar
Avatar
TheMollusk
So you could do: c++ struct FExplorerNoteEntry { uint8 _padding[0xA8]; int& ExplorerNoteIndexField() { return *GetNativePointerField<int*>(this, "FExplorerNoteEntry.ExplorerNoteIndex"); } int& ExplorerNoteTypeField() { return *GetNativePointerField<int*>(this, "FExplorerNoteEntry.ExplorerNoteType"); } FString& ExplorerNoteDescriptionField() { return *GetNativePointerField<FString*>(this, "FExplorerNoteEntry.ExplorerNoteDescription"); } FName& DossierTameableDinoNameTagField() { return *GetNativePointerField<FName*>(this, "FExplorerNoteEntry.DossierTameableDinoNameTag"); } };
Dodo Enthusiast 3/14/2023 5:51 AM
I just tested it, it works with this definition. Thank you. (edited)
Avatar
Avatar
TheMollusk
That could be a good idea. UArrayProperty has a UProperty* Inner; that you can use to get the size of the element type.
yeah
5:52 AM
actually, we can take it a step further
👍 1
5:52 AM
since the TArray is templated
5:52 AM
we can compute the size of T at construction time
5:52 AM
using the CDO
5:53 AM
that way it's only ever computed once per T
5:53 AM
pretty sure if it's a static member, it's value will get shared for every T
5:53 AM
it'll just be 0 until a TArray is constructed
5:54 AM
so the logic in the constructor could be like
5:54 AM
if (TArray<T>::Size == 0) TArray<T>::Size = CalculateSizeOf<T>; (edited)
Avatar
Avatar
substitute
your second is by checking the sizeof the structure against what IDA states the size is
Dodo Enthusiast 3/14/2023 6:01 AM
Thanks for your answers. Could you maybe give a little example on how to do that? My main issue with understanding is that the struct in IDA has like 20 fields but it seems to be ok to just define some of them, so how can I accurately compare the sizes?
Avatar
anyone got a template for using cmake instead of vstudio? or any notes on what's the important parts of your template @substitute or is it a standard DLL export long as ArkApi.lib is linked?
Avatar
i'm feeling so downgraded using vstudio over clion lol.
Avatar
Avatar
Aikar
anyone got a template for using cmake instead of vstudio? or any notes on what's the important parts of your template @substitute or is it a standard DLL export long as ArkApi.lib is linked?
it's a standard dll project but you link with ArkApi.lib if you use any API functions like SetHook etc...
3:08 PM
you can also export functions with the names Plugin_Init and Plugin_Unload
3:08 PM
Plugin_Init will be called after LoadLibrary and Plugin_Unload will be called before FreeLibrary (if they are exported)
Avatar
are those more recommended than standard DLL Load/Unload?
3:12 PM
seems like every plugin ive seen just uses DLL entry point
Avatar
these functions should be used when you have code that cannot execute under loader lock for example
3:13 PM
an example of this would be if you need to load another dll on your dll's load for example
Avatar
whats harm in always using em
Avatar
additionally Plugin_Unload can be used for freeing any threads you have created (edited)
Avatar
Avatar
Aikar
whats harm in always using em
no harm 😄
Avatar
k as yeah id rather not have to 2 load and 2 unload methods if not necessary lol.
3:14 PM
then everyone looking at source has to figure out which is called in what order (edited)
3:15 PM
im trying to make my first plugin finally, but man using jetbrains IDE's for so many years for every language i work in this has been a stumble with keybindings 😛 ive accidently compiled project so many times trying to jump to symbol!
Avatar
not had to use other editors tbh, my university also hands out assignments which should be completed in vscode or visual studio
Avatar
yeah unis can be weird like that.
3:17 PM
i remember getting yelled at for USING Vstudio instead of command line compilers in college
Avatar
i got minus 5 points on an assignment for having more than 50 characters on a line 🤷
Avatar
50!? man even linux allows 70
3:18 PM
well 80 but git is 72~ for first line of commit message
3:18 PM
to allow room to display hash before it to fit 80 lol
Avatar
yeah but it wasn't even my fault you have to upload just the code on their grading website and it messed up my formatting (edited)
Avatar
what i learned about college courses is your instructor thinks they have the best methods and you gotta do things the same way as them or its wrong
Avatar
that is exactly accurate yeah 😄
Avatar
hopefully things are better these days than 15 years ago when i went to school haha
Avatar
this particular university is notorious for making the first year of Computer Science very difficult so they can get as many students to drop the course and switch to something else
3:21 PM
because most of the ppl that enroll here chose Computer Science
Avatar
yeah what also sucks is CS is a flawed degree for a career too. something ive always ranted about. Things you learn in CS are great and should be learned, but when you get out and look for a job, the issue is that no one wants juniors touching code where that info is relevant lol.
3:22 PM
it's def good knowledge though to do things right early on
3:23 PM
just Software Engineering degree teaches better topics on real world topics for writing software and getting it shipped, business practices, project management, etc.
Avatar
that is very true, but to be honest i've not learned anything in university pretty much all of my knowledge can be accredited to the very cool developer of this project (Michidu) he very generously taught me pretty much everything about c++ lol
Avatar
yeah that's how I ultimately learned over the years, I got started in high school and actually didnt learn anything in HS or college programming classes. I've been at it over 20 years now lol.
3:25 PM
been 15 years since I touched C++ though so got to catch up on new things
Avatar
you have have been gathering experience for more time than i've been alive 😛
Avatar
yep lol. I come from minecraft community where def huge influx in young developers ive helped teach things over the years
Avatar
very nice to have you in our community 🙂
Avatar
Avatar
Aikar
yeah what also sucks is CS is a flawed degree for a career too. something ive always ranted about. Things you learn in CS are great and should be learned, but when you get out and look for a job, the issue is that no one wants juniors touching code where that info is relevant lol.
I disagree, computer science as a degree is fine. It’s all about computer science
3:54 PM
If someone wants to go into software engineering, a software engineering degree is better. 😉
Avatar
except what most people get a CS Degree for is to do software engineering, unless your definition of software engineering is different than mine lol.
4:12 PM
if you're not building software, im struggling to think what is CS gonna do for you outside of academics?
Avatar
does anyone know of an example plugin using cmake
9:01 PM
used cmake-converter on subs template but def not working yet
Avatar
Ainz Ooal Gown 3/14/2023 9:03 PM
Hello, do you know if the api works on mtxserv servers ?
Avatar
Avatar
Aikar
if you're not building software, im struggling to think what is CS gonna do for you outside of academics?
Yes, a CS degree is for academics
9:15 PM
You want a CE degree for engineering
9:15 PM
I went the CS route because I want to eventually get my PhD
Avatar
Avatar
Aikar
does anyone know of an example plugin using cmake
Why not use MSVC with CLion?
9:17 PM
Pretty sure it’s supported
9:18 PM
Only thing you might need to move over is the additional includes and library directories
Avatar
maybe this will work, i had selected VStudio toolchain but it still kept complaining about cmake
Avatar
i think issue was ultimately with cmake-converter, i made new project and just copied the main cmake configs in to it and the files and got it to compile (edited)
9:28 PM
this guide is ultimately what i had going, cmake still uses the vs toolchain to compile
Avatar
Avatar
Ainz Ooal Gown
Hello, do you know if the api works on mtxserv servers ?
Ainz Ooal Gown 3/14/2023 10:16 PM
For information yes it works on mtxserv you just have to install the API and reboot the server to finish the installation.
Avatar
getting stuck :/ https://gist.github.com/aikar/47cd115b196b3361153dfea9e66f3e56 plugin compiles but gives 126. searching discord mentions dependency issues, but what dependency? clearly ARK API is loaded lol. everyone elses plugin loads so clearly shouldnt be missing any system deps.
GitHub Gist: instantly share code, notes, and snippets.
3:01 AM
tried commenting out near all the code to make sure init isnt having an error
Avatar
hmm release mode worked, is it just something wrong with debug builds
Avatar
void Hook_NotifyItemAdded(AShooterCharacter* _this, UPrimalItem* item, bool bEquipItem) { NotifyItemAdded_original(_this, item, bEquipItem); if (!item) { return; } try { FString name = item->NameField().ToString(); if (!name.Contains("PrimalItem_AwesomeSpyGlass_C")) { LOG->info("No Match" + name.ToString()); return; } auto controller = ArkApi::GetApiUtils().FindControllerFromCharacter(_this); if (!controller) { LOG->info("No Controller" + name.ToString()); return; } //if (!_this->HasBuff()) controller->ServerRequestInventoryUseItem(_this->MyInventoryComponentField(), item->ItemIDField()); LOG->info("Used Spyglass: " + name.ToString()); } catch (const std::runtime_error &e){ LOG->error("RuntimeError: " + std::string(e.what())); } catch (const std::exception &e) { LOG->error("Exception: " + std::string(e.what())); } } so is there a different way to get controller than this? hooks firing correctly, just cant get controller w/o crash, and is there something I can do to catch the error properly and not crash the whole server? SET_HOOK("AShooterCharacter.NotifyItemAdded", NotifyItemAdded); For the Hook
5:22 AM
once i get basics working ill add in the buff detection to not use it if its already active (ie picked up a duplicate spyglass)
Avatar
You pretty much need to nullptr check all pointers before using them.
Avatar
but isnt this saying its crashing inside of the FindControllerFromCharacter, which only param there is _this
6:11 AM
and how would _this be null
6:14 AM
or was it cause i need: auto* controller = ArkApi::GetApiUtils().FindControllerFromCharacter(_this); to avoid auto deref?
6:15 AM
though im literally in game so why would that ptr be null, how do i get the controller for the char receiving item (edited)
6:20 AM
seems like batman and pela had issues with this code in past too https://discord.com/channels/513432877904691202/745040316196847626/852864595205816321
Avatar
Avatar
Aikar
void Hook_NotifyItemAdded(AShooterCharacter* _this, UPrimalItem* item, bool bEquipItem) { NotifyItemAdded_original(_this, item, bEquipItem); if (!item) { return; } try { FString name = item->NameField().ToString(); if (!name.Contains("PrimalItem_AwesomeSpyGlass_C")) { LOG->info("No Match" + name.ToString()); return; } auto controller = ArkApi::GetApiUtils().FindControllerFromCharacter(_this); if (!controller) { LOG->info("No Controller" + name.ToString()); return; } //if (!_this->HasBuff()) controller->ServerRequestInventoryUseItem(_this->MyInventoryComponentField(), item->ItemIDField()); LOG->info("Used Spyglass: " + name.ToString()); } catch (const std::runtime_error &e){ LOG->error("RuntimeError: " + std::string(e.what())); } catch (const std::exception &e) { LOG->error("Exception: " + std::string(e.what())); } } so is there a different way to get controller than this? hooks firing correctly, just cant get controller w/o crash, and is there something I can do to catch the error properly and not crash the whole server? SET_HOOK("AShooterCharacter.NotifyItemAdded", NotifyItemAdded); For the Hook
AShooterCharacter has a ControllerField in it
7:01 AM
Technically it's on the APawn (edited)
Avatar
auto* controller = static_cast<AShooterPlayerController*>(_this->ControllerField()); ?
7:03 AM
tried a LastValidController but that was null
Avatar
You don't need the * on auto but ye
7:03 AM
Give that a try
Avatar
really wish this dang ASM rcon had up arrow for previous commands to help with unload/load repeating 😭
7:06 AM
sweet that seemed to work, now to the next crash lol
Avatar
Aight
7:07 AM
Hmm
Avatar
guessing controller->ServerRequestInventoryUseItem(controller->GetPlayerInventory(), item->ItemIDField()); is bettter to do
7:08 AM
ultimately i want on obtaining a spyglass, use it
7:08 AM
then ill do login hook to auto use it then too
Avatar
I don't know why it would crash on FindFunction
7:09 AM
Only thing I can think of is that somehow the controller passed is in valid
7:09 AM
Can you print the ObjectFlags of the controller
Avatar
line that crashed was: controller->ServerRequestInventoryUseItem(_this->MyInventoryComponentField(), item->ItemIDField());
7:10 AM
im about to try using the PlayerInventory instead
Avatar
That just does controller->character->InventoryComponent
7:10 AM
Should be the same
Avatar
think there needs to be a delay before using on notify added? but should really be in inventory at that point shouldnt it
Avatar
Avatar
Aikar
really wish this dang ASM rcon had up arrow for previous commands to help with unload/load repeating 😭
if you put a new DLL in your plugin folder named like this "YourPluginName.dll.arkapi" the api will auto load it for you.
1:59 PM
You no longer need to unload/load it manually via commands.
2:00 PM
Also when testing you should include the plugins PDB file so you can get full debugging output.
2:02 PM
I never use "auto" I always strictly type my vars. I doubt there is anything wrong with using "auto" I just like to have them defined in the code from the start.
2:04 PM
You can also try moving NotifyItemAdded_original(_this, item, bEquipItem); to the bottom of your hook incase those pointers are destroyed or invalid after the original code runs.
Avatar
Avatar
Aikar
sweet that seemed to work, now to the next crash lol
Did FindFunction return null?
Avatar
Avatar
Lethal
I never use "auto" I always strictly type my vars. I doubt there is anything wrong with using "auto" I just like to have them defined in the code from the start.
Hi, there are cases where you have to use auto in C++
6:50 PM
[[nodiscard]] constexpr auto operator*() const { return *immutable_ptr; } in my container over raw pointers
6:51 PM
if you use T (we know T as T, not T*) with *immutable_ptr and it points to a function T, then you will fail to compile
6:51 PM
because *T on T* when T* is a function produces T* and not T
Avatar
CLang tidy yells at me to use auto to keep it cleaner and not double write the type def for the static cast lol
7:01 PM
@substitute havent figured that one out yet, had to sleep and now work.
7:01 PM
gonna try lethals suggestion see if it is a pointerbeing free'd issue to move the original call down (edited)
Avatar
I also suggest using FindFunctionChecked
Avatar
but the this_ reference is fine, as well as item, so i suspect its not that
Avatar
which will throw an assert crash
7:02 PM
if it can't find the function
Avatar
but im not calling that method, its the ->ServerRequestInventoryUseItem doing it self
7:02 PM
the crash is inside of that method
Avatar
what are you passing to that method?
7:03 PM
are you sure MyInventoryComponentField isn't null?
Avatar
im not yet, havent gotten to debugging that, but how would a players inventory be null if online lol
7:06 PM
hence i was questioning am i using wrong inventory
7:06 PM
cant remember if i tried the PlayerInventory one or not before bed, but person above said it should ultimately be same call
Avatar
I suspect you’re being trolled by UE4 garbage collector but that’s my final stretch on what I can think of
8:28 PM
You’d have to print the object flags
8:28 PM
Nullptr checks aren’t enough
Avatar
Avatar
Aikar
seems like batman and pela had issues with this code in past too https://discord.com/channels/513432877904691202/745040316196847626/852864595205816321
Issues we had were on an old version of the API were not all PDB symbols were exported. API had a default fields, and devs had to include other symbols in a PdbInfo.json file too. Our issue ended up being APawn not being exported hence the function address being garbage It is no longer necessary since we forced all symbols to be exported since 3.51 version (edited)
Avatar
Hook_APrimalStructure_IsAllowedToBuild(APrimalStructure* _this, APlayerController* PC, FVector AtLocation, FRotator AtRotation,FPlacementData* OutPlacementData, bool bDontAdjustForMaxRange, FRotator PlayerViewRotation, bool bFinalPlacement) I even found a blueprint using hooks. But I couldn't find the item name. Which method should I use?
Avatar
well tried moving the callback to after andu sing getPlayerInventory, still cant get an inventory comp for the player, im getting no comp log msg: https://gist.github.com/aikar/344aac731a90759c370f5fdd744c14c9 I was looking back at what natsu provided here: https://discord.com/channels/513432877904691202/513432877904691205/1083445372883587122 and was trying UFunction *pFunction = _this->FindFunctionChecked(FName("ToggleUILock", EFindName::FNAME_Find)); if (pFunction) { LOG->info("ProcessEvent"); _this->ProcessEvent(pFunction, {}); return TRUE; } But that doesnt find the function nor does item->FindFunctionChecked. function approach feels like could be more reliable, anyone got tips on what i could try to fix for function method?
GitHub Gist: instantly share code, notes, and snippets.
3:10 AM
wait i just realized natsu loaded wrong mod
3:10 AM
no wonder that doesnt work
3:12 AM
@Natsu how did you load the mod into dev kit to see that? can it be done for AwesomeSpyglass, you did SuperSpyglass which isnt same thing. I tried loading uasset file in dev kit but it didnt like it. compiled a ue4 compress app to de compress the .z asset.
Avatar
Avatar
Aikar
@Natsu how did you load the mod into dev kit to see that? can it be done for AwesomeSpyglass, you did SuperSpyglass which isnt same thing. I tried loading uasset file in dev kit but it didnt like it. compiled a ue4 compress app to de compress the .z asset.
you can't view that stuff in the devkit when the mod is cooked
3:31 AM
at that point, it's essentially compiled
3:31 AM
you can however dump the fields and functions for a blueprint using UE4 reflection
Avatar
ah im guessing natsu got it loaded cause that mod is open source and prob released the files
Avatar
including the parameters for a function
Avatar
but thats not the mod im using
3:35 AM
kinda out of ideas to try until yall can give me some tips at this point 😦 i just cant find a function thatll give me the players inventory component
3:35 AM
UPrimalInventoryComponent* comp = _this->MyInventoryComponentField(); if (comp) { auto itemId = item->ItemIDField(); controller->ServerRequestInventoryUseItem(comp, itemId); feels like it should work
Avatar
if you want when the character spawns
3:37 AM
this may be a good hook AShooterCharacter::BeginPlay
Avatar
im not on that one yet, im just doing pick up item first then ill move on to spawn
3:38 AM
or well login
Avatar
don't you want on spawn
Avatar
itemadded feels like best hook to handle player receiving their inventory after death
3:38 AM
they wont have spyglass yet
Avatar
since you have to activate the spyglass
3:38 AM
so you don't always have the spyglass?
Avatar
after death, when the keep inventory mod returns their inventory
3:39 AM
i was thinking logically, on spyglass receive, if buff not active, use spyglass (finding buff is next step)
Avatar
Can you send me the mods
3:39 AM
Their Steam urls
3:40 AM
one of chris's mods lol
3:40 AM
who's sadly MIA too
Avatar
This is how UPrimalInventoryComponent::ServerUseInventoryItem works
4:00 AM
if ( UActorComponent::GetOwner(this) ) { UPrimalInventoryComponent::InventoryRefresh(this); Item = UPrimalInventoryComponent::FindItem(this, itemID, 0, 0, 0i64); if ( Item ) { Owner = UActorComponent::GetOwner(this); v3 = Owner->GetOwnerController(Owner) != ByPC; if ( Item->AllowUseInInventory(Item, v3, ByPC, 0) ) { if ( AShooterPlayerController::GetPlayerCharacter(ByPC) ) { PlayerCharacter = AShooterPlayerController::GetPlayerCharacter(ByPC); if ( PlayerCharacter->IsConscious(PlayerCharacter) ) { v8 = UActorComponent::GetOwner(this); v4 = v8->GetOwnerController(v8) != ByPC; Item->Use(Item, v4); } } } } }
Avatar
im not getting to that line
4:00 AM
i cant get ahold of the inventory comp
Avatar
Item->Use(Item, v4); is probably what you want
Avatar
Avatar
Aikar
i cant get ahold of the inventory comp
you might not even need it
Avatar
ah interesting
Avatar
since you have the direct item reference
Avatar
any idea why i cant get it during this event though?
Avatar
well for starters you're using AShooterPlayerController::ServerRequestInventoryUseItem (edited)
4:02 AM
I'm looking at UPrimalInventoryComponent::ServerUseInventoryItem
Avatar
im still talking about before that method, in the NotifyItemAdded, the AShooterCharacter->MyInventoryComponentField() is returning null
4:03 AM
Yes, but that just calls UPrimalInventoryComponent::ServerUseInventoryItem
4:03 AM
which eventually just calls Item->Use(Item, v4);
4:03 AM
at least that's what I'm expecting to happen under the hood in the BP stuff (edited)
4:10 AM
i have UPrimalItem not Item but it worked! item->Use(false);
4:10 AM
I'll let you know if it works
4:10 AM
oh
4:10 AM
just doing item->use worked for you?
Avatar
nice
Avatar
is there a command to dump all buffs i have
Avatar
you could write one
Avatar
as i need to handle duplicate spyglasses
4:11 AM
so it doesnt toggle it back off
4:11 AM
lol yeah crafted another and it turned off
4:12 AM
if mod author was around id ask for this to be built into the mod but yeah his discord said he hasnt signed in over a year 😦
4:12 AM
and man he has some of the most subscribed mods out there
4:13 AM
now heres hoping on login the dang get inventory works
Avatar
The Character should always have a valid pointer to it's own inventory.
Avatar
man my old coworker would scream at that code you pasted. he was such a strong believer in "Guard Clause Dont Nest"
Avatar
That's IDA code pretty sure
Avatar
It's IDA Code
Avatar
Maybe cleaned up a little
Avatar
so how come i keep getting null
Avatar
Avatar
Frigoff
The Character should always have a valid pointer to it's own inventory.
not if the character doesn't have an inventory
Avatar
or is my if (!comp) wrong
Avatar
but the inventory should have a character
Avatar
Are you firing the original
Avatar
and it needs to be if != nullptr
Avatar
Avatar
Aikar
and it needs to be if != nullptr
if(!x) is fine
Avatar
i fired it AFTER yes, per suggestions
Avatar
you could have tried this AShooterPlayerController* playerController = playerInventory->GetOwnerController();
Avatar
GitHub Gist: instantly share code, notes, and snippets.
Avatar
Let me take a look
Avatar
Avatar
Frigoff
Let me take a look
I'm thinking the definition isn't correct
4:18 AM
in the API any more
Avatar
auto controller = static_cast<AShooterPlayerController*>(_this->ControllerField()); was working
4:18 AM
UPrimalInventoryComponent* comp = _this->MyInventoryComponentField(); this is what failed condition check
Avatar
because I got the crash too and it's due to a fucked up pointer value (edited)
4:19 AM
specifically on _this->GetOwnerController()
4:19 AM
btw @Aikar make sure to filter out engrams too
4:19 AM
as those count as items
Avatar
i guess question - this method lives on APrimalCharacter but I added it to AShooterCharacter to only hook for Shooter chars, could that be causing anything? but so far everything else about it worked
4:20 AM
yeah i asdded logic since then for that
4:20 AM
as i saw it in ArkShop code
4:20 AM
that's the error
Avatar
Nah if you hook the AShooterCharacter one you should be fine
Avatar
even GetOwnerController is throwing
Avatar
BOOL trySpyglass(AShooterCharacter *_this, UPrimalItem *item) { FString name = item->NameField().ToString(); if (!name.Contains("PrimalItem_AwesomeSpyGlass_C")) { return FALSE; } try { auto controller = static_cast<AShooterPlayerController*>(_this->ControllerField()); if (!controller) { return FALSE; } TArray<APrimalBuff*> buffs; _this->GetAllBuffs(&buffs); LOG->info("Used Spyglass: " + name.ToString()); item->Use(false); return TRUE; } catch (const std::runtime_error &e){ LOG->error("RuntimeError: " + std::string(e.what())); } catch (const std::exception &e) { LOG->error("Exception: " + std::string(e.what())); } return FALSE; } void Hook_NotifyItemAdded(AShooterCharacter* _this, UPrimalItem* item, bool bEquipItem) { if (_this && item && item->ClassField() && !item->bIsEngram()()) { trySpyglass(_this, item); } NotifyItemAdded_original(_this, item, bEquipItem); }
Avatar
so something in the game is definitely amiss
Avatar
is what I have working now, trying to add buff check now
4:20 AM
but uh its been 15 years since C++ and i dont remember how to foreach LOL
Avatar
Sure
4:21 AM
for(const auto& element : container)
Avatar
i dont know the name of the buff yet to just check for specific buff
Avatar
you can dump the buff names
Avatar
yeah thats what im trying to do
Avatar
I would compare with the FName
4:21 AM
That will give you the fastest easiest solution I've found
4:22 AM
buff->Name.ComparisionIndex
4:22 AM
@substitute Does the API have the object flags check
Avatar
he's going to need to modify the api definition for APrimalBuff
4:22 AM
it doesn't contain padding
4:23 AM
and the return value of BuffsField is TArray<APrimalBuff>
4:23 AM
I might just write the modified code to compute the size at construction time so it's not an issue for anyone
Avatar
_this->GetAllBuffs(&buffs); for(const auto& buff : buffs) { auto buffName = buff->NameField().ToString(); if (buffName.Contains("Spyglass")) { LOG->info("Buff: " + buffName.ToString()); return TRUE; } } ?
Avatar
Avatar
Aikar
_this->GetAllBuffs(&buffs); for(const auto& buff : buffs) { auto buffName = buff->NameField().ToString(); if (buffName.Contains("Spyglass")) { LOG->info("Buff: " + buffName.ToString()); return TRUE; } } ?
that will fail
4:24 AM
because TArray uses pointer arithmetic for getting items
4:24 AM
and sizeof(APrimalBuff) is 0 in the API
4:25 AM
you'll have to add padding to APrimalBuff until I write code to TArray to avoid this issue
Avatar
Should be APrimalBuff* sizeof that should be 8
Avatar
actually, you're right
4:25 AM
it is an array of pointers
Avatar
GetAllBuffs returns TArray<APrimalBuff*>
4:25 AM
yes
Avatar
and not an array of values
4:25 AM
so it'll be fine since sizeo(T*) is always sizeof(void*) (edited)
Avatar
Avatar
Aikar
_this->GetAllBuffs(&buffs); for(const auto& buff : buffs) { auto buffName = buff->NameField().ToString(); if (buffName.Contains("Spyglass")) { LOG->info("Buff: " + buffName.ToString()); return TRUE; } } ?
Looks fine to me
4:26 AM
Though in the future you should move from string comparing 👍
Avatar
so ArkApi needs an update? would the Hasbuff method work fine if i get the proper BP path for the UVictoryCore stuff?
4:26 AM
yeah im trying to just dump for now
Avatar
yeah
Avatar
i dont know the bp path at all currently so just want to dump
Avatar
Avatar
Aikar
so ArkApi needs an update? would the Hasbuff method work fine if i get the proper BP path for the UVictoryCore stuff?
I've never tested that
Avatar
Avatar
Aikar
so ArkApi needs an update? would the Hasbuff method work fine if i get the proper BP path for the UVictoryCore stuff?
it should work fine (the api)
4:26 AM
since TArray in this instance is for a pointer type
Avatar
oh ight you was meaning API looks wrong for the inventory stuff right
4:27 AM
and not buffs
Avatar
Avatar
Aikar
oh ight you was meaning API looks wrong for the inventory stuff right
it could also just be an "ark thing"
4:27 AM
where there isn't really a fix
4:27 AM
there's a lot of bad code in Ark
Avatar
and why the fuck does the item name field append an incrementing number every time
Avatar
Avatar
Aikar
and why the fuck does the item name field append an incrementing number every time
it's a unique instance of that class
4:28 AM
so the name has to be unique
4:28 AM
you can just trim that off
Avatar
That's because of GlobalNames and GlobalObjects
Avatar
yeah i did the contains to get around it
Avatar
@Frigoff we should reverse engineer broken things and write patches that fix the broken things
Avatar
Sure.
Avatar
careful, youll end up like what we did for minecraft 😛
Avatar
First thing on the list is GetDescriptiveName memory leak
Avatar
what's the leak?
Avatar
High performance Spigot fork that aims to fix gameplay and mechanics inconsistencies - Paper/patches/server at master · PaperMC/Paper
Avatar
Last time I used that function a lot it would jump memory a lot
Avatar
nearly 1000 patches lol
Avatar
I have plans to implement s3 transfers for everyone
4:29 AM
it's possible to use s3 as your transfers backend already
4:29 AM
without any plugins with a command line arg
4:29 AM
but it doesn't enable the anti-dupe timer
Avatar
And I'm fairly certain it's because their way of appending the names
4:29 AM
Because descriptive name
4:29 AM
Returns Playername - Lvl
Avatar
is any decompiler good enough to create a compilable server to actually patch server code and rebuild?
Avatar
and I think their really old logic causes a memory server
Avatar
Avatar
Aikar
is any decompiler good enough to create a compilable server to actually patch server code and rebuild?
IDA is your best bet but I personally like Binary Ninja
Avatar
that was one good thing about java is we could do this patchin then compile
Avatar
And most cases since the PDB doesn't get the types right with templated types it takes some x64dbg knowledge to get it
Avatar
i have ghidra or w/e its called and looking at some stuff i just havent figured out how to just make it dump everything as this app sucks for navigating
Avatar
If you're looking to just go through the game classes I highly recommend dumping an SDK
4:31 AM
And if you're looking for a good dump, IDA is your best bet
4:32 AM
sadly because IDA sucks
Avatar
something tells me that your buff that you want
4:32 AM
is AwesomeSpyGlass_Buff
Avatar
yeah well im not looking to pay for that and try not to pirate things anymore
4:32 AM
lol
Avatar
yeah thats the file i was trying to load in devkit lol
Avatar
Avatar
Aikar
is any decompiler good enough to create a compilable server to actually patch server code and rebuild?
not exactly
Avatar
Avatar
Aikar
yeah well im not looking to pay for that and try not to pirate things anymore
Ghidra is probably your best unless you want to try out Binary Ninja
Avatar
but you could overwrite the existing implementation for something
Avatar
I like Binary Ninja because it's multithreaded analyzing
Avatar
and never call the original
4:33 AM
you can even reclaim the memory the original used by marked the memory as writable and freeing it
4:33 AM
if you're feeling bold
Avatar
Does detours fix the stack
4:33 AM
If you don't call the original
Avatar
im trying to leep it simple for now lol
Avatar
Avatar
Frigoff
Does detours fix the stack
that would only be an issue for functions that are LTO
4:33 AM
everything else is __fastcall
Avatar
Can you expand LTO
Avatar
link time optimization
Avatar
i see
Avatar
and whole program optimization
4:33 AM
that's what produces those garbage non-standard calling conventions
Avatar
they're not garbage for optimization
4:34 AM
but they're garbage for hooking because you can't just hook them
4:34 AM
you have to write assembly code to translate the stack from that to something like __fastcall
4:34 AM
and then back into whatever it expects for clean up
Avatar
yikes
Avatar
like if the expectation is eax,ebx,ecx are used
Avatar
Ye I got you
Avatar
but the convention expects everything on the stack
4:35 AM
you'll know you found one of these functions when you see __usercall in IDA
4:35 AM
if you see __fastcall then just use cdecl in x64
4:35 AM
since that is __fastcall
Avatar
Ye __fastcall is babe (edited)
Avatar
Avatar
Aikar
im trying to leep it simple for now lol
Did you get it working?
Avatar
it's just the default for x64
4:36 AM
x32 is where calling conventions actually matter
Avatar
so far my buff code isnt printing so moving my log to just dump them all, unless this buffs array isnt looping at all
Avatar
the ark show is an anime guys
4:36 AM
4:36 AM
the skin proves it
Avatar
Do you have any buffs on the character?
Avatar
You might not get any until the next game tick when you've equipped something
Avatar
ive got the arkshop ui one
4:37 AM
though the spyglass doesnt seem to put an actual buff icon in bottom right
4:37 AM
so is it gonna show up
Avatar
You can disable that icon from showing up
Avatar
In the blueprint
Avatar
TArray<APrimalBuff*> buffs; _this->GetAllBuffs(&buffs); for(const auto& buff : buffs) { auto buffName = buff->NameField().ToString(); LOG->info("Buff: " + buffName.ToString()); if (buffName.Contains("Awesome_SpyGlass")) { return TRUE; } } didnt print anything so i dont think its finding the buffs correctly, but didnt crash at least.
Avatar
@Frigoff HDR moment
4:39 AM
Avatar
AH HELL NAH
Avatar
im dropping 2 spyglasses, first turns it on, then 2nd is turning it off
4:39 AM
oh im on 4k hdr too 😛
Avatar
Maybe try printing buffs size?
Avatar
I'm thinking the iterator might be the issue
4:41 AM
4:41 AM
the game uses indexes
4:41 AM
not iterators
Avatar
I can't remember the apis implementation of iterators
Avatar
is it ->Num for size?
4:44 AM
Though since your TArray isnt a pointer it should be (edited)
4:44 AM
.Num
Avatar
Num is showing 0 for me
4:47 AM
i expect it to least be showing the ark shop ui, but expectation is after first id see the spyglass buff and can return early
Avatar
There's a different way, gonna test rq
Avatar
there is GetBuffs too
Avatar
and GetAllBuffs
4:48 AM
which is probably more useful since it ensures no filters
Avatar
i was using GetAllBuffs
Avatar
I was using ->Buffs() (edited)
Avatar
then ->GetBuffs is the next try lol
4:48 AM
all these sim named things is pretty confusin
4:49 AM
that ones 0 too
Avatar
@Frigoff
5:02 AM
I think I know the problem
5:02 AM
NotifyItemAdded is probably for sending a notification to the player
5:02 AM
so some things may not have their server sided data attached to them
Avatar
pretty sure it is yeah
5:02 AM
1 tick delay should solve?
Avatar
UPrimalCharacterStatusComponent::CharacterUpdatedInventory
5:03 AM
that's probably better
Avatar
hmm would that handle login too
Avatar
and with this you can iterate the inventory and toggle the buff (and break your iterator)
Avatar
feels slower to do that than on notify of a new item though where can do simple check and ignore rest
5:04 AM
and only scan inv for the login scenario
5:04 AM
cant i just timer 0 delay to run next tick
Avatar
You won't ever have the server sided data
5:04 AM
if it isn't attached to the reference you got
Avatar
Can you explain to me what you’re trying to do
5:04 AM
Maybe I know a good starting point
Avatar
does it not just keep a single char object
Avatar
He wants to toggle an item when it is in his inventory
Avatar
Avatar
Aikar
does it not just keep a single char object
as we can see in this case, no
5:05 AM
since we don't have any of our buffs
5:05 AM
and that code should work given that other people have used buffs before without issue
Avatar
I’ve personally used GetAllBuffs (edited)
Avatar
and it also crashes when trying to get the owning controller
Avatar
yeah and im now trying to use the buffs to find out when the item is ALREADY on and ignore it to avoid toggling off
5:07 AM
you could also try these
5:08 AM
@Frigoff IDA moment
5:08 AM
Avatar
I mean
5:08 AM
At least it
5:08 AM
Saved you
5:08 AM
When I dump the game
Avatar
it didn't save shit
Avatar
I always copy the db
5:08 AM
Because yeah
5:09 AM
Ida can be trash
5:10 AM
notice gps toggled off when picked up 2nd one
5:10 AM
trying to avoid that and my understanding is theres a buff active while its on so tryin to look for it and don't re-use if it is on.
5:11 AM
sure perfect world people only have 1 spyglass lol
Avatar
There is also UPrimalItem::AddToInventory
5:12 AM
which absolutely should have everything
Avatar
@substitute does the inventory have a begin play
5:12 AM
Or tick
Avatar
Everything has a beginplay and tick
Avatar
Well then that’s how I’d do it
Avatar
would this method also be fired upon login as the char is being created lol
5:12 AM
but i can try it
5:12 AM
but does the uprimalitem have a char reference
5:14 AM
hey could i just always pass equipitem true for this?
5:14 AM
to that method
5:14 AM
(UPrimalInventoryComponent* toInventory, bool bEquipItem, bool AddToSlotItems, FItemNetID* InventoryInsertAfterItemID, bool ShowHUDNotification, bool bDontRecalcSpoilingTime, bool bIgnoreAbsoluteMaxInventory) { NativeCall<void, UPrimalInventoryComponent, bool, bool, FItemNetID, bool, bool, bool>(this, "UPrimalItem.AddToInventory", toInventory, bEquipItem, AddToSlotItems, InventoryInsertAfterItemID, ShowHUDNotification, bDontRecalcSpoilingTime, bIgnoreAbsoluteMaxInventory); }
Avatar
I believe so.
Avatar
Avatar
Aikar
but does the uprimalitem have a char reference
it has a reference for the inventory
5:14 AM
which should have a character attached to it
Avatar
I think that's how equipping an item from a vault works ^^
Avatar
you'll have to verify that the inventory IS a player character though
Avatar
that should be easy enough
Avatar
static void onNotifyItemAdded(UPrimalInventoryComponent* _this, UPrimalItem* anItem, bool bEquipItem) { NotifyItemAdded.original(_this, anItem, bEquipItem); if (!_this || !anItem) return; AActor* owner = _this->GetOwner(); if (!owner || !owner->IsA(AShooterCharacter::StaticClass())) return; AShooterCharacter* playerCharacter = static_cast<AShooterCharacter*>(owner); Log::GetLog()->error("has buff count {}\n", playerCharacter->BuffsField().Num()); anItem->Use(true); }
5:15 AM
I'll give this a shot
5:17 AM
this was not it chief
Avatar
Yeah might be worth to try
5:19 AM
UPrimalInventoryComponent::TickComponent
Avatar
lol
5:19 AM
I forgot to update teh reference
Avatar
if that doesn't work I'll make it work with
5:21 AM
@Frigoff
5:22 AM
UE4 is such a piece of shit man
5:22 AM
Trust me
5:22 AM
the other engines I've studied
5:22 AM
This is top of the line
5:23 AM
hey
5:23 AM
@Aikar
5:23 AM
UPrimalInventoryComponent.NotifyItemAdded
5:23 AM
that's what you want
5:23 AM
that executes on the server w/ everything
5:23 AM
static void onNotifyItemAdded(UPrimalInventoryComponent* _this, UPrimalItem* anItem, bool bEquipItem) { NotifyItemAdded.original(_this, anItem, bEquipItem); if (!_this || !anItem) return; AActor* owner = _this->GetOwner(); if (!owner || !owner->IsA(AShooterCharacter::StaticClass())) return; AShooterCharacter* playerCharacter = static_cast<AShooterCharacter*>(owner); Log::GetLog()->error("has buff count {}\n", playerCharacter->BuffsField().Num()); anItem->Use(true); }
5:25 AM
though, im curious to try the equipitem bool then i dont even need to check buffs
5:26 AM
void Hook_NotifyItemAdded(AShooterCharacter* _this, UPrimalItem* item, bool bEquipItem) { if (_this && item && item->ClassField() && !item->bIsEngram()()) { FString name = item->NameField().ToString(); if (name.Contains("PrimalItem_AwesomeSpyGlass_C")) { NotifyItemAdded_original(_this, item, true); return; } //trySpyglass(_this, item); } NotifyItemAdded_original(_this, item, bEquipItem); } gonna try this
Avatar
yeah that didnt work at all
5:27 AM
has to be a use not equip, so going to yourhook
5:33 AM
woot thats working just gotta fix my has buff check:
5:33 AM
if (buffName.Contains("AwesomeSpyGlass")) { had a `\` in there mistakenly (edited)
Avatar
you should check the full blueprint path of the buff
5:34 AM
imagine if there's a server with another spyglass named buff (edited)
5:34 AM
FString spyGlassBuffBlueprint = "Blueprint'/Game/Mods/AwesomeSpyglass/AwesomeSpyGlass_Buff.AwesomeSpyGlass_Buff'";
Avatar
literally named AwesomeSpyGlass lol?
Avatar
explicit safety over implied safety
Avatar
but yeah im good with full bp
5:36 AM
whats method to compare BP for? i dont see anything super obvious in completion
Avatar
You could either load the UClass at the BP and check if the buff/item are the same UClass
5:37 AM
or you could do a string comparison
Avatar
lol yeah i rather keep it simple, the odds of someone trying to make a mod with exact same buff name and using my plugin
5:38 AM
these try catches are useless yeah?
5:40 AM
and ill use startswith for performance opt
5:41 AM
so current ver: void trySpyglass(AShooterCharacter *_this, UPrimalItem *item) { static auto BuffName = "AwesomeSpyGlass_Buff"; static auto ItemName = "PrimalItem_AwesomeSpyGlass_C"; FString name = item->NameField().ToString(); if (!name.StartsWith(ItemName)) { return; } TArray<APrimalBuff*> buffs; _this->GetBuffs(&buffs); for (int i = 0; i < buffs.Num(); i++) { APrimalBuff* buff = buffs[i]; auto buffName = buff->NameField().ToString(); if (buffName.StartsWith(BuffName)) { return; } } item->Use(false); } void Hook_NotifyItemAdded(UPrimalInventoryComponent* _this, UPrimalItem* anItem, bool bEquipItem) { NotifyItemAdded_original(_this, anItem, bEquipItem); if (!_this || !anItem || anItem->bIsEngram()()) return; AActor* owner = _this->GetOwner(); if (!owner || !owner->IsA(AShooterCharacter::StaticClass())) return; auto playerCharacter = static_cast<AShooterCharacter*>(owner); trySpyglass(playerCharacter, anItem); }
Avatar
This should work as well
5:44 AM
static void onNotifyItemAdded(UPrimalInventoryComponent* _this, UPrimalItem* anItem, bool bEquipItem) { static FString spyGlassBuffBlueprint = "Blueprint'/Game/Mods/AwesomeSpyglass/AwesomeSpyGlass_Buff.AwesomeSpyGlass_Buff'"; static FString spyGlassBlueprint = "Blueprint'/Game/Mods/AwesomeSpyglass/PrimalItem_AwesomeSpyGlass.PrimalItem_AwesomeSpyGlass'"; static UClass* spyGlassBuffClass = UVictoryCore::BPLoadClass(&spyGlassBuffBlueprint); static UClass* spyGlassClass = UVictoryCore::BPLoadClass(&spyGlassBlueprint); NotifyItemAdded.original(_this, anItem, bEquipItem); if (!_this || !anItem || !anItem->IsA(spyGlassClass)) return; AActor* owner = _this->GetOwner(); if (!owner || !owner->IsA(AShooterCharacter::StaticClass())) return; AShooterCharacter* playerCharacter = static_cast<AShooterCharacter*>(owner); if (playerCharacter->HasBuff(spyGlassBuffClass, true)) return; anItem->Use(true); }
Avatar
and what was the method for on login
Avatar
(in C++, a static local variable is initialized once and never again, so there is no performance concern here)
Avatar
yeah i know thats why i did it in my code here too for the initial strings to compare
5:45 AM
as wasnt sure if it would smart intern that or not
5:46 AM
cant remember shit for what cpp does for optimizations 😦
5:46 AM
and plus so much has changed since i was messing with it too
5:46 AM
i didn't even know what interning was then!
Avatar
They do a lot so much infact it's hard to know all of them
Avatar
I just tested it
5:47 AM
the code I posted works
5:48 AM
and should be the most optimal solution
5:48 AM
HasBuff uses IsA for example
Avatar
nice, i was breaking it out into a method to also use during login (though guess dropping that boolean was a bad idea there on return to know when to abort early)
Avatar
the logic will be a little different on login
5:48 AM
you'll want to scan the user inventory for the item
5:48 AM
and then enable the buff
5:48 AM
I don't imagine the buff is persistent?
Avatar
yeah i was gonna do foreach item, if (trySpyglass(this, item)) { return; }
5:49 AM
id imagine not since its not active during login
5:49 AM
gotta manual for login or death
Avatar
you can use
5:49 AM
5:49 AM
it's what I use for my boss unlocking thing
Avatar
and thats not for new player creation lol?
Avatar
it's for both
Avatar
i guess this is wildcard, bad names expected
Avatar
onStartNewShooterPlayer(AShooterGameMode* _this, APlayerController* newPlayer, bool forceCreateNewPlayerData, bool isFromLogin, const FPrimalPlayerCharacterConfigStruct& characterConfig, UPrimalPlayerData* playerData)
Avatar
that sounds like create new player to me
Avatar
you want isFromLogin = true
Avatar
oh its a bool
Avatar
What about transfering
5:50 AM
Or downloading
Avatar
this fires on transfer too
5:50 AM
UPrimalPlayerData has the transferred data
Avatar
Nice
Avatar
and i do want to release this as a free plugin, as you see this is a super popular mod, im sure many would want this
Avatar
if you don't I will
Avatar
its drove me nuts it wasnt an option by default
Avatar
since I wrote the same code too
Avatar
lol hey if you wanna go ahead and make a proper build please do
5:51 AM
credit isnt important you def did the work here helping me learn
Avatar
there's one warning I have for you when working with me
5:51 AM
and that's that I am a very hardline open source supporter
Avatar
And he smells
5:52 AM
So stay far away
Avatar
so anything I write I outside of work goes OSS
Avatar
Owner of Empire Minecraft / @Starlis LLC - Sr. Software Architect for @iContact - Core team for @PaperMC - aikar
5:52 AM
ive uh gone a bit inactive past few years, world state put me in a just relax mode
5:52 AM
but yeah i am super OSS
5:52 AM
trying to get stuff at work OSS'd too
Avatar
hey you wanna see something cool?
Avatar
was a good year 😛
5:53 AM
never got past proof of concept phase
5:53 AM
but integrating REST into the server
5:53 AM
the webpage sends a post command to the game server, which adds the selected item
6:00 AM
static auto onStartNewShooterPlayer(AShooterGameMode* _this, APlayerController* newPlayer, bool forceCreateNewPlayerData, bool isFromLogin, const FPrimalPlayerCharacterConfigStruct& characterConfig, UPrimalPlayerData* playerData) { AShooterPlayerController* playerController = static_cast<AShooterPlayerController*>(newPlayer); StartNewShooterPlayer.original(_this, newPlayer, forceCreateNewPlayerData, isFromLogin, characterConfig, playerData); if (!playerController) return; AShooterCharacter* playerPawn = playerController->LastControlledPlayerCharacterField().Get(); if (!playerPawn) return; static FString spyGlassBlueprint = "Blueprint'/Game/Mods/AwesomeSpyglass/PrimalItem_AwesomeSpyGlass.PrimalItem_AwesomeSpyGlass'"; static UClass* spyGlassClass = UVictoryCore::BPLoadClass(&spyGlassBlueprint); for (auto&& item : playerPawn->MyInventoryComponentField()->InventoryItemsField()) { if (!item->IsA(spyGlassClass)) continue; item->Use(true); return; } }
6:00 AM
something like that is probably good enough tbh
6:01 AM
StartNewShooterPlayer.original is my own container over functions that can be hooked, if you end up using this you'll have to change it to the function the API macro generates instead
Avatar
yeah i know, i modded yours from that earlier
Avatar
static inline moar::function_ptr<void(AShooterGameMode*, APlayerController*, bool, bool, const FPrimalPlayerCharacterConfigStruct&, UPrimalPlayerData*)> StartNewShooterPlayer;
6:01 AM
😛
Avatar
yeah i got the gist of what its doing, just def trying to keep it simple for now lol.
6:07 AM
but yeah id say since you got it all working and its now all your code id say release it so its under your credit. ill just compile it for my own needs for now so i can get it on my server then remove code from my personal plugin once standalone is ready
6:08 AM
but def appreciate help its def helped me learn
6:08 AM
just all these damn data not avail states is gonna be a pain
6:08 AM
or is most hooks not that unlucky?
6:09 AM
also i got CLion working good with this CMakeLists https://gist.github.com/aikar/76439555cbc9e6448bc9e0ebd3c43ca8
GitHub Gist: instantly share code, notes, and snippets.
6:09 AM
so happy to be in jetbrains IDE
Avatar
You'll probably have to add a delay on the onStartNewShooterPlayer
Avatar
I pay for jetbrains all access toolbox so i get entire suite of tools
Avatar
for (auto&& item : playerPawn->MyInventoryComponentField()->InventoryItemsField()) { Log::GetLog()->error("item {}\n", item->NameField().ToString().ToString()); if (!item->IsA(spyGlassClass)) continue; API::Timer::Get().DelayExecute([item]() { item->Use(true); }, 1); return; }
6:11 AM
I'll see how that goes
Avatar
lol i had just compiled and was about to update test server
6:12 AM
stupid RDP Shared drive is so slow to copy
6:13 AM
i will bitch about windows every day of using windows again
6:13 AM
i miss my linux life
Avatar
actually thinking about it, just adding the buff directly is probably best when the user logs in, assuming they have the spyglass
6:14 AM
assuming that just adding the buff works
Avatar
id ask if the mod does anything BEFORe the buff is the question
6:15 AM
next task after this should hopefully be A LOT more simpler, simply setting damn exp caps on exp earned per kill, so people doing bosses cant go getting 100 mil exp in 10 mins on a 2x Server
6:16 AM
ooo since ark doesnt give us commands to take away exp, a plugin def should be able to do it
6:17 AM
other day had to roll my damn char back as when i tested your ark auto bosses first build it corrupted my char and lost all my XP, and when i tried to give EXACTLY what i had back, damn XP multiplier kicked in and gave me way too much lol
6:21 AM
speaking of that plugin didnt you say it requires an ArkAPI update? i havent moved to the new build as i interpreted it as cant until new api is pulled to add support you needed
Avatar
you only need to pull the latest api source code to compile it
6:21 AM
running it doesn't require an update
Avatar
ohh ok
6:22 AM
and did it include the island explorer notes 10 levels? i know you added fj/gen2 in that last one
6:23 AM
or well i guess thats not the island only, its all maps with notes
Avatar
it includes everything
Avatar
API::Timer:: << what is this, unresolved symbol
Avatar
#include <Timer.h>
Avatar
FYI IDE is grumbling (but not an error) about that
Avatar
lmfao
6:26 AM
the buff
6:26 AM
when added works
6:26 AM
but
6:26 AM
there's no HUD elements
Avatar
well that defeats goal 😛
6:27 AM
free esp
Avatar
It has a range!
Avatar
i see it on the far back ones still
6:27 AM
that thickness is configurable btw
Avatar
I think it's 50meters or so
Avatar
i got mine thinner lol
6:29 AM
but yeah this mods nice, good for seeing boss outlines when theres 4 billion particles going on and you can target lock so you keep boss HP on screen even when mouse isnt over them
6:29 AM
def a PVE based idea though lol
6:29 AM
i love pvp but im happy w/o the stress now, i got my fill of vanilla pvp
Avatar
I wish those outlines were easier to make
Avatar
raided and owned snow north, i consider that a solid ending
6:31 AM
um did this just give me another spyglass lol
6:31 AM
haha, your codes missing the engram check @substitute and its crafting one every login
6:32 AM
but overall seems to work good
Avatar
that might be why it wasn't working
6:34 AM
->use on an engram is to craft
6:34 AM
I didn't have the materials in my inventory
6:34 AM
so it didn't craft
Avatar
ok login code isnt working, didnt activate once i excluded engram
6:35 AM
yeah i got my recipe just 1 metal though im gonna switch that to fiber
6:35 AM
its ARK Omega theres enough early game struggles beyond basic kit items lol
Avatar
did you check the engram like this?
6:36 AM
item->bIsEngram()() || item->bIsBlueprint()()
Avatar
ah no i just did engram only
6:36 AM
it stopped the crafting
Avatar
did you use two sets of () (edited)
6:37 AM
if (!item->IsA(spyGlassClass) || item->bIsEngram()()) continue;
Avatar
is the item on your hotbar?
6:37 AM
goal was to not need it in hotbar
6:37 AM
long as one is in the inventory
6:40 AM
i feel like whole task should prob be delayed, the item ref is likely no longer valid
Avatar
I got it to work
6:42 AM
API::Timer::Get().DelayExecute([playerPawn]() { static FString spyGlassBuffBlueprint = "Blueprint'/Game/Mods/AwesomeSpyglass/AwesomeSpyGlass_Buff.AwesomeSpyGlass_Buff'"; static FString spyGlassBlueprint = "Blueprint'/Game/Mods/AwesomeSpyglass/PrimalItem_AwesomeSpyGlass.PrimalItem_AwesomeSpyGlass'"; static UClass* spyGlassBuffClass = UVictoryCore::BPLoadClass(&spyGlassBuffBlueprint); static UClass* spyGlassClass = UVictoryCore::BPLoadClass(&spyGlassBlueprint); for (auto&& item : playerPawn->MyInventoryComponentField()->InventoryItemsField()) { Log::GetLog()->error("item {}\n", item->NameField().ToString().ToString()); if (item->bIsEngram()() || item->bIsBlueprint()() || !item->IsA(spyGlassClass)) continue; item->Use(true); return; } }, 1);
6:42 AM
you can move the lambda into a function call though to clean it up
Avatar
lol literally what i was just testing
6:42 AM
why not 0 though to just be start of next tick
Avatar
could be too soon, but you can try it
6:43 AM
1 you don't even notice though
6:43 AM
this all fires while you're still on the loading screen
Avatar
and timer is in seconds and not game ticks right
Avatar
it is in seconds
Avatar
does it suffer desync if the server tick rate is falling behind? thats common issues plugin devs run into on our minecraft scheduler, human time vs 'time in ticks IF server is running at the expected ticks per second'
Avatar
the game tick rate is decoupled from updates
Avatar
ie passing 20*30 and expecting 30s on the dot
6:44 AM
k
Avatar
updates (such as a 1 second delay) happen anywhere from 1
6:44 AM
to many seconds
6:44 AM
depending on the tick rate
6:44 AM
(like 1 tick / 100 seconds means 1 sec delay = 100 seconds)
6:45 AM
basically, every tick uses delta time
Avatar
ok lemme rephrase, if server is expecting 30 TPS right i think i saw ARK does, but consistently runs at 15 ticks per second, is a delay of 10 consistently 20 or is it 10-11s~
Avatar
it would be near 10-11
6:46 AM
each tick computes the time since the last tick
6:46 AM
and everything happens on real time time deltas
Avatar
ok cool,just def important to understand how scheduler behaves for delays
Avatar
anyways, 0 works fine
Avatar
our scheduler api was built years ago and didnt factor in that stuff :/
6:46 AM
then combine in 12 year olds writing code
6:47 AM
fun times
Avatar
this should work
6:47 AM
static auto enableSpyGlassOnLogin(AShooterCharacter* playerPawn) { static FString spyGlassBuffBlueprint = "Blueprint'/Game/Mods/AwesomeSpyglass/AwesomeSpyGlass_Buff.AwesomeSpyGlass_Buff'"; static FString spyGlassBlueprint = "Blueprint'/Game/Mods/AwesomeSpyglass/PrimalItem_AwesomeSpyGlass.PrimalItem_AwesomeSpyGlass'"; static UClass* spyGlassBuffClass = UVictoryCore::BPLoadClass(&spyGlassBuffBlueprint); static UClass* spyGlassClass = UVictoryCore::BPLoadClass(&spyGlassBlueprint); for (auto&& item : playerPawn->MyInventoryComponentField()->InventoryItemsField()) { if (item->bIsEngram()() || item->bIsBlueprint()() || !item->IsA(spyGlassClass)) continue; item->Use(true); return; } } static auto onStartNewShooterPlayer(AShooterGameMode* _this, APlayerController* newPlayer, bool forceCreateNewPlayerData, bool isFromLogin, const FPrimalPlayerCharacterConfigStruct& characterConfig, UPrimalPlayerData* playerData) { AShooterPlayerController* playerController = static_cast<AShooterPlayerController*>(newPlayer); StartNewShooterPlayer.original(_this, newPlayer, forceCreateNewPlayerData, isFromLogin, characterConfig, playerData); if (!playerController) return; AShooterCharacter* playerPawn = playerController->LastControlledPlayerCharacterField().Get(); if (!playerPawn) return; API::Timer::Get().DelayExecute(std::bind(enableSpyGlassOnLogin, playerPawn), 0); } (edited)
6:48 AM
std::bind let's us pass playerPawn to enableSpyGlassOnLogin
6:48 AM
because DelayExecute expects a function with no args
6:49 AM
API::Timer::Get().DelayExecute(std::bind(enableSpyGlassOnLogin, playerPawn), 0); is the same as like API::Timer::Get().DelayExecute([playerPawn]() { enableSpyGlassOnLogin(playerPawn); }, 0);
6:54 AM
I'll publish it on GitHub later
6:54 AM
and on the api site
6:56 AM
thanks, this has pretty much been my #1 goal for plugin, its just so annoying turning that on with how frequently you die in these op mod packs lol
6:57 AM
hence why most people run keep inventory mods since you die so damn much
Avatar
Avatar
Aikar
@Natsu how did you load the mod into dev kit to see that? can it be done for AwesomeSpyglass, you did SuperSpyglass which isnt same thing. I tried loading uasset file in dev kit but it didnt like it. compiled a ue4 compress app to de compress the .z asset.
it's been released to open source inside the Ark Modding community
Avatar
yeah i figured when i looked at it, that it must likely include the devkit files
8:08 AM
got the plugin working for the correct mod now though with subs help
Avatar
Hook_APrimalStructure_IsAllowedToBuild(APrimalStructure* _this, APlayerController* PC, FVector AtLocation, FRotator AtRotation, FPlacementData* OutPlacementData, bool bDontAdjustForMaxRange, FRotator PlayerViewRotation, bool bFinalPlacement)!.. I need a GetItemName function or some way to get the item name. please help me
Avatar
Avatar
Aikar
got the plugin working for the correct mod now though with subs help
Good to hear 🙂
Avatar
data tags are simply a string array right, not a map? and up to users of data to filter out to only ones they know how to deal with
5:24 PM
ie if i want to store things on items or entities
Avatar
Avatar
Aikar
data tags are simply a string array right, not a map? and up to users of data to filter out to only ones they know how to deal with
custom data tags?
Avatar
@substitute are you confirming to me that is what im looking for lol? the question mark makes me question if you are asking me a question. but like the spyglass mod said that modders can add a :Spyglass: data tag to add their own text to the spyglass - accessing those custom tags is what i was asking about.
3:55 PM
but i assume there isnt some Map<string, any> type data structure, gotta do it as Array<string> ?
Avatar
I imagine it’s something made by the mod author directly
3:58 PM
Probably parses it
3:59 PM
That or it uses the custom data tags with the tag being named :SpyGlass:
4:01 PM
4:01 PM
4:01 PM
Looks like it’s an actual “tags” field on a Dino
Avatar
@substitute what are you using to inspect that?
4:04 PM
curious where the full text of that box is set though, if the stored tag is just that ID
4:05 PM
ultimately would like to see if theres ways i can add my own text alongside of the mods text as well as store my own identifiers in the actor too
4:05 PM
in mc i just had generic persistent entity metadata as a <String, SomethingSerializable> map.
Avatar
Avatar
Aikar
@substitute what are you using to inspect that?
I found these pics from the modding discord (edited)
Avatar
Avatar
Aikar
but i assume there isnt some Map<string, any> type data structure, gotta do it as Array<string> ?
I could take a look if you want once i am home in the dev kit
4:21 PM
Was there a updated version from CrossChat, like a official one ?
Avatar
updated in what sense, the kals on hub website works fine
4:23 PM
though this is prob wrong channel 😛
Avatar
Avatar
Aikar
updated in what sense, the kals on hub website works fine
i am talking about, https://github.com/ark-mod/ArkCrossServerChat Kals is a non official plugin made by himself same as wooly's. I just dont like kals way of the chat order
Cross Server Chat support for ARK Survival Evolved servers. - GitHub - ark-mod/ArkCrossServerChat: Cross Server Chat support for ARK Survival Evolved servers.
Avatar
chat order? O.o what order is there beyond chronical order the messages was sent lol
Avatar
Avatar
Aikar
chat order? O.o what order is there beyond chronical order the messages was sent lol
Normally the chat is like "PlayerName - [TribeName]: Message " inside the message your allowed to use ArkML (https://ark.fandom.com/wiki/ArkML) Kals skips the first one and uses the message part instead so you get the : before every message
Ark Markup Language (or ArkML for short) is a markup language seen in several instances within ARK. It is a type of SGML, and currently has only one known element, the "RichColor" element, which is used to add color to text. There is no official documentation for this markup language, and it may change at any time. When parsing ArkML, be sure th...
👍 1
Avatar
ah yeah iw as gonna look into seeing if i could hook after kals to remove that as its annoying
Avatar
Avatar
Aikar
ah yeah iw as gonna look into seeing if i could hook after kals to remove that as its annoying
well now you know the reason 🙂
Avatar
yeah well ill just fix the problem 😛 kals is a really nice solution
Avatar
Avatar
Aikar
yeah well ill just fix the problem 😛 kals is a really nice solution
well message me if you do and il buy the plugin as well haha the only reason i did not buy it was that annoying : , using rcon cross chat now from spikeydragon
Avatar
yeah i wanted the bi directional chat, and the playerlist is awesome
Avatar
Avatar
Aikar
yeah well ill just fix the problem 😛 kals is a really nice solution
Does Kal’s work cross machines?
5:49 PM
just hwid for 20+ users so gotta buy multiple licenses
5:49 PM
but its free for < 20 players online
5:49 PM
so i havent needed to upgrade yet lol
Avatar
Does it use any dependencies or rcon?
Avatar
i dont think it needs rcon for chat but it does for commands
Avatar
I’ve had the idea of replacing the chat system (on the server) with an irc type system
Avatar
it lets you program buttons to do rcon like kick self, reload plugins, etc
Avatar
So everything is real time with minimal overhead
Avatar
its honestly quite a lot of good stuff combined in one package
5:50 PM
role syncs too
5:50 PM
ingame to discord
Avatar
It uses mysql
5:51 PM
For the chat
5:51 PM
No thanks 😄
5:51 PM
That’s a lot of added overhead and latency
5:51 PM
vs packet forwarding
Avatar
man its chat you dont need nanosecond latency lol
5:53 PM
biggest concern would be if the queries are running main thread and adding too much time anytime a chat msg is sent
Avatar
Sure but having a whole sql server for it
5:53 PM
That’s a LOT
5:54 PM
Imagine if you don’t use anything else that needs sql
Avatar
sure in that regard, but lot of good plugins benefit from it
Avatar
That’s a lot of additional overhead and security risks
Avatar
Avatar
Aikar
biggest concern would be if the queries are running main thread and adding too much time anytime a chat msg is sent
Even if they aren’t
5:55 PM
If you’re doing it safely
5:55 PM
With transactions
Avatar
yeah i was surprised at fucking ASM default exposing rcon ports, they add firewall rules to expose rcon, and if you do what they suggest to manually set external IP, RCON binds to public IP instead of local too
Avatar
SQL also isn’t real time so it’s all polling based
5:55 PM
Which has its own problems
5:55 PM
It’s the best solution currently available
5:56 PM
But not the best possible solution
Avatar
Avatar
Aikar
yeah i was surprised at fucking ASM default exposing rcon ports, they add firewall rules to expose rcon, and if you do what they suggest to manually set external IP, RCON binds to public IP instead of local too
That’s terrible
Avatar
yeah thankfully i caught it quick and just disabled automatic firewall in asm and did it myself
Avatar
I don’t even have my web server exposed publicly, it only allows cloudflare proxy ips
Avatar
and also ignored their suggestion and set it back to let ark choose which keeps rcon on localhost only
Avatar
And every game server I run goes behind wireguard
5:57 PM
And everyone gets a vps IP
5:57 PM
(Which nats back to my home server over wireguard)
Avatar
people been asking for ark to add rcon bind support to keep it on localhost for years but looks like no action
Avatar
It’s probably not that hard to fix
Avatar
im just gonna keep my scale at 1 cluster per box and not worry about cross machine stuff
Avatar
You could as a worst case
5:58 PM
Hook the actual network stack
Avatar
but i prob will only do this 1 cluster as i want to focus ark2 IF it comes out
5:58 PM
we will see in 11 days
Avatar
And force 127.0.0.1 for the rcon port
Avatar
Avatar
Aikar
but i prob will only do this 1 cluster as i want to focus ark2 IF it comes out
Lol
5:58 PM
It’s not coming out in 11 days
5:58 PM
No shot
Avatar
news i mean
5:58 PM
2023 roadmap is being posted on mar 31
5:59 PM
per jeremy twitter
Avatar
Expect it mid April
5:59 PM
Wildcard has zero ability to be on time
Avatar
well thatll be a lol be late on releasing the other dates youll be late on
6:00 PM
but i feel like a roadmap they gotta say something about ark2or else thats a confirmation its not coming in 2023 lol
6:01 PM
heres hoping they release linux pdb and we can all move to linux only plugins instead of windows only
Avatar
Avatar
Aikar
heres hoping they release linux pdb and we can all move to linux only plugins instead of windows only
They won’t
6:03 PM
Also linux does use a pdb per se
6:03 PM
But it does have debug symbols
Avatar
Avatar
Aikar
heres hoping they release linux pdb and we can all move to linux only plugins instead of windows only
I'm just hoping WC keeps publishing Windows pdb when they make the switch to UE5 for ARK1 lol
Avatar
well, if they dont everyone gets to use the joys of signatures!
6:03 PM
dust off my 15 year old library: http://aikar.github.io/SigScan/
6:04 PM
oh right that one was external use, i had local use version somewhere on my drive
6:06 PM
yes people used VB.net back then :shivers:
Avatar
Avatar
substitute
Sure but having a whole sql server for it
Kals chat is pretty nice. It's the only closed source plugin from another developer that I use on my servers. I've thought about eventually trying to make my own cross-server chat plugin though. Haven't gotten around to it yet but I've thought about making a DB-free solution.
Avatar
even if diff solution exists it would still be a bind for me as i use so many things from it lol. discord playerlist, join logs, role syncs, discord actions to rcon commands, linking ingame name to discord to auto sync peoples name / tribe name
6:12 PM
2 way chat too
Avatar
Avatar
Natsu
well message me if you do and il buy the plugin as well haha the only reason i did not buy it was that annoying : , using rcon cross chat now from spikeydragon
I don't think it's possible to get rid of the leading ":" completely. But you could modify the messages to put stuff like the players name before the : so it looks a little more natural. I don't think you can modify the color before the : though, you might be stuck with the yellow font color.
Avatar
Avatar
TheMollusk
I don't think it's possible to get rid of the leading ":" completely. But you could modify the messages to put stuff like the players name before the : so it looks a little more natural. I don't think you can modify the color before the : though, you might be stuck with the yellow font color.
that's what im lookin to do, put all the identity stuff on left hand side and keep msg on right. i dont mind the : to separate identity from msg
6:15 PM
[RAG] Name [Tribe]: Hello - though maybe rewrite server to be ( ) so its a diff wrapper. and maybe tribe on left hand side of name so its tags then name then msg
6:15 PM
i figure simple hook there then regex then rewrite structure
Avatar
Avatar
Aikar
even if diff solution exists it would still be a bind for me as i use so many things from it lol. discord playerlist, join logs, role syncs, discord actions to rcon commands, linking ingame name to discord to auto sync peoples name / tribe name
Yeah the in-game /online player list and the Discord player list are both pretty slick.
Avatar
though can prob just split on space since its simple format
6:16 PM
though tribe names can have spaces
6:18 PM
though could kal fix this with just changing what hook is used to control entire line?
Avatar
Yeah you could probably figure out some regex
Avatar
or do you lose color potential on left hand side is why he pushes everything to msg?
Avatar
I think Kal does it the way he does because you can modify the color of text inside the message itself, but I think it's not possible in the "player name" portion of the chat line before the :
Avatar
lol ok as i just asked
6:20 PM
i assume at some point its sent as a simple FString
6:20 PM
that could be modified?
Avatar
There's some client-side formatting and sanitizing that takes place after the message is received.
6:21 PM
That's where the : is added, on the client.
Avatar
k so worse case move server identifier only to left hand side
6:21 PM
ah shit
6:22 PM
ok so every chat msg is from <Server> 😛
6:22 PM
RAG: Aikar[Admin]: Hi would be better
Avatar
Avatar
TheMollusk
I don't think it's possible to get rid of the leading ":" completely. But you could modify the messages to put stuff like the players name before the : so it looks a little more natural. I don't think you can modify the color before the : though, you might be stuck with the yellow font color.
Yellow is fine :p
Avatar
There's some other function you can use to send messages to the chat box. But the font size is larger. Like what spikey dragoons RCON chat bot uses. (edited)
Avatar
so we really just need a matching client side mod to proper fix it
Avatar
Yeah you could probably make a mod+plugin solution to format it more nicely.
Avatar
name mod "Chat Stripper" and just give vague description of "Strips the :" and see how many people think its uh more adult oriented lol.
6:32 PM
well glad we had this convo now can avoid wasting time trying to solve it with plugin
Avatar
Avatar
Aikar
name mod "Chat Stripper" and just give vague description of "Strips the :" and see how many people think its uh more adult oriented lol.
Contents Contents 1 Overview 2 How it works 2 Stackability 2 Prerequisites 2 Creating the Mod 3 Preparation 3 Copying the Chatbox Widget 3 Creating the Buff Blueprint 4 Preparing a reference to the Command Buff. 4 Setting up variables on the Command Buff 6 Creating the Intercept Event on the Com...
Avatar
any know how i can change the CuddleType in a baby dino? im hooking Hook_APrimalDinoCharacter_UpdateBabyCuddling_Implementation and change the char NewBabyCuddleType to EBabyCuddleType::PET, it works, but the text in the dino no changes. c++ void Hook_APrimalDinoCharacter_UpdateBabyCuddling_Implementation(APrimalDinoCharacter* _this, long double NewBabyNextCuddleTime, char NewBabyCuddleType, TSubclassOf<UPrimalItem> NewBabyCuddleFood) { NewBabyCuddleType = EBabyCuddleType::PET; APrimalDinoCharacter_UpdateBabyCuddling_Implementation_original(_this, NewBabyNextCuddleTime, NewBabyCuddleType, NewBabyCuddleFood); } If i click "E" for pet the dino, it works, but the text still saying "wants to be hand-fed comfort food: food type" any know how i can fix it?
Avatar
Avatar
Loki
any know how i can change the CuddleType in a baby dino? im hooking Hook_APrimalDinoCharacter_UpdateBabyCuddling_Implementation and change the char NewBabyCuddleType to EBabyCuddleType::PET, it works, but the text in the dino no changes. c++ void Hook_APrimalDinoCharacter_UpdateBabyCuddling_Implementation(APrimalDinoCharacter* _this, long double NewBabyNextCuddleTime, char NewBabyCuddleType, TSubclassOf<UPrimalItem> NewBabyCuddleFood) { NewBabyCuddleType = EBabyCuddleType::PET; APrimalDinoCharacter_UpdateBabyCuddling_Implementation_original(_this, NewBabyNextCuddleTime, NewBabyCuddleType, NewBabyCuddleFood); } If i click "E" for pet the dino, it works, but the text still saying "wants to be hand-fed comfort food: food type" any know how i can fix it?
You only want Pet ?
Avatar
Avatar
Natsu
You only want Pet ?
yes
8:11 PM
if i press "E" looking at the dino, it pets anyways, but text says wants to be hand-fed comfort food: food type (or the text when dino need to walk with you, it's still random), I need it would always say pet message. (edited)
Avatar
did you log the output of the hook ?
Avatar
Avatar
Natsu
did you log the output of the hook ?
yes, it works, but the text not changes.
8:15 PM
8:15 PM
as you can see, it is changed to "PET", but the text is still random.
Avatar
Avatar
Loki
yes, it works, but the text not changes.
there are 2 hooks i see one with _Implementation and one without , did you try both ?
Avatar
Avatar
Natsu
there are 2 hooks i see one with _Implementation and one without , did you try both ?
i will try one without (edited)
8:22 PM
oh it works, I didn't think there would be a difference between these 2, but it's worked. Thanks, sorry for the waste of time.
Avatar
oh no worries 😄
Avatar
The one without is likely a multicast function so it will pass the args to both Server and Client, the _Implementation one would only be called on the server, so you would need to replicate the CurrentPetTypeField yourself with MulticastPropertyfunction
Avatar
It's kind of cool how it works. When you have a net-replicated native UFunction, there's a Foo() function and a Foo_Implementation(). Foo_Implementation() is where the function is actually implemented. Foo() is a UE-generated function that basically just calls UObject::ProcessEvent(). ProcessEvent() figures out where the function is supposed to run (on the server, the owner client, or on all clients) and invokes it there. APrimalDinoCharacter::UpdateBabyCuddling() is a multicast UFunction, so it gets invoked on the server and all clients. Another case where you see _Implementation() is when there's a base class with a UFunction implemented in C++ that can be overridden with a Blueprint graph in a child class. In that case, the generated Foo() function calls UObject::FindFunction(), which returns the BP-override UFunction if it exists or the native Foo_Implementation() UFunction. Then Foo() calls ProcessEvent() with whatever UFunction it found. (Like the DoMate() function we talked about in DM @Loki).
Avatar
thanks for the explication GOGHEART1
Avatar
this CreateCloneFertilizedEgg on APrimalDinoCharacter the method used for all egg making and not something special to clones right?
6:10 AM
suspecting the clone word just means its cloning parents
6:10 AM
finally able to see the voodoo of the mutation code lol
Avatar
Avatar
Aikar
this CreateCloneFertilizedEgg on APrimalDinoCharacter the method used for all egg making and not something special to clones right?
I think that function just creates a clone as it says, but that egg is clean from mutations, so it just spawns the same dino, just baby
9:03 PM
By the looks of the decompiled code
Avatar
this is the code that seems to trigger the mutations, i see the mutation logic in it
9:04 PM
i wanted to make sure didnt need to hook multiple places to control mutations
Avatar
You just need to hook DoMate, and change values on the dino before calling original
Avatar
planning to take a diff route, of modifying that FItemNetInfo it uses for the < 20 checks
9:06 PM
bool isCreateEgg = false; FItemNetInfo* Hook_UPrimalItem_GetItemNetInfo(UPrimalItem* _this, FItemNetInfo* result, bool bIsForSendingToClient) { return UPrimalItem_GetItemNetInfo_original(_this, result, bIsForSendingToClient); } ADroppedItem* Hook_APrimalDinoCharacter_CreateCloneFertilizedEgg(APrimalDinoCharacter* dino, FVector AtLoc, FRotator AtRot, TSubclassOf<ADroppedItem> DroppedItemTemplateOverride) { isCreateEgg = true; auto result = APrimalDinoCharacter_CreateCloneFertilizedEgg_original(dino, AtLoc, AtRot, DroppedItemTemplateOverride); isCreateEgg = false; return result; }
9:07 PM
i want to make it consider the female > 20 too if the male is, to cut off mutations completely once it hits 20
Avatar
Avatar
Aikar
this is the code that seems to trigger the mutations, i see the mutation logic in it
I'm pretty sure the mutations are added in the DoMate_Implementation function, the create clone fert egg just copies the dino values into the egg, without actually incrementing any mutation counter
Avatar
theres code here doing the if < 20 add +1 though
9:07 PM
DoMate ^^
Avatar
ok so guess there is diff place
Avatar
Nevermind it does the same lol sorry
Avatar
iVar3 = rand(); bVar2 = 0.5 < (float)iVar3 / 32767.0; local_34c = (uint)bVar2; if ((((bVar2) && (local_1c8.EggRandomMutationsFemale < *(int *)(this + 0x2018))) || ((!bVar2 && (local_1c8.EggRandomMutationsMale < *(int *)(this + 0x2018))))) && ((float)(uint)local_1c8.EggNumberOfLevelUpPointsApplied[local_35c] + *(float *)(this + 0x2024) <= 255.0)) { local_1c8.EggNumberOfLevelUpPointsApplied[local_35c] = (uchar)(longlong) ((float)(uint)local_1c8.EggNumberOfLevelUpPointsApplied[local_35c] + *(float *)(this + 0x2024)); if (bVar2) { local_1c8.EggRandomMutationsFemale = local_1c8.EggRandomMutationsFemale + 1; } else { local_1c8.EggRandomMutationsMale = local_1c8.EggRandomMutationsMale + 1; } theres def mutation logic going on here
9:09 PM
in the create clone one
Avatar
yeah missed that bit when reading
Avatar
so that was ultimately the question what scenarios makes it use this one, is the doMAte maybe for gestation?
Avatar
DoMate does egg and gest (edited)
9:10 PM
Both functions are almost identical when creating the egg data, but one does not call the other and viceversa
Avatar
so i guess question is wtf scenario does the create clone method get used, by name feels like doMate would be primary
Avatar
Yeah DoMate is what handles mating at full, I feel like the clone function is mainly for modders or other type of scenarios like missions or who knows
Avatar
im showing doMAte as a small FindFunction method?
9:15 PM
or is it on a diff object than dino
9:15 PM
i dont seee this same logic in _impl
Avatar
It's in APrimalDinoCharacter, there's 2 of them. APrimalDinoCharacter::DoMate is an engine implementation, and APrimalDinoCharacter::DoMate_Implementation has the actual logic
Avatar
i think ghidra did a worse job on this method or something
Avatar
I used ghidra a while ago and I didn't like how it handled the ark decompile
Avatar
I use IDA Freeware which is free and has a cloud based decompiler (edited)
Avatar
oh ill need to try that out, can IDA just dump it all so can open it in damn IDE (Even if not compilable)?
Avatar
I know you can export a header with all types, but I am not sure if you need the IDA pro version to dump .c files
9:18 PM
I once dumped a .c file and was like 2gb file lol
Avatar
its interesting ghidra got the more human readable names for the clone method but not this one
Avatar
By the way, did a full ida search and the clone egg function is not called at all on the C++ code of the game
9:20 PM
well my goal was to simply say if (creatingEgg) { if either male or female >= 20, consider both sides 20. so people can get 20 per line then its cut off.
9:20 PM
so figure manipulate the FITemNetinfo
Avatar
Yeah the code of the clone egg func is copy pasted into DoMate lol, maybe inlined at compile time
9:21 PM
You could hook DoMate, call original first, do an sphere overlap at the dino location, find the egg and modify the item info
9:22 PM
Or as you did with isCreateEgg bool in function, hook DoMate and StaticDropitem from UPrimaInventoryComponent, and check wether that bool is true do modify the item to drop (edited)
Avatar
hmm i dont see DoMate_Implementation in the Actor.h file, will DoMate call it still? ultimately my approach should still work fine in DoMate i think
Avatar
Yeah possibly, I think I hook DoMate for modifiying breeding stuff
Avatar
what is the Rolls field?
Avatar
The amount of mutation points it gives when the chance is successful (edited)
10:05 PM
Although I am not 100% sure
Avatar
I've never looked at mutation code, but APrimalDinoCharacter has MaxAllowedRandomMutations, RandomMutationRolls, RandomMutationChance, and RandomMutationGivePoints fields. Normally offspring have 3 chances at mutations (can be on different stats).
10:13 PM
Also heads up with APrimalDinoCharacter::DoMate(), that's a function that can be overridden by child classes of APrimalDinoCharacter with Blueprint functions.
10:13 PM
Although I think Ferox is the only dino that actually has its own implementation.
Avatar
Avatar
Aikar
so i guess question is wtf scenario does the create clone method get used, by name feels like doMate would be primary
You can also search for where functions are called in the dev kit. Open a Blueprint that has graphs, go to the "Graph" tab, right click on a function name in the left hand pane and select "Find References", then in the "Find References" pane replace the function name with the function you want to search for and de-select the "Find in current Blueprint only box". (Anyone know if there's a better way?)
11:15 PM
Avatar
oh so thats used for nests too? weird it has mutation code, does that mean eggs in nest technically could mutate lol?
Avatar
Idk, if wild nest eggs can have mutations it's news to me lol
Avatar
well theres the code for processing mutations in that method, unless the wild dinos have the 20 counter set to 0
Avatar
Well theres a "Num Mutations to Add" argument it looks like
11:17 PM
set to 0
Avatar
ah yeah
Avatar
guys give server api documentation
12:48 PM
@deleted-role
Avatar
Hi, any know how i can hook BPStaticCreateBabyDino? if i use Hooker Creator i get this code c++ DECLARE_HOOK(APrimalDinoCharacter_APrimalDinoCharacter*, APrimalDinoCharacter*, APrimalDinoCharacter*, UWorld*, TSubclassOf<APrimalDinoCharacter>, FVector*, float, char*, char*, float, int, TArray<FDinoAncestorsEntry>*, TArray<FDinoAncestorsEntry>*, int, int); APrimalDinoCharacter* Hook_APrimalDinoCharacter_APrimalDinoCharacter*(APrimalDinoCharacter* _this, UWorld* theWorld, TSubclassOf<APrimalDinoCharacter> EggDinoClassToSpawn, FVector* theGroundLoc, float actorRotationYaw, char* EggColorSetIndices, char* EggNumberOfLevelUpPointsApplied, float EggTamedIneffectivenessModifier, int NotifyTeamOverride, TArray<FDinoAncestorsEntry>* EggDinoAncestors, TArray<FDinoAncestorsEntry>* EggDinoAncestorsMale, int EggRandomMutationsFemale, int EggRandomMutationsMale) { return APrimalDinoCharacter_APrimalDinoCharacter*_original(_this, theWorld, EggDinoClassToSpawn, theGroundLoc, actorRotationYaw, EggColorSetIndices, EggNumberOfLevelUpPointsApplied, EggTamedIneffectivenessModifier, NotifyTeamOverride, EggDinoAncestors, EggDinoAncestorsMale, EggRandomMutationsFemale, EggRandomMutationsMale); } ArkApi::GetHooks().SetHook("APrimalDinoCharacter.APrimalDinoCharacter*", &Hook_APrimalDinoCharacter_APrimalDinoCharacter*, &APrimalDinoCharacter_APrimalDinoCharacter*_original); ArkApi::GetHooks().DisableHook("APrimalDinoCharacter.APrimalDinoCharacter*", &Hook_APrimalDinoCharacter_APrimalDinoCharacter*); but dont compiles.
11:11 PM
i changed it to: c++ DECLARE_HOOK(APrimalDinoCharacter_StaticCreateBabyDino, APrimalDinoCharacter*, APrimalDinoCharacter*, UWorld*, TSubclassOf<APrimalDinoCharacter>, FVector*, float, char*, char*, float, int, TArray<FDinoAncestorsEntry>*, TArray<FDinoAncestorsEntry>*, int, int); APrimalDinoCharacter* Hook_APrimalDinoCharacter_StaticCreateBabyDino(APrimalDinoCharacter* _this, UWorld* theWorld, TSubclassOf<APrimalDinoCharacter> EggDinoClassToSpawn, FVector* theGroundLoc, float actorRotationYaw, char* EggColorSetIndices, char* EggNumberOfLevelUpPointsApplied, float EggTamedIneffectivenessModifier, int NotifyTeamOverride, TArray<FDinoAncestorsEntry>* EggDinoAncestors, TArray<FDinoAncestorsEntry>* EggDinoAncestorsMale, int EggRandomMutationsFemale, int EggRandomMutationsMale) { Log::GetLog()->info("CreateBabyDino"); return APrimalDinoCharacter_StaticCreateBabyDino_original(_this, theWorld, EggDinoClassToSpawn, theGroundLoc, actorRotationYaw, EggColorSetIndices, EggNumberOfLevelUpPointsApplied, EggTamedIneffectivenessModifier, NotifyTeamOverride, EggDinoAncestors, EggDinoAncestorsMale, EggRandomMutationsFemale, EggRandomMutationsMale); } ArkApi::GetHooks().SetHook("APrimalDinoCharacter.StaticCreateBabyDino", &Hook_APrimalDinoCharacter_StaticCreateBabyDino, &APrimalDinoCharacter_StaticCreateBabyDino_original); ArkApi::GetHooks().DisableHook("APrimalDinoCharacter.StaticCreateBabyDino", &Hook_APrimalDinoCharacter_StaticCreateBabyDino); And "CreateBabyDino" shows sucess, but i cant find the way to get the dino after it creates.
11:11 PM
Because if i do c++ APrimalDinoCharacter* Dino = APrimalDinoCharacter_StaticCreateBabyDino_original(_this, theWorld, EggDinoClassToSpawn, theGroundLoc, actorRotationYaw, EggColorSetIndices, EggNumberOfLevelUpPointsApplied, EggTamedIneffectivenessModifier, NotifyTeamOverride, EggDinoAncestors, EggDinoAncestorsMale, EggRandomMutationsFemale, EggRandomMutationsMale); server crash. And if i try to modify the "_this" variable, it crash in the return line. c++ _this->TamedNameField() = FString("Test"); return APrimalDinoCharacter_StaticCreateBabyDino_original(_this, theWorld, EggDinoClassToSpawn, theGroundLoc, actorRotationYaw, EggColorSetIndices, EggNumberOfLevelUpPointsApplied, EggTamedIneffectivenessModifier, NotifyTeamOverride, EggDinoAncestors, EggDinoAncestorsMale, EggRandomMutationsFemale, EggRandomMutationsMale); With this code, it crash in the return line.
Avatar
jraServerAPI 4/6/2023 6:37 AM
Q: Is it possible to store a unordered_map inside another unordered_map? This code will not compile for me 😦 c++ struct AwardData { float Amount{}; bool bUseTokens{}; std::string sTokenName{}; int min_level{}; int max_level{}; int KillsNeeded{}; }; typedef std::unordered_map<FString, std::vector<AwardData>> FStringAwardDataMap; typedef std::unordered_map<uint64, FStringAwardDataMap> SteamIdBPAwardDataMap; SteamIdBPAwardDataMap PlayerDinoRewardsMap3{}; const FString bp = "Some random dino blueprint"; const uint64 steam_id = 13213682736873613; if (PlayerDinoRewardsMap3.size() > 0) { auto& result = PlayerDinoRewardsMap3.find(steam_id); if (result != PlayerDinoRewardsMap3.end()) { FStringAwardDataMap& awardMap = result->second; auto& result2 = awardMap.find(bp); // this line won't compile, when i try to search for FString in FStringAwardDataMap } }
6:38 AM
6:39 AM
Thank you in advance pepeold
Avatar
Think you'll have to implement your own hash function for that.
👍 1
7:01 AM
A header library in C++ that adds a smart container for different types of pointers. - MoarPtr/function_ptr.h at main · SubstituteR/MoarPtr
Avatar
jraServerAPI 4/6/2023 7:01 AM
yeah, changing it to std::map instead does compile
Avatar
Weird.
Avatar
TheMollusk 4/6/2023 7:02 AM
I thinks it's because the FString has no hash function, but it does have a < (for a std::map)
Avatar
Avatar
TheMollusk
I thinks it's because the FString has no hash function, but it does have a < (for a std::map)
Hence the need for a custom std hash function
10:38 AM
Which we should probably add
10:38 AM
A shortcut could be to map FString hash to std::string hash
Avatar
TheMollusk 4/6/2023 6:16 PM
There's also UE's TMap, which is another hash table. TMap already supports FString keys. I haven't used ArkServerApi's TMap much, but the headers are there so I assume it all works? Types implement GetTypeHash() for UE hash containers. FString's GetTypeHash() just returns a 32-bit CRC.
Avatar
I think someone fixed it a while ago.
6:18 PM
The time I tried to use them, before it was fixed it would create multiple pairs of the same key-value lol (edited)
Avatar
Hi someone have a little documentation about Player events like Player death, Player kill or something ?
Avatar
There’s functions in primal character, primal Dino character and shooter character about “Die” event
Avatar
do you have a quick guide for that
Avatar
Avatar
Magnet
do you have a quick guide for that
RIO (Александр) 4/7/2023 4:23 PM
u can find hooks on Hook Creator, for example (edited)
Avatar
oh okay for other guys that have the same question ask chat gpt
Avatar
Avatar
Magnet
do you have a quick guide for that
RIO (Александр) 4/7/2023 4:27 PM
Avatar
thanks
Avatar
Hi I want to ask how i can fix this I downloaded the ark server and installed the ark server api and add the DinoColors from MichiDu but getting this message
04/07/23 17:18 [API][warning] (API::PluginManager::LoadAllPlugins) Plugin .vs does not exist 04/07/23 17:18 [API][warning] (API::PluginManager::LoadAllPlugins) Plugin DinoColors does not exist
Avatar
Avatar
Magnet
Hi I want to ask how i can fix this I downloaded the ark server and installed the ark server api and add the DinoColors from MichiDu but getting this message
04/07/23 17:18 [API][warning] (API::PluginManager::LoadAllPlugins) Plugin .vs does not exist 04/07/23 17:18 [API][warning] (API::PluginManager::LoadAllPlugins) Plugin DinoColors does not exist
RIO (Александр) 4/7/2023 5:28 PM
usually, this problem occurs when there is no plugin itself (.dll file) in the plugin folder
Avatar
ok but the plugin work ?
Avatar
RIO (Александр) 4/7/2023 5:29 PM
No. It’s not loaded 🙂
Avatar
yeah so i need to buiold the plugin sorry im stupid xd
Avatar
RIO (Александр) 4/7/2023 5:33 PM
Just copy needed plugins to ShooterGame\Bin\Wn64\ArkApi\Plugins folder
Avatar
yeah but i want to edit the plugins
Avatar
Avatar
Magnet
yeah but i want to edit the plugins
RIO (Александр) 4/7/2023 5:35 PM
there are a lot of guys who put their plugins on open source. u can download it and edit. look at git
Avatar
yeah i want to compile the cpp that i write to dll
5:37 PM
so the plugin work
Avatar
Avatar
Magnet
yeah i want to compile the cpp that i write to dll
RIO (Александр) 4/7/2023 5:37 PM
Compile it and put in Plugins\UrPluginName folder
Avatar
Avatar
RIO (Александр)
Compile it and put in Plugins\UrPluginName folder
yeah but how in vs 2022
Avatar
Avatar
Magnet
yeah but how in vs 2022
RIO (Александр) 4/7/2023 5:40 PM
How to compile? im_sorry_what
Avatar
yeah sorry i dont know in vs xd
Avatar
RIO (Александр) 4/7/2023 5:42 PM
ummm… click on build?)) (edited)
Avatar
where ?
Avatar
RIO (Александр) 4/7/2023 5:43 PM
Omg) u need add some headers and libs))
Avatar
RIO (Александр) 4/7/2023 5:44 PM
there is a setup guide somewhere.
Avatar
this is my first time ark api and cpp
Avatar
Avatar
Magnet
this is my first time ark api and cpp
RIO (Александр) 4/7/2023 5:47 PM
any tutorial to create plugins? Thank you
Avatar
thanks
Avatar
thank you so much
Avatar
I have another Question how i can include the ArkApi.h
Avatar
#pragma once /* READ ME * * This file contains some basic and useful includes. * You can change this how you like, but I suggest * only removing something If you know what you are doing. */ #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <API/ARK/Ark.h> #include <Logger/Logger.h> #include <Timer.h> #pragma comment(lib, "ArkApi.lib")
6:29 PM
Contribute to SubstituteR/ArkServerAPI-Template development by creating an account on GitHub.
6:31 PM
or if you happen to use Jetbrains products from other languages, you can use cmake with CLion: https://gist.github.com/aikar/7ff0a9360246dd80c68b0a3a33b7aff9
GitHub Gist: instantly share code, notes, and snippets.
Avatar
thanks
Avatar
switching to clion was a huge help for me lol, been using jetbrains products for so many years def nicer to work in a familiar and consistent ide experience
6:33 PM
i used a cmake visual studio converter tool first to take substitutes repo and convert it to cmake
Avatar
I get an Error when i Build my plugin
1>D:\ARK-DEV\ARK-Server-API-master\version\Core\Public\API\Fields.h(166,20): error C2027: Using undefined type "UClass". 1>D:\ARK-DEV\ARK-Server-API-master\version\Core\Public\API\Base.h(590,8): message : See declaration of "UClass". 1>D:\ARK-DEV\ARK-Server-API-master\version\Core\Public\API\Fields.h(186,24): error C2027: Usage of undefined type "UScriptStruct". 1>D:\ARK-DEV\ARK-Server-API-master\version\Core\Public\API\Base.h(638,8): message : See declaration of "UScriptStruct".
Avatar
yeah i checkt it another time but i didnt find the issue
Avatar
Avatar
Magnet
yeah i checkt it another time but i didnt find the issue
show me your includes
Avatar
Avatar
Magnet
Click to see attachment 🖼️
try moving "ArkApi.lib" under "Timer.h"
Avatar
nope same issue
Avatar
Show me full includes
10:50 PM
and what did you include in settings
10:51 PM
and in Linker this
10:51 PM
this is all
Avatar
Avatar
Magnet
I get an Error when i Build my plugin
1>D:\ARK-DEV\ARK-Server-API-master\version\Core\Public\API\Fields.h(166,20): error C2027: Using undefined type "UClass". 1>D:\ARK-DEV\ARK-Server-API-master\version\Core\Public\API\Base.h(590,8): message : See declaration of "UClass". 1>D:\ARK-DEV\ARK-Server-API-master\version\Core\Public\API\Fields.h(186,24): error C2027: Usage of undefined type "UScriptStruct". 1>D:\ARK-DEV\ARK-Server-API-master\version\Core\Public\API\Base.h(638,8): message : See declaration of "UScriptStruct".
Get the latest ArkServerApi headers: https://github.com/ServersHub/Framework-ArkServerApi Older versions of the headers don't compile with Visual Studio 2022 (v143)
ArkServerAPI is open source software you can install directly into windows versions of Ark Survival Evolved this software allows you to manage and create plugins to enhance your video game servers....
Avatar
@Magnet where did you get that template if it is template?
Avatar
Avatar
SR
@Magnet where did you get that template if it is template?
its from the hook generator
10:56 PM
with a little bit chat gpt
10:56 PM
xd
Avatar
Avatar
Magnet
with a little bit chat gpt
DON'T USE CHAT GPT HERE
10:58 PM
It is not going to give you something usable in most cases.
10:59 PM
now i get a new issue but i dont have a include Ycpch.h The "#include" statement specified with the /Ycpch.h command line option could not be found in the source file
Avatar
You forgot something in settings
Avatar
what ?
Avatar
Show me precompiled headers
11:00 PM
in C/C++
Avatar
sorry its in germany but it is off
Avatar
set like this and try (edited)
Avatar
npe same issue
Avatar
Show me Code Generation
Avatar
you mean the hook ?
Avatar
#define WIN32_LEAN_AND_MEAN #include <windows.h> #include <API/ARK/Ark.h> #include <Logger/Logger.h> #include <Timer.h> #pragma comment(lib, "ArkApi.lib") DECLARE_HOOK(AShooterPlayerController_ClientNotifyRemotePlayerDeath_Implementation, void, AShooterPlayerController*, FString*, FString*); void Hook_AShooterPlayerController_ClientNotifyRemotePlayerDeath_Implementation(AShooterPlayerController* _this, FString* PlayerName, FString* AttackerName) { AShooterPlayerController_ClientNotifyRemotePlayerDeath_Implementation_original(_this, PlayerName, AttackerName); ArkApi::GetApiUtils().SendNotification(_this, FLinearColor(1, 0, 0), 1, 10, nullptr, "*GetText"); } void Init() { ArkApi::GetHooks().SetHook("AShooterPlayerController.ClientNotifyRemotePlayerDeath_Implementation", &Hook_AShooterPlayerController_ClientNotifyRemotePlayerDeath_Implementation, &AShooterPlayerController_ClientNotifyRemotePlayerDeath_Implementation_original); } void Unload() { ArkApi::GetHooks().DisableHook("AShooterPlayerController.ClientNotifyRemotePlayerDeath_Implementation", &Hook_AShooterPlayerController_ClientNotifyRemotePlayerDeath_Implementation); }
11:05 PM
if you mean this
Avatar
where's DLLMain???
Avatar
here's your issue
11:07 PM
just try something off here.
11:07 PM
Server Plugins for ARK: Server API. Contribute to Michidu/Ark-Server-Plugins development by creating an account on GitHub.
Avatar
now this is my code but it still not work // pch.cpp: Quelldatei, die dem vorkompilierten Header entspricht /* READ ME * * This file contains some basic and useful includes. * You can change this how you like, but I suggest * only removing something If you know what you are doing. */ #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <API/ARK/Ark.h> #include <Logger/Logger.h> #include <Timer.h> #pragma comment(lib, "ArkApi.lib") DECLARE_HOOK(AShooterPlayerController_ClientNotifyRemotePlayerDeath_Implementation, void, AShooterPlayerController*, FString*, FString*); void Hook_AShooterPlayerController_ClientNotifyRemotePlayerDeath_Implementation(AShooterPlayerController* _this, FString* PlayerName, FString* AttackerName) { AShooterPlayerController_ClientNotifyRemotePlayerDeath_Implementation_original(_this, PlayerName, AttackerName); ArkApi::GetApiUtils().SendNotification(_this, FLinearColor(1, 0, 0), 1, 10, nullptr, "*GetText"); } void Init() { ArkApi::GetHooks().SetHook("AShooterPlayerController.ClientNotifyRemotePlayerDeath_Implementation", &Hook_AShooterPlayerController_ClientNotifyRemotePlayerDeath_Implementation, &AShooterPlayerController_ClientNotifyRemotePlayerDeath_Implementation_original); } void Unload() { ArkApi::GetHooks().DisableHook("AShooterPlayerController.ClientNotifyRemotePlayerDeath_Implementation", &Hook_AShooterPlayerController_ClientNotifyRemotePlayerDeath_Implementation); } BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: Init(); break; case DLL_PROCESS_DETACH: Unload(); break; } return TRUE; }
Avatar
Avatar
Magnet
now this is my code but it still not work // pch.cpp: Quelldatei, die dem vorkompilierten Header entspricht /* READ ME * * This file contains some basic and useful includes. * You can change this how you like, but I suggest * only removing something If you know what you are doing. */ #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <API/ARK/Ark.h> #include <Logger/Logger.h> #include <Timer.h> #pragma comment(lib, "ArkApi.lib") DECLARE_HOOK(AShooterPlayerController_ClientNotifyRemotePlayerDeath_Implementation, void, AShooterPlayerController*, FString*, FString*); void Hook_AShooterPlayerController_ClientNotifyRemotePlayerDeath_Implementation(AShooterPlayerController* _this, FString* PlayerName, FString* AttackerName) { AShooterPlayerController_ClientNotifyRemotePlayerDeath_Implementation_original(_this, PlayerName, AttackerName); ArkApi::GetApiUtils().SendNotification(_this, FLinearColor(1, 0, 0), 1, 10, nullptr, "*GetText"); } void Init() { ArkApi::GetHooks().SetHook("AShooterPlayerController.ClientNotifyRemotePlayerDeath_Implementation", &Hook_AShooterPlayerController_ClientNotifyRemotePlayerDeath_Implementation, &AShooterPlayerController_ClientNotifyRemotePlayerDeath_Implementation_original); } void Unload() { ArkApi::GetHooks().DisableHook("AShooterPlayerController.ClientNotifyRemotePlayerDeath_Implementation", &Hook_AShooterPlayerController_ClientNotifyRemotePlayerDeath_Implementation); } BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: Init(); break; case DLL_PROCESS_DETACH: Unload(); break; } return TRUE; }
what does it give in output?
Avatar
if a player die the plugin show a notification
11:10 PM
idk if this code is correct i think no
Avatar
Avatar
Magnet
idk if this code is correct i think no
What does it give in "error"???
Avatar
Avatar
Magnet
now i get a new issue but i dont have a include Ycpch.h The "#include" statement specified with the /Ycpch.h command line option could not be found in the source file
.
Avatar
Avatar
Magnet
.
Contribute to SubstituteR/ArkServerAPI-Template development by creating an account on GitHub.
11:20 PM
set up your libraries add "ArkApi.lib" to the resource files and set Visual Studio 2019 v142
Avatar
do you have time to go in a call ?
Avatar
can someone create me a new list what i need to do if i want to start develope ark plugins because the current list is for vs 2017 and i use 2022 old doc: https://docs.google.com/document/d/1U4kRBevkLbXxcVMzKTmsjRKFkCEjtG46bfi5TdHNluQ/edit
This guide is based on the Visual Studio Community 2019 version install Prerequisites: 1. https://visualstudimicrosofto..com/vs/ 2. https://github.com/Michidu/ARK-Server-API/archive/master.zip Step N1: Install Visual Studio by the link given on the first prerequisite. When the inst...
Avatar
Avatar
Magnet
can someone create me a new list what i need to do if i want to start develope ark plugins because the current list is for vs 2017 and i use 2022 old doc: https://docs.google.com/document/d/1U4kRBevkLbXxcVMzKTmsjRKFkCEjtG46bfi5TdHNluQ/edit
substitute 4/9/2023 7:00 AM
There’s nothing majorly different between VS 2017 and VS 2022
Avatar
Other than it's x64 😠
Avatar
Hello, can someone help me with installing plugins into my ark server hosted on linux?
Avatar
There's no plugins in Linux
Avatar
Avatar
Pelayori
There's no plugins in Linux
Stevie senpai 4/11/2023 3:00 AM
TidyDams When a player leaves a beaver dam with only wood and no other items, the beaver dam is automatically destroyed. Any remaining wood is dropped into an item cache. The decay timer on the item cache is configurable. Console/RCON Commands...
3:00 AM
Like now that I remember, didn't kals have a linux version of crosschat or something?
Avatar
Oh that's mine, I've been meaning to get around to updating that and probably removing the Linux version. I don't think that build of the plugin even works on the current Linux server. (edited)
🙌 1
🇫 1
3:04 AM
For several months last year I ran my own plugins (not ArkServerApi-based) on a Linux server cluster. But I switched back to Windows. Too many things that are much easier to do with the pdb and some (non plugin-related) bugs on the Linux server that you don't get on the Windows server (although there's some things I like better about the Linux server too) (edited)
Avatar
Avatar
TheMollusk
For several months last year I ran my own plugins (not ArkServerApi-based) on a Linux server cluster. But I switched back to Windows. Too many things that are much easier to do with the pdb and some (non plugin-related) bugs on the Linux server that you don't get on the Windows server (although there's some things I like better about the Linux server too) (edited)
Stevie senpai 4/11/2023 3:04 AM
a newbie question, why couldn't the api run on linux? is it because the code would have to be written differently? it's something I've always wondered xD
Avatar
Avatar
Stevie senpai
a newbie question, why couldn't the api run on linux? is it because the code would have to be written differently? it's something I've always wondered xD
Well the big reason is that ArkServerApi plugins use debug symbols and only the Windows version of the ARK server ships with those. Plus existing plugins are often written specifically for Windows.
🙌 1
3:08 AM
The plugins I wrote for Linux were based mostly off the Unreal Engine reflection system, but that doesn't give you access to as many fields and functions as you get with debug symbols.
🙌 1
Avatar
Stevie senpai 4/11/2023 3:11 AM
so ark has a different version of files to host a linux server?
Avatar
Yes. There's a version of the server executable file for Windows and one for Linux. WildCard ships the Windows version with debug symbols (the .pdb file), which is what ArkServerApi uses to get variable offsets and function addresses. The Linux build doesn't come with debug symbols.
Avatar
If the ARK UE5 remaster doesn't ship with debug symbols and ArkServerApi gets ported to support it, maybe that's an opportunity to re-architect it in a way that provides support for both platforms.
Avatar
Avatar
TheMollusk
Yes. There's a version of the server executable file for Windows and one for Linux. WildCard ships the Windows version with debug symbols (the .pdb file), which is what ArkServerApi uses to get variable offsets and function addresses. The Linux build doesn't come with debug symbols.
Stevie senpai 4/11/2023 3:27 AM
the executable I imagined that if it was different because normally if I'm not wrong linux does not run .exe, I was going to ask that because it was not carried or injected that pdb (from ignorance) in linux but I just saw that it is owned by windows so little compatibility I think .... F
Avatar
Avatar
TheMollusk
If the ARK UE5 remaster doesn't ship with debug symbols and ArkServerApi gets ported to support it, maybe that's an opportunity to re-architect it in a way that provides support for both platforms.
Stevie senpai 4/11/2023 3:28 AM
that would be great, that would be the end of the "no, you can't put plugins because it's a linux host" thing
3:28 AM
thank you very much for answering my stupid questions mollusk🙌
Avatar
Maybe there won't even be a Linux server for the remaster 🤷‍♂️ Like Owl said in announcements the other day, lots of unknowns
Avatar
Turns out when the studio doesn't know what they're doing, everyone relying on them can't know either thonkRolly
Avatar
Avatar
TheMollusk
If the ARK UE5 remaster doesn't ship with debug symbols and ArkServerApi gets ported to support it, maybe that's an opportunity to re-architect it in a way that provides support for both platforms.
The average skill level of this community would make porting the api without a PDB arduous to say the least.
10:09 AM
We really need better tutorials and documentation
10:09 AM
And maybe some links to learning modern C++
10:11 AM
I don’t mean it in any rude way, there’s just a lot of newer programmers that join here and using UE reflection takes a pretty high level of knowledge of the architecture and language.
Avatar
After doing the low level part, a more user friendly interface could be implemented perhaps?
Avatar
Yeah that's the point of ArkServerApi right? Personally, I haven't had to learn how to process a pdb file from C++ because ArkServerApi does it for me. Should be the same situation for most plugin developers whether the API is based on pdb or UE reflection or signature detection or whatever.
Avatar
Yeah, then the fields we can access by reflection system could be used somewhat similar to the fields now, wrappers functions that gets us what we really need and abstract the low level stuff
Avatar
Avatar
substitute
The average skill level of this community would make porting the api without a PDB arduous to say the least.
it would just require all the getters be exposed as signature scans instead of offset pdb lookups, so the core team would just have to put in a lot more work to expose things. the FFXIV community did pretty well there. I have a 15 yr old sig scan library for it too lol. basic principles of the signature scan would still be the same today. Just the PDB def makes it easier for people to define their own structs w/o having to get it officially added. Expose the structs/sigs as a separate repo that people can contribute to easy.
6:51 PM
finding sigs though thats one hell of a job
Avatar
Avatar
Aikar
it would just require all the getters be exposed as signature scans instead of offset pdb lookups, so the core team would just have to put in a lot more work to expose things. the FFXIV community did pretty well there. I have a 15 yr old sig scan library for it too lol. basic principles of the signature scan would still be the same today. Just the PDB def makes it easier for people to define their own structs w/o having to get it officially added. Expose the structs/sigs as a separate repo that people can contribute to easy.
My friend has a signature scanner that uses AVX to increase performance
Avatar
I'd imagine the reflection system can be leveraged with a minimal amount of signature scanning (that's the case in the current engine at least). Then it's easy to generate a useful set of partial definitions for native class variables and functions and for basically everything in BP-generated classes. Discovering signatures for unreflected stuff would be painful, but maybe in some cases at least there will be some additional clues available if WC copies a lot of their current code. (edited)
Avatar
jraServerAPI 4/16/2023 6:38 PM
Is there a way to find out what Folder a UPrimalItem is currently sitting in, whether it be a custom folder of one of the predefined folders (when in folder view)? I did some initial searching but haven't come up with much.
6:40 PM
I did some snooping around in IDA and found this function, looks promising, but when I checked the API it doesn't exist. 😦
Avatar
item->ItemFolderPathField() (edited)
Avatar
jraServerAPI 4/16/2023 7:13 PM
it's not coming up for me
Avatar
You need to add it then
Avatar
that method can be used to move to a folder by name yeah? i was wanting to make some sorting command to let users sort regex patterns to folders
7:23 PM
and is there a way to change an items name? i was thinking if we can let users rename their personal armor sets, then it wont get caught in regex to move other stuff, as i want to make it so it can drop newly aquired armor thats not your primary set but be able to exclude your personal armor sets
Avatar
Avatar
Pelayori
You need to add it then
jraServerAPI 4/16/2023 7:39 PM
Okay I added the struct and made UPrimalItem inherit from IDataListEntryInterface c++ struct IDataListEntryInterface { TArray<FString>& CustomFoldersNamesField() { return *GetNativePointerField<TArray<FString>*>(this, "UPrimalItem.CustomFoldersNames"); } TArray<FString>& ItemFolderPathField() { return *GetNativePointerField<TArray<FString>*>(this, "UPrimalItem.ItemFolderPath"); } }; it crashes on this line: auto ItemFolderPaths = currentItem->ItemFolderPathField(); KERNELBASE.dll!UnknownFunction(0x00007ff83ab840ac)+0bytes[UnknownFile:0] ShooterGameServer.exe!FOutputDeviceWindowsError::Serialize()(0x00007ff78374426a)+0bytes[f:\build\lostisland\engine\source\runtime\core\private\windows\windowsplatformoutputdevices.cpp:95] ShooterGameServer.exe!FError::LowLevelFatal()(0x00007ff783710fa9)+0bytes[f:\build\lostisland\engine\source\runtime\core\private\misc\outputdevice.cpp:354] ShooterGameServer.exe!FMallocBinned::Malloc()(0x00007ff78373736a)+0bytes[f:\build\lostisland\engine\source\runtime\core\public\hal\mallocbinned.h:984] TheAutoCrafter.dll!FMemory::Malloc()(0x00007fffbe795eac)+92bytes[C:\programming\ARK-Server-API\version\Core\Public\API\UE\HAL\UnrealMemory.h:105] TheAutoCrafter.dll!FMemory::Realloc()(0x00007fffbe795f0c)+0bytes[C:\programming\ARK-Server-API\version\Core\Public\API\UE\HAL\UnrealMemory.h:111] TheAutoCrafter.dll!TArray<FString,FDefaultAllocator>::ResizeForCopy()(0x00007fffbe7b5f53)+15bytes[C:\programming\ARK-Server-API\version\Core\Public\API\UE\Containers\TArray.h:2067]
Avatar
Because it's not an uprimalitem function are you are getting a null address
7:40 PM
IDataListEntryInterface.ItemFolderPath
Avatar
jraServerAPI 4/16/2023 8:01 PM
Ahh yes.. a copy/paste blunder combined with old man eyes 😆
8:01 PM
tyvm!
Avatar
Dodo Enthusiast 4/19/2023 2:51 AM
Hi, I'm currently struggling to read the Transform from an Actor inside a submap, ANPCZoneManager in this case. Neither one of ANPCZoneManager -> AInfo -> AActor does seem to have a transform property/field, then I tried NPCzoneManager->GetTransform(&transform); but after looking into it this just seems to use NPCzoneManager->ActorToWorld(&transform); which takes the value from USceneComponent if it exists, but checking USceneComponent* component = NPCzoneManager->RootComponentField(); gives a nullptr for me so it kinda makes sense that ActorToWorld does not work properly. It just gives all zeros for x,y,z which could also be related to my followup question. So the first question would be where did I overlook to look? And a followup how do I use the m128 datatype inside FTransform correctly? Searching the Internet a bit this seems to be pretty low level and dependent on CPU and compiler etc (or I read that wrong) and on top of that in this case a single \m128 should actually represent 3 values (x,y,z) and not a single value.
Avatar
Is it possible for two timers to interfere with each other from two separate plugins if they have the same name? For example if I unload a timer called "run_events" on one plugin and the other has the same timer name, will it disable both of them by chance? I keep loosing a timer on 1 of my plugins.
Avatar
Ya, i'm pretty sure they are all stored in a generic list.
Avatar
Avatar
Lethal
Ya, i'm pretty sure they are all stored in a generic list.
Yeah they’re keyed by name I’m pretty sure
Avatar
okay, makes sense lol. once I really thought about it I figured it would all be ran by the API as a list, seems to be working now, I will make sure to make them very unique names from now on.
Avatar
How to access class FName?
Avatar
What do you mean by access?
Avatar
I'm pretty new to learning this. But when I understand how to add .h and libraries of other plugins But still do not understand how to create
4:07 AM
I just build the plugin that they give away. but i try to rebuild it all by putting .h of API in it can use but build still can't work
Avatar
Avatar
TheHack
I just build the plugin that they give away. but i try to rebuild it all by putting .h of API in it can use but build still can't work
You can compare your project file with this one to check differences: https://github.com/K07H/AutoFillCrops/blob/main/AutoFillCrops/AutoFillCrops.vcxproj
11:45 AM
11:45 AM
Then include ArkServerAPI header in your source files:
11:46 AM
11:46 AM
Share a link to your code repository if it still doesn't work after that.
Avatar
yes i added
1:44 PM
1:44 PM
1:45 PM
1:45 PM
1:45 PM
1:48 PM
Able to use API
Avatar
Avatar
TheHack
Able to use API
Dodo Enthusiast 4/28/2023 2:59 PM
Did you include the lib also?
Avatar
Avatar
TheHack
Able to use API
in pch.h
7:44 PM
yeb
Avatar
I feel like such the rebel being the only one not using VStudio lol.
Avatar
Avatar
TheHack
yeb
You should not use pch, disable precompiled headers in the project settings and delete those pch files
💯 1
Avatar
Avatar
Aikar
I feel like such the rebel being the only one not using VStudio lol.
I mean, you are kinda 😛
Avatar
you have no idea how much my ability to be productive increased getting CLion working keeping with the keybinds im so use to.
11:15 PM
Only issue i was running into was some slowdown hangs but i fixed that as it dealt with some clangd or something trying to bind for code completion, turned it off and i guess let CLion use built in Jetbrains engine stuff and all great now
11:18 PM
https://github.com/K07H/AutoFillCrops/blob/main/AutoFillCrops/AutoFillCropPlots.cpp#L7 @OSubMarin this code is O(n) complexity for performance, may I recommend this approach instead: https://gist.github.com/aikar/9c179f0979b4237a341dd0cade8671fe Then you can static BlueprintCache bp("blah"); then bp.Get();
11:21 PM
as it seems your uses are static BP's, i could see using a map if it was open ended on what BP's was referenced
11:22 PM
though that current code is using a map but seems to iterate entire collection instead, should at least be using map based operations instead of iteration
Avatar
thank you but that's not needed for what it does 😉
1:14 AM
the goal is to have a map of cached loaded blueprints
1:14 AM
that's a utility function that I use in various project
1:15 AM
it has negligible impact on performance (edited)
1:16 AM
better to recode this function: UVictoryCore::ServerOctreeOverlapActorsClass
1:22 AM
also I'm not even playing Ark since more than a year, and I heard they plan to shutdown servers and stop releasing updates and content for it so I don't have interests in coming back
1:24 AM
it will just die slowly now :3
Avatar
Avatar
Pelayori
You should not use pch, disable precompiled headers in the project settings and delete those pch files
Should this be changed? I've seen other projects use it. stdafx.h but never saw the file stdafx.h
Avatar
Avatar
Pelayori
You should not use pch, disable precompiled headers in the project settings and delete those pch files
After removing the pch I was able to build an empty job now. 😂 🙏
6:33 AM
It can run but nothing in the works.😂 It's a small step that I can take.🙏
👍 1
Avatar
hmm found a better mysql client than what everyone seems to be using https://github.com/seznam/SuperiorMySqlpp
SuperiorMySQL++. Contribute to seznam/SuperiorMySqlpp development by creating an account on GitHub.
6:07 AM
that daotk one doesnt provide a pool that i can see
6:07 AM
but need a connection pool to do async queries
6:08 AM
wait err "Note: This library currently doesn't support MySQL library version 8 and newer." is that saying it doesnt support connector C for mysql 8?
Avatar
Avatar
Aikar
hmm found a better mysql client than what everyone seems to be using https://github.com/seznam/SuperiorMySqlpp
It's not mandatory to use an SQL server tho, I don't use SQL server. You can simply store in a file asynchronously. It depends of what you want to achieve. (edited)
Avatar
@OSubMarin SQL is def much desirable, im far from beginner in this stuff, just put here since beginning on using mysql in c++. If you only see the crazy amount of code I have built in minecraft with DB and Metadata powers 😛 framework is key, and also building things as a linked cluster, file based is horrible, as you also have the windows kernel being super slow there. With MySQL you get to buffer things in memory and improve latency.
6:28 PM
i just did some file based status reporting as a quic hack until i get mysql working in my plugin lol
6:29 PM
but that modern mysql lib people use is not pooled, and you absolutely need to use pools when dealing with multiple threads as you should never share a mysql connection over multiple threads. i see people naively doing that in minecraft all the time 😦
6:32 PM
trying to get this superior lib to work, does anyone know if those .lib files in arkshops lb folder is just an older mysql connector C? i was using those, but getting this which i also was getting on the modern sql too until i updated it to the newer one:
6:36 PM
hmm switching to the latest connector C 6.1.11 got past that
6:37 PM
i feel like this lib is just a mess for C++20
6:38 PM
but man the syntax looks good for it
6:41 PM
as this feels like C++ level incompat yeah?
6:42 PM
ok im confused by this one, this feels like it would ALWAYs fail, is this some C++ magic?
6:44 PM
isnt pthread.h linux only, im starting to suspect this doesnt support windows
6:47 PM
guess ima have to just find a generic connection pool lib like i was orig looking for and wrap the other one with it
Avatar
yep im giving up, i tried putting in win32 pthread but this ones a hard fail lol
7:04 PM
the atomic one i did fix by switching back to CXX17 and adding set(CMAKE_CXX_STANDARD_REQUIRED ON)
Avatar
Avatar
Aikar
@OSubMarin SQL is def much desirable, im far from beginner in this stuff, just put here since beginning on using mysql in c++. If you only see the crazy amount of code I have built in minecraft with DB and Metadata powers 😛 framework is key, and also building things as a linked cluster, file based is horrible, as you also have the windows kernel being super slow there. With MySQL you get to buffer things in memory and improve latency.
nah just use async file operations, works great. It only depends on what you want to achieve 👍 (and also what you feel more comfortable with) (edited)
8:34 PM
If you think SQL only stores data in memory, well... surprise! it stores its data to files asynchronously ^^
Avatar
yeah ive been doing this for 20 years, im aware 😛 but it does it much more efficiently (edited)
8:48 PM
just been 15 years since i did C++ before this so still got a bit to learn on this language
Avatar
it depends on what you want to achieve (I suppose you're not processing millions of requests) (edited)
9:03 PM
calling a function (which will then do async processing) is faster than calling an SQL server
Avatar
of course, talking about data storage though, of shared state data you want to be able to persist and let other things read.
9:08 PM
but not really relevant here, i absolutely will be using mysql
Avatar
if you think it fits better for your usage alright then 🙂
9:09 PM
you didn't say what you want to do so I was just giving an idea since I saw "found a better mysql client than what everyone seems to be using"
Avatar
Avatar
OSubMarin
If you think SQL only stores data in memory, well... surprise! it stores its data to files asynchronously ^^
Oh boy do I have a surprise for you
Avatar
what is the surprise?
Avatar
If you use that, MySQL stores everything in memory only
9:11 PM
No disk operations
Avatar
I see, then it could be smart to enable this if you don't have too much data to store
9:13 PM
depends on what you're trying to do because if you start storing images and videos with this your memory will be full very quick
Avatar
even with standard dbs, RDBMS has super optimized crud operations to optimize disk access, reads hit memory cache and dont touch disk. writes can be bundled by pages. right now because i didnt have db setup yet im writing tiny text files 1 per metric to export, which then suffers with windows file locking too, and writing tiny small files is pure evil in terms of performance. I will be moving this over to db once I get this all polished, which then would let me run my monitoring code on a different machine too. as long game ima prob end up building a linux box to move db/management code over to.
9:20 PM
as ive spent past 3 days cursing windows, life was so nice when i was windows free for 10 years
😄 1
👍 1
9:23 PM
wrote code to detect crashed servers, and last night it was looking good when ran it myself, used taskslist and dumped processes, and used the window title to find desired process to folder. well, when i turned it on to a windows task scheduler, the task scheduler now cant see the window titles, and broke it, and ended up spawning duplicate server processes. thankfully found a powershell alternative to dump actual full process binary path and that solved the issue.
Avatar
I think the game will die quickly tho, because if they don't provide bugfixes and cheat-fixes it will become unplayable game considering the amount of cheaters :/
9:28 PM
Unless you're managing small community servers or pve servers maybe.
Avatar
Who said they won't deliever updates for bugfixes or critical issues?
Avatar
That's just a supposition from me haha ^^
9:37 PM
Maybe they will continue to update it, I just doubt about it :p
Avatar
Avatar
Pelayori
Who said they won't deliever updates for bugfixes or critical issues?
Did development team started to look at UE5 dumpers? An API for Ark 1.5 would be nice 🙂
9:43 PM
I'm curious to see how it looks under UE5, only problem is that my shitty computer will probably die...
Avatar
well i see it as all the code and infra im building can still carry over to ark 1.5
9:57 PM
i have such an extensive framework of infrastructure for my mc servers, just having to rebuild that baseline here lol
Avatar
Avatar
OSubMarin
Did development team started to look at UE5 dumpers? An API for Ark 1.5 would be nice 🙂
If the PDB is provided we would just use that
🤞 1
Avatar
so this is all still valuable for 1.5
Avatar
Avatar
Aikar
well i see it as all the code and infra im building can still carry over to ark 1.5
I want to replace a lot of the core framework code with my replacement
Avatar
i def gotta figure out storing generic key/value store stuff on all actors
Avatar
A lot of the core code is C and Macros
Avatar
like you messed with sub for the bosses (edited)
Avatar
I’ve written actual C++ containers over things
Avatar
someone suggested maybe buffs can be a vector to store data
9:58 PM
i want the data stored in the actor data so that it is self maintaining for cleanup when dino dies etc
9:58 PM
and not external data sotre
9:59 PM
also persisting between podding (edited)
Avatar
Avatar
OSubMarin
Maybe they will continue to update it, I just doubt about it :p
They have said they will do that
9:59 PM
Bug fixes and critical issues
9:59 PM
Just not content
9:59 PM
Content updates will be shifted to ASA
Avatar
This also assumes ASA won’t be a steaming pile of shit at release
😅 1
Avatar
its WC, of course it will be
Avatar
Release 1 piece of content on time without bugs challenge (impossible)
Avatar
"UE5 is much harder to adapt to than we expected" didnt they say something along that lol
Avatar
Avatar
Pelayori
They have said they will do that
Thanks, I didn't know.
Avatar
so they of course will bungle it
Avatar
They’re gonna customize the engine again and then have to release Ark 1.5.5 in 6 years
Avatar
yeah im shocked they did it, conan devs were like yeah we hacked this shit too much it aint happening
Avatar
I’m willing to actually bet on it
10:01 PM
Wildcard simply can not follow good coding practices
Avatar
i wouldnt say its about coding practices, though they may have flaws there too, its about when you depend on an upstream framework/library, and you need to modify it, ensuring your modifications are done in a maintainable way, keeping your diffs isolated from baseline so they are re-applyable, and when you rebase upstream, knowing how to re-apply your desired changes on top of the new base, then keep your implementation separate from maintainenance of the fork. have to say we did a lot of things well in the minecraft dev scene, we literally have over 1000~ patch files on top of the minecraft base game and maintained it for a decade. (well, it wasnt 1k back then, I blew things to larger scale starting in 2016 lol)
10:06 PM
and its a fork of a fork of a fork of a fork of a fork
10:07 PM
Minecraft -> Craftbukkit -> Spigot -> Paper -> My personal fork - plugin is completely separate repo.
10:07 PM
if they kept their changes isolated updating to new engines is much more viable
Avatar
Avatar
Aikar
if they kept their changes isolated updating to new engines is much more viable
Yes, this is part of proper coding practices
10:08 PM
Maintaining a downstream fork isn’t something new, a lot of projects do it and they do it much better than WC.
Avatar
id consider it more project/change management best practices, cause the code can still be the same both ways, its just organization of managing those changes with updating maintenance in mind
10:10 PM
maybe if wanna umbrella term it, engineering best practices 😛
10:13 PM
i feel like it maybe an industry weakness though, they look at it as start with a copy of ue as your starting repo files, rather than a blank repo with ue as a submodule
Avatar
If you leave the base classes alone
10:14 PM
It’s usually a non-issue
10:15 PM
Anyways a lot of core ark design
10:15 PM
Screams prototype that never was fixed
10:15 PM
Stuff like multi-use entries
Avatar
you mean like keeping the game named the hello world app name lol...
10:20 PM
i always wondered why the fuck it was named ShooterGame, but then found out thats the name of the UE4 example project
Avatar
DECLARE_HOOK(validateName, void, AShooterPlayerState*, FPrimalPlayerCharacterConfigStructReplicated*); void Hook_validateName(AShooterPlayerState* _this, FPrimalPlayerCharacterConfigStructReplicated* playerCharacterConfig) { Log::GetLog()->info("Plugin On Hook."); return validateName_original(_this, playerCharacterConfig); } void Load() { Log::Get().Init("Init Plugin."); Log::GetLog()->info("Plugin INIT."); SET_HOOK("AShooterPlayerState.ServerRequestCreateNewPlayer_Implementation", validateName); } void Unload() { DISABLE_HOOK("AShooterPlayerState.ServerRequestCreateNewPlayer_Implementation", validateName); } Any idea why ? Failed to find hook (AShooterPlayerState.ServerRequestCreateNewPlayer_Implementation) 04/30/23 22:32 [API][warning] (API::PluginManager::LoadAllPlugins) Failed to load plugin - ArkPlugin Error code: 1114 (edited)
Avatar
Avatar
Hatya
DECLARE_HOOK(validateName, void, AShooterPlayerState*, FPrimalPlayerCharacterConfigStructReplicated*); void Hook_validateName(AShooterPlayerState* _this, FPrimalPlayerCharacterConfigStructReplicated* playerCharacterConfig) { Log::GetLog()->info("Plugin On Hook."); return validateName_original(_this, playerCharacterConfig); } void Load() { Log::Get().Init("Init Plugin."); Log::GetLog()->info("Plugin INIT."); SET_HOOK("AShooterPlayerState.ServerRequestCreateNewPlayer_Implementation", validateName); } void Unload() { DISABLE_HOOK("AShooterPlayerState.ServerRequestCreateNewPlayer_Implementation", validateName); } Any idea why ? Failed to find hook (AShooterPlayerState.ServerRequestCreateNewPlayer_Implementation) 04/30/23 22:32 [API][warning] (API::PluginManager::LoadAllPlugins) Failed to load plugin - ArkPlugin Error code: 1114 (edited)
Is that all the error output you got? What does your DllMain() look like? Your SET_HOOK and DISABLE_HOOK macros? "Failed to find hook" is printed when DisableHook() is called and your detour isn't found in the installed hooks.
Avatar
DllMain #include "includes.h" #include "init.h" BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: Load(); case DLL_PROCESS_DETACH: Unload(); } return FALSE; //Nothing happened! }
Avatar
Avatar
Hatya
DllMain #include "includes.h" #include "init.h" BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: Load(); case DLL_PROCESS_DETACH: Unload(); } return FALSE; //Nothing happened! }
you never return true
11:15 PM
the switch runs the code for Load and Unload, and then returns false
11:16 PM
An optional entry point into a dynamic-link library (DLL). When the system starts or terminates a process or thread, it calls the entry-point function for each loaded DLL using the first thread of the process.
11:16 PM
// Return FALSE to fail DLL load.
11:17 PM
You can probably safely change return FALSE; //Nothing happened! to return TRUE; //Nothing happened! as you don't have any logic to abort loading when something fails
Avatar
Hum i see, BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: return Load(); case DLL_PROCESS_DETACH: return Unload(); } return FALSE; //Nothing happened! } Better ?
Avatar
no, Load() probably isn't returning anything
11:18 PM
you would have to explicitly return from Load() (edited)
Avatar
Yes i've change my load and unload
Avatar
Change return FALSE to TRUE
11:18 PM
there's literally no reason as-is to abort loading your DLL
11:18 PM
you have zero initialization dependencies as far as I can tell
Avatar
DECLARE_HOOK(validateName, void, AShooterPlayerState*, FPrimalPlayerCharacterConfigStructReplicated*); void Hook_validateName(AShooterPlayerState* _this, FPrimalPlayerCharacterConfigStructReplicated* playerCharacterConfig) { Log::GetLog()->info("Plugin On Hook."); return validateName_original(_this, playerCharacterConfig); } BOOL Load() { Log::Get().Init("Init Plugin."); Log::GetLog()->info("Plugin INIT."); SET_HOOK("AShooterPlayerState.ServerRequestCreateNewPlayer_Implementation", validateName); return true; } BOOL Unload() { DISABLE_HOOK("AShooterPlayerState.ServerRequestCreateNewPlayer_Implementation", validateName); return false; }
Avatar
Avatar
Hatya
DECLARE_HOOK(validateName, void, AShooterPlayerState*, FPrimalPlayerCharacterConfigStructReplicated*); void Hook_validateName(AShooterPlayerState* _this, FPrimalPlayerCharacterConfigStructReplicated* playerCharacterConfig) { Log::GetLog()->info("Plugin On Hook."); return validateName_original(_this, playerCharacterConfig); } BOOL Load() { Log::Get().Init("Init Plugin."); Log::GetLog()->info("Plugin INIT."); SET_HOOK("AShooterPlayerState.ServerRequestCreateNewPlayer_Implementation", validateName); return true; } BOOL Unload() { DISABLE_HOOK("AShooterPlayerState.ServerRequestCreateNewPlayer_Implementation", validateName); return false; }
This is wrong
11:19 PM
Unload should return true for DllDetach to ensure the dll is properly unloaded
11:19 PM
since you are returning true literally from Load and (will be) from Unload
11:19 PM
there's no reason to return anything from those functions at all
11:19 PM
as they're effectively the same as just returning true in dllmain instead of false
Avatar
Part of the issue was you're falling through switch cases. When the DLL is loaded, you call Load(), then fall through to Unload(), then return false, then DllMain was called again because you returned false, then Unload() is called but there's nothing to unload.
Avatar
Avatar
TheMollusk
Part of the issue was you're falling through switch cases. When the DLL is loaded, you call Load(), then fall through to Unload(), then return false, then DllMain was called again because you returned false, then Unload() is called but there's nothing to unload.
this too, though it wouldn't be an issue with a return statement
11:20 PM
as a return statement breaks all execution
Avatar
hum i see
11:25 PM
Thx for feedback and help
Avatar
newbie request 😂 Is there any format suitable for Have me tried creating own plugin
Avatar
Avatar
TheHack
newbie request 😂 Is there any format suitable for Have me tried creating own plugin
Double dinos on their kill to learn hooks and some spawning stuff.
Avatar
hum they is anyway to get actor unique id ? for dino for example
Avatar
Yes. They have a field that contains that info. I think it’s called DinoID but I can’t remember exactly off the top of my head.
Avatar
For APrimalDinoCharacter (I've used this one so I know it works): https://github.com/ServersHub/Framework-ArkServerApi/blob/master/version/Core/Public/API/ARK/Actor.h#L6907 For AActor you can try this (I've not tested this one so I'm not sure what you will get): https://github.com/ServersHub/Framework-ArkServerApi/blob/master/version/Core/Public/API/ARK/Actor.h#L832 ---- (edited)
2:58 PM
Given a AActor* theActor; you can do: if (theActor != nullptr && theActor->IsA(APrimalDinoCharacter::GetPrivateStaticClass())) // Check if given actor is a valid dino. { APrimalDinoCharacter* theDino = static_cast<APrimalDinoCharacter*>(theActor); int theDinoID1; int theDinoID2; theDino->GetDinoIDs(&theDinoID1, &theDinoID2); // Do something with the dino IDs here... } (edited)
Avatar
Thx !
👍 1
Avatar
isnt it better to use the exports instead of dllmain methods? imo should just recommend people to switch instead of working around issues with dll main entry points
Avatar
Avatar
Aikar
isnt it better to use the exports instead of dllmain methods? imo should just recommend people to switch instead of working around issues with dll main entry points
Interresting, can you explain me the difference ? 🙂
Avatar
waiting for threads to join isnt allowed in dllmain ive read
3:59 AM
theres more restrictions in there
4:00 AM
and to my understanding theres no benefit to using the dllmain either
Avatar
hum i see, and it's require lot of change to move to export from dllmain ? (edited)
4:01 AM
extern "C" __declspec(dllexport) void __fastcall Plugin_Init() { SA::Load(); } extern "C" __declspec(dllexport) void __fastcall Plugin_Unload() { SA::Unload(); }
4:01 AM
just define those 2 exports
4:06 AM
also @Hatya this Log::Get().Init("Init Plugin."); is suppose to be your plugin name, it names the logger
Avatar
Avatar
SR
Double dinos on their kill to learn hooks and some spawning stuff.
What are hooks? 🥲
Avatar
Avatar
TheHack
What are hooks? 🥲
Events
🙏 1
👌 1
Avatar
Where can I find more information or codes?
Avatar
@Aikar thx !
  • I've change for init function
  • if i change for export, i've to only keep myplugin.cpp & myplugin.h and in bottom (or top ?) of add the export ?
Avatar
Hum, which hook you use to start "recurring" task after server launch ? Some of hook can have performance issue ?
Avatar
Yes a poorly coded hook can cause performance issues. Depends on how often you would like it to reoccur.
Avatar
yeah you have to consider how often is said hook called. then if its super 'hot', be careful what you do in it.
4:09 PM
add a log line, if your console is absolutely bombed, be cautious 🙂
4:09 PM
- if i change for export, i've to only keep myplugin.cpp & myplugin.h and in bottom (or top ?) of add the export ? I think you can just put this at bottom of your plugin.cpp file and all is fine
4:10 PM
the exports
Avatar
any know how i can change the dino gender? if i do: c++ if (dino->bIsFemale()()){ dino->bIsFemale().Set(false); } else { dino->bIsFemale().Set(true); } works fine, and i can breed it, but in the dino information dont change, like if i change male to female, the name color is still blue, and in the inventory still says "Male"
Avatar
Avatar
Aikar
yeah you have to consider how often is said hook called. then if its super 'hot', be careful what you do in it.
Yes, i do the change, very simple and clear 🙂
Avatar
Avatar
Loki
any know how i can change the dino gender? if i do: c++ if (dino->bIsFemale()()){ dino->bIsFemale().Set(false); } else { dino->bIsFemale().Set(true); } works fine, and i can breed it, but in the dino information dont change, like if i change male to female, the name color is still blue, and in the inventory still says "Male"
You have to multicast the property like this: dino->MulticastProperty(FName("bIsFemale", EFindName::FNAME_Find));
7:24 PM
That way players will get the updated info
7:25 PM
This only works for replicated variables, not all variables will get updated on the client with multicast
Avatar
thanks
Avatar
It's possible to add external lib ? (OpenSSL, CURL, etc)
Avatar
Avatar
Hatya
It's possible to add external lib ? (OpenSSL, CURL, etc)
why shouldn't it be
Avatar
Idk, some limitation link to UE or something, but if i correctly understand, i can use all C++ code i want inside plugin ?
Avatar
you can use any library you want
8:33 PM
API itself uses POCO for requests for example
8:33 PM
it used to use curl
8:33 PM
there is a one header library for c++ requests btw
8:33 PM
A C++ header-only HTTP/HTTPS server and client library - GitHub - yhirose/cpp-httplib: A C++ header-only HTTP/HTTPS server and client library
Avatar
@WETBATMAN thx ! I come from .Net dev, some c++ concept are new for me 😄 if I just copy .h file in my project I can use it ?
Avatar
sure, but if you need to make requests to an https endpoint you need to link with openssl libraries
8:41 PM
you should just use the API requests though
8:42 PM
you can include <Requests.h> after including the API
8:42 PM
API can handle both https and http
Avatar
I see, i've found request.h in Api Source, but idk how to use it in plugin
Avatar
are you sending a get request?
Avatar
Both post and get, and i also want to send file as attachement
8:51 PM
ChatGPT give me this sample : API::Requests::Get()
Avatar
API::Requests::Get().CreateGetRequest
8:51 PM
first param is the request url
8:52 PM
then you pass it a function which will be called when the request is complete
8:52 PM
and lastly it takes a vector of headers (if any)
8:55 PM
post request is similar but attaching a file won't be very straightforward 😄
Avatar
im kind of scared that chatgpt got it right to give that API::Requests::Get()
Avatar
it can get hooks right too 😄
Avatar
how the hell does it have enough context about this project
Avatar
open source plugins i guess
Avatar
Probably, but some response about it's "approximate" and some time it's old (2021 Training data)
Avatar
Avatar
Aikar
how the hell does it have enough context about this project
substitute 5/2/2023 9:10 PM
It’s been able to explain complicated template code I’ve written
9:10 PM
It does a really good job
Avatar
k get everyone to trick it into a fork bomb to crash itself before it takes over the world/our career
Avatar
jraServerAPI 5/2/2023 9:11 PM
It created Flappy Bird lol
Avatar
I ask it the code for upload file, it's approximative, and not working 😄
Avatar
one alternative is to write code in another language then invoke a web request or child process to do the stuff like file uploading
9:32 PM
but whys it got to be a file upload, what are you uploading from within ark?
Avatar
All dino in map, i've get some data (no all) and all dino generate a file of 6MB json payload of 6MB is big it's why i do a file transfer
Avatar
Avatar
Hatya
I ask it the code for upload file, it's approximative, and not working 😄
you can't really do that with the built in requests
Avatar
API::Requests::Get().CreatePostRequest(hookUrl, [](bool success, std::string response) { Log::GetLog()->info(response); if (success) { Log::GetLog()->info("File upload."); } else { Log::GetLog()->info("File not upload."); } }, file_content, "application/octet-stream", { });
9:36 PM
It's the code from ChatGPT
Avatar
file_content param will expect an std::string not a file
Avatar
yeah if you read the file yourself and write the data into a string then it will work
Avatar
I've try, i receive a Bad Request from Requestbin
Avatar
"application/octet-stream"
9:39 PM
are you using this type?
9:40 PM
it should be application/json
Avatar
Yes for pure json, but for trying upload i've change to octet-stream, but not working
9:40 PM
I try with json right now
9:47 PM
try { const std::string hookUrl = "https://eos83ya2pn0dqil.m.pipedream.net"; const std::string fileContentPath = ArkApi::Tools::GetCurrentDir() + "/ArkApi/Plugins/ArkPlugin/" + fileName; std::string content = ReadFileToString(fileContentPath); std::vector<std::string> headers = { "Content-Type: application/json" }; API::Requests::Get().CreatePostRequest(hookUrl, [](bool success, std::string response) { Log::GetLog()->info(response); if (success) { Log::GetLog()->info("File upload."); } else { Log::GetLog()->info("File not upload."); } }, content, "application/json", headers); } catch (...) { Log::GetLog()->error("EX"); }
9:47 PM
But bad request
9:51 PM
05/02/23 21:51 [API][error] Software caused connection abort
Avatar
you likely exceed max post payload size
9:56 PM
the target web server must be configured to take larger payloads (edited)
Avatar
Probably i try with local ASPNET Core without upload limit to test
9:57 PM
And when i've launch it i relaunch server to test large request
9:58 PM
pipedream.net has probably 1-2mb limit size
Avatar
or a firewall is blocking it either one, software caused connection abort im thinking means your local machine though
9:58 PM
but yeah it is typical for default limits to be around 2m
9:58 PM
or 8m for php
Avatar
I try, i restart server and the url it's localhost
Avatar
so the api requests is by default threaded yeah?
Avatar
In my code ? xD
Avatar
no im asking the arkapi devs
10:06 PM
i wasnt aware that api existed
10:06 PM
but i did wanna look at doing my own discord hooks and yeah dont wanna do that on main thread
Avatar
Oh, idk, in my code i've just hook on "OnSaveWorld" get all informations and send to API, with ASP API it's work, base limit it's 28Mb in ASP
Avatar
so that fixed it going to local?
10:07 PM
if so you will have to get config changed on that other host
Avatar
Yes, local work, but if config it on remote it's work too
10:07 PM
pipedream it's a bin request tester
Avatar
API Request libs process the request on a worker thread and then calls the callback on the main game thread
Avatar
Make sens
10:08 PM
sense*
Avatar
jraServerAPI 5/10/2023 7:29 PM
Hello, I'm trying to give a dino a saddle using the API and it works, but I need to leave the area and come back in order for the saddle to render (or log out and back into the game). I've tried a few things, but nothing seems to work.. Anyone got any ideas? I noticed the ArkShop only gives saddle to dinos that are going into cryopods and not normal ones.. is this a known issue? Thanks in advance! c++ FString fsaddleBlueprint("Blueprint'/Game/PrimalEarth/CoreBlueprints/Items/Armor/Saddles/PrimalItemArmor_DiplodocusSaddle.PrimalItemArmor_DiplodocusSaddle'"); UClass* saddleClass = UVictoryCore::BPLoadClass(&fsaddleBlueprint); UPrimalItem* itemSaddle = dino->GiveSaddle(TSubclassOf<UPrimalItem>(saddleClass), 1, 0, true); if (itemSaddle) { // none of these worked, i still have to leave the rendered area and come back //itemSaddle->InventoryRefreshCheckItem(); //itemSaddle->UpdatedItem(false); //dino->MyInventoryComponentField()->InventoryRefresh(); //dino->ForceReplicateNow(false, false); } (edited)
Avatar
Give the saddle to the dinos inventory then equip it.
Avatar
jraServerAPI 5/10/2023 10:40 PM
I will try that, thank you!
Avatar
\include\mysql++11\mysql++11.h(26,10): fatal error C1083: Cannot open include file: 'mysql/mysql.h': No such file or directory When building off of OGLootbox I get this error on buidling. I have included MySQl Connector in Additional Include Directories under C/C++ general and tried it under Linker but still failing. Am I missing anything?
Avatar
Avatar
Lethal
Give the saddle to the dinos inventory then equip it.
jraServerAPI 5/11/2023 12:39 AM
Thanks @Lethal , but I am still having a hard time getting it to equip (never done this before) .. I've tried a few things that seemed obvious, but now I am out of ideas.. Here is where I am at: c++ FString fsaddleBlueprint("Blueprint'/Game/PrimalEarth/CoreBlueprints/Items/Armor/Saddles/PrimalItemArmor_DiplodocusSaddle.PrimalItemArmor_DiplodocusSaddle'"); UClass* saddleClass = UVictoryCore::BPLoadClass(&fsaddleBlueprint); // add saddle to inventory - works! UPrimalItem* itemSaddle = UPrimalItem::AddNewItem(saddleClass, _this->MyInventoryComponentField(), false, true, iSaddleQuality, true, 1, false, 0, false, nullptr, 0, false, false); // Now Equip? but how? // similiar to AddNewItem when i set to autoequip, this works but i still had to leave and come back for it to render //_this->MyInventoryComponentField()->ServerEquipItem(&itemSaddle->ItemIDField()); // this didnt work, idk if index 0 is correct though //itemSaddle->AddToSlot(0, true); // this didnt work //ForPC->ServerRequestInventoryUseItem(_this->MyInventoryComponentField(), itemSaddle->ItemIDField()); (edited)
Avatar
Should have worked from the inventory component I thought.
Avatar
Avatar
jraServerAPI
Thanks @Lethal , but I am still having a hard time getting it to equip (never done this before) .. I've tried a few things that seemed obvious, but now I am out of ideas.. Here is where I am at: c++ FString fsaddleBlueprint("Blueprint'/Game/PrimalEarth/CoreBlueprints/Items/Armor/Saddles/PrimalItemArmor_DiplodocusSaddle.PrimalItemArmor_DiplodocusSaddle'"); UClass* saddleClass = UVictoryCore::BPLoadClass(&fsaddleBlueprint); // add saddle to inventory - works! UPrimalItem* itemSaddle = UPrimalItem::AddNewItem(saddleClass, _this->MyInventoryComponentField(), false, true, iSaddleQuality, true, 1, false, 0, false, nullptr, 0, false, false); // Now Equip? but how? // similiar to AddNewItem when i set to autoequip, this works but i still had to leave and come back for it to render //_this->MyInventoryComponentField()->ServerEquipItem(&itemSaddle->ItemIDField()); // this didnt work, idk if index 0 is correct though //itemSaddle->AddToSlot(0, true); // this didnt work //ForPC->ServerRequestInventoryUseItem(_this->MyInventoryComponentField(), itemSaddle->ItemIDField()); (edited)
GiveSaddleFromString(&SaddleBP, 0, 0, true);
1:24 AM
function from APrimalDinoCharacter
1:25 AM
last param specifies if it should be equipped or not
1:25 AM
should be true in your case
Avatar
Avatar
WETBATMAN
GiveSaddleFromString(&SaddleBP, 0, 0, true);
jraServerAPI 5/11/2023 1:26 AM
yes i've tried that, it was one of the first things i tried, but i need to log out/ or leave the area to render the saddle
Avatar
hm been using this for a while in a hook and never had any similar issues
Avatar
3rd parameter as true doesn't equip it? UPrimalItem* itemSaddle = UPrimalItem::AddNewItem(saddleClass, _this->MyInventoryComponentField(), false, true, iSaddleQuality, true, 1, false, 0, false, nullptr, 0, false, false);
1:29 AM
Also are you doing this after BeginPlay of the dino?
Avatar
jraServerAPI 5/11/2023 1:29 AM
it does, but only when I log out/in or when i leave the render area
1:29 AM
it magically appears
Avatar
Avatar
Lethal
Also are you doing this after BeginPlay of the dino?
jraServerAPI 5/11/2023 1:31 AM
yes, I'm doing it on the TameDino hook.. because I wanted to automatically put a generic saddle on a dino after it is tamed (edited)
Avatar
the code i sent was inside of TameDino and i never had such issues
Avatar
Post or Pre hook?
Avatar
jraServerAPI 5/11/2023 1:31 AM
post
Avatar
try TameDino
1:32 AM
or try running force net update on the dino
Avatar
jraServerAPI 5/11/2023 1:37 AM
well son of a
1:38 AM
GiveSaddleFromString and ForceNetUpdate on the dino did the trick.. man I swear i tried that!!!
1:38 AM
Thank you all
1:42 AM
hmm i did get it to work.. I just ran the DoTame command on a dino I already tamed.. but on a fresh dino..it doesnt work(i'm back in the render snafu)... maybe i need a bit of a delay after it is tamed, i'll try that (edited)
Avatar
jraServerAPI 5/11/2023 1:51 AM
yup, after a 1 second delay, it works fine.. ughhh.. it was probably working many times before for me, but I just needed a delay 🤦‍♂️ (edited)
Avatar
jraServerAPI 5/11/2023 4:50 PM
is it possible to figure out what a dino's level was prior to it being tamed? Minus the taming effectiveness boost? Or how many levels were awarded for taming effectiveness? I searched some of the obvious fields and all come back the current level.
Avatar
I'm not sure if this is true for all dinos but the after tame level seems to be 150% of the wild level
4:52 PM
So a 100 wild turns to 150 tamed
Avatar
jraServerAPI 5/11/2023 5:17 PM
unless it was attacked while taming right?.. is there a way to get the final taming effectiveness value?
5:17 PM
i couldnt find anything
Avatar
You could do a sum of all wild points + 1
5:21 PM
I do t know of a field that already has it
Avatar
hey, any know whats the hook of rex tek saddle fire? I would like search it in the devkit but its 400+gb and I had to uninstall it
Avatar
@jraServerAPI It's called AbsoluteBaseLevel
7:48 PM
For the level of a dino before tamed
Avatar
jraServerAPI 5/19/2023 8:29 PM
thanks!
Avatar
jraServerAPI 5/21/2023 8:03 PM
I'd like to take the value from RootComponentField()->RelativeRotationField() and rotate it 180 degrees.. Does anyone know how this can be done? Much appreciated!
Avatar
Avatar
jraServerAPI
I'd like to take the value from RootComponentField()->RelativeRotationField() and rotate it 180 degrees.. Does anyone know how this can be done? Much appreciated!
Get the roll, add 180 and do the modulo with 360
8:09 PM
rotation.Roll = (rotation.Roll + rotateDegrees) % 360 (edited)
Avatar
Avatar
Pelayori
Get the roll, add 180 and do the modulo with 360
Hey now hold on we don’t know what axis they want 😂
Avatar
Well you got me there 😛
8:32 PM
I sent that as I did that but didn't think about the other axis
Avatar
Hopefully they don’t just want “180” and have an actual axis in mind
Avatar
jraServerAPI 5/21/2023 8:33 PM
not working 😦
Avatar
Since stuff like roll, pitch, and yaw change things
Avatar
Avatar
jraServerAPI
not working 😦
What axis of rotation do you want
Avatar
jraServerAPI 5/21/2023 8:33 PM
1st.. when i try your code it wont compile
8:33 PM
Avatar
cast it to int then, it says float is not allowed there
Avatar
jraServerAPI 5/21/2023 8:35 PM
i think roll
Avatar
Avatar
Pelayori
cast it to int then, it says float is not allowed there
Well is the .Roll a float?
Avatar
jraServerAPI 5/21/2023 8:35 PM
I want to turn a dino around
Avatar
Avatar
substitute
Well is the .Roll a float?
Correct
Avatar
Avatar
jraServerAPI
I want to turn a dino around
So what you want is to make the forward direction face the other way?
8:35 PM
Because if so you can’t just use one axis
Avatar
jraServerAPI 5/21/2023 8:35 PM
wait// maybe its the Yaw?
Avatar
If the Dino is on a sloped surface then their forward direction will have pitch
8:36 PM
As well as yaw
Avatar
jraServerAPI 5/21/2023 8:36 PM
oh man
Avatar
lol
8:37 PM
You’ll have to get a little involved
8:37 PM
Let me see if I can help
Avatar
jraServerAPI 5/21/2023 8:37 PM
it may not be worth it lol
8:37 PM
haha
Avatar
FRotator in unreal engine has a series of functions to rotate a vector by x degrees, but when I wanted to use it the api lacks a dozen of functions and data structures to make it work
Avatar
jraServerAPI 5/21/2023 8:39 PM
so i basically have a safezone bubble and i'm preventing pawns from entering.. but if it's a wild dino i was hoping to turn it around first..otherwise it just keeps bopping the bubble over and over and over lol
Avatar
Maybe this will help
Avatar
jraServerAPI 5/21/2023 8:40 PM
ooh
Avatar
Avatar
jraServerAPI
so i basically have a safezone bubble and i'm preventing pawns from entering.. but if it's a wild dino i was hoping to turn it around first..otherwise it just keeps bopping the bubble over and over and over lol
Well you can probably use the yaw for this (edited)
8:40 PM
And just not care about an angle
8:41 PM
I mean just rotate the yaw
8:41 PM
That is
Avatar
jraServerAPI 5/21/2023 8:43 PM
okay
8:43 PM
sooo.. just subtract 180? lol
Avatar
If you did want to handle pitch roll and yaw you’d have to find the angular distance of each axis between the forwards vector and the backwards vector (negated forward) (edited)
8:44 PM
But you probably don’t need that level of care
8:44 PM
So just 180 on the yaw
Avatar
jraServerAPI 5/21/2023 8:44 PM
ok i will give that a try
Avatar
Avatar
substitute
If you did want to handle pitch roll and yaw you’d have to find the angular distance of each axis between the forwards vector and the backwards vector (negated forward) (edited)
But in this case since the diff is 180 if would probably work to negate the rotator
8:46 PM
If you wanted to drop roll (which probably should if you did do all axis as it is not important here) then the manual calculation would be needed
Avatar
jraServerAPI 5/21/2023 8:46 PM
pepe_noted
8:47 PM
thank you 🙂
Avatar
Anyways the reason I mention this
8:47 PM
Is pitch yaw and roll are rotations around a fixed axis
8:48 PM
While if you were wanting to rotate around the character’s axis (forward, left, up)
8:48 PM
Things get a little more complicated
Avatar
Avatar
substitute
Is pitch yaw and roll are rotations around a fixed axis
(The global forward (+x), left (+z), and up (+y))
Avatar
jraServerAPI 5/21/2023 8:49 PM
the ez method worked
Avatar
Oh (edited)
8:49 PM
There’s also this
Avatar
jraServerAPI 5/21/2023 8:50 PM
just adding 180 to yaw
Avatar
You can probably use this, use the character up direction and do +180 to yaw (edited)
Avatar
Yeah but we are lacking half of the data structures needed internally, and from FRotator / FVector as well
Avatar
And have everything sorted
Avatar
I already did extensive testing of those
8:50 PM
We need to include UE4 structures properly
Avatar
Yes
8:51 PM
@jraServerAPI
8:51 PM
8:51 PM
In vect = character rotation to vec3
8:51 PM
Axis = character up vector
8:51 PM
That could work if you take that output back to rotator
8:51 PM
As well
8:55 PM
@jraServerAPI if you are also ever confused on which axis to use for what rotation
8:55 PM
Hold your left arm out
8:55 PM
Either forward, to the left, or up (edited)
8:55 PM
And then rotate it
8:56 PM
How your hand rotates shows which direction (yaw, pitch, or roll) that the rotation applies for the axis (your arm, pointing +x, +y, or +z)
8:56 PM
8:56 PM
And then you just match to this if you can’t remember which is which by name (edited)
8:57 PM
You can also see how rotating around an unaligned axis works by doing the same but bending at an angle
Avatar
How do I modify the Andrewsarchus Saddle to be only crafted in the fabricator?
6:38 PM
Im quite new at this
6:38 PM
I did try to search for anything like modifying items but I dont seem to find much
Avatar
Items have a RequiresInventoryComponentToCraft array, you add an entry to the fabricator inventory
Avatar
Mmmmm
6:41 PM
Is there any plugins to look that off?
6:42 PM
I dunno the structure of a plugin so far
Avatar
Nope, but it should be quite simple if I'm not mistaken
Avatar
Avatar
Levviata
I dunno the structure of a plugin so far
Contribute to SubstituteR/ArkServerAPI-Template development by creating an account on GitHub.
Avatar
You might be able to do that with hooking UWorld::InitializeActorsForPlay, and modify the Class Default Object to reflect that change. Be aware, however that the clients won't see the requirement added but the server will acknowledge that DECLARE_HOOK(UWorld_InitializeActorsForPlay, void, UWorld*, FString*, bool); void Hook_UWorld_InitializeActorsForPlay(UWorld* _this, FString* InURL, bool bResetTime) { static FString AndrewPath("put andrew path here"); UClass* AndrewClass = UVictoryCore::BPLoadClass(&AndrewPath); static FString FabPath("put fabricator inventory path here"); UClass* FabClass = UVictoryCore::BPLoadClass(&FabPath); ((UPrimalItem*)AndrewClass->GetDefaultObject(true))->CraftingRequiresInventoryComponentField().Add(FabClass); UWorld_InitializeActorsForPlay_original(_this, InURL, bResetTime); } void Load() { ArkApi::GetHooks().SetHook("UWorld.InitializeActorsForPlay", &Hook_UWorld_InitializeActorsForPlay, &UWorld_InitializeActorsForPlay_original); } void Unload() { ArkApi::GetHooks().DisableHook("UWorld.InitializeActorsForPlay", &Hook_UWorld_InitializeActorsForPlay); } That might be useful, if UWorld::InitializeActorsForPlay is early enough (edited)
Avatar
Hmmmm
6:55 PM
How would you make the client see the requirements then?
Avatar
You don't
6:55 PM
Ark api is server side only
6:55 PM
Not everything can be sent back to clients
Avatar
What would the result of the code?
6:56 PM
Would players would be able to see the andrew's engram in the fabri's inventory?
Avatar
If it doesn't belong to the fabricator usually, you would need to add is an an engram by yourself
Avatar
Is there any example out there?
Avatar
I'm not sure
6:59 PM
You can hook APrimalStructureItemContainer::BeginPlay, and add the item yourself post original call
Avatar
@Pelayori Im not quite sure where to start to learn about plugins
8:14 PM
Should I look at ark's code?
8:14 PM
Other plugins? (I mean, yeah)
Avatar
Avatar
Levviata
Other plugins? (I mean, yeah)
#【💌】ʜᴇʟᴘꜰᴜʟ-ʟɪɴᴋꜱ Has the github with the open source plugins
Avatar
Ok thanks neat
8:23 PM
My bad for not saying thanks before, I was trying my best to not over-use it and I ended up under-using it 😅 (edited)
Avatar
jraServerAPI 5/27/2023 8:35 PM
I'm curious, is it possible to control what map is loaded via the API? or is that only from the command line when the server is launched?
Avatar
Avatar
jraServerAPI
I'm curious, is it possible to control what map is loaded via the API? or is that only from the command line when the server is launched?
might be wrong but i think it's called FString& PGMapNameField() { return GetNativePointerField<FString>(this, "AShooterGameMode.PGMapName"); } that's filled in
Avatar
Avatar
Natsu
might be wrong but i think it's called FString& PGMapNameField() { return GetNativePointerField<FString>(this, "AShooterGameMode.PGMapName"); } that's filled in
jraServerAPI 5/28/2023 3:42 AM
Thanks.. I wonder at what point or hook, this needs to be implemented.. I'm going to check the GameMode hooks
Avatar
Avatar
jraServerAPI
Thanks.. I wonder at what point or hook, this needs to be implemented.. I'm going to check the GameMode hooks
Jra do you know what hook i need to get to edit dino drop's? was thinking something like ConfigOverrideSupplyCrateItems but i only found LinkedSupplyCrateDestroyed
Avatar
Avatar
Natsu
Jra do you know what hook i need to get to edit dino drop's? was thinking something like ConfigOverrideSupplyCrateItems but i only found LinkedSupplyCrateDestroyed
jraServerAPI 5/31/2023 2:38 AM
not sure
Avatar
Avatar
Natsu
Jra do you know what hook i need to get to edit dino drop's? was thinking something like ConfigOverrideSupplyCrateItems but i only found LinkedSupplyCrateDestroyed
Dino item drops are generated from template UPrimalInventoryComponent objects. One option is to modify the TArray<FSupplyCrateItemSet> ItemSets field in those UPrimalInventoryComponents. More info here: https://discord.com/channels/513432877904691202/745040653582336120/1092560503882121288 Another option could be to hook when a dino dies and add/remove items from its inventory yourself.
Avatar
Avatar
TheMollusk
Dino item drops are generated from template UPrimalInventoryComponent objects. One option is to modify the TArray<FSupplyCrateItemSet> ItemSets field in those UPrimalInventoryComponents. More info here: https://discord.com/channels/513432877904691202/745040653582336120/1092560503882121288 Another option could be to hook when a dino dies and add/remove items from its inventory yourself.
Cannot see that section that you linked
Avatar
It's in the intermediate discussion channel. Idk how you get access to that 🤷‍♂️
Avatar
I need some help with TimedRewards, i copied it from ArkShop but for some reason it will crash at the for (auto& reward_data : data->reward_callbacks) When people logout i will remove them from the online_players list. Could someone point me to the right direction ?
Avatar
substitute 6/2/2023 9:08 PM
Can you post a crashstack
Avatar
Know what to do 🙂 (edited)
Exported 5,575 message(s)
Timezone: UTC+1