Jump to content
  • 0

Anti-mob System


serjtk

Question


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  4
  • Reputation:   0
  • Joined:  11/12/14
  • Last Seen:  

Hello all,

I've been trying to create a system wich in a 2x1, 3x1, 4x1 (etc..) situation, mobers wil receive a debuff like decrease agi.

This is an example made by chat gpt/deep seek. This one does not show any problems on rAthena, but no working at all.

Quote

-    script    AntiGankSystem    -1,{
OnPCAttackEvent:
    if (strcharinfo(3) == "guild_vs3") { // Aplica apenas nesses mapas
        set .targetID, getcharid(0);
        set .attackers, 0;

        // Obtém lista de jogadores próximos no mesmo mapa PvP
        getmapxy .@map$, .@x, .@y, 0;
        setarray .@players, getmapunits(BL_PC, .@map$);

        for (set .@i, 0; .@i < getarraysize(.@players); set .@i, .@i + 1) {
            if (getcharid(0, .@players[.@i]) != .targetID) {
                if (checkvending(.@players[.@i]) == 0) { 
                    set .attackers, .attackers + 1;
                }
            }
        }

        // Se houver 2 ou mais atacantes no mesmo alvo, aplica penalidade
        if (.attackers >= 2) {
            sc_start SC_DECREASEAGI, 10000, 10;  // Reduz a velocidade de movimento
        }
    }
    end;
}
 


Could you guys please make some comments?

Thank you.

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  1
  • Reputation:   0
  • Joined:  04/15/25
  • Last Seen:  

On 2/28/2025 at 8:07 AM, serjtk said:

Hello all,

I've been trying to create a system wich in a 2x1, 3x1, 4x1 (etc..) situation, mobers wil receive a debuff like decrease agi.

This is an example made by chat gpt/deep seek. This one does not show any problems on rAthena, but no working at all.


Could you guys please make some comments?

Thank you. Geometry Dash

Unfortunately, OnPCAttackEvent alone doesn't give you all the context you need. You might consider combining OnPCAttackEvent with a timer or periodic check to aggregate attack data.

Use src mod for better tracking. If you're open to modifying the source (src), you could implement a true anti-gank system by tracking attackers on the target side, which is more reliable.

Link to comment
Share on other sites

  • 0

  • Group:  Developer
  • Topic Count:  37
  • Topics Per Day:  0.01
  • Content Count:  897
  • Reputation:   248
  • Joined:  01/30/13
  • Last Seen:  

I don't have a script solution, but I tried around a bit in src.

In battle.cpp in the battle_damage function, if you find:

	if (src)
		sd = BL_CAST(BL_PC, src);

and replace it with:

	if (src) {
		sd = BL_CAST(BL_PC, src);
		unit_data* ud = unit_bl2ud(target);
		if (src->type == BL_PC && target->type == BL_PC && ud != nullptr && ud->target_count >= 2)
			status_change_start(target, src, SC_DECREASEAGI, 10000, 10, 0, 0, 0, 10000, SCSTART_NOAVOID);
	}

It's kinda working. However, it only counts autoattackers, not players that use skills on the target. If there are already 2 auto attackers and someone attacks with skill, they also get cursed, though.

Would be easier to do if we had the official system of counting attackers that adds them to a list and then deletes them after 3000ms again.

Edited by Playtester
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...