| 01-29-2008, 08:27 PM | #1 |
Hey I have a problem with a spell i made, its the expansion wave of a nuclear explosion, this is how it works: First it starts the countdown over the hero head, then if the hero is still alive it creates 18 casters (for player PLAYER_NEUTRAL_AGGRESSIVE in 18 diferent directions, making a circle), it kills the hero (to make it more realistic it should kill everything in the area so the triggering unit must die too) and it orders each of the 18 units to cast shockwave in the direction they are pointing. The problem is that I want that the player who casted the spell gets all the bounty of the surrounding units for which the casters should be owned by that player, but the issue is that shockwave doesnt hit alies (which should be hited if they are in the area of the explosion, reason why the units are owned by PLAYER_NEUTRAL_AGGRESSIVE). Is there a way to make shockwave hit alies or is there another spell like shockwave that i can use to create this efect? Thanks! Spell: JASS:function NeutronBomb_Wait takes unit caster returns nothing local texttag tt local location l = GetUnitLoc(caster) local integer i = 3 loop exitwhen i < 1 set tt = CreateTextTagLocBJ(I2S(i), l, GetUnitFlyHeight(caster), 10.00, 100.00, 0.00, 0.00, 0.00) call ShowTextTagForceBJ(true, tt, udg_Gen_Players) call SetTextTagVelocityBJ(tt, 55.00, 90.00) call SetTextTagFadepoint(tt, 2.00) call SetTextTagLifespan(tt, 3.00) call SetTextTagPermanent(tt, false) call MyPolledWait(1.00) set i = i - 1 endloop call RemoveLocation(l) set l = null set tt = null endfunction function Trig_Neutron_Bomb_Conditions takes nothing returns boolean if (GetSpellAbilityId() == rcAbNeutronBomb()) then return true endif return false endfunction function Trig_Neutron_Bomb_Actions takes nothing returns nothing local location l = GetUnitLoc(GetTriggerUnit()) local unit array casters local integer i = 1 call NeutronBomb_Wait(GetTriggerUnit()) if (GetUnitState(GetTriggerUnit(), UNIT_STATE_LIFE) > 0) then loop exitwhen i > 18 set casters[i] = CreateUnitAtLoc(Player(PLAYER_NEUTRAL_AGGRESSIVE), rcNbCaster(), l, I2R(i) * 20.00) set i = i + 1 endloop call KillUnit(GetTriggerUnit()) set i = 1 loop exitwhen i > 18 call UnitApplyTimedLifeBJ(0.50, 'BTLF', casters[i]) call IssuePointOrderLoc(casters[i], "shockwave", l) set casters[i] = null set i = i + 1 endloop endif call RemoveLocation(l) set l = null endfunction //=========================================================================== function InitTrig_Neutron_Bomb takes nothing returns nothing set gg_trg_Neutron_Bomb = CreateTrigger() call TriggerRegisterAnyUnitEventBJ(gg_trg_Neutron_Bomb, EVENT_PLAYER_UNIT_SPELL_CHANNEL) call TriggerAddCondition(gg_trg_Neutron_Bomb, Condition(function Trig_Neutron_Bomb_Conditions)) call TriggerAddAction(gg_trg_Neutron_Bomb, function Trig_Neutron_Bomb_Actions) endfunction |
| 01-30-2008, 03:15 PM | #2 |
You ran into the same problem i did. resorting to neutrals just so you can hit your own stuff as well as the other players. There is a trick i did in my map to keep track of who gets credit for what I had a bomb that released shockwaves.. so i created this bomb unit. and when it blew up, i created 4 neutral-hostile shockwave dummy units.. and i set their custom value equal to the Player Number of the dying unit (the bomb) so that i keep track of the player who i want to give credit. Then, make your actual shockwave spell deal 0.00 damage. or some other exact number. doesn't matter what really. then have a damage detection trigger with no events... and also create two other triggers that add events to that damage detection trigger of pick every unit.. loop ->"when picked unit takes damage "at the ini of the first trigger.. and in the other trigger have "when entering unit takes damage" so now your damage detection trigger would have events made mid game for every unit created or ever made. now, in that damage detection trigger put some conditions: if "damage source not equal to null/no unit" if "attacked unit is not equal to null/nounit" If "damage source is equal to DummyNeutralSHockwaveCaster[Integer a]" or you could use Unit-type of dmaage source is equal to the unittype of shockwave dummy caster. and here is the key part.. if Real "damage taken is equal to 0.00" and Owner of dummyshockwavecaster or damage source is equal to neutralhostile then cause RealCastingUnit[Player(Custom value of damage source)] //= as in the non-dummy casting unit that initiated the nuke that way it damages the unit on behalf of the correct unit.. and it can never screw up. because the dummy units are perfectly marked for the correct player number. if the caster unit is dead or doesn't exist or somehow you have many of those units that keep initiated nukes and you are having trouble keeping track of who is currently set to that variable.. by the time your nuke goes off you could also create a "DamageCreditDummyUnit" with an expiration timer the sole purpose of damaging the units and then disapearing...for player(custom value of damage source) just before the Cause damage function so then it would finish with Cause Lastcreatedunit to damage Attacked Unit, dealing xxx there you go |
| 01-31-2008, 05:45 AM | #3 |
I really would recreate the whole spell from scratch, meaning that I actually create a shockwave using JASS. Then I can make it do whatever I want it to. If you don't mind if the units take damage when the spell is cast rather than when the shockwave 'hits' them, it is extremely easy and I could do it for you. I've already created a very similar spell that would be easy to adapt to what you want. If you want them to take damage when the shockwave hits them, then I won't do it. I don't have the time at the moment to recreate shockwave and have it cast. Edit: I think my suggestion would be easier to do than Brash's. His method works but where it isn't actually doing damage via the shockwave, it just screams wrong at me. My inner programmer says that's a no-no when you can actually make the shockwave do damage. |
| 01-31-2008, 07:09 AM | #4 |
you do not need bounty from ally, so make 36 casters 16 for self and 16 for hostile. |
| 01-31-2008, 07:46 AM | #5 |
Make 1, make it cast everything. |
| 01-31-2008, 08:48 AM | #6 |
There's an easy way to solve this, but it will only work if you have 2 (and only 2) forces/teams in your map. Synthesizing what both Malf and DioD said: you need 2 casters, but they will still cast a total of 36 shockwaves. You'll need 2 shockwave spells: one with a missile art and one without. Make both spells identical copies of each other except for the aforementioned difference; they should also only each affect enemies. Then, make sure your universal dummy unit (or whatever you use to dummy cast spells on your map) has a "cast backswing" and "cast point" of 0.00. When the spell is cast, do this: Create 1 of these dummy units and add the first spell to it (the one with art); make sure the owner of the dummy unit is the casting player. Then, move the dummy to the first point, cause it to face the center, and order it to cast the shockwave. Wash, rinse, and repeat for all 17 other points. Add a 5 second or so expiration timer to this dummy. Next, create another dummy unit, but this time create it for a player on the opposing team. Add the other shockwave ability to this new dummy and cast all 18 shockwaves as you did with the 1st dummy. This time, however, remove the dummy immediately after casting all 18 shockwaves (they will be cast instantly because you modified the unit's cast points). Now, the reason that this works is because of this: a player only gains bounty for a kill from an ability like shockwave, shadow strike, etc., if the unit that cast the spell is alive at the time of death of the unit. Since the dummy is not alive for the other player when/if units die from it, he will gain no bounty from this. Now, if I am wrong about this and my above statement does not hold through for shockwave (I only remember testing on Shadow Strike at one point), you simply need to transfer ownership of the second dummy to a computer player that's allied with the opposing team instead of to any random player. |
| 02-02-2008, 01:01 PM | #7 |
Thank you everyone! they are all valid ideas ill use the last one but ill make the second caster hostile as it is now so i can use it fer every map (i have 3 of them and one is multiteam) the spell is supposed to kill everything so i dont care if it deals twice dmg to the caster's alies. Also i had no idea about the casting point and cast backswing issues (reason why i use 18 units, LOL!) so also thanks for that tip. Brashes idea is fine but way too complicated and you need more than one trigger to make the spell which for my maps makes it complicated to export/import. So thanks for the help ppl ![]() |
| 02-03-2008, 04:49 AM | #8 |
Yeah. You can make a unit cast spells instantly by setting cast point and backswing to 0.00. Quite a handy trick, I must say. |
| 02-04-2008, 05:33 PM | #9 |
Im having a problem when changing the unit facing, remember the trigger for the spell? well this is the modified acording to the answers that you gave me: JASS:function Trig_Neutron_Bomb_Actions takes nothing returns nothing local location l = GetUnitLoc(GetTriggerUnit()) local unit caster local unit casterNoArt local integer i call NeutronBomb_Wait(GetTriggerUnit()) if (GetUnitState(GetTriggerUnit(), UNIT_STATE_LIFE) > 0) then set casterNoArt = CreateUnitAtLoc(Player(PLAYER_NEUTRAL_AGGRESSIVE), rcNbCasterNoArt(), l, bj_UNIT_FACING) set caster = CreateUnitAtLoc(GetOwningPlayer(GetTriggerUnit()), rcNbCaster(), l, bj_UNIT_FACING) call UnitApplyTimedLifeBJ(5.00, 'BTLF', caster) call KillUnit(GetTriggerUnit()) set i = 1 loop exitwhen i > 18 call SetUnitFacing(caster, I2R(i) * 20.00) call IssuePointOrderLoc(caster, "shockwave", l) call SetUnitFacing(casterNoArt, I2R(i) * 20.00) call IssuePointOrderLoc(casterNoArt, "shockwave", l) set i = i + 1 endloop call RemoveUnit(casterNoArt) endif call RemoveLocation(l) set l = null set casterNoArt = null set caster = null endfunction the big problem is that SetUnitFacing isnt realy making the unit to face to a diferent angle, i changed the backswing and cast point as you told me, maybe my dummy unit is not right, i been looking for a tutorial on making a dummy unit but there is none, is there anothe parameter that i should change so the unit turns instantly? Thanks |
| 02-04-2008, 07:32 PM | #10 |
I'm at school, so I can't take the time to go through it right now, but this might help you: On Dummy Casters |
