Jump to content

Question

Posted
-	script	Sample	-1,{
	OnInit:
		set .amount, 40; // amount of item to shower
		set .item_id, 7227; // item id to shower
		set .item_id2, 1234; // next item id to shower
		set .map$, "prontera"; // map to shower
		bindatcmd "itemshower",strnpcinfo(3)+"::OnShower";
		end;
	OnShower:
		while ( .count < .amount ) {
			do {
				.@x = rand(1,500);
				.@y = rand(1,500);
			} while (!checkcell(.map$,.@x,.@y,cell_chkpass));
			.@var = rand(2);
			makeitem .@var?.item_id:.item_id2,1,.map$,.@x,.@y;
			set .count, .count + 1;
		}
		set .count, 0;
		end;
}

 

 

can anyone change this to area only where i use @itemshower instead of random area thanks.

16 answers to this question

Recommended Posts

  • 1
Posted

-	script	Sample	-1,{
	OnInit:
		set .amount, 40; // amount of item to shower
		set .item_id, 7227; // item id to shower
		set .item_id2, 1234; // next item id to shower
		bindatcmd "itemshower",strnpcinfo(3)+"::OnShower";
		end;
	OnShower:

		getmapxy .@map$, .@x, .@y, UNITTYPE_PC;

		while ( .count < .amount ) {
			do {
				.@x_diff = .@x + rand(1,5);
				.@y_diff = .@y + rand(1,5);
			} while (!checkcell(.@map$,.@x_diff,.@y_diff,cell_chkpass));
			.@var = rand(2);
			makeitem .@var?.item_id:.item_id2,1,.@map$,.@x_diff,.@y_diff;
			set .count, .count + 1;
		}
		set .count, 0;
		end;

This will make the command @itemshow  ... start with the characters position, then it will consider a differential between 1 and 5 from their X,Y coordinates to "shower" around them...

 

  • Upvote 1
  • 0
Posted (edited)
-	script	Sample	-1,{
	OnInit:
		set .amount, 40; // amount of item to shower
		set .item_id, 7227; // item id to shower
		set .item_id2, 1234; // next item id to shower
		bindatcmd "itemshower",strnpcinfo(3)+"::OnShower";
		end;
	OnShower:

		getmapxy .@map$, .@x, .@y, UNITTYPE_PC;

		while ( .count < .amount ) {
			do {
				.@x_diff = .@x + rand(1,5);
				.@y_diff = .@y + rand(1,5);
			} while (!checkcell(.@map$,.@x_diff,.@y_diff,cell_chkpass));
			.@var = rand(2);
			makeitem .@var?.item_id:.item_id2,1,.map$,.@x,.@y;
			set .count, .count + 1;
		}
		set .count, 0;
		end;

This will make the command @itemshow  ... start with the characters position, then it will consider a differential between 1 and 5 from their X,Y coordinates to "shower" around them...

Edited by Z3R0
  • 0
Posted
19 hours ago, Z3R0 said:

-	script	Sample	-1,{
	OnInit:
		set .amount, 40; // amount of item to shower
		set .item_id, 7227; // item id to shower
		set .item_id2, 1234; // next item id to shower
		bindatcmd "itemshower",strnpcinfo(3)+"::OnShower";
		end;
	OnShower:

		getmapxy .@map$, .@x, .@y, UNITTYPE_PC;

		while ( .count < .amount ) {
			do {
				.@x_diff = .@x + rand(1,5);
				.@y_diff = .@y + rand(1,5);
			} while (!checkcell(.@map$,.@x_diff,.@y_diff,cell_chkpass));
			.@var = rand(2);
			makeitem .@var?.item_id:.item_id2,1,.map$,.@x,.@y;
			set .count, .count + 1;
		}
		set .count, 0;
		end;

This will make the command @itemshow  ... start with the characters position, then it will consider a differential between 1 and 5 from their X,Y coordinates to "shower" around them...

where can i edit the character position ?

  • 0
Posted

why doesn't work ? /hmm

screenRuru_Server007.thumb.jpg.f42ce110ace565215fe0a02fe067cfe5.jpg

maybe change the (1,5) into (-5,5) will make it spawn around the player instead of top right position

and sometimes can infinite loop ... adding freeloop works

  • 0
Posted
2 hours ago, AnnieRuru said:

why doesn't work ? /hmm

screenRuru_Server007.thumb.jpg.f42ce110ace565215fe0a02fe067cfe5.jpg

maybe change the (1,5) into (-5,5) will make it spawn around the player instead of top right position

and sometimes can infinite loop ... adding freeloop works

image.png.98e0df5b1932a59196fba4b6c070233f.png
igot this debug error everytime i use @itemshower ?

  • 0
Posted

Use the 2nd one I wrote, not the first... the first had a glitch in it... check all map variables.. make sure they match :D

  • 0
Posted
3 hours ago, Z3R0 said:

Use the 2nd one I wrote, not the first... the first had a glitch in it... check all map variables.. make sure they match ?

+1 thanks mate its working ? hope you can teach me how to put some more items on it, just want to make it 4 and if its posible to control it drop
i mean for item 1 =20pcs item2=20pcs item3=30pcs item4=30pcs.

 

sorry for my bad english

  • 0
Posted
On 4/27/2018 at 10:23 PM, Z3R0 said:

fyi, I think I missed a closing } at the bottom (but if I edit it, it screws up the code...)

hello sir, can you edit it command where only gm can used it. even a normal player can use that shower 

  • 0
Posted (edited)

bindatcmd "itemshower",strnpcinfo(3)+"::OnShower", 99, 100;

doc
 

Quote

*bindatcmd "<command>","<NPC object name>::<event label>"{,<atcommand level>,<charcommand level>};

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.
Note: The default level for atcommand is 0 while the default level for charcommand is 100.

 

Edited by AnnieRuru

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...