Jump to content
  • 1

Run and Hide Script


fzxree1010

Question


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  23
  • Reputation:   2
  • Joined:  11/17/16
  • Last Seen:  

Hi All,

I would like to request a basic script of my idea below.

Imagine we are using a small map for this event. When the npc timer start, a bunch of NPC that will disguise into Hole effect or Crystal or Mob will spawn in a random location in the map. Player has to run and stand next to a NPC to hide. The NPC and the player will be hidden when they are next to it. When the timer runs out players who are not able to find a NPC will get killed by a lightning. Then the script restart

I have a very basic knowledge of scripting but would appreciate if anyone can guide me to kick start with the script. Thank you in advance.

  • Love 1
Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

event script .... oh yeah its been a while ...

rathena doesn't have OnUntouch: label ... but I think its still do-able with setpcblock after trigger OnTouch label

https://github.com/AnnieRuru/Release/blob/master/scripts/Games %26 Events/Run and Hide/runandhide_0.2r.txt

.... as usual there are always some people trying to ruin my fun =/


also that event script that @Poring King link to ... doesn't really fit the description in this topic,
this one wants a several npc for players to hide, and I think only 1 npc for each player ? because he said

4 hours ago, fzxree1010 said:

The NPC and the player will be hidden when they are next to it

mean once a player stand next to an npc, the npc will also goes into hiding
that event script only has 1 set of npc doing specialeffect and ALL players are force to stand in that location

Edited by AnnieRuru
  • MVP 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  61
  • Topics Per Day:  0.02
  • Content Count:  911
  • Reputation:   166
  • Joined:  11/27/14
  • Last Seen:  

Quote

 

I think that is what you are looking 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  23
  • Reputation:   2
  • Joined:  11/17/16
  • Last Seen:  

2 hours ago, Poring King said:

I think that is what you are looking 

Thank you @Poring King Yup i have found this script, this gives me idea on the movenpc, but i was stuck on instead of warp the player outside the area i want it kill the player outside the area.

48 minutes ago, AnnieRuru said:

event script .... oh yeah its been a while ...

rathena doesn't have OnUntouch: label ... but I think its still do-able with setpcblock after trigger OnTouch label

https://github.com/AnnieRuru/Release/blob/master/scripts/Games %26 Events/Run and Hide/runandhide_0.2r.txt

.... as usual there are always some people trying to ruin my fun =/


also that event script that @Poring King link to ... doesn't really fit the description in this topic,
this one wants a several npc for players to hide, and I think only 1 npc for each player ? because he said

mean once a player stand next to an npc, the npc will also goes into hiding
that event script only has 1 set of npc doing specialeffect and ALL players are force to stand in that location

OMG! Thank you so much! Will study the method and give it a test on this one. Thank you @AnnieRuru

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  23
  • Reputation:   2
  • Joined:  11/17/16
  • Last Seen:  

Hi @AnnieRuru

The script that you provided works like a charm! Thank you for your work.

On the side note, i tried adding and changing few things from the initial idea, and i encounter few issue in the making. Below are the details and the script

Addons and Challenges

  • Added Rounds to make the event a little longer.
  • Change from 1_SHADOW_NPC to 139(A not clickable npc, with position/info send to client) , i tried to replace the NPC sprite to specialeffect instead because i find it hard to walk to the NPC while clicking on the npc position due to the clickable NPC. But by doing this, i seem cant find the reason why not all NPC showing the effect. It sometime randomly shows 2 or 4 special effect while i have 6 duplicate NPC.
  • Tried to make everyone start the event from the middle of the map every round. Added mapwarp right before the round starts, but by doing this, the npc did not kill the person who fail to find the portal to hide.
  • tried to make PCBLOCK_MOVE after the warp in the middle and few seconds after the portal appears players can move freely to catch the portal. This i also fail miserably.

Here are the latest changes i made, hope you can give few advise on this since im still learning on the scripting area.

//===== rAthena Script =======================================
//= Run and Hide
//===== By: ==================================================
//= AnnieRuru
//===== Current Version: =====================================
//= 0.3
//===== Compatible With: ===================================== 
//= rAthena 2020-10-12
//===== Description: =========================================
//= Player has to run and stand next to a NPC to hide to survive
//===== Topic ================================================
//= https://rathena.org/board/topic/126202-run-and-hide-script/
//===== Additional Comments: =================================  
//=
//============================================================

prontera,154,178,5	script	Run And Hide	1_F_MARIA,{
	if (!.start) {
		mes "no event atm";
		close;
	}
	if (.start == 2) {
		mes "event is running";
		close;
	}
	if (.register_count >= .register_limit) {
		mes "this event has reach the maximum player participations";
		close;
	}
	if (!checkweight(.reward_itemid, .reward_itemamount)) {
		mes "You are currently overweight, store some items to continue";
		close;
	}
	percentheal 100,100;
	warp "guild_vs5", 0,0;
	.register_aid[.register_count++] = getcharid(3);
	@runandhide_flag = false;
	end;
OnGMCommand:
	if (getgmlevel() < 60) end;
//OnClock0000: // put all your start timer here
OnMinute00:
	if (.start == 2)
		callsub L_resetmap;
	else if (.start == 1)
		end;
	disablenpc "Exit#runandhide";
	announce "Run And Hide event registration start", bc_all;
	.start = 1;
	sleep 10000; // registration timer here
	announce "Run And Hide event registration close", bc_all;
	.start = 2;
	if (.register_count < .register_min) {
		announce "Not enough participants for Run And Hide event", bc_all;
		mapwarp "guild_vs5", .map$, .x, .y;
		callsub L_resetmap;
		end;
	}
	sleep 3000;
	for(.round = 1;.round <= .setround;.round++){
	//mapwarp "guild_vs5","guild_vs5",49,46; // Warp To Middle Not Working	
	mapannounce "guild_vs5", "Round "+.round+".!!! Find the portal to Hide !!!!!", bc_all;
	for (.@i = 1; .@i <= 6; ++.@i) {
		setnpcdisplay "runandhide#"+ .@i, 139;
		set getvariableofnpc(.runandhide_flag[.@i], "runandhide#main"), false;
		getfreecell "guild_vs5", .@x, .@y;
		movenpc "runandhide#"+ .@i, .@x, .@y;
	}
	callsub PlayEffect;
	if(.round == 1)
	sleep 15000;
	if(.round == 2)
	sleep 13000;
	if(.round == 3)
	sleep 12000;
	if(.round > 3)
	sleep 10000; // time for players to hide
	for (.@i = 0; .@i < .register_count; ++.@i) {
		if (isloggedin(.register_aid[.@i])) {
			attachrid .register_aid[.@i];
			if (@runandhide_flag == false) {
				unitkill .register_aid[.@i];
				specialeffect2 EF_THUNDERSTORM;
				deletearray .register_aid[.@i], 1;
				--.@i;
				--.register_count;
			}
			else {
				setpcblock PCBLOCK_MOVE|PCBLOCK_SKILL, false;
				setoption 0x2, false;
				@runandhide_flag = false;
			}
		}
		else {
			deletearray .register_aid[.@i], 1;
			--.@i;
			--.register_count;
		}
	}
	}
	detachrid;
	enablenpc "Exit#runandhide";
	for (.@i = 1; .@i <= 6; ++.@i) {
		setnpcdisplay "runandhide#"+ .@i, HIDDEN_WARP_NPC;
		set getvariableofnpc(.runandhide_flag[.@i], "runandhide#main"), false;
		movenpc "runandhide#"+ .@i, 0,0;
	}
	announce .register_count +" players survive the onslaught, visit the exit npc in the center to claim the reward.", bc_all;
	end;

PlayEffect:
	for(set .@ef,1; .@ef<=6; set .@ef,.@ef+1)
		initnpctimer "runandhide#"+.@ef;
	return;
	
OnPCLogoutEvent:
	if (.start != 2 || strcharinfo(3) != "guild_vs5") end;
	while (.register_aid[.@i] != getcharid(3) && .@i < .register_count) ++.@i;
	if (.@i == .register_count) end;
	deletearray .register_aid[.@i], 1;
	--.register_count;
	warp "SavePoint", 0,0;
	end;
L_resetmap:
	mapwarp "guild_vs5", .map$, .x, .y;
	.start = 0;
	deletearray .register_aid;
	.register_count = 0;
	disablenpc "Exit#runandhide";
	return;
OnInit:
	getmapxy .map$, .x, .y, BL_NPC;
	.register_min = 1; // minimum amount of players to start this event, or else it auto-abort
	.register_limit = 100; // maximum amount of players able to participate in this event
	.reward_itemid = 501;
	.reward_itemamount = 1;
	.setround = 5;
	bindatcmd "runandhide", strnpcinfo(0)+"::OnGMCommand", 60,100;
	disablenpc "Exit#runandhide";
	end;
}
guild_vs5	mapflag	nosave	SavePoint
guild_vs5	mapflag	nowarp
guild_vs5	mapflag	nowarpto
guild_vs5	mapflag	noteleport
guild_vs5	mapflag	nomemo
guild_vs5	mapflag	nopenalty
guild_vs5	mapflag	nobranch
guild_vs5	mapflag	noicewall

guild_vs5,49,56,5	script	Exit#runandhide	112,{
	mes "[Exit]";
	mes "See ya.";
	close2;
	warp "Save",0,0;
	getitem 501, 1;
	end;
}

-	script	runandhide#main	FAKE_NPC,{
	end;
OnTimer1:
	specialeffect 317;
	end;

OnTouch:
	if (getvariableofnpc(.start, "Run And Hide") != 2) end;
	.@npcid = atoi(strnpcinfo(2));
	if (.runandhide_flag[.@npcid]) end;
	setoption 0x2, true;
	setpcblock PCBLOCK_MOVE|PCBLOCK_SKILL, true;
	setnpcdisplay strnpcinfo(0), HIDDEN_WARP_NPC;
	specialeffect 218;
	@runandhide_flag = true;
	.runandhide_flag[.@npcid] = true;
	end;
}

guild_vs5,0,0,0	duplicate(runandhide#main)	runandhide#1	139,1,1
guild_vs5,0,0,0	duplicate(runandhide#main)	runandhide#2	139,1,1
guild_vs5,0,0,0	duplicate(runandhide#main)	runandhide#3	139,1,1
guild_vs5,0,0,0	duplicate(runandhide#main)	runandhide#4	139,1,1
guild_vs5,0,0,0	duplicate(runandhide#main)	runandhide#5	139,1,1
guild_vs5,0,0,0	duplicate(runandhide#main)	runandhide#6	139,1,1

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

1 hour ago, fzxree1010 said:

because i find it hard to walk to the NPC while clicking on the npc position due to the clickable NPC

use *unitwalk script command
or just use WARPNPC (45)

1 hour ago, fzxree1010 said:

i seem cant find the reason why not all NPC showing the effect.

I see the initial *initnpctimer script command, where is the loop for it ?

specialeffect 317;

unfortunately this line won't work
that's why `@auraset` exist to persist the specialeffect of certain effects, because specialeffect only cast once and won't be seen by players outside `area_size` battle_config

1 hour ago, fzxree1010 said:

Tried to make everyone start the event from the middle of the map every round

warp "guild_vs5", 0,0;

why not just change this line ...?

1 hour ago, fzxree1010 said:

tried to make PCBLOCK_MOVE after the warp in the middle and few seconds after the portal appears players can move freely to catch the portal

I guess the PCBLOCK_MOVE trigger before every round start

 

https://github.com/AnnieRuru/Release/blob/master/scripts/Games %26 Events/Run and Hide/runandhide_0.3r.txt

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  23
  • Reputation:   2
  • Joined:  11/17/16
  • Last Seen:  

Hi @AnnieRuru

thank you for your feedback and suggestion. Really really appreciate your assistance on the amendment too.I Really learn a lot on the progress of this script. Thank you. Will give it a run tomorrow.

 

Cheers from malaysia.
 

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

58 minutes ago, fzxree1010 said:

Cheers from malaysia.

https://herc.ws/board/topic/11717-ragnarok-online-access-card/

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  23
  • Reputation:   2
  • Joined:  11/17/16
  • Last Seen:  

7 hours ago, AnnieRuru said:

Heheyyyy Awesome!! Fellow malaysiannn.. #kitajagakita

  • Love 1
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...