Example how to override void OnKilled(HitInfo hitInfo = null)Solved

How would i overide this in a class BaseRidableAnimal

public override void OnKilled(HitInfo hitInfo = null)

You can't override that. Well you can ofc, but you need to make edits in server dll's. All you need to do is use hooks (in your case)

ya none of the hooks catche it before the corpse spawns.

Ts3hosting

ya none of the hooks catche it before the corpse spawns.

Would be easier to help if you'd explained why do you need that

Needed to stop horse spawn. and run my own.

Ts3hosting

Needed to stop horse spawn. and run my own.

That's still describing an intermediate problem. When asking for help, it's best to always describe the original problem you are trying to solve, not just the problem you are encountering when attempting a particular solution.

This thread, like many that are opened in this community, is an example of the XY problem.
https://en.m.wikipedia.org/wiki/XY_problem

Ok problem im trying to solve i want to stop OnKilled from heppening and spawning the corpse. and instead do my thing. Catching the corpse and destroying it on spawn just seems to be not working like i like because i need more info from the baseEntity that the corpse does not have.

Merged post

I Tried private void OnCorpsePopulate(BaseRidableAnimal horse, BaseCorpse horseCorpse)
But this is not catching the death.

void OnEntitySpawned(BaseCorpse entity)
{
    // Check here for corpse shortname if needed
    
    entity.Kill();
}
dNpkqFyTbVbWbfa.png Orange
void OnEntitySpawned(BaseCorpse entity)
{
    // Check here for corpse shortname if needed
    
    entity.Kill();
}

Problem is i dont want to kill every corps of that type only ones witch info is tied to the BaseEntity that died 

Ts3hosting

Ok problem im trying to solve i want to stop OnKilled from heppening and spawning the corpse. and instead do my my own thing.

That's still describing an intermediate problem. Why do you want to override spawning the corpse? What do you want the override logic to do? What problem are you trying to solve by overriding the corpse?

I have noticed this being a pattern in your posts, so I want to encourage you to get into the habit of explaining the original problem that is being solved. People can provide you with better help that way, since they can potentially point out alternative solutions to earlier problems that you have already passed by, which can prevent you from even needing to solve the intermediate problem you are currently facing.

Even if it turns out that the path you have taken is a sensible one, having all of the information helps people get on the same page and focus on the intermediate problem. Simply asking people to help solve intermediate problems without showing why the intermediate problem is the right problem to solve, will likely result in no answer, or answers that don't fit your use case because the people sharing knowledge and advice can't see the bigger picture.

Competent developers who are well equipped to help you solve the problem are also the kind of people who understand that having the bigger picture is essential. With the bigger picture being clearly missing from your question, competent developers will likely pass by your post because they deem it not worth their time to bother extracting the bigger picture out of you though back and forth posts like this. They may also conclude that since you did not include the bigger picture, that you are not very experienced and therefore not creating anything meaningful, and therefore not worth the time to help.

The PROBLEM is "Im Dumb and dont know how to ask a question like you said /"like many that are opened in this community,"/ "

When Orange gives best answer 😶

Ts3hosting

The PROBLEM is "Im Dumb and dont know how to ask a question like you said /"like many that are opened in this community,"/ "

I was not intending to insult you. I find things like insults, sarcasm, double meaning statements, and similar speech patterns to be an inefficient and often counter-productive usage of communication, so I am intentional about avoiding them. If I considered you to be dumb and not worth respect, I would not have wasted time making fun of you. Instead, I would simply not have replied at all. The fact that I am bothering to reply and provide constructive feedback about how you can ask questions that lead to better answers demonstrates that I respect you and that I am here to help.
Ts3hosting

Problem is i dont want to kill every corps of that type only ones witch info is tied to the BaseEntity that died 

You can check shortname of BaseCorpse. Its same as BaseEntity but have more fields

dNpkqFyTbVbWbfa.png Orange

You can check shortname of BaseCorpse. Its same as BaseEntity but have more fields

I think what Ts3hosting is saying is that he only wants to replace the corpse of specific horse instances. For example, if the horse was being ridden by an NPC. The preferred way to solve this would be to hook the method that creates the corpse so that a reference to the original horse is still available. I believe there are already hooks that accomplish that for players, but none have been added for entities in general. Given that this pattern already has a precedent for players, the way I would suggest to solve this would be to add a new hook (using the Oxide Patcher, then create a PR). If you are time pressed and cannot wait until Thursday for it to come out (or possibly later if the team doesn't get to reviewing the PR), then you can try something less direct such as record the time/position when the horse is killed and then compare against that when the corpse is spawned to see if it's in the same frame and it's positon is close enough.