# Need Help on the C++ code

**URL:** https://discourse.cataclysmdda.org/t/need-help-on-the-c-code/13027
**Category:** The Toolbox
**Created:** [November 27, 2016, 9:25pm UTC](https://discourse.cataclysmdda.org/t/need-help-on-the-c-code/13027 "2016-11-27T21:25:19Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![bennettdrill](https://avatars.discourse-cdn.com/v4/letter/b/bbe5ce/32.png) [@bennettdrill](https://discourse.cataclysmdda.org/u/bennettdrill)
#### Post date: [November 27, 2016, 9:25pm UTC](https://discourse.cataclysmdda.org/t/need-help-on-the-c-code/13027/1 "2016-11-27T21:25:19Z")

</div>

So I’m trying to make a monster similar to the ratking, but for insects.

(background info down here, forum wouldn’t let me put in a spoiler, so just scroll down to the line)

So I downloaded code::blocks and started doing some reverse engineering/self teaching like my good old SS13 days.  
Wanting to actually start the mod after halfway confident with my skill, I started looking into the ratking C++ code,  
everything was going smooth, until I tried to add an the insect counterpart to the rat/ratting effect.

* * *

So I see that in monattack.cpp there is a little bit of code governing ratking’s attack.

CODE:  
if (rl\_dist( z-\>pos(), g-\>u.pos() ) \<= 10)  
{  
g-\>u.add\_effect( effect\_rat, 30);  
}

And it talks about adding the effect when a player gets too close (I believe), but where is the actual code for effect\_rat?  
I mean, precisely the code that might say something like this from what I’ve gathered from the mutation code.

CODE:  
effect\_rat()  
{  
g-\>u.mutate\_category( rat );  
}

I’ve looked on github to no avail, for a moderate amount of time.

So:  
Where is the code for effect\_rat kept?  
and  
How can I add my effect?

Any help would be appreciated,  
Thanks!

Btw this is my first ever post on a forum, but I’ve been lurking for a while, so I’m not too intelligible around forum common procedure.  
If I’m doing something horribly wrong, tell me! =p

---

<div class="post-metadata">

### Author: ![Coolthulhu](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/coolthulhu/32/2446_2.png) [@Coolthulhu](https://discourse.cataclysmdda.org/u/Coolthulhu)
#### Post date: [November 27, 2016, 10:31pm UTC](https://discourse.cataclysmdda.org/t/need-help-on-the-c-code/13027/2 "2016-11-27T22:31:12Z")

</div>

player.cpp, search for effect\_rat

---

<div class="post-metadata">

### Author: ![bennettdrill](https://avatars.discourse-cdn.com/v4/letter/b/bbe5ce/32.png) [@bennettdrill](https://discourse.cataclysmdda.org/u/bennettdrill)
#### Post date: [November 27, 2016, 10:39pm UTC](https://discourse.cataclysmdda.org/t/need-help-on-the-c-code/13027/3 "2016-11-27T22:39:17Z")

</div>

Thanks, I found everything I needed there!  
Still not sure why when you search effect\_rat in the repo search on github it only turns up mondeath.cpp & monattack.cpp, but aside from that, now I dont have to waste even more of my time repo searching. =p
