Jump to content
  • 0

REMOVED


Deleted User

Question


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  235
  • Reputation:   55
  • Joined:  12/02/11
  • Last Seen:  

REMOVED

post-630-0-21450800-1322819694_thumb.png

Edited by Kaze
Link to comment
Share on other sites

10 answers to this question

Recommended Posts

  • 1

  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  106
  • Reputation:   28
  • Joined:  11/08/11
  • Last Seen:  

I don't know either if there's already such script (but it probably is on the other forums), but I just wrote a basic script.

Since I'm not at home I'm unable to test if it actually works.

What the script does:

- checks if the player is less then 5 cells away (checkdistance(...)<5)

- check if player has required item (countitem(607), Ygg Berry in this case)

- 60% chance (rand(0,100) < 60) to get the materials (getitem 501,1;)

- basic protection to prevent massive farming (the npc will be disable for 30-60 seconds)

map,x,y,0	script	Name::identifier	111,{
getmapxy(.@dummy$, .@px, .@py, 0);			// get Player coordinates
getmapxy(.@dummy$, .@nx, .@ny, 1, strnpcinfo(3));	// get NPC coordinates

// Check if player is near enough (distance < 5)
if (distance(.@px, .@py, .@nx, .@ny) < 5) {

	// Check if user has required item [in this case: Ygg Berry#607]
	if (countitem(607)) {
		progressbar "0x00ff00", 2000;
		// 60% chance to obtain item
		if (rand(0,100) < 60) {
			getitem 501,1;	// Red Potion#501
			specialeffect2 154;
			donpcevent strnpcinfo(3)+"::OnDisable";
			end;
		}
		specialeffect2 155;
		dispbottom "You didn't get anything this time.";
		end;
	}
	dispbottom "You don't have the necessary tools..";
	end;
}
dispbottom "You're too far away.";
end;

OnDisable:
disablenpc strnpcinfo(3);
initnpctimer
end;

// 10% chance to reactivate after 30, 40 or 50 seconds. otherwise reactive after 60 seconds
OnTimer30000:
OnTimer40000:
OnTimer50000:
if (rand(0,100) < 90)
	end;
OnTimer60000:
OnEnable:
stopnpctimer;
enablenpc strnpcinfo(3);
end;
}

Edited by Toshiro
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  148
  • Reputation:   8
  • Joined:  11/20/11
  • Last Seen:  

can you post the script? :)

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  235
  • Reputation:   55
  • Joined:  12/02/11
  • Last Seen:  

REMOVED

Edited by Kaze
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  106
  • Reputation:   28
  • Joined:  11/08/11
  • Last Seen:  

Thanks for the Fast Reply, well..seems i got 'ERROR' line '10'?

http://i42.tinypic.com/awyng8.png

- Keenan

Oh sorry, should have been "countitem" instead of "checkitem". Updated the script in the first post.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  235
  • Reputation:   55
  • Joined:  12/02/11
  • Last Seen:  



Thanks for the Fast Reply, well..seems i got 'ERROR' line '10'?
http://i42.tinypic.com/awyng8.png
- Keenan

Oh sorry, should have been "countitem" instead of "checkitem". Updated the script in the first post.


Removed Edited by Kaze
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  117
  • Reputation:   167
  • Joined:  11/10/11
  • Last Seen:  

@Keenan: You need to learn to start debugging scripts instead of relying on everyone to post up the fixes. It was a simple typo:

if (distance(.@px, .@py, .@nx, .@xy) < 5) {

Should be:

if (distance(.@px, .@py, .@nx, .@ny) < 5) {

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  235
  • Reputation:   55
  • Joined:  12/02/11
  • Last Seen:  

Removed.

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

@Epoque or the person giving it to him should've tested it... You can't blame someone "requesting" a script, (meaning they can't obviously script it themselves) to debug a script...

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  106
  • Reputation:   28
  • Joined:  11/08/11
  • Last Seen:  

@Epoque or the person giving it to him should've tested it... You can't blame someone "requesting" a script, (meaning they can't obviously script it themselves) to debug a script...

As I already wrote when posting the script, I have not been at home, so I was unable to test it.

Also if I still would have been online when Keenan posted that it was still not working, I'd checked it again and would have fixed it anyways.

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

@Toshiro I understand that you weren't @ home, it's just, he quickly attacked the OP, when it was obvious he didn't really know how to script something like this in the first place...

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