Jump to content
  • 0

cutin support for announcements


Gidz Cross

Question


  • Group:  Members
  • Topic Count:  123
  • Topics Per Day:  0.03
  • Content Count:  640
  • Reputation:   82
  • Joined:  04/07/14
  • Last Seen:  

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

12 answers to this question

Recommended Posts

  • 1

  • Group:  Content Moderator
  • Topic Count:  55
  • Topics Per Day:  0.02
  • Content Count:  1676
  • Reputation:   702
  • Joined:  12/21/14
  • Last Seen:  

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);
		.@map$ = getarg(0);
		.@filename$ = getarg(1);
		.@position = getarg(2);
		.@s = getmapunits(BL_PC,.@map$,.@SD);
		for(.@i=0;.@i<.@s;.@i++){
			cutin(.@filename$,.@position,convertpcinfo(.@SD[.@i],CPC_CHAR));
		}
		return;
	}
}

 

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

  • 2

  • Group:  Content Moderator
  • Topic Count:  55
  • Topics Per Day:  0.02
  • Content Count:  1676
  • Reputation:   702
  • Joined:  12/21/14
  • Last Seen:  

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

 

  • MVP 1
Link to comment
Share on other sites

  • 0

  • Group:  Content Moderator
  • Topic Count:  55
  • Topics Per Day:  0.02
  • Content Count:  1676
  • Reputation:   702
  • Joined:  12/21/14
  • Last Seen:  

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

OnTimer event does not attach any plyer

checkout addrid command

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  123
  • Topics Per Day:  0.03
  • Content Count:  640
  • Reputation:   82
  • Joined:  04/07/14
  • Last Seen:  

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

  • Group:  Content Moderator
  • Topic Count:  55
  • Topics Per Day:  0.02
  • Content Count:  1676
  • Reputation:   702
  • Joined:  12/21/14
  • Last Seen:  

checkout the command detachrid

Edited by sader1992
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  123
  • Topics Per Day:  0.03
  • Content Count:  640
  • Reputation:   82
  • Joined:  04/07/14
  • Last Seen:  

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

  • Group:  Content Moderator
  • Topic Count:  55
  • Topics Per Day:  0.02
  • Content Count:  1676
  • Reputation:   702
  • Joined:  12/21/14
  • Last Seen:  

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

  • Group:  Members
  • Topic Count:  123
  • Topics Per Day:  0.03
  • Content Count:  640
  • Reputation:   82
  • Joined:  04/07/14
  • Last Seen:  

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);
		.@map$ = getarg(0);
		.@filename$ = getarg(1);
		.@position = getarg(2);
		.@s = getmapunits(BL_NPC,.@map$,.@SD);
		for(.@i=0;.@i<.@s;.@i++){
			cutin(.@filename$,.@position,convertpcinfo(.@SD[.@i],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

  • 0

  • Group:  Members
  • Topic Count:  123
  • Topics Per Day:  0.03
  • Content Count:  640
  • Reputation:   82
  • Joined:  04/07/14
  • Last Seen:  

OMG! Excellent! Thanks @sader1992!

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  123
  • Topics Per Day:  0.03
  • Content Count:  640
  • Reputation:   82
  • Joined:  04/07/14
  • Last Seen:  

Sorry for necrobumping this post @sader1992. Just a quick question. I have 2 to 5 NPC that uses this awesome mod of yours. What i did was for every txt file of the NPC. I always include the function.

	function	cutin2	{
		freeloop(true);
		.@map$ = getarg(0);
		.@filename$ = getarg(1);
		.@position = getarg(2);
		.@s = getmapunits(BL_PC,.@map$,.@SD);
		for(.@i=0;.@i<.@s;.@i++){
			cutin(.@filename$,.@position,convertpcinfo(.@SD[.@i],CPC_CHAR));
		}
		return;
	}
	
	function	cutin3	{
		freeloop(true);
		.@filename$ = getarg(0);
		.@position = getarg(1);
		.@s = getunits(BL_PC,.@SD);
		for(.@i=0;.@i<.@s;.@i++){
			if((.@cid = convertpcinfo(.@SD[.@i],CPC_CHAR)))
				cutin(.@filename$,.@position,.@cid);
		}
		return;
	}

Can i just add this to Global_Functions instead? Sorry im not at home so i cannot test.

Link to comment
Share on other sites

  • 0

  • Group:  Content Moderator
  • Topic Count:  55
  • Topics Per Day:  0.02
  • Content Count:  1676
  • Reputation:   702
  • Joined:  12/21/14
  • Last Seen:  

you can , just put it out of the script (same as the other functions in the Global_Functions file)

change

function	<name>	{

to be

function	script	<name>	{

now you can reuse it without adding it to every script you make

Edited by sader1992
  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  123
  • Topics Per Day:  0.03
  • Content Count:  640
  • Reputation:   82
  • Joined:  04/07/14
  • Last Seen:  

On 3/21/2022 at 3:40 PM, sader1992 said:

you can , just put it out of the script (same as the other functions in the Global_Functions file)

change

function	<name>	{

to be

function	script	<name>	{

now you can reuse it without adding it to every script you make

Awesome. Will conduct some test.

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