Welcome to the Builder Academy

Question Simple Harvesting Trigger

More
23 Jun 2012 20:00 - 23 Jun 2012 20:02 #219 by Papaya Pete
Since everyone's been so helpful here, I thought I'd share a really simple trigger that I made when trying to learn DG Scripts. The idea came from a mud I played on in which every starting town had a way to make some coin, so that even if you lose everything you're not completely destitute.

This is for shearing wool off of sheep. Item 1017 is a pair of shears and 1018 is a bundle of wool. Mob 1006 is the sheared sheep.
Code:
Name: 'Shearing Sheep Command', VNum: [ 1004], RNum: [ 187] Trigger Intended Assignment: Mobiles Trigger Type: Command , Numeric Arg: 100, Arg list: shear Commands: if %actor.has_item(1017)% %send% %actor% You grab your pair of shears and get to work, cutting tufts of wool off of the sheep. %echoaround% %actor% %actor.name% gets out a pair of old shears and starts trimming the wool off of a sheep... wait 16 %send% %actor% It isn't long before you've sheared off a nice bundle of wool. You'll have to find another sheep to do shear though. %load% obj 1018 %actor% inv %echoaround% %actor% It doesn't take %actor.name% too long before %actor.heshe% has gathered a nice bundle of wool, leaving that sheep sheared. %load% mob 1006 %purge% %self% else %send% %actor% You can't shear anything without a pair of shears! end

So it purges the sheep mob and loads a sheared one (mob 1005) in its place. On the sheared sheep, put this trigger on it to that, after a while, it purges itself and loads one that can be harvested.
Code:
Name: 'Sheared Sheep's Load', VNum: [ 1005], RNum: [ 188] Trigger Intended Assignment: Mobiles Trigger Type: Load , Numeric Arg: 100, Arg list: None Commands: wait 3600 %load% mob 1005 %purge% %self%

Or put the "wait 3600" to however long you want to make the wait.

A problem that can occur is that someone can spam "shear" and shear wool off of four sheep at a time, keeping someone else from doing it. Also, if someone attacks a sheep, almost kills it, and someone shears it *poof* now there's a perfectly healthy sheared sheep in its place. My solution was to put a trigger on them that makes them automatically keel over if taken below 99% health with no xp given.

Anyways, it's nowhere near as complex and cool as the stuff Rumble's been posting, I'm definitely going to be using something similar to that, but I just wanted to try and contribute something. :)

Edit: another change I'm going to make is perhaps taking out the delay in the first trigger. We'll see though. I suppose the improvement I would be keeping the player from doing anything while shearing one sheep. Hmmm. Now I'm going to be thinking about that all day! :P
Last edit: 23 Jun 2012 20:02 by Papaya Pete.

Please Log in or Create an account to join the conversation.

Time to create page: 0.428 seconds