HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Custom Resources via Trees

09-25-2008, 03:38 AM#1
holyadvocate
Is there any "simple" way to create custom resources (name/model) based on trees which function properly (or at all).

or... any complex way??
09-25-2008, 04:01 AM#2
Szythe
I'm using a very complex method in order to have "stone" resources in my map. The process I use is as follows:

---

First off, the worker units have the 'ward' classification, which hides their UI.

The Stones are units which abuse the chaos/locust bug, so that they are unselectable but are able to be targeted (similar behavior to trees)

Mining

When a worker is issued a smart (right-click) order onto a stone, the worker is given the "Mine" ability (Based off of channel, the unit has a 0.5 sec cast point, and the ability has a 0.5 second channel time), and is ordered to cast Mine on the rock.

When a unit begins casting the Mine ability, the game checks how much stone the unit is carrying. If it has full capacity, the game orders the unit to Return*

When a unit starts the effects of Mine, the rock is damaged for 1 hp and the worker has the "Gold" animation tag added to it. The game adds 1 to the integer which keeps track of the stone being carried for that unit.

When a unit finishes casting Mine, the game checks if the current rock-target of the worker is dead, and if the worker has full capacity. If the worker does not have full cap but the rock is dead, it orders him to Mine the closest rock. If the unit has full cap, it makes him Return*. If the unit does not have full cap, and the rock is still alive, it orders him to cast Mine on the same rock again.

*Returning

Return: An ability named "Return" is added to the unit (again based on channel, this one is instant though), and the game orders the worker to cast it on the closest "Resource Depot" type structure.

When a unit is issued a smart (right-click) order targeting a Resource Depot and it is carrying at least one stone, it is given Return and ordered to use it on the building.

When a worker begins casting Return, all stone carried is removed, the "Gold" animation tag is removed, and the player is credited with the resource. The game then looks at the position of the last rock mined by this unit (which is stored every time the unit harvests a stone), and orders it to Mine the closest rock to that position.

---

So yeah, thats the method I used for my Deity map I'm making. In the end, it runs very fluid and you can't tell the difference between it and a worker chopping a tree. I hope this helped. Ask if you need any clarification on any parts.

Additional Note: I encountered a bug with the attack animation in this, so I had to manually trigger the "Attack" animation on the Begin-Cast event of the Mine trigger. It would not work immediately though, so I had to use a 0. sec delay using a timer before I applied the animation. I also manually triggered a metal-chopping-stone sound effect every time a stone is harvested from a rock.
09-25-2008, 04:31 AM#3
Kyrbi0
Wow, you are a freakin' beast. :P

~~~

I have tried and tried to get that "Chaos/Locust" bug to work for me, but it fails repeatedly.

Rather, it works, but triggers don't properly select them (using "Pick Every Unit etc etc etc).
09-25-2008, 06:28 PM#4
holyadvocate
That is a monster of a trigger group

i wonder why Blizzard decided to make it so hard to create custom tree based resources...

and thanks, that could do me alot of good
09-26-2008, 12:39 AM#5
Pyrogasm
Quote:
Originally Posted by Kyrbi0
Rather, it works, but triggers don't properly select them (using "Pick Every Unit etc etc etc).
Yeah... that's kind-of one of the effects of locust, you know.

Picking the units of a player, however, does include locust units, so you can get them that way and then just filter out the ones that are far away.
09-26-2008, 03:06 AM#6
Kyrbi0
I know of that effect of Locust, yes, but I thought (I read somewhere...?) that doing the "Chaos/Locust" bug made them targettable to triggers.
Or is that just "targettable to attack"?

Meh, whatever I'm doing, it's crazy. I'm doing "Pick Every Unit Within X range of X unit Matching Y and Z", and then issuing an order to the Picked Unit. You'd think it would take all the matching, picked units and order them, right?
No. It takes 1. 1 specific matching/picked unit. Then if you do the trigger really fast, it orders to each one within range at a time.

Bleh?
09-26-2008, 04:26 AM#7
Szythe
Pick every unit in range works for chaos/locust units. I have it working for one of the spells I'm using. GUI may be funky in this case, but my Jass works fine.
09-26-2008, 04:29 AM#8
Kyrbi0
Ah, that may be the problem. I was trying to recreate what you described for your Diety Map, and I'm using GUI.

Are you using full JASS, or could a lot of Custom Script suffice? :P
09-27-2008, 12:38 PM#9
Askhati
@ holy:
If you're making a subterranean map, you could just change the tree's image to look like a rock chunk, and then your peasants can mine them regularly. Unless you want to keep trees?
09-28-2008, 01:30 AM#10
holyadvocate
well, ive tried changing the model of trees and it doesnt work... at all... they just dont appear

inot subterrainian btw, based on survivors of the scourge in the highlands
09-28-2008, 11:08 AM#11
Askhati
Well, the default tree models have that thing with a terrain-specific texture or something - if you view the basic tree model in the WE, you'll see it has no skin - and it could be making trouble with the rock's model, which has a fixed skin.
09-28-2008, 04:16 PM#12
Alevice
Yeah, it has somethin to do with a replaceable textures/tileset specific data field on the object editor IIRC. You could try basing your rock on a standard destructible and then checking a flag that marks it as a tree and see if it works.
09-29-2008, 05:25 AM#13
holyadvocate
Thats not a bad idea...

i doubt it will work, seeing as Szythe went through all the trouble he has.
09-29-2008, 05:29 AM#14
Szythe
I didn't go through all of my trouble because I couldn't get changing trees to work...I went through that trouble in order to make an additional resource alongside trees that behaved the same.
09-29-2008, 03:01 PM#15
Alevice
Quote:
Originally Posted by holyadvocate
Thats not a bad idea...

i doubt it will work, seeing as Szythe went through all the trouble he has.

It does work actually, I did test it afterwards. Sadly, I can't find a way to change the color for the displayed amount of lumber delivered. Also, the workers would display lumber being carried.