• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Farm/Hunt System

Status
Not open for further replies.
Level 11
Joined
Mar 31, 2016
Messages
657
I need help writing triggers for a hunting system and a farming system.

I'm using @ZiBitheWand3r3r 's Harvest Resource System for harvestable resources. It works for lumber as well as custom resources harvested from destructibles.

Food (gold) is harvested from plants\crops (berry bush, wheat, corn, etc), corpses of animals, and fish (just like in Age of Empires. Crops, corpses and fish are all destructibles and everything except fish and certain plants are spawned via triggers. After an animal finishes death animation and begins decay animation, the unit should turn into a certain sized destructible corpse (bigger animals have bigger corpses and more meat). Crops are the tricky part although I've seen it done before in Dark Deeds and Medieval Villagers. Make a 'Plow Farmland' ability to turn grass terrain into farm terrain (should not work on mountain terrain) + seed items will be used exclusively on farm terrain to spawn crops. Crops grow in stages - first a baby crop, then matures into a full sized crop after a minute. Another feature should also be that mature crops reproduce each minute spawning baby crops nearby only if there is free space (so if there is already a farm full of crops, they wont reproduce because its already crowded).

Appreciate any help and advice. Also if anybody can rip trigger(s) off Dark Deeds/Medieval Villagers, I can re-implement them to my map - that could get the job done.
 
Last edited:
Level 11
Joined
Mar 31, 2016
Messages
657
Here's what I came up with for hunting - however its not working...

  • Corpse Alpha
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Misha (Level 4)
      • (Unit-type of (Triggering unit)) Equal to Spirit Bear (Level 3)
    • Actions
      • Destructible - Create a Corpse - Alpha at (Position of (Triggering unit)) facing (Random angle) with scale 0.45 and variation 1
 
Level 8
Joined
Mar 19, 2017
Messages
248
Many years ago i made a "harvest from corpse" system, it followed the same concept you are using (using destructibles). Sadly i don't have that system with me (which was written in vJass, but was very simple nonetheless), so i'm just recalling what i did.

I remember that i had to import a modified model for each carcass, aswell as tracking the death of a huntable animal with a trigger (just like your trigger), removing the dying unit as it "dies", and creating the destructible in that position (the "carcass", also facing the same angle as the unit).
If i remember correctly, the carcass model was basically the model of the respective animal with just a birth, stand and death animation (a basic model edit).
The birth animation of such model would be the DEATH animation of the animal, the stand animation would be the carcass itself lying (you can make some cosmetic adjustments, like flies or whatever), and the death animation a standart Wc3 decay animation.
If you select the correct options, the destructible (the carcass) could also be selectable and have no pathing.

The trick was that the dying unit should not play its death animation (removing it instantly), and in its place the destructable would play it instead (that's why it should have a birth animation playing the death animation of the animal, i still don't remember if this was the case tho, in which case there is a trigger that allows you to play animations from a destructible directly, resolving this disjunctive).


I'm not native english speaker, so i apologize for any incommunication.
 
Level 11
Joined
Mar 31, 2016
Messages
657
Many years ago i made a "harvest from corpse" system, it followed the same concept you are using (using destructibles). Sadly i don't have that system with me (which was written in vJass, but was very simple nonetheless), so i'm just recalling what i did.

I remember that i had to import a modified model for each carcass, aswell as tracking the death of a huntable animal with a trigger (just like your trigger), removing the dying unit as it "dies", and creating the destructible in that position (the "carcass", also facing the same angle as the unit).
If i remember correctly, the carcass model was basically the model of the respective animal with just a birth, stand and death animation (a basic model edit).
The birth animation of such model would be the DEATH animation of the animal, the stand animation would be the carcass itself lying (you can make some cosmetic adjustments, like flies or whatever), and the death animation a standart Wc3 decay animation.
If you select the correct options, the destructible (the carcass) could also be selectable and have no pathing.

The trick was that the dying unit should not play its death animation (removing it instantly), and in its place the destructable would play it instead (that's why it should have a birth animation playing the death animation of the animal, i still don't remember if this was the case tho, in which case there is a trigger that allows you to play animations from a destructible directly, resolving this disjunctive).


I'm not native english speaker, so i apologize for any incommunication.

Interesting - looks like I may have to add a few more lines to my hunting trigger. Nice, good points mate. I'll take your advice and hopefully I can get it working.
 
Level 10
Joined
Sep 25, 2013
Messages
521
my map is a bit simpler than what you seem to want to create, but it involves fishing, farming, and hunting. You can take a look and tell me if it might be suitable for you. I am looking for someone to help me make some lords of europe type terrain, I'm absolutely burned out of making terrain and I am stuck.

EDIT: also, this version of my map is slighty jacked up because its missing a tech building, but it doesn't affect the resource system at all
 

Attachments

  • Dwarven Wars Alpha 0.17.w3x
    6.1 MB · Views: 132
Level 11
Joined
Mar 31, 2016
Messages
657
my map is a bit simpler than what you seem to want to create, but it involves fishing, farming, and hunting. You can take a look and tell me if it might be suitable for you. I am looking for someone to help me make some lords of europe type terrain, I'm absolutely burned out of making terrain and I am stuck.

EDIT: also, this version of my map is slighty jacked up because its missing a tech building, but it doesn't affect the resource system at all

Interesting map mate. I like some of the systems you have going on but I need to figure out how to adjust them for my map. Gonna tinker with this for a few days and see what I can get done. Also nice market trading triggers too - I can use those as well.
Terrain is tough - I need to get better myself... GL mate, thanks much appreciated.
 
Level 11
Joined
Mar 31, 2016
Messages
657
Wow, I'm impressed. This is nearly perfect - exactly what I wanted. Just one problem though - Plow Farmland ability is a little buggy in consistently turning terrain into farmland. Most of the time, it does nothing - unless I'm missing something?

Also, does this system support multiple types of seeds and crops? And different sizes of meat depending on the animal?
 
Level 18
Joined
Nov 21, 2012
Messages
835
meat is trivial:
  • meat
    • Events
      • Unit - A unit Decays
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Decaying unit)) Equal to Chicken
        • Then - Actions
          • Destructible - Create a Meat at (Position of (Decaying unit)) facing 0.00 with scale 0.40 and variation 0
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Decaying unit)) Equal to Stag
            • Then - Actions
              • Destructible - Create a BigMeat at (Position of (Decaying unit)) facing 0.00 with scale 0.40 and variation 0
            • Else - Actions
      • Game - Display to (All players) the text: (decay: + (Name of (Decaying unit)))
Plow Farmland ability
targeted area is divided to 9 128-size squares (its "size 2, shape: square" in terrain palette)
it checks for terrain type 'Lgrs' Lordaeron summer-grass. Feel free to change it (or add more conditions if you want to convert to farmland more then 1 terrain-type)

does this system support multiple types of seeds and crops?
not at its current state, but it can be easily modified to do that. Does all seeds/crops should follow the same pattern (baby/small/big + separate seed-item + spread)?
 
Level 11
Joined
Mar 31, 2016
Messages
657
meat is trivial:
  • meat
    • Events
      • Unit - A unit Decays
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Decaying unit)) Equal to Chicken
        • Then - Actions
          • Destructible - Create a Meat at (Position of (Decaying unit)) facing 0.00 with scale 0.40 and variation 0
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Decaying unit)) Equal to Stag
            • Then - Actions
              • Destructible - Create a BigMeat at (Position of (Decaying unit)) facing 0.00 with scale 0.40 and variation 0
            • Else - Actions
      • Game - Display to (All players) the text: (decay: + (Name of (Decaying unit)))

targeted area is divided to 9 128-size squares (its "size 2, shape: square" in terrain palette)
it checks for terrain type 'Lgrs' Lordaeron summer-grass. Feel free to change it (or add more conditions if you want to convert to farmland more then 1 terrain-type)

not at its current state, but it can be easily modified to do that. Does all seeds/crops should follow the same pattern (baby/small/big + separate seed-item + spread)?

Awesome mate. You are the best!

Good - yes, all seeds and crops should follow the same growth pattern + spread.
 
Level 18
Joined
Nov 21, 2012
Messages
835
after wheat is harvested completely and dies, the model remains
default wheat war3 model has no death animation, edit this model and/or import something new.

I decided to bind this new library with Custom Reource, as this new lib uses the same hashtable. Make your settings with caution ;)
 

Attachments

  • CustomResourcesCost_Ext.w3x
    99.2 KB · Views: 111
Level 11
Joined
Mar 31, 2016
Messages
657
Question: How do I make the crops spread closer together? I tried changing the offset value and it spread closer however the spread was uneven - a few spread crops were missing in the upper right corner - another value wouldn't spread toward the bottom.
 
Level 11
Joined
Mar 31, 2016
Messages
657
@ZiBitheWand3r3r

Hey - I tried setting CROP_DENSITY to lower and lower amounts however it had no effect. Am I missing another variable to edit?

Also, how exactly do I add more terrain types that are plow-able?
Do i just edit like this?

globals
//configurable
private constant integer TERRAIN_TYPE_GRASS = 'Lgrs' or 'Adrt' or 'Adrg' or 'Agrd'
private constant integer TERRAIN_TYPE_CROPS = 'Vcrp' //VILLAGE-crops, it is a terrain where seeds can be used
private constant integer ABI_PLOW_FARMLAND = 'A05J' //ability to change TERRAIN_TYPE_GRASS --> TERRAIN_TYPE_CROPS
 
Last edited:
Level 11
Joined
Mar 31, 2016
Messages
657
do you need more then 1 TERRAIN_TYPE_GRASS ?
do you need more then 1 TERRAIN_TYPE_CROPS ? if so, then
do you need more then 1 ability ABI_PLOW_FARMLAND ?
more you tell me, it will be easier to set system for me
Yeah - I need 5-7 TERRAIN_TYPE_GRASS.
Just 1 TERRAIN_TYPE_CROPS is fine. Same with ABI_PLOW_FARMLAND, just one.

I tried setting CROP_DENSITY to lower and lower amounts however it had no effect. Am I missing another variable to edit or does it only go higher?

With that - the system should be ready to go 100%.
 
Level 18
Joined
Nov 21, 2012
Messages
835
sorry, my mistake, now it should work fine
you have to make your settings in globals block and inside private function Settings

and in two existing calls: call CreatePlant where you can define 2 reals: time, when baby transforms into mature, and mature--big plant
 

Attachments

  • CustomResourcesCost_Ext.w3x
    99.5 KB · Views: 64
Last edited:
Level 11
Joined
Mar 31, 2016
Messages
657
sorry, my mistake, now it should work fine
you have to make your settings in globals block and inside private function Settings

and in two existing calls: call CreatePlant where you can define 2 reals: time, when baby transforms into mature, and mature--big plant
You da best! Forever grateful. With this working, all core triggers in my map are now done so I can release an alpha soon.
 
Status
Not open for further replies.
Top