Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help needed to finish a farming script
Author Message
Sha
Apprentice
*

Posts: 6
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Aug 2020
Reputation: 0



Post: #1
Help needed to finish a farming script
Hello everyone Wink

20 years ago, I was co-admin with a friend on a very small server during 2 years.
At that time, it was out of the question for me to put my nose in the scripts, I preferred to draw the graphics of the game (because girls prefer drawing dresses Lol )
3 years ago, I found the files of the server, and I decided to finish what we had barely sketched, and start again this project alone.

In other words, I am a very newbie and bad script writer, but I try to do my best to understand and learn. And my english is not very good too Blush

I usually read the wiki and the scripts posted on the forum, and try to adapt what I find to what I want to do. The result is not always very clean and would make a lot of you laugh, and I always have a lot of difficulty to find the good syntax.

The script below is a very simple farming script that works well (I'm proud!).
But I would like to expand it to get this:
- the plant disappears after 7 days of use (for example) or after a number of uses.
- the player has a 1/3 chance of obtaining a seed when picking.

I have no idea how doing it, so I need help, but the script and the explanation must be easy to understand for me.
I think I ask a lot Smile

For the moment I'm still on Sphere 56b. I prefer waiting to be a little more sure of what I'm doing before changing for 56d.

Code:
[ITEMDEF i_mem_plante]
ID=i_memory
TYPE=t_eq_script
NAME=Timer plante [Ne pas supprimer]

ON=@create
attr=attr_newbie

on=@timer
cont.newitem <tag.typePlante>
cont.act.p <tag.Plante>
remove
return 1

Code:
//****************************** Oignons blancs
//-------------- Graine oignon blanc
[ITEMDEF i_graine_oignon_blanc]
DEFNAME=i_graine_oignon_blanc
ID=08d7
TYPE=t_script
NAME=graines d'oignon blancs
VALUE=103

CATEGORY=Metiers
SUBSECTION=Cultures legumes
DESCRIPTION=Oignon blanc graines

On=@DClick
    TARGET Ou voulez vous planter cette graine ?
    Return 1
    
On=@Targon_Char
    SRC.MESSAGE Vous devez planter cette graine dans une terre labouree !
    Return 1
    
On=@TargOn_Ground
    SRC.MESSAGE Vous devez planter cette graine dans une terre labouree, sinon la graine ne poussera jamais.
    Return 1
    
On=@Targon_Item
    IF <SRC.TARG.TYPE>==t_dirt
        SRC.NEWITEM=i_oignon_blanc_mur // si je mets le crop, tout disparait a la fin du timer.
        SRC.ACT.P=<SRC.TARG.P>
        SRC.act.nudgeup=1
        SRC.MESSAGE Vous plantez la graine dans la terre meuble.
        REMOVE
        Return 1
    ELSE
        SRC.MESSAGE Vous ne pouvez pas planter cette graine ici.
        Return 1
    ENDIF

//-------------- Pousse oignon blanc
[ITEMDEF i_crop_oignon_blanc]
DEFNAME=i_crop_oignon_blanc
ID=0c68
NAME=pousse d'oignons blancs
TYPE=t_eq_script
CATEGORY=Metiers
SUBSECTION=Cultures legumes
DESCRIPTION=Oignon blanc pousse
ON=@Create
attr=010
Timer=60*60*21

ON=@Dclick
Src.message Il n'y a rien a ceuillir pour l'instant.
Return 1

ON=@Timer
Remove
Return 1

//-------------- oignon blanc mur
[ITEMDEF i_oignon_blanc_mur]
DEFNAME=i_oignon_blanc_mur
ID=0c6f
NAME=oignons blancs
TYPE=t_eq_script
CATEGORY=Metiers
SUBSECTION=Cultures legumes
DESCRIPTION=Oignon blanc mur
ON=@Create
attr=010

ON=@Dclick
    src.message Vous recoltez des oignons blancs.
    src.newitem i_fruit_oignon_blanc
    src.act.amount 6
    src.act.bounce
    src.newitem i_crop_oignon_blanc
    src.act.p <p>
    src.newitem i_mem_plante
    src.act.tag.Plante <p>
    src.act.tag.typePlante i_oignon_blanc_mur
    src.act.equip
    src.act.timer 60*60*21
    remove
    Return 1

//-------------- fruit oignons blancs
[ITEMDEF 0c6d]
DEFNAME=i_fruit_oignon_blanc
NAME=oignon%s blanc%s
TYPE=t_fruit
TDATA1=0
FLIP=1
VALUE=1
WEIGHT=0.1
RESOURCES=1 i_crop_oignon_blanc
CATEGORY=Metiers
SUBSECTION=Cultures legumes
DESCRIPTION=Oignon blanc fruit
DUPELIST=0c6e
ON=@Create
   MOREM=1

[ITEMDEF 0c6e]
//onion
DUPEITEM=0c6d
12-15-2020 02:27 AM
Find all posts by this user Like Post Quote this message in a reply
Soulless
Master
**

Posts: 336
Likes Given: 28
Likes Received: 48 in 27 posts
Joined: Jun 2012
Reputation: 12

HereticUO

Post: #2
RE: Help needed to finish a farming script
welcome back, join us on the discord for help if you haven't already https://discord.gg/ZrMTXrs

What am I working on?
01-14-2021 07:22 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)

This forum uses Lukasz Tkacz MyBB addons.