Jump to content
  • 0
Gidz Cross

cutin support for announcements

Question

Hello. Im not sure if im in the correct section. To all mods, please move the topic if its not. Anyways...

Im trying to put cutin supports to my automated events that uses announce. How can i properly call cutin and properly close it as well? The idea is this.

OnClock0100:	
	if (agitcheck() || agitcheck2() || agitcheck3()) end;
	cutin "pc.bmp",2; (This works)
	announce "It's time to play some Poring Catcher!",0,0x00FFFD;

OnTimer30000:
	cutin "pc.bmp",2; // To re show the cutin (Will show error/debug to map saying Player not attached)
	announce "Last 30 seconds.",0,0x00FFFD;
	sleep 5000;
	announce "Hurry to Midgard 40 315 or you can type @event if you want to join.",0,0x00FFFD;
	end;

OnTimer60000:
	cutin "",255; // To close the cutin ( Will show error/debug to map saying Player not attached)
	announce "The Poring Catcher has begun!",0,0x00FFFD;
	end;

Thanks guys!

The idea is this:
Catch the Poring Event (Darkside RO) - YouTube
 

Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 1

to save time and replies

here is a step-by-step

rathena/src/map/script.cpp

search for

BUILDIN_FUNC(cutin)
{
	TBL_PC* sd;

	if( !script_rid2sd(sd) )
		return SCRIPT_CMD_SUCCESS;

	clif_cutin(sd,script_getstr(st,2),script_getnum(st,3));
	return SCRIPT_CMD_SUCCESS;
}

replace

if( !script_rid2sd(sd) )

with

if (!script_charid2sd(4, sd))

 

search and replace this

BUILDIN_DEF(cutin,"si"),

with

BUILDIN_DEF(cutin,"si?"),

DON'T FORGET TO RECOMPILE YOUR SERVER!

 

and this is an example on how i would have done it

prontera,0,0,0	script	gdfjfhadh	444,{
	function cutin2;
	announce("test 1",BC_ALL);
	cutin2("prontera","pc.bmp",2);
	sleep 3000;
	announce("test 2",BC_ALL);
	cutin2("prontera","",255);
	sleep 3000;
	announce("test 3",BC_ALL);
	cutin2("prontera","pc.bmp",2);
	sleep 3000;
	announce("test 4",BC_ALL);
	cutin2("prontera","",255);
end;

	function	cutin2	{
		freeloop(true);
		[email protected]$ = getarg(0);
		[email protected]$ = getarg(1);
		[email protected] = getarg(2);
		[email protected] = getmapunits(BL_PC,[email protected]$,[email protected]);
		for([email protected]=0;[email protected]<[email protected];[email protected]++){
			cutin([email protected]$,[email protected],convertpcinfo([email protected][[email protected]],CPC_CHAR));
		}
		return;
	}
}

 

Edited by sader1992
BL_NPC -> BL_PC
  • MVP 1
Link to comment
Share on other sites

  • 2
	//for map
	//cutin2(<"map">,"<filename>",<position>);
	function	cutin2	{
		freeloop(true);
		[email protected]$ = getarg(0);
		[email protected]$ = getarg(1);
		[email protected] = getarg(2);
		[email protected] = getmapunits(BL_PC,[email protected]$,[email protected]);
		for([email protected]=0;[email protected]<[email protected];[email protected]++){
			if(([email protected] = convertpcinfo([email protected][[email protected]],CPC_CHAR)))
				cutin([email protected]$,[email protected],[email protected]);
		}
		return;
	}
	
	//whole server
	//cutin3("<filename>",<position>);
	function	cutin3	{
		freeloop(true);
		[email protected]$ = getarg(0);
		[email protected] = getarg(1);
		[email protected] = getunits(BL_PC,[email protected]);
		for([email protected]=0;[email protected]<[email protected];[email protected]++){
			if(([email protected] = convertpcinfo([email protected][[email protected]],CPC_CHAR)))
				cutin([email protected]$,[email protected],[email protected]);
		}
		return;
	}

 

  • MVP 1
Link to comment
Share on other sites

  • 0
On 7/18/2021 at 1:32 AM, sader1992 said:

cutin needs a player to be attached in the script first,

OnTimer event does not attach any plyer

checkout addrid command

Oh yes. I have tried adding addrid(0); before cutin "xxx",2; 

I thought it works. Until i tried to login my second account. The announcement got doubled. Is the more efficient way to do this? Kindly refer to the youtube link i posted.

 

I think i have solved it. By making another script solely for the cutins to work alone. Tied with my onlocks and onminutes. Unless otherwise there is still efficient way.

Example
 

-	script	Nvz#cutin	-1,{

OnClock0035:
OnClock0115:
OnClock0235:
OnClock0335:
OnClock0435:
OnClock0535:
OnClock0635:
OnClock0735:
OnClock0835:
OnClock0935:
OnClock1035:
OnClock1135:
OnClock1235:
OnClock1335:
OnClock1435:
OnClock1535:
OnClock1635:
OnClock1735:
OnClock1835:
OnClock1935:
OnClock2035:
OnClock2135:
OnClock2235:
OnClock2335:
	addrid(0); cutin "nvz.bmp",2;
	sleep 5000;
	addrid(0); cutin "nvz.bmp",2;
	sleep 5000;
	addrid(0); cutin "nvz.bmp",2;
	sleep 5000;
	addrid(0); cutin "nvz.bmp",2;
	sleep 60000;
	addrid(0); cutin "nvz.bmp",2;
	sleep 30000;
	addrid(0); cutin "nvz.bmp",2;
	sleep 10000;
	addrid(0); cutin "nvz.bmp",2;
	sleep 5000;
	addrid(0); cutin "",255;
	end;
}

 

Link to comment
Share on other sites

  • 0
6 hours ago, sader1992 said:

checkout the command detachrid

Yes ive tested it. And it doesnt work. Is there another way to detachrid using addrid(0);?

Ive seen this thread. This what happens to me. @addrid, @detachrid? - Scripting Support - rAthena

My test were

addrid(0); cutin "xxx",2; detachrid; (this supposed to close the cutin before the annouce script)
announce "hello world!",0,0x00FFFD;

i also tried

addrid(0); cutin "xxx",2; end;
announce "Hello world!",0,0x00FFFD;

But its ending the whole script. Make sense i did use END after the the cutin.

Link to comment
Share on other sites

  • 0

you can edit the cutin command script to accept char id at the end , and get the users list from the map using getmapunits and send the cutin in a for loop instead of attaching the players

you can use this for reference on how to do it https://github.com/rathena/rathena/pull/4143/files

if i am planing to do what you want to do , i would have done this from the start , because it's better to not attach a player when you can if it's a group of players

Link to comment
Share on other sites

  • 0
3 hours ago, sader1992 said:

to save time and replies

here is a step-by-step

rathena/src/map/script.cpp

search for

BUILDIN_FUNC(cutin)
{
	TBL_PC* sd;

	if( !script_rid2sd(sd) )
		return SCRIPT_CMD_SUCCESS;

	clif_cutin(sd,script_getstr(st,2),script_getnum(st,3));
	return SCRIPT_CMD_SUCCESS;
}

replace

if( !script_rid2sd(sd) )

with

if (!script_charid2sd(4, sd))

 

search and replace this

BUILDIN_DEF(cutin,"si"),

with

BUILDIN_DEF(cutin,"si?"),

DON'T FORGET TO RECOMPILE YOUR SERVER!

 

and this is an example on how i would have done it

prontera,0,0,0	script	gdfjfhadh	444,{
	function cutin2;
	announce("test 1",BC_ALL);
	cutin2("prontera","pc.bmp",2);
	sleep 3000;
	announce("test 2",BC_ALL);
	cutin2("prontera","",255);
	sleep 3000;
	announce("test 3",BC_ALL);
	cutin2("prontera","pc.bmp",2);
	sleep 3000;
	announce("test 4",BC_ALL);
	cutin2("prontera","",255);
end;

	function	cutin2	{
		freeloop(true);
		[email protected]$ = getarg(0);
		[email protected]$ = getarg(1);
		[email protected] = getarg(2);
		[email protected] = getmapunits(BL_NPC,[email protected]$,[email protected]);
		for([email protected]=0;[email protected]<[email protected];[email protected]++){
			cutin([email protected]$,[email protected],convertpcinfo([email protected][[email protected]],CPC_CHAR));
		}
		return;
	}
}

 


Oh my! This is HUGE! Thanks @sader1992. However i did try this and this is my result
image.thumb.png.f0410b6fc72beb06233cc02a76fb345a.png


also, is there an option for the whole players of the server? Not just specific map. Thanks!

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

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.