Jump to content
  • 0
Sign in to follow this  
minx123

help me fix counting script

Question

how to calculate coordinate when change map?

how to make it announce. right now this script not make announce?

how to make it on when using commands?

 

invek,118,200,5	script	Monster Counting Game	757,{	function xy_wall;	end;		OnInit:		.max_round = 3;		.max_duration = 3;		.wall_mob_id = 1085;		setarray .xy_area,			151,169,			161,179;		setarray .monster,			PORING,			DROPS,			MARIN,			POPORING;					.monster_size = getarraysize( .monster );		.npc_name$ = strnpcinfo(0);		getmapxy( .map$,.npc_x,.npc_y,1 );		setmapflag .map$,mf_monster_noteleport;		end;			OnMinute00:	OnStartEvent:		if ( !.status ) {			areawarp .map$,.xy_area[0],.xy_area[1],.xy_area[2],.xy_area[3],.map$,.npc_x,.npc_y;			killmonster .map$,.npc_name$+"::OnDied";			killmonster .map$,.npc_name$+"::OnWallDied";			setcell .map$,.xy_area[0],.xy_area[1],.xy_area[2],.xy_area[3],cell_basilica,1;			setcell .map$,.xy_area[0],.xy_area[1],.xy_area[2],.xy_area[3],cell_walkable,1;			.status = 1;						for( .@i = .xy_area[0]; .@i <= .xy_area[2]; .@i++ ){				xy_wall( .@i,.xy_area[1] );				xy_wall( .@i,.xy_area[3] );			}			for( .@i = .xy_area[1]; .@i <= .xy_area[3]; .@i++ ){				xy_wall( .xy_area[0],.@i,0 );				xy_wall( .xy_area[2],.@i );			}						do{				.@round++;				npctalk "Round # "+.@round;				sleep 5000;								.status = 2;				.@mob = .monster[ rand( .monster_size ) ];				.@amount = rand( 20,50 );				// add-on size influence ?				areamonster .map$,.xy_area[0],.xy_area[1],.xy_area[2],.xy_area[3],"",.@mob,.@amount,.npc_name$+"::OnDied";							deletepset 1;				defpattern 1,"([^:]+):.*"+.@amount+".$", "OnRight";				activatepset 1;				waitingroom "How many's there?",0;				npctalk "Tell me the correct amount of monster in there.";				// debugmes " > "+.@amount+" "+getmonsterinfo( .@mob,MOB_NAME );								sleep ( .max_duration * 60000 );								killmonster .map$,.npc_name$+"::OnDied";				delwaitingroom;				deletepset 1;				.status = 1;				sleep 5000;							}while( .@round < .max_round );						npctalk "That's the Last, thank you for participating.";			emotion e_thx;						killmonster .map$,.npc_name$+"::OnDied";			killmonster .map$,.npc_name$+"::OnWallDied";			setcell .map$,.xy_area[0],.xy_area[1],.xy_area[2],.xy_area[3],cell_basilica,0;			setcell .map$,.xy_area[0],.xy_area[1],.xy_area[2],.xy_area[3],cell_walkable,1;			.status = 0;		}		end;			OnDied: 	OnWallDied: 		end;	OnRight:		getmapxy( .@map$,.@x,.@y,0 );		if ( .status == 0 ) {			dispbottom "[Counting Game] Event isnt running.";		}		else if ( .status == 1 ) {			dispbottom "[Counting Game] Please wait for the round to start.";		}		else if ( distance( .npc_x,.npc_y,.@x,.@y ) > 14 ) {			dispbottom "[Counting Game] You're too far away.";		}		else {			npctalk "Bravo!! "+strcharinfo(0)+" is correct!!";						// rewards			getitem 7227,2;						specialeffect2 EF_POTION_CON;			awake .npc_name$;		}		end;			function	xy_wall	{		.@x = getarg(0); 		.@y = getarg(1);		monster .map$,.@x,.@y,"",.wall_mob_id,1,.npc_name$+"::OnWallDied";		setcell .map$,.@x,.@y,.@x,.@y,cell_walkable,0;		// setcell .map$,.@x,.@y,.@x,.@y,cell_basilica,1;		return;	}}
Edited by minx123

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

@@minx123

1. Calculate coordinates to where?

2. *announce "<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}};

 

 This command will broadcast a message to all or most players, similar to 
@kami/@kamib GM commands.
 
announce "This will be shown to everyone at all in yellow.",0;
 
The region the broadcast is heard in (target), source of the broadcast and 
the color the message will come up as is determined by the flags.
 
The flag values are coded as constants in db/const.txt to make them easier 
to use.
 
Target flags:
- bc_all: Broadcast message is sent server-wide (default).
- bc_map: Message is sent to everyone in the same map as the source of 
the broadcast (see below).
- bc_area: Message is sent to players in the vicinity of the source.
- bc_self: Message is sent only to current player.
You cannot use more than one target flag.
 
Source flags:
- bc_pc: Broadcast source is the attached player (default).
- bc_npc: Broadcast source is the NPC, not the player attached to the 
script (useful when a player is not attached or the message 
should be sent to those nearby the NPC).
You cannot use more than one source flag.
 
Special flags:
- bc_yellow:Broadcast will be displayed in yellow color (default).
- bc_blue: Broadcast will be displayed in blue color.
- bc_woe: Indicates that this broadcast is 'WoE Information' that can 
be disabled client-side.
Due to the way client handles broadcasts, it is impossible to set both 
bc_blue and bc_woe.
 
The optional parameters allow usage of broadcasts in custom colors, 
font-weights, sizes etc. If any of the optional parameters is used, 
special flag is ignored. Optional parameters may not work well (or at all) 
depending on a game client used.
 
The color parameter is a single number which can be in hexadecimal 
notation.
 
For example:
announce "This will be shown to everyone at all in green.",bc_all,0x00FF00;
Will display a global announce in green. The color format is in RGB 
(0xRRGGBB).
 
In official scripts only two font-weights (types) are used:
 - normal (FW_NORMAL = 400, default),
 - bold   (FW_BOLD = 700).
 
Default font size is 12.
 
Using this for private messages to players is probably not that good an 
idea, but it can be used instead in NPCs to "preview" an announce.
 
// This will be a private message to the player using the NPC that 
// made the announcement
announce "This is my message just for you",bc_blue|bc_self;
 
// This will be shown on everyones screen that is in sight of the NPC.
announce "This is my message just for you people here",bc_npc|bc_area;

 

3. *bindatcmd "command","<NPC object name>::<event label>"{,<group level>,<group level char>,<log>};


 

This command will bind a NPC event label to an atcommand. Upon execution 
of the atcommand, the user will invoke the NPC event label. Each atcommand 
is only allowed one binding. If you rebind, it will override the original 
binding. If group level is provided, only users of that group level or 
above will be able to access the command, if not provided, everyone will 
be able to access the command.
"group level char" is the minimum group level required for the label to be 
used on others like a char command would, e.g. "#command "target" params", 
when not provided, "group level char" defaults to 99.
"log" whether to log the usages of this command with the atcommand log 
(1 = log, 0 = no log), default is to not log.
 
The following variables are set upon execution:
.@atcmd_command$      =  The name of the @command used.
.@atcmd_parameters$[] =  Array containing the given parameters,
                        starting from an index of 0.
.@atcmd_numparameters =  The number of parameters defined.
 
Parameters are split on spaces. Multiple spaces aren't grouped together, and
will create multiple (empty) arguments.
Any leading spaces before the first parameter will be omitted.
 
Usage example:
 
When a user types the command "@test", an angel effect will be shown.
 
- script atcmd_example -1,{
OnInit:
bindatcmd "test",strnpcinfo(3)+"::OnAtcommand";
end;
OnAtcommand:
specialeffect2 338;
end;
}
 
Parameter splitting example:
@mycommand
.@atcmd_numparameters -> 0
.@atcmd_parameters$   -> { }
@mycommand<space><space>
.@atcmd_numparameters -> 0
.@atcmd_parameters$   -> { }
@mycommand<space>foo
.@atcmd_numparameters -> 1
.@atcmd_parameters$   -> { "foo" }
@mycommand<space><space>foo
.@atcmd_numparameters -> 1
.@atcmd_parameters$   -> { "foo" }
@mycommand<space>foo<space>bar
.@atcmd_numparameters -> 2
.@atcmd_parameters$   -> { "foo", "bar" }
@mycommand<space>foo<space><space>bar
.@atcmd_numparameters -> 3
.@atcmd_parameters$   -> { "foo", "", "bar" }
@mycommand<space>foo<space>
.@atcmd_numparameters -> 2
.@atcmd_parameters$   -> { "foo", "" }
@mycommand<space>foo<space><space>
.@atcmd_numparameters -> 3
.@atcmd_parameters$   -> { "foo", "", "" }
 
The called event label needs to take care of joining arguments together, in
case it expects spaces. For example:
 
- script atcmd_example -1,{
OnInit:
bindatcmd "test",strnpcinfo(3)+"::OnAtcommand";
end;
OnAtcommand:
// This command expects a character name (that may contain spaces) as
// the only parameter.
.@name$ = "";
for (.@i = 0; .@i < .@atcmd_numparameters; ++.@i) {
.@name$ += (.@i > 0 ? " " : "") + .@atcmd_parameters$[.@i];
}
dispbottom("The specified name is: '" + .@name$ + "'");
end;
}

 

I recommend you to check this: https://github.com/HerculesWS/Hercules/blob/master/doc/script_commands.txt here you can find all commands that you can use.

Edited by Winterfox

Share this post


Link to post
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.   Restore formatting

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

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