| 06-23-2008, 07:00 PM | #1 |
Alright. I've been around since TFT came out, and I've always tinkered around with the WE and only lately am I getting a bit of popularity for one of my projects, The Lazy War. However, I've decided on going down a different path. I want to create two different maps, but since the second one still gives me a headache thinking about the work required, I need help starting the first one. Like the person who posted sometime ago, I need to develop a physics system for a map called Catapults. I don't really care about flight, but I need projectiles to explode and knockback enemies, send large shrapnel fragments about, knock around enemies when not directly contacted them, etc. Very specific crud I'll ask about later. Here's the trouble. I see a lot of JASS around this board, but it's always absolutely confounded me. Anyone who tries explaining it to me thus far has just used the condescending "I'll explain it, but only in a way someone who already knows it could understand, and lord it over them with the confusing vocabulary they know nothing of." For starters, I just want to know how you would go about setting off an explosion which would knock someone around. If this goes answered, I'll ask then next step, and the next, until this problem is resolved, and if I'm allowed to. Thanks |
| 06-23-2008, 07:22 PM | #2 | ||
Quote:
Quote:
|
| 06-23-2008, 07:27 PM | #3 |
You hit the nail on the head with the second response, but you lost me at "You could replace parallel arrays with a single array of structs if you're using vJass, also it's usually a faster implementation to replace speed and direction with x and y speed." I'm assuming I could use a buff to add the units to these arrays. I want direction to be the angle the unit was in comparison to the explosion, like if it was to the absolute north of the explosion theoretically, it would move north. I want it all to be relative to a certain value, maybe percentage of HP, lower it gets, the more it slides, accounting for both the speed and time. Unless the time can't be altered using a comparison to the unit's HP... If I knew more I'd want to make the unit slow down... There's a way to remove collisions while a unit's under this effect right? Say I want him to bump and bounce or remain sliding into a tree until the effect is done, but if I want him to slide off a cliff and into a crevice I can remove his collisions when he hits the edge (marked by a rect,) and the unit has the sliding buff? p.s. Regarding arrays, how do I set the affected units all as the array value? I mean, do I have to do a unit group, and for every unit within range of casting unit, add picked unit to array [current array value + 1] or something along those lines? |
| 06-23-2008, 09:18 PM | #4 | |||||
Quote:
The second part means that you can translate the speed and direction into x speed and y speed (x speed = speed * cos(direction)) and then store those values, so you don't need to calculate them every time you move the unit. Quote:
Quote:
Quote:
Quote:
JASS://adding a unit to the array //"unit" is the unit that is being pushed set slidingUnit[numberOfSlidingUnits] = unit //add the unit at the end of the array set slidingSpeed[numberOfSlidingUnits] = ... ... set numberOfSlidingUnits=numberOfSlidingUnits+1 JASS://removing a unit from the array //"int" is the array index of the unit being removed from sliding units set numberOfSlidingUnits=numberOfSlidingUnits-1 set slidingUnit[int] = slidingUnit[numberOfSlidingUnits] //use the unit at the end of the array to overwrite the unit being removed set slidingSpeed[int] = slidingSpeed[numberOfSlidingUnits] ... |
| 06-23-2008, 10:06 PM | #5 |
Ahh. It's becoming clearer and clearer. I mentioned the buff to link the trigger to the explosion at the end. Hmmm... Alright, so the following variables I'll need are a unit variable, a integer variable, and another integer variable, or a real? I use the move unit instantly trigger, and use the offsets? Now I'm confused again, this time on the actual moving trigger >_> |
| 06-23-2008, 10:30 PM | #6 |
You have the sliding speed, defined in distance units per second, let's say 1000. Then you have your timer period, let's say 0.02 seconds (that makes it run 50 times per second, which should look fairly smooth). The distance the unit travels on each timer tick is then 1000*0.02=20 distance units. You move it with something like this: JASS:local integer i=0 loop exitwhen i>=numberOfSlidingUnits call SetUnitX(slidingUnit[i], GetUnitX(slidingUnit[i])+slidingSpeed[i]*timerPeriod*Cos(slidingDirection[i])) call SetUnitY(slidingUnit[i], GetUnitY(slidingUnit[i])+slidingSpeed[i]*timerPeriod*Sin(slidingDirection[i])) set slidingTime[i]=slidingTime[i]-timerPeriod if slidingTime[i]<=0 then set numberOfSlidingUnits=numberOfSlidingUnits-1 set slidingUnit[i] = slidingUnit[numberOfSlidingUnits] set slidingSpeed[i] = slidingSpeed[numberOfSlidingUnits] set slidingDirection[i] = slidingDirection[numberOfSlidingUnits] set slidingTime[i] = slidingTime[numberOfSlidingUnits] else set i=i+1 endif endloop |
| 06-24-2008, 04:45 AM | #7 |
If you're looking to make a knockback system... Coding an efficient knockback is an excellent step-by-step tutorial. It does use vJASS, but in a way that you can follow along and not worry about not knowing vJASS. |
| 01-10-2009, 08:50 PM | #8 |
I think I'm going to roll with anitarf's ideas.. I'm starting to use Jass, have vJass... so what variables do I need exactly? speed array time array unit array and direction array, units and reals right? |
| 01-10-2009, 09:48 PM | #9 |
If you want to have deceleration, then you would need arrays for: Unit / Deceleration and xVelocity / yVelocity or velocity / direction Yes, it would be unit / real arrays |
