Jump to content
  • 0

Loop for add item to players in specific map with addrid(1) problem


Unique Scripter

Question


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.01
  • Content Count:  7
  • Reputation:   0
  • Joined:  09/07/23
  • Last Seen:  

My code:
 

morocc,150,172,4	script	Give Reward	951,{
	end;
OnClock2336:
Main:
	addrid(1);
	getitem 7227, 10;
	sleep 5000;
	goto Main;
}	

My problem is players got exponent amount of item. How to resolve this problem?

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  3
  • Reputation:   0
  • Joined:  06/11/23
  • Last Seen:  

`goto Main` runs script all over again every 5000 ms. you should omit it.

 

morocc,150,172,4	script	Give Reward	951,{
	end;
OnClock2336:
Main:
	addrid(1);
	getitem 7227, 10;
}
Edited by jasonch35
Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

everything that run after addrid will be repeatedly executed for each attached players.

in your case, after your player obtained 10ea of item 7227, then each of this players, trigger the "Main" event again, and give each other another 10ea of 7227 and repeat endlessly.

 

If you wish to trigger it every 5 seconds, you can do it this way.

-   script  Sample  -1,{
    OnTimer5000:
        donpcevent strnpcinfo(3)+"::OnReward";
    OnInit:
        initnpctimer;
        end;

    OnReward:
        addrid(5, 0, "prontera");
        getitem 7227, 10;
        end;
}

 

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