Jump to content

Question

Posted

hello guys , currently im using this itemshower script , but i want to make itemshower more than 2 item

here my example script

 

-    script    Sample    -1,{
    OnInit:
        set .amount, 10; // amount of item to shower
        set .item_id, 12903; // next item id to shower
        set .item_id2, 12904; // next item id to shower
        set .item_id3, 12905; // next item id to shower
        set .item_id4, 12906; // next item id to shower
        set .item_id5, 12907; // next item id to shower
        set .item_id6, 12908; // next item id to shower
        set .item_id7, 13576; // next item id to shower
        set .item_id8, 13584; // next item id to shower

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

        getmapxy .@map$, .@x, .@y, BL_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;   // <<< im stuck on this
            set .count, .count + 1;
        }
        set .count, 0;
        end;
}

3 answers to this question

Recommended Posts

  • 1
Posted (edited)
set .item_id, 12903; // next item id to shower

to

set .item_id1, 12903; // next item id to shower

and

.@var = rand(2);
makeitem .@var?.item_id:.item_id2,1,.@map$,.@x_diff,.@y_diff;   // <<< im stuck on this

to

makeitem getd(".item_id" + rand(1,8)),1,.@map$,.@x_diff,.@y_diff;   // <<< im stuck on this

 

 

And this is a better way to do your script

-	script	Sample	-1,{
OnInit:
	set .amount, 10; // amount of item to shower
	setarray .ItemID,12903,12904,12905,12906,12907,12908,13576,13584;
	.Size = getarraysize(.ItemID);

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

OnShower:
	getmapxy(.@map$, .@x, .@y, BL_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));
		makeitem .ItemID[rand(.Size)],1,.@map$,.@x_diff,.@y_diff;   // <<< im stuck on this
		set .count, .count + 1;
	}
	set .count, 0;
end;
}

 

 

btw "bindatcmd "itemshower",strnpcinfo(3)+"::OnShower";" means any player can use the command

Edited by sader1992
  • 0
Posted (edited)
On 5/15/2021 at 11:53 AM, sader1992 said:
set .item_id, 12903; // next item id to shower

to

set .item_id1, 12903; // next item id to shower

and

.@var = rand(2);
makeitem .@var?.item_id:.item_id2,1,.@map$,.@x_diff,.@y_diff;   // <<< im stuck on this

to

makeitem getd(".item_id" + rand(1,8)),1,.@map$,.@x_diff,.@y_diff;   // <<< im stuck on this

 

 

And this is a better way to do your script

-	script	Sample	-1,{
OnInit:
	set .amount, 10; // amount of item to shower
	setarray .ItemID,12903,12904,12905,12906,12907,12908,13576,13584;
	.Size = getarraysize(.ItemID);

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

OnShower:
	getmapxy(.@map$, .@x, .@y, BL_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));
		makeitem .ItemID[rand(.Size)],1,.@map$,.@x_diff,.@y_diff;   // <<< im stuck on this
		set .count, .count + 1;
	}
	set .count, 0;
end;
}

 

 

btw "bindatcmd "itemshower",strnpcinfo(3)+"::OnShower";" means any player can use the command

Hi @sader1992, just wanting to know how'd you enable the canShowEffect option on makeitem script command? I've tried True,Enable,1,dropEffect words trying to enable it but failed.

makeitem <item id>,<amount>,"<map name>",<X>,<Y>{,<canShowEffect>};

EDIT: Fixed, updated my emu

Edited by Almond Snicker

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