User Tools

Site Tools


scripting:samples:simpleaxe

Simple Bronze Axe Sample

This simple sample script provides a 'UseItem' event that will check to see if the player is near to some trees and if so, award them with 1 'Wood' item.

//------------------------------------- Bronze Axe
Event( "UseItem", "Bronze Axe" )
{
	$dist = sysGetNearestForest( $gPlayerWorldX,$gPlayerWorldY )
	$distM = $dist / 100

	if ( $distM < 65 )
	{
		*notifylarge %PLAYER% +1 Wood
		*choptrees $gPlayerWorldX,$gPlayerWorldY
		*grantitem %PLAYER% 1 Wood
	}
	else
	{
		*alert %PLAYER% No suitable trees nearby (Nearest forest = $distM m )
	}
	CancelTransaction()
}
scripting/samples/simpleaxe.txt · Last modified: 2020/01/28 17:50 by 127.0.0.1

Except where otherwise noted, content on this wiki is licensed under the following license: Public Domain
Public Domain Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki