Jump to content
  • 0

Can someone modify this script?


Dolphin86

Question


  • Group:  Members
  • Topic Count:  258
  • Topics Per Day:  0.06
  • Content Count:  710
  • Reputation:   16
  • Joined:  01/07/12
  • Last Seen:  

just to be clear i did not wrote these script @Emistry did back few years, i need some improvement for this script below are the details.

1. Player can mine from the same spot/npc for maximum of 100 times

2. Each time have 5sec waiting time gap and player will get random item drop from this spot for each 5sec wait u can just follow as the script there for random drop chance

3. Player can cancel mining anytime they please, and the mined count will stay the same ( example if player have mine for 20 times, it will be 20/100 )

4. Next player who mined at the used mine will continue the count ( 20/100 ) once it reach the max 100/100 the npc/spot will be removed, and new spot will be spawn after 3mins on random location ( walkable area )

5. If possible add mining progress bar animation or just plain text

6. Its a PvP map, so when the miner dead by pvp the count stay as describe in part 4.

Thank you soo much, for you effort and time
script:

Spoiler

 

-	script	sample_main	-1,{
	OnPCDieEvent:
		if (getmapflag(strnpcinfo(3), mf_pvp)) {
			getmapxy(@map$, @x, @y, BL_PC);
			callsub(L_DropItem, 969);
			callsub(L_DropItem, 724);
			callsub(L_DropItem, 7049);
		}
		end;
		
	L_DropItem:
		.@item_id = getarg(0, 0);
		if (.@item_id) {
			.@countitem = countitem(.@item_id);
			delitem .@item_id, .@countitem;
			makeitem .@item_id, .@countitem, @map$, @x, @y;
		}
		return;
}
ein_dun03,170,227,4	script	Normal Crystal	1288,{
	if (countitem(6010)) {
		.@rate = rand(100);
		if (.@rate < 1) {
			.@item_id = 969;
		}
		else if (.@rate < 25) {
			.@item_id = 724;
		}
		else if (.@rate < 90) {
			.@item_id = 7049;
		}
		else {
			// nothing
		}
		if (.@item_id) {
			getitem .@item_id, 1;
			movenpc strnpcinfo(3), rand(300), rand(300), rand(8); 
		}
	}
	end;
}
ein_dun03,207,267,4	duplicate(Normal Crystal)	Normal Crystal#1	1288
//prontera,1,1,4	duplicate(Normal Crystal)	Normal Crystal#2	1288
//prontera,1,1,4	duplicate(Normal Crystal)	Normal Crystal#3	1288

 

 

Edited by dolphincute
Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.01
  • Content Count:  147
  • Reputation:   36
  • Joined:  05/15/20
  • Last Seen:  

On 2/9/2022 at 3:58 PM, dolphincute said:

just to be clear i did not wrote these script @Emistry did back few years, i need some improvement for this script below are the details.

1. Player can mine from the same spot/npc for maximum of 100 times

2. Each time have 5sec waiting time gap and player will get random item drop from this spot for each 5sec wait u can just follow as the script there for random drop chance

3. Player can cancel mining anytime they please, and the mined count will stay the same ( example if player have mine for 20 times, it will be 20/100 )

4. Next player who mined at the used mine will continue the count ( 20/100 ) once it reach the max 100/100 the npc/spot will be removed, and new spot will be spawn after 3mins on random location ( walkable area )

5. If possible add mining progress bar animation or just plain text

6. Its a PvP map, so when the miner dead by pvp the count stay as describe in part 4.

Thank you soo much, for you effort and time
script:

  Reveal hidden contents

 

-	script	sample_main	-1,{
	OnPCDieEvent:
		if (getmapflag(strnpcinfo(3), mf_pvp)) {
			getmapxy(@map$, @x, @y, BL_PC);
			callsub(L_DropItem, 969);
			callsub(L_DropItem, 724);
			callsub(L_DropItem, 7049);
		}
		end;
		
	L_DropItem:
		.@item_id = getarg(0, 0);
		if (.@item_id) {
			.@countitem = countitem(.@item_id);
			delitem .@item_id, .@countitem;
			makeitem .@item_id, .@countitem, @map$, @x, @y;
		}
		return;
}
ein_dun03,170,227,4	script	Normal Crystal	1288,{
	if (countitem(6010)) {
		.@rate = rand(100);
		if (.@rate < 1) {
			.@item_id = 969;
		}
		else if (.@rate < 25) {
			.@item_id = 724;
		}
		else if (.@rate < 90) {
			.@item_id = 7049;
		}
		else {
			// nothing
		}
		if (.@item_id) {
			getitem .@item_id, 1;
			movenpc strnpcinfo(3), rand(300), rand(300), rand(8); 
		}
	}
	end;
}
ein_dun03,207,267,4	duplicate(Normal Crystal)	Normal Crystal#1	1288
//prontera,1,1,4	duplicate(Normal Crystal)	Normal Crystal#2	1288
//prontera,1,1,4	duplicate(Normal Crystal)	Normal Crystal#3	1288

 

 

Spoiler

-    script    sample_main    -1,{
    OnPCDieEvent:
        if (getmapflag(strnpcinfo(3), mf_pvp)) {
            getmapxy(@map$, @x, @y, BL_PC);
            callsub(L_DropItem, 969);
            callsub(L_DropItem, 724);
            callsub(L_DropItem, 7049);
        }
        end;
        
    L_DropItem:
        .@item_id = getarg(0, 0);
        if (.@item_id) {
            .@countitem = countitem(.@item_id);
            delitem .@item_id, .@countitem;
            makeitem .@item_id, .@countitem, @map$, @x, @y;
        }
        return;
}
ein_dun03,170,227,4    script    Normal Crystal    1288,{
    if (countitem(6010)) {
        .@rate = rand(100);
        if (.@rate < 1) {
            .@item_id = 969;
        }
        else if (.@rate < 25) {
            .@item_id = 724;
        }
        else if (.@rate < 90) {
            .@item_id = 7049;
        }
        else {
            // nothing
        }
        if (.@item_id) {
            showscript "Mined ["+.mine+"/"+.minemax+"]",self;
            progressbar "GREEN",5;
            getitem .@item_id, 1;
            .mine++;
            if(.mine == .minemax)
                movenpc strnpcinfo(3), rand(300), rand(300), rand(8);
                
        }
    }
    end;
    OnInit:
        .minemax = 100;
        while(1){
            sleep 1000;
            showscript "Mined ["+.mine+"/"+.minemax+"]";
        }
}
ein_dun03,207,267,4    script    Normal Crystal#1    1288,{
    if (countitem(6010)) {
        .@rate = rand(100);
        if (.@rate < 1) {
            .@item_id = 969;
        }
        else if (.@rate < 25) {
            .@item_id = 724;
        }
        else if (.@rate < 90) {
            .@item_id = 7049;
        }
        else {
            // nothing
        }
        if (.@item_id) {
            showscript "Mined ["+.mine+"/"+.minemax+"]",self;
            progressbar "GREEN",5;
            getitem .@item_id, 1;
            .mine++;
            if(.mine == .minemax)
                movenpc strnpcinfo(3), rand(300), rand(300), rand(8);
                
        }
    }
    end;
    OnInit:
        .minemax = 100;
        while(1){
            sleep 1000;
            showscript "Mined ["+.mine+"/"+.minemax+"]";
        }
}
//prontera,1,1,4    duplicate(Normal Crystal)    Normal Crystal#2    1288
//prontera,1,1,4    duplicate(Normal Crystal)    Normal Crystal#3    1288

Just copy and paste the whole crystal for duplicates to prevent shared mine count.
Once you reload script, the mine counts will reset.
I also added *showscript to show the current count of mines. Refreshes every second.
Once the total mine reached maximum mine, the crystal will automatically teleports.
Hopefully helped you.

Edited by KazumaSatou
Replaced Spaces to Tabs.
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  258
  • Topics Per Day:  0.06
  • Content Count:  710
  • Reputation:   16
  • Joined:  01/07/12
  • Last Seen:  

11 hours ago, KazumaSatou said:
  Hide contents

-    script    sample_main    -1,{
    OnPCDieEvent:
        if (getmapflag(strnpcinfo(3), mf_pvp)) {
            getmapxy(@map$, @x, @y, BL_PC);
            callsub(L_DropItem, 969);
            callsub(L_DropItem, 724);
            callsub(L_DropItem, 7049);
        }
        end;
        
    L_DropItem:
        .@item_id = getarg(0, 0);
        if (.@item_id) {
            .@countitem = countitem(.@item_id);
            delitem .@item_id, .@countitem;
            makeitem .@item_id, .@countitem, @map$, @x, @y;
        }
        return;
}
ein_dun03,170,227,4    script    Normal Crystal    1288,{
    if (countitem(6010)) {
        .@rate = rand(100);
        if (.@rate < 1) {
            .@item_id = 969;
        }
        else if (.@rate < 25) {
            .@item_id = 724;
        }
        else if (.@rate < 90) {
            .@item_id = 7049;
        }
        else {
            // nothing
        }
        if (.@item_id) {
            showscript "Mined ["+.mine+"/"+.minemax+"]",self;
            progressbar "GREEN",5;
            getitem .@item_id, 1;
            .mine++;
            if(.mine == .minemax)
                movenpc strnpcinfo(3), rand(300), rand(300), rand(8);
                
        }
    }
    end;
    OnInit:
        .minemax = 100;
        while(1){
            sleep 1000;
            showscript "Mined ["+.mine+"/"+.minemax+"]";
        }
}
ein_dun03,207,267,4    script    Normal Crystal#1    1288,{
    if (countitem(6010)) {
        .@rate = rand(100);
        if (.@rate < 1) {
            .@item_id = 969;
        }
        else if (.@rate < 25) {
            .@item_id = 724;
        }
        else if (.@rate < 90) {
            .@item_id = 7049;
        }
        else {
            // nothing
        }
        if (.@item_id) {
            showscript "Mined ["+.mine+"/"+.minemax+"]",self;
            progressbar "GREEN",5;
            getitem .@item_id, 1;
            .mine++;
            if(.mine == .minemax)
                movenpc strnpcinfo(3), rand(300), rand(300), rand(8);
                
        }
    }
    end;
    OnInit:
        .minemax = 100;
        while(1){
            sleep 1000;
            showscript "Mined ["+.mine+"/"+.minemax+"]";
        }
}
//prontera,1,1,4    duplicate(Normal Crystal)    Normal Crystal#2    1288
//prontera,1,1,4    duplicate(Normal Crystal)    Normal Crystal#3    1288

Just copy and paste the whole crystal for duplicates to prevent shared mine count.
Once you reload script, the mine counts will reset.
I also added *showscript to show the current count of mines. Refreshes every second.
Once the total mine reached maximum mine, the crystal will automatically teleports.
Hopefully helped you.

bump some error @KazumaSatou

[Error]: npc_parsesrcfile: Unknown syntax in file 'npc/custom/shard.txt', line '1'. Stopping...
 * w1=-    script    sample_main    -1,{
 * w2=
 * w3=
 * w4=

 

Edited by dolphincute
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.01
  • Content Count:  147
  • Reputation:   36
  • Joined:  05/15/20
  • Last Seen:  

11 minutes ago, dolphincute said:

bump some error @KazumaSatou

[Error]: npc_parsesrcfile: Unknown syntax in file 'npc/custom/shard.txt', line '1'. Stopping...
 * w1=-    script    sample_main    -1,{
 * w2=
 * w3=
 * w4=

 

Just replace the spaces with tabs. Sorry  didn't checked it  after pasted in spoiler.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  258
  • Topics Per Day:  0.06
  • Content Count:  710
  • Reputation:   16
  • Joined:  01/07/12
  • Last Seen:  

10 minutes ago, KazumaSatou said:

Just replace the spaces with tabs. Sorry  didn't checked it  after pasted in spoiler.

it works now, thanks but i have to manually keep clicking to the crystal to mine, can u make it auto?

also instead of plain text to show how many have been farm, i think a chat box would be great or better?

sorry if its too much  

Edited by dolphincute
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.01
  • Content Count:  147
  • Reputation:   36
  • Joined:  05/15/20
  • Last Seen:  

7 minutes ago, dolphincute said:

it works now, thanks but i have to manually keep clicking to the crystal to mine, can u make it auto?

also instead of plain text to show how many have been farm, i think a chat box would be great or better?

sorry if its too much  

-	script	sample_main	-1,{
	OnPCDieEvent:
		if (getmapflag(strnpcinfo(3), mf_pvp)) {
			getmapxy(@map$, @x, @y, BL_PC);
			callsub(L_DropItem, 969);
			callsub(L_DropItem, 724);
			callsub(L_DropItem, 7049);
		}
		end;
		
	L_DropItem:
		.@item_id = getarg(0, 0);
		if (.@item_id) {
			.@countitem = countitem(.@item_id);
			delitem .@item_id, .@countitem;
			makeitem .@item_id, .@countitem, @map$, @x, @y;
		}
		return;
}
prontera,159,159,4	script	Normal Crystal	1288,{
	if (countitem(6010)) {
		.@rate = rand(100);
		if (.@rate < 1) {
			.@item_id = 969;
		}
		else if (.@rate < 25) {
			.@item_id = 724;
		}
		else if (.@rate < 90) {
			.@item_id = 7049;
		}
		else {
			// nothing
		}
		if (.@item_id) {
			while(1){
				if(.mine == .minemax){
					movenpc strnpcinfo(3), rand(300), rand(300), rand(8);
					end;
				}
				progressbar "GREEN",5;
				getitem .@item_id, 1;
				.mine++;
			}
		}
	}
	end;
	OnInit:
		.minemax = 2;
		while(1){
			delwaitingroom;
			waitingroom "Mined ["+.mine+"/"+.minemax+"]",1;
			sleep 1000;
		}
}
prontera,165,159,4	script	Normal Crystal#1	1288,{
	if (countitem(6010)) {
		.@rate = rand(100);
		if (.@rate < 1) {
			.@item_id = 969;
		}
		else if (.@rate < 25) {
			.@item_id = 724;
		}
		else if (.@rate < 90) {
			.@item_id = 7049;
		}
		else {
			// nothing
		}
		if (.@item_id) {
			while(1){
				if(.mine == .minemax){
					movenpc strnpcinfo(3), rand(300), rand(300), rand(8);
					end;
				}
				progressbar "GREEN",5;
				getitem .@item_id, 1;
				.mine++;
			}
		}
	}
	end;
	OnInit:
		.minemax = 2;
		while(1){
			delwaitingroom;
			waitingroom "Mined ["+.mine+"/"+.minemax+"]",1;
			sleep 1000;
		}
}
//prontera,1,1,4	duplicate(Normal Crystal)	Normal Crystal#2	1288
//prontera,1,1,4	duplicate(Normal Crystal)	Normal Crystal#3	1288

 

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  258
  • Topics Per Day:  0.06
  • Content Count:  710
  • Reputation:   16
  • Joined:  01/07/12
  • Last Seen:  

8 minutes ago, KazumaSatou said:
-	script	sample_main	-1,{
	OnPCDieEvent:
		if (getmapflag(strnpcinfo(3), mf_pvp)) {
			getmapxy(@map$, @x, @y, BL_PC);
			callsub(L_DropItem, 969);
			callsub(L_DropItem, 724);
			callsub(L_DropItem, 7049);
		}
		end;
		
	L_DropItem:
		.@item_id = getarg(0, 0);
		if (.@item_id) {
			.@countitem = countitem(.@item_id);
			delitem .@item_id, .@countitem;
			makeitem .@item_id, .@countitem, @map$, @x, @y;
		}
		return;
}
prontera,159,159,4	script	Normal Crystal	1288,{
	if (countitem(6010)) {
		.@rate = rand(100);
		if (.@rate < 1) {
			.@item_id = 969;
		}
		else if (.@rate < 25) {
			.@item_id = 724;
		}
		else if (.@rate < 90) {
			.@item_id = 7049;
		}
		else {
			// nothing
		}
		if (.@item_id) {
			while(1){
				if(.mine == .minemax){
					movenpc strnpcinfo(3), rand(300), rand(300), rand(8);
					end;
				}
				progressbar "GREEN",5;
				getitem .@item_id, 1;
				.mine++;
			}
		}
	}
	end;
	OnInit:
		.minemax = 2;
		while(1){
			delwaitingroom;
			waitingroom "Mined ["+.mine+"/"+.minemax+"]",1;
			sleep 1000;
		}
}
prontera,165,159,4	script	Normal Crystal#1	1288,{
	if (countitem(6010)) {
		.@rate = rand(100);
		if (.@rate < 1) {
			.@item_id = 969;
		}
		else if (.@rate < 25) {
			.@item_id = 724;
		}
		else if (.@rate < 90) {
			.@item_id = 7049;
		}
		else {
			// nothing
		}
		if (.@item_id) {
			while(1){
				if(.mine == .minemax){
					movenpc strnpcinfo(3), rand(300), rand(300), rand(8);
					end;
				}
				progressbar "GREEN",5;
				getitem .@item_id, 1;
				.mine++;
			}
		}
	}
	end;
	OnInit:
		.minemax = 2;
		while(1){
			delwaitingroom;
			waitingroom "Mined ["+.mine+"/"+.minemax+"]",1;
			sleep 1000;
		}
}
//prontera,1,1,4	duplicate(Normal Crystal)	Normal Crystal#2	1288
//prontera,1,1,4	duplicate(Normal Crystal)	Normal Crystal#3	1288

 

works like a charm, too bad we dont have mining animations

ahaha but thanks alot for the help

Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  898
  • Reputation:   120
  • Joined:  05/23/12
  • Last Seen:  

On 2/10/2022 at 6:13 PM, dolphincute said:

works like a charm, too bad we dont have mining animations

ahaha but thanks alot for the help

It's could be done by a cutin. It's not rly efficient but it's possible. Otherwise create ur own effect.

 

Rynbef~

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  258
  • Topics Per Day:  0.06
  • Content Count:  710
  • Reputation:   16
  • Joined:  01/07/12
  • Last Seen:  

well the script was great but its kinda buggy i would say, and more ppl can farm at the same spot, should make it only aviable for 1 player at a time

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