Solved taking away dinos structure damage ability

WETBATMAN

Active member
Plugin Developer
Donators
Messages
234
Likes
67
Points
28
Website
dopeark.com
I'm running Annunaki on my server (its a mod which adds tameable dragons and stuff) but there is a big issue, most of the stuff from that mod has the ability to break metal AND tek

I want to make something like this plugin https://arkserverapi.com/threads/anti-cannon-raid.559/
but for dinos, how would I go about doing that? I'm sorry for just asking like this but i don't even know where to start when it comes to plugin development :D
 
Advertisement

Monetise Your Game Server

Want to monetise your ARK Server? Create your own webstore at tebex.io

Michidu

Administrator
Staff member
Messages
620
Likes
458
Points
63
It's similar but you need a different hook, APrimalDinoCharacter::TakeDamage.
 

WETBATMAN

Active member
Plugin Developer
Donators
Messages
234
Likes
67
Points
28
Website
dopeark.com
so this would in theory work?
also which add-ons do I need for visual studio to compile plugins like this?
thanks in advance and sorry for the stupid questions here :D

C++:
#include <iostream>
#include <API/ARK/Ark.h>

#pragma comment(lib, "ArkApi.lib")

DECLARE_HOOK(APrimalDinoCharacter_TakeDamage, float, APrimalDinoCharacter*, float, FDamageEvent*, AController*, AActor*);

float Hook_APrimalDinoCharacter_TakeDamage(APrimalDinoCharacter* _this, float Damage, FDamageEvent* DamageEvent,
                                       AController* EventInstigator, AActor* DamageCauser)
{
    if (DamageCauser)
    {
        FString descr;
        DamageCauser->GetHumanReadableName(&descr);

        if (descr.StartsWith("Cannon"))
        {
            return 0;
        }
        if (descr.StartsWith("Dragon"))
        {
            return 0;
        }
        if (descr.StartsWith("Broodmother"))
        {
            return 0;
        }
        if (descr.StartsWith("Megapithecus"))
        {
            return 0;
        }
    }

    return APrimalDinoCharacter_TakeDamage_original(_this, Damage, DamageEvent, EventInstigator, DamageCauser);
}

void Load()
{
    Log::Get().Init("NoDragons");

    ArkApi::GetHooks().SetHook("APrimalDinoCharacter.TakeDamage", &Hook_APrimalDinoCharacter_TakeDamage,
                               &APrimalDinoCharacter_TakeDamage_original);
}

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:
        break;
    }
    return TRUE;
}
 

Michidu

Administrator
Staff member
Messages
620
Likes
458
Points
63
You don't need any addons actually.

Yeah, it looks close. But i think i have misunderstood you, if you want to take away the ability from dinos to deal damage, you need to hook both functions + the one for players.
 

WETBATMAN

Active member
Plugin Developer
Donators
Messages
234
Likes
67
Points
28
Website
dopeark.com
so structure dmg, dino dmg and player damage

also what is the hook for player damage and how do i go about adding 3 hooks into the file :D

sorry for the dumb question you probably answered shit like this 100000 times but i would love to have something like this on my server :D
 

WETBATMAN

Active member
Plugin Developer
Donators
Messages
234
Likes
67
Points
28
Website
dopeark.com
also i want to take away the ability from a certain dino to do structure damage not damage in general

cause this mod adds dragons that can break stone and metal and they have insane dps
 

Michidu

Administrator
Staff member
Messages
620
Likes
458
Points
63
Actually, you only need those two: APrimalCharacter.TakeDamage and APrimalStructure.TakeDamage. The first one works for players and dinos.
 

WETBATMAN

Active member
Plugin Developer
Donators
Messages
234
Likes
67
Points
28
Website
dopeark.com
Actually, you only need those two: APrimalCharacter.TakeDamage and APrimalStructure.TakeDamage. The first one works for players and dinos.
i know that i'm getting annoying as fuck but i installed visual studio with the visual c++ pack, i have it set to release and x64 but building a premade template gives me errors what else do i need to build ark api plugins ?
very new to this so, please dumb it down for me :D
 

Michidu

Administrator
Staff member
Messages
620
Likes
458
Points
63
You just need to declare two hooks.
What exactly problems you have? There were screenshots somewhere showing how you need to configure a project.
 

WETBATMAN

Active member
Plugin Developer
Donators
Messages
234
Likes
67
Points
28
Website
dopeark.com
could you post a link to those because I've been searching but i could not find anything like that

i'm getting compilation errors when trying to compile NoCannons from the source so i know there is something wrong with my setup
 

WETBATMAN

Active member
Plugin Developer
Donators
Messages
234
Likes
67
Points
28
Website
dopeark.com
i configured my visual studio to a guide on here by OwnProx

here is the compilation errors i'm getting
Code:
1>------ Build started: Project: NoAnnunaki, Configuration: Release x64 ------
1>stdafx.cpp
1>dllmain.cpp
1>NoAnnunaki.cpp
1>c:\users\avtoj\source\repos\noannunaki\noannunaki\noannunaki.cpp(46): fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?
1>Done building project "NoAnnunaki.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
also typing ArkApi:: in the IDE does not show any references to any functions
do you have discord or something of that sort so communication is easier?
 

Michidu

Administrator
Staff member
Messages
620
Likes
458
Points
63
Yes, you can add me Michidu#4228.
About the error, you need to disable precompiled headers.
 
Top