| 01-19-2006, 12:51 AM | #1 |
I have been trying to create a tree/terrain effect system, changing trees and terrain into the appropriate season based on a timer cycle. I have had several questions in this regard on the thehelper.net forums, but most have not been answered. I have seen the recent post in General that claims to allow you to add natives to code. This would indeed solve all my problems. I have two basic problems: 1) I have a random map generator in place, but the minimap is pre-generated and stored as a file. I would like to change the data in the minimap dynamically. Preferrably, I would like to "refresh" the minimap according to the same algorithm that is used when creating the map in the first place (in the world editor). 2) I want to change more destructable attributes such as the type of the destructable, the size, and the angle. Since there are no such natives, I was forced to create two systems. The first is where I just plop down 4 trees in each tree tile, one for each season (using my random map generator algorithm). I would then hide 3 of them (excepting the current season). For each weather cycle, I would un-hide one and show the next season. However, I cannot change the size of the tree with this method. I also cannot use variable-sized trees with the first method OR the second method, because the tree imprint for the "randomdestructableinrect" if it is too big and therefore either overlaps several trees (causing the wrong one to be picked), or picks nothing if it is too small. With my tree spacing, they overlap, unless they have they all have the same standard size (every 256 pixels) where the imprints are very close. Note that the "randomdestructableinrect" method takes a dynamic region that is different for each tree. The second method is to destroy/create the trees. This solves the problem of being unable to change the size of each tree, but it is a little bit slower. I would be happy with just being able to go through each by its destructable array index (I tried selecting a random tree from the entire map, and it lagged horribly) and change its properties from the index if they are the correct destructable type (also by being able to check the properties)... something quite simple but currently impossible: if destructable(i).type = tree1(current_season) then destructable(i).type = tree1(next_season) Thanks in advance. |
| 01-19-2006, 01:00 AM | #2 |
It is not that easy to add natives, besides of being able to add natives you also have to be able to add the proper hack. This whole native adding technology is just starting anyways. And it requires hacking the game so it would only be great if you are making a mod or campaign So the answer is that without a hack you can't do things like updating the minimap image dynamically, sorry for that. You can't change the type of a destructable or get its scale either. And the final line of code you placed is not JASS. But getting the array index of a destructable is easy if you use gamecache to first link the index of the array to the handle id of the tree |
| 01-19-2006, 01:10 AM | #3 | |
I was just giving straightforward code of what I wanted to do in the last example... Quote:
I would have no idea how to do this. Even if I did, I don't have a use for it unless I can get the actual tree into a destructible variable and work with it.. i.e.: treed1 = destructable[udg_i]...? So I would need to create an array for that |
| 01-19-2006, 01:39 AM | #4 |
well you can hide/show destructibles anyways |
| 01-19-2006, 01:58 AM | #5 |
But how would I do that? I have no idea where to start. |
| 01-19-2006, 02:04 AM | #6 |
There is a native function that hides destructables. JASS:native ShowDestructable takes destructable d, boolean flag returns nothing You can hide a destructable then show the winter version of it. The problem would be the scale there is no way to set/get it in game. But that does not have to be a problem, I take it that you really want this feature so you could sacrifice variation in scale (make it so all destructables have 1.0 for scale) |
| 01-19-2006, 02:33 AM | #7 |
But, I already have a way to do that by both hiding and replacing the tree.... is there a way to reduce the footprint in the region then... ? (for instance, making it a point instead of a huge 400x400 box for each destructible) |
| 01-19-2006, 03:16 AM | #8 |
Man, what a mess! I finally figured out how to do it using the return bug. I got the pointers to the trees when creating for the first time and then referred to them when deleting/making more. (And got the pointers again, etc.) |
