Jump to content
  • 0

Script to Block Specific Skill for All Players


Jinun

Question


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  16
  • Reputation:   3
  • Joined:  02/15/21
  • Last Seen:  

Hello,

I’m trying to figure out how to block a specific skill for all players when my event starts automatically. For example, I want to stop everyone from using the Warp Skill during the event.

I found the pcblockskill function, which lets you prevent a specific character from casting all his skills. It looks like this:

// Prevents the current char from casting skills.
pcblockskill getcharid(3),1;

But it only works when attached to a player and for one player at a time.

What I really need know is a way to block a skill ID (like the Warp Skill) for everyone at once when the event kicks off.

Does anyone know how I can do this in rAthena? I’d really appreciate any tips or examples!

 

 

 

 

 

Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0

  • Group:  Developer
  • Topic Count:  50
  • Topics Per Day:  0.02
  • Content Count:  776
  • Reputation:   239
  • Joined:  02/11/17
  • Last Seen:  

One thing is to hold your event on a specific map to avoid any possible conflicts towards non-participants.
You can set the zone mapflag and edit skill_nocast_db to your needs.

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  63
  • Topics Per Day:  0.02
  • Content Count:  1016
  • Reputation:   191
  • Joined:  11/27/14
  • Last Seen:  

add mapflag to the map

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  16
  • Reputation:   3
  • Joined:  02/15/21
  • Last Seen:  

I already put the mapflag for the event. but Despite implementing map flags to restrict movements, I can still use the /memo command or warp skills outside the tower to access the summit area.

I have created a Automatic Geffen Tower Summit Event (I just name it on my own) where the first player to reach the summit and click with the event NPC will be declared the winner. The same principle of Hide and Seek Event with Twist I guess.

Here is my code:

gef_tower,104,32,5	script	GTS Event	871,{

	OnTouch:
		killmonsterall "gef_tower";

		announce "Congrats to " + strcharinfo(0) + " for winning the Geffen Tower Summit Event! You're the first to reach the GTS Event NPC!", 0;
		//reward for winning
		getitem 7227, 1;
		getitem 30031, 1;
		getitem 30038, 1;

		disablenpc "GTS Event";

		// Disable mapflag
        	removemapflag "gef_tower", mf_noskill;
	end;

	OnGTS_EventStart:
		// add a notify
		waitingroom "Geffen Tower Summit Event!", 0;

		// Enable mapflag
        setmapflag "gef_tower", mf_noskill;

		// warp out all players outside the geffen tower, when the GTS event is started
		mapwarp "gef_tower","geffen",120,104,0;

		sleep 2000;
		// enable the npc becasue we will disable the npc once the player reach the summit
		enablenpc "GTS Event";

		// summon monsters each floor
		monster "gef_tower", 113, 73, "Paladin Randel", 2235, 1;
		monster "gef_tower", 102, 75, "Paladin Randel", 2235, 1;
		monster "gef_tower", 111, 72, "Paladin Randel", 2235, 1;

		monster "gef_tower", 108, 108, "Paladin Randel", 2235, 1;
		monster "gef_tower", 120, 107, "Paladin Randel", 2235, 1;
		monster "gef_tower", 112, 108, "Paladin Randel", 2235, 1;

		monster "gef_tower", 119, 168, "Paladin Randel", 2235, 1;
		monster "gef_tower", 105, 167, "Paladin Randel", 2235, 1;
		monster "gef_tower", 113, 166, "Paladin Randel", 2235, 1;

		monster "gef_tower", 36, 33, "Paladin Randel", 2235, 1;
		monster "gef_tower", 53, 33, "Paladin Randel", 2235, 1;
		monster "gef_tower", 65, 28, "Paladin Randel", 2235, 1;

		monster "gef_tower", 60, 98, "Paladin Randel", 2235, 1;
		monster "gef_tower", 46, 99, "Paladin Randel", 2235, 1;
		monster "gef_tower", 41, 98, "Paladin Randel", 2235, 1;
	end;

	OnGTS_EventAnnouncement:
		// delete a notify room first
		delwaitingroom;

		// Remove mapflag first
        	removemapflag "gef_tower", mf_noskill;

		killmonsterall "gef_tower";

		// Disable the npc before enabling to avoid exploit
		disablenpc "GTS Event";

		announce "GTS Event: We are going to have a Geffen Tower Summit Event!", 0;
		end;
		OnTimer3000:
			announce "GTS Event: For those who want to join, please come to Geffen Tower!", 0;
		end;
		OnTimer5000:
			announce "GTS Event: Whoever to reach first the summit and click the GTS Event NPC will win!.", 0;
		end;
		// 35000
		OnTimer10000:
			announce "GTS Event: Last 30 Seconds until the event will start.", 0;
		end;
		// 65000
		OnTimer15000:
			sleep 1000;
			announce "GTS Event: The Event will start in 5 seconds.", 0;
			sleep 1000;
			announce "GTS Event: The Event will start in 4 seconds.", 0;
			sleep 1000;
			announce "GTS Event: The Event will start in 3 seconds.", 0;
			sleep 1000;
			announce "GTS Event: The Event will start in 2 seconds.", 0;
			sleep 1000;
			announce "GTS Event: The Event will start in 1 second.", 0;
			sleep 1000;
			announce "GTS Event: lets the GTS Event begin!", 0;

			// Call the GTS start event
			goto OnGTS_EventStart;
		end;
	end;

	OnInit:
		// Call it first the OnGTS_EventAnnouncement after I reload the script
		// then, the timer will Start a every 1hr and 30-minute the "OnGTS_EventAnnouncement"
		OnTimer5400000:
		initnpctimer;

		goto OnGTS_EventAnnouncement;
	end;

	// Prevent user from logout and login hack, to immediately go to the summit.
	OnPCLoginEvent:
		// warp players outside the geffen tower, when the GTS event is started
		mapwarp "gef_tower","geffen",120,104,0;
	end;
}

// Mapflags
gef_tower	mapflag	nowarp
gef_tower	mapflag	nowarpto
gef_tower	mapflag	nomemo
gef_tower	mapflag	noreturn

 

Edited by Jinun
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  59
  • Topics Per Day:  0.01
  • Content Count:  1278
  • Reputation:   170
  • Joined:  06/12/12
  • Last Seen:  

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  16
  • Reputation:   3
  • Joined:  02/15/21
  • Last Seen:  

22 hours ago, hendra814 said:

Thanks mate,

but the mapflag only restricts the skill on a specific map. I have already done that. What I want to know is how to restrict the Warp Skill on all maps in the server once the Automatic Event starts and disable it once the event finishes.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  209
  • Reputation:   92
  • Joined:  06/02/12
  • Last Seen:  

Hi. You can create a new restricted zone that blocks Warp Portal and use a loop to activate and deactivate it in every single map during your event.

 

Add this in your \db\import\skill_nocast_db.txt

//----------------------------------------------------------------------------
// Zone 10 - Temporary (event only)
//----------------------------------------------------------------------------
27,16384    //disables skill id 27 AL_WARP (warp portal) on zone 10

Save the file. Use @reloadskilldb or restart the server.

 

Insert this in the NPC when the event starts:

	freeloop(1);
	for(.@i = 1; .@i < 1400; .@i++) {
		.@map$ = mapid2name(.@i);
		if (.@map$ != "") {
			setmapflag .@map$, mf_restricted, 10;
		}
	}
	freeloop(0);

And insert this when the event ends:

	freeloop(1);
	for(.@i = 1; .@i < 1400; .@i++) {
		.@map$ = mapid2name(.@i);
		if (.@map$ != "") {
			removemapflag .@map$, mf_restricted, 10;
		}
	}
	freeloop(0);

Save the file. Use @reloadscript/@reloadnpcfile or restart the server.

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  16
  • Reputation:   3
  • Joined:  02/15/21
  • Last Seen:  

On 10/18/2024 at 11:55 PM, Racaae said:

Hi. You can create a new restricted zone that blocks Warp Portal and use a loop to activate and deactivate it in every single map during your event.

 

Add this in your \db\import\skill_nocast_db.txt

//----------------------------------------------------------------------------
// Zone 10 - Temporary (event only)
//----------------------------------------------------------------------------
27,16384    //disables skill id 27 AL_WARP (warp portal) on zone 10

Save the file. Use @reloadskilldb or restart the server.

 

Insert this in the NPC when the event starts:

	freeloop(1);
	for(.@i = 1; .@i < 1400; .@i++) {
		.@map$ = mapid2name(.@i);
		if (.@map$ != "") {
			setmapflag .@map$, mf_restricted, 10;
		}
	}
	freeloop(0);

And insert this when the event ends:

	freeloop(1);
	for(.@i = 1; .@i < 1400; .@i++) {
		.@map$ = mapid2name(.@i);
		if (.@map$ != "") {
			removemapflag .@map$, mf_restricted, 10;
		}
	}
	freeloop(0);

Save the file. Use @reloadscript/@reloadnpcfile or restart the server.

It works. Thanks mate. 

But I would like to know why 16348 not 8192?

Why zone 10 instead of zone 9?

Edited by Jinun
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  209
  • Reputation:   92
  • Joined:  06/02/12
  • Last Seen:  

4 hours ago, Jinun said:

It works. Thanks mate. 

But I would like to know why 16348 not 8192?

Why zone 10 instead of zone 9?

Avoid conflicts. Base renewal  rAthena uses zone 9 for "Wave Mode".

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...