Jump to content
  • 0

My delay npc script had bug


Dolphin86

Question


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

as title, when i click on my npc at 1st time it was working as it should, but when i click it on the 2nd time i got this delay

Spoiler

image.thumb.png.bdcb2b54bbea9fb52d12d3a30257fb5c.png

script:

Spoiler
neko_isle,71,122,6	script	Green Tree	659,{

	if(Pick == 1) goto Pick1;
	if(Pick == 2) goto Pick2;
	if(Pick == 3) goto Pick3;
	else {
		getitem 512, 1;
		set Pick,1;
		close;
		}

	Pick1:
		if (gettimetick(2) > #COOLDOWN_PICK) {
		#COOLDOWN_PICK += (gettimetick(2) + 3); // 3 seconds.
		getitem 512, 1;
		set Pick,2;
		}
		
	Pick2:
		if (gettimetick(2) > #COOLDOWN_PICK) {
		#COOLDOWN_PICK += (gettimetick(2) + 3); // 3 seconds.
		getitem 512, 1;
		set Pick,3;
		}
	Pick3:
		if (gettimetick(2) > #COOLDOWN_PICK) {
		#COOLDOWN_PICK += (gettimetick(2) + 3); // 3 seconds.
		getitem 512, 1;
		set Pick,0;
		}
		
	mes "Need to wait "+(#COOLDOWN_PICK - gettimetick(2))+" seconds.";
	close;
	}

 

also i plan to make duplicate of this which each npc will give different items

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.01
  • Content Count:  148
  • Reputation:   21
  • Joined:  11/12/18
  • Last Seen:  

t

4 hours ago, Dolphin86 said:

as title, when i click on my npc at 1st time it was working as it should, but when i click it on the 2nd time i got this delay

  Hide contents

image.thumb.png.bdcb2b54bbea9fb52d12d3a30257fb5c.png

script:

  Hide contents
neko_isle,71,122,6	script	Green Tree	659,{

	if(Pick == 1) goto Pick1;
	if(Pick == 2) goto Pick2;
	if(Pick == 3) goto Pick3;
	else {
		getitem 512, 1;
		set Pick,1;
		close;
		}

	Pick1:
		if (gettimetick(2) > #COOLDOWN_PICK) {
		#COOLDOWN_PICK += (gettimetick(2) + 3); // 3 seconds.
		getitem 512, 1;
		set Pick,2;
		}
		
	Pick2:
		if (gettimetick(2) > #COOLDOWN_PICK) {
		#COOLDOWN_PICK += (gettimetick(2) + 3); // 3 seconds.
		getitem 512, 1;
		set Pick,3;
		}
	Pick3:
		if (gettimetick(2) > #COOLDOWN_PICK) {
		#COOLDOWN_PICK += (gettimetick(2) + 3); // 3 seconds.
		getitem 512, 1;
		set Pick,0;
		}
		
	mes "Need to wait "+(#COOLDOWN_PICK - gettimetick(2))+" seconds.";
	close;
	}

 

also i plan to make duplicate of this which each npc will give different items

try to put end; function on each Pick# function

Link to comment
Share on other sites

  • 0

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

3 hours ago, Forshaken said:

t

try to put end; function on each Pick# function

nope that did not work

Link to comment
Share on other sites

  • 0

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

as title i was trying to enable player to talk to the npc only 3 times, on between those 3x talk there is 5 seconds gap where player will have to wait, now after the player talked to the npc 3x,  he/she will need to wait 3 minutes until he /she can talk again with the npc, but i got confused to to set player from the 1st 5 sec wait to the 3 minute wait.. kindly guide me..

Script:

neko_isle,71,122,6	script	Green Tree	659,{

	if(Pick == 0) goto Pick1;
	if(Pick == 1) goto Pick2;
	if(Pick == 2) goto Pick3;
	if(Pick == 3) goto Pick4;
	if(Pick == 4) goto Pick5;


Pick1:
	
	if(#tree1_CD > gettimetick(2)) 
	{mes "Please wait for 5 seconds. ";
    end;}
	
		getitem 512, 1;
		set Pick,1;
		set #tree1_CD,gettimetick(2) + 5;
		end;
		
Pick2:
	
	if(#tree1_CD > gettimetick(2)) 
	{mes "Please wait for 5 seconds. ";
    end;}
	
		getitem 512, 1;
		set Pick,2;
		set #tree1_CD,gettimetick(2) + 5;
		end;

Pick3:

	if(#tree1_CD > gettimetick(2)) 
	{mes "Please wait for 5 seconds. ";
    end;}
	
		getitem 512, 1;
		set Pick,3;
		set #tree1_CD,gettimetick(2) + 5;
		end;
		
Pick4:

	if(#tree1_CD > gettimetick(2)) 
	{mes "Please wait for 5 seconds. ";
    end;}
	
		getitem 512, 1;
		set Pick,4;
		set #tree1load1_CD,gettimetick(2) + 20;
		end;
		
Pick5:
	if(#tree1load1_CD > gettimetick(2)) 
	{mes "Empty, come back again in 3 minute. ";
    end;}
	
		getitem 512, 1;
		set Pick,0;
		set #tree1_CD,gettimetick(2) + 5;
		end;
		
}

the script had been changed totally from ground up, fixed the delay issue but came up with new problem by changing the timer / quest on players

Nvm it works as it should, i did not notice the timer i edited with extra minutes...

Edited by Dolphin86
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...