| 04-20-2009, 08:04 PM | #1 |
So I've started to do some coding again, sort of, and I have a few questions and problems: these are in no particular order: 1) Has anyone been able to trigger proper bouncing off of cliffsides (ie they bounce off in roughly the right direction) and other protrusions with any sort of given knockback system? 2) What's a good way to detect cliffs and distinguish between them and hills? Also in the same respect, how can you trigger that a unit can slide up and down hills, but bounce or fly off of cliffs? 3) What is a good way to detect damage coming from ranged unit orb attacks and regular abilities? 4) How do you make floating texts only appear for a particular player? (I just don't know the syntax )5) What would cause a trigger to skip actions without you telling it to? I seem to have this problem because all of my spells were working properly before and I tried adding in a new system to display damage dealt and now some spells don't seem to work, even though I thought they were completely isolated from the workings of the damage system. 6) Attached to this is my testmap, which contains the buggy system (using .GUI, sorry ) for making self-updating floating texts which update whenever a unit takes additional damage from the same source, and eventually dissipate and display the correct damage after a short period of time. How would you do this using JASS?[edit] removed map, link below |
| 04-20-2009, 10:32 PM | #2 |
Cliffs are typically not pathable, hills are. |
| 04-20-2009, 10:53 PM | #3 |
but at the same time, the upper and lower levels of walkable terrain is. Considering I'm currently measuring on a point basis, if I miss the point where it's unpathable, my units are just gonna keep going. Unless there's a specific way to check this already? |
| 04-20-2009, 11:22 PM | #4 | ||||
Quote:
Yes, I have. It is not in the resources section though. I use a vector library to easily calculate an object's "velocity" and "position" vectors while applying the "acceleration" vector to the velocity vector properly. This achieves the effect of real physics. It really isn't that difficult once you know the vector math behind it. Quote:
If you're triggering a slide, then you can find the current cliff-level before you update the unit's position and then again after. If the two values are not the same, then the unit has officially moved down/up a cliff level. You could use different comparison operators to achieve different results. The function is: GetTerrainCliffLevel; Quote:
Most orb effects yield buffs on an affected unit, which you could detect using the EVENT_UNIT_DAMAGED unit event. Orb effects can also be applied to melee attacks, so if you can imagine every unit is given an "invisible" orb ability then you would be able to detect when an instance of damage has come from a trigger (or a regular ability) or a physical attack. Quote:
JASS:if GetLocalPlayer() == specificPlayer then // create and setup the floating text within this block endif In the previous code specificPlayer refers to a variable reference to the player that you would like to display the text-tag (floating text) for. For example, if it were the case that specificPlayer was set to reference the player Player(0) then the text-tag would only be displayed to player one. This is what I could answer off the top of my head, I'll look into your other queries. **I just saw the name of your map now, and its kind of funny - I have a map I'm working on named "Heroes" as well. This is something that I saw when looking through your "Damage setup" triggers. Trigger: You should add a "Custom Script: DestroyGroup( udg_TempStartGroup )" to remove the group handle. It doesn't make much of a difference because the group is only referenced once, but its always nice to try and be 100% clean. Trigger: Do Multiple ActionsFor each (Integer A) from 1 to 1600, do (Actions)![]() Loop - ActionsThe idea of updating these text-tags every 0.05 seconds, in which you loop through 1600 indexes doesn't seem very efficient to me. I think there might be a better (and quicker) way to go about this. If anybody pops out at me while I'm reading this I'll try and explain it. |
| 04-20-2009, 11:46 PM | #5 |
1) I got as far as units, but cliffsides don't work the same way because it doesn't collide with another object. I had an idea to create 3+ expanding points which stopped when they hit a cliff jump, then use those points to create a best fit line and use that as my bouncing reference (ie my virtual wall) I'm worried this might lag a lot so i wanted to know if there was a better method for bouncing off of cliffsides. 2) Ok that's what I did, well sort of. Each cliff is actually 128 higher than the previous one so i just did a multiplier to check for that difference and it worked ok... 3) The problem is that I don't need an orb effect for regular melee units because of how i setup my detection (ie all damage not coming from attack comes directly from the hero) The problem with orb effects is i tried using cold arrows and when I tried to get the damage, it returned 0. And it's useless if you want to have damage dealt based on attack damage dealt, so that doesn't work for me either if there is an ability that works and doesn't return 0 damage then I'll use that. Or I'll cheat..... 4) Thanks I'll try and work that in right away. BTW that damage detection is pretty much a copy of the really leaky one I saw on here but it's the only non-jass way I could setup my preliminary system. Also, I know that 1600 cycles is very inefficient, that's why I was wondeirng how I'd set this up differently in JASS (i'm slowly making the transition) that 1600 is basically 16 groups of 100 possible units running at 1 time. If a unit exists in a slot, then it updates the FT for that unit and cycles through for all units. This is the only way I could think of to make it MUI for 12 players (since i'm not sure which 12 are users and which 4 are neutral...) |
| 04-21-2009, 12:11 AM | #6 |
For the 1,600 cycles thing, construct a simple algorithm by using a loop that figures out the highest number to cycle through, updating each time a projectile is created. |
| 04-21-2009, 01:13 AM | #7 |
Yeah that might cut it down to about 1/4-1/10th of it's used space since the FT instances last about 2-3 seconds before the slot is voided. Hmmm, I could also use the more efficient way of replacing the values from the last slot to the current slot. That way the system would only be running at about 5% capacity for most of the time, and for large unit groups, maybe 20-25%. Could be interesting to see how much faster it goes. In all actuality, unless there's a full house and every type of player is used, this system uses a very small portion of its capacity. Each player is about 6% of the systems capacity. So if no creeps are used then it's already using 24% less space each time it runs through, if i set it up right. |
| 04-24-2009, 02:52 PM | #9 |
About cliffs (and hills), you should be using GetLocationZ and working out the average terrain normal from a small sample area around the target point. Check out any physics systems if you're interested. |
| 04-26-2009, 12:17 AM | #10 |
can you give me a link to one? also, the most prominent issue right now is my floating text code. ANYONE have ANY idea how it can leak? |
| 04-26-2009, 02:36 AM | #11 |
http://www.wc3c.net/showthread.php?t=98089 No idea about the floating text code, but I can't say I put too much effort into reading it - I can't stand GUI. Why are you using a for loop over a single value? (For each integer b from 2 to 2) |
| 04-26-2009, 05:59 AM | #12 |
Basically the whole idea is to create self-updating floating texts that will constantly update the damage they display for a unit, as long as it is within a very short time frame (currently damage instances are set to update the FT if they are within 0.35 seconds between each instance). The main reason for this is because I had some abilities that fired multiple small projectiles, or dealt small amounts of damage rapidly, so i figured this system would give the player a much better estimate of how much damage their ability was doing for a single unit. Right now it's not quite accurate for what I wish to make it out to be (once I actually finish my damage detection system) but it displays everything properly, for the most part. Anyways, dl the map and try it out for about 2-3 minutes and you can see how the systems display looks.... and you will also notice the weird bug which I have been unable to locate in which floating texts are left undestroyed and all displayed across the playing field. that's not normally how it works, I just set it up to go through that one value (normally it's 1-12, so 1 cycle through for every player slot. As far as reading the code, there's only about 8 lines that you need to focus on, 6 of those are the last 6 lines of the code, not counting the game displayed messages. what the system does is it tracks up to 100 units (as it is right now) of which it will display the damage they take, per player but it stores all units, damage, floating texts, etc in one giant array of 1200 slots. I split up that array and only cycle through slots that actually have information, ie |
| 04-26-2009, 05:50 PM | #14 |
For bouncing off cliffs, the easiest way is to use the vector library to get the terrain normal vector at the collision point, flatten it's z value and then use it to modify the projectile's velocity vector (by subtracting from it it's projection onto the normal multiplied by two). |
| 04-26-2009, 06:29 PM | #15 |
@Antiarf: vector library? link or is it a function or what? I might have to modify my knockback system to work that in. @Dark: Hmmm, the problem isn't associated with the colors. BTW I've taken my system out of the big map and just put in by itself. You can all look and see for how it works a lot quicker now... each unit actually has 2 floating texts attached to them: one follows them around and updates itself and follows the unit, and then when the timer expires, that first one is destroyed and a second short duration floating text is created (this one isn't defined or attached to any variable so it shouldn't bug out). [edit] found the problem although I still don't understand it. Apparently if I can't transfer information between floating texts by just setting one as another...I have to manually create and update a new floating text, or something like that. Hopefully others might find this useful. Now I know it's just .GUI but it's the most efficient way I've been told of for keeping track of the data and updating everything so I hope yall enjoy. |
