Jump to content
  • 0

item shower


behemothcze

Question


  • Group:  Members
  • Topic Count:  40
  • Topics Per Day:  0.02
  • Content Count:  102
  • Reputation:   2
  • Joined:  02/24/17
  • Last Seen:  

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

Link to comment
Share on other sites

16 answers to this question

Recommended Posts

  • 1

  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  615
  • Reputation:   201
  • Joined:  11/09/11
  • Last Seen:  


-	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
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  615
  • Reputation:   201
  • Joined:  11/09/11
  • Last Seen:  

-	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
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  40
  • Topics Per Day:  0.02
  • Content Count:  102
  • Reputation:   2
  • Joined:  02/24/17
  • Last Seen:  

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 ?

Link to comment
Share on other sites

  • 0

  • Group:  Developer
  • Topic Count:  48
  • Topics Per Day:  0.01
  • Content Count:  1443
  • Reputation:   337
  • Joined:  10/17/12
  • Last Seen:  

18 hours ago, behemothcze said:

where can i edit the character position ?

The character is the one who types it.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  40
  • Topics Per Day:  0.02
  • Content Count:  102
  • Reputation:   2
  • Joined:  02/24/17
  • Last Seen:  

6 minutes ago, Stolao said:

The character is the one who types it.

but it doesnt work.

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:  

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

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  40
  • Topics Per Day:  0.02
  • Content Count:  102
  • Reputation:   2
  • Joined:  02/24/17
  • Last Seen:  

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 ?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  615
  • Reputation:   201
  • Joined:  11/09/11
  • Last Seen:  

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

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  40
  • Topics Per Day:  0.02
  • Content Count:  102
  • Reputation:   2
  • Joined:  02/24/17
  • Last Seen:  

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

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  615
  • Reputation:   201
  • Joined:  11/09/11
  • Last Seen:  

Sure I can rewrite it tonight and put some comments around the code

  • Like 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  615
  • Reputation:   201
  • Joined:  11/09/11
  • Last Seen:  

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

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  40
  • Topics Per Day:  0.02
  • Content Count:  102
  • Reputation:   2
  • Joined:  02/24/17
  • Last Seen:  

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 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  625
  • Reputation:   188
  • Joined:  11/19/11
  • Last Seen:  

Just add in bindatcmd after "OnShower" The levels, look up doc/script_commands.txt about it.

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  615
  • Reputation:   201
  • Joined:  11/09/11
  • Last Seen:  

after OnShower: 

OnShower:
if (!getgmlevel() < 99) { end; }

 

Edited by Z3R0
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:  

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
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  40
  • Topics Per Day:  0.02
  • Content Count:  102
  • Reputation:   2
  • Joined:  02/24/17
  • Last Seen:  

On 5/1/2018 at 12:22 AM, AnnieRuru said:

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

doc
 

 

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