• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

[Solved] (Jass) Silence on AoE - Remove DMG

Status
Not open for further replies.
Level 7
Joined
Sep 16, 2016
Messages
185
Hello,

Firstly, here is the Jass code;

JASS:
function SacredSongCast6 takes nothing returns nothing
local timer t=GetExpiredTimer()
local integer id=GetHandleId(t)
local unit u=LoadUnitHandle(h,id,0)
local real dmg=GetHeroInt(u,true)*(0.2+0.1*GetUnitAbilityLevel(u,0x41313955))
local real x1=LoadReal(h,id,4)
local real y1=LoadReal(h,id,5)
local real a=LoadReal(h,id,3)
local integer i=50
local real dist=LoadReal(h,id,2)
local real dist2=LoadReal(h,id,6)
local group g=LoadGroupHandle(h,id,10)
local player p=GetOwningPlayer(u)
if dist<1.1 then
call SaveReal(h,id,2,dist+0.1)
set n=CreateUnit(p,0x65313038,x1,y1,a*bj_RADTODEG)
call SetUnitTimeScale(n,1)
call UnitApplyTimedLife(n,1,1)
call GroupEnumUnitsInRange(G,x1,y1,400,Base)
loop
set E=FirstOfGroup(G)
exitwhen E==null
if Condition_Base(p,E)then
call UnitDamageTarget(u,E,dmg,false,false,null,null,null)
endif
call GroupRemoveUnit(G,E)
endloop
else
call RemoveUnit(LoadUnitHandle(h,id,2))
call DestroyLightning(LoadLightningHandle(h,id,11))
call DestroyLightning(LoadLightningHandle(h,id,12))
call DestroyLightning(LoadLightningHandle(h,id,13))
call DestroyLightning(LoadLightningHandle(h,id,14))
call DestroyLightning(LoadLightningHandle(h,id,15))
loop
set de=LoadDestructableHandle(h,id,i)
exitwhen de==null
call RemoveDestructable(de)
set i=i+1
endloop
call ForGroup(g,function KillGroup)
call DestroyGroup(g)
call PauseTimer(t)
call DestroyTimer(t)
call FlushChildHashtable(h,id)
endif
set g=null
set u=null
set p=null
set t=null
endfunction

If I were to remove ''local real dmg='' - the spell itself shouldn't take any damage, right?
If not, correct me.

Moving on to the REAL hurdle that I have faced for 2 hours straight now and can't seem to just crack this nut - so guidance would be very appreciated.

Basically what I want to do, is simply removing the damage AND add a AoE silence for it. Now, most of it is done, the spell and everything that is - it is already set up and it already has an AoE; the only thing I need to do now is add a Silence Effect to it and everything is *perfect* - but I have no clue on how to add the silence so it would be nice with a bit of help here.

Regards
 
Last edited:
Level 37
Joined
Jul 22, 2015
Messages
3,485
So a few things:
  • You can only bump a post after 48 hours
  • If you have a script you need to fix, post it in Triggers & Scripts, not World Editor Help Zone (moved it for you)
  • Use [code=jass][/code], not [CODE][/CODE]
If I were to remove ''local real dmg='' - the spell itself shouldn't take any damage, right?
Yes it would, but you would get a "undeclared variable" error. You are going to want to remove this line as well: call UnitDamageTarget(u,E,dmg,false,false,null,null,null)

add a AoE silence for it.
You have two options:
  • Use a "disabled" unit system in the database, or look for one that just silences. You will either need to enumerate the units in an area and then call the system through it's API, or you can just declare a radius and call the system
  • Create a dummy unit and order it to use the silence ability on an area
 
Level 15
Joined
Mar 25, 2016
Messages
1,327
There are other abilities than silence, that can prevent the unit from casting spells. Soul Burn silences the target and Drunken Haze and Cloud can be modified to silence their target's as well. Using Soul Burn/Drunken Haze you can easily silence a specific unit.
 
Level 7
Joined
Sep 16, 2016
Messages
185
Thanks for the replies! And thanks for moving the topic and once again, the thing about bumping.

Now moving on, I only plan to use Jass when I make the Silence ability;

Now take this as an example; I made a spell and everything in Jass, it works perfectly. I removed the damage but adding a Silence on top of the spell is of course different; and I have no clue on what to do that you told me KILLCIDE, sorry. :/

Jampion, I haven't learned that step in Jass quite yet; my apologies.

If you want to contact me in person; my Discord is: null#2675

Once again, thanks for the help! Appreciate it and sorry for breaking some of the rules.
 
Level 15
Joined
Mar 25, 2016
Messages
1,327
Providing a map with the spell would help a lot.
Basically what you want to do is replace the line
JASS:
call UnitDamageTarget(u,E,dmg,false,false,null,null,null)
with a piece of code that silences this unit.
This is usually done by using a dummy unit that casts a spell with the desired effect on the target. Single target effects are always best in this case as they only hit the target. Here you can choose between Drunken Haze and Soul Burn.
It really does not matter which one you choose in general. However as the same base ability cannot have multiple active instances on the same unit, you should choose a base ability, you are not using as a different ability in your map.
What the code should do is:
Create dummy unit.
Add ability to dummy unit.
Order dummy unit to cast ability on target.
Add expiration timer on dummy unit to remove it after it has finished casting.
 
Level 7
Joined
Sep 16, 2016
Messages
185
Providing a map with the spell would help a lot.
Basically what you want to do is replace the line
JASS:
call UnitDamageTarget(u,E,dmg,false,false,null,null,null)
with a piece of code that silences this unit.
This is usually done by using a dummy unit that casts a spell with the desired effect on the target. Single target effects are always best in this case as they only hit the target. Here you can choose between Drunken Haze and Soul Burn.
It really does not matter which one you choose in general. However as the same base ability cannot have multiple active instances on the same unit, you should choose a base ability, you are not using as a different ability in your map.
What the code should do is:
Create dummy unit.
Add ability to dummy unit.
Order dummy unit to cast ability on target.
Add expiration timer on dummy unit to remove it after it has finished casting.

First; heres the map: MEGA

Secondly, very very well explained, thank you! I will try this once I return from a special occasion I attend atm.
The line in the war3map.j is 30057; and pay attention; there seems to be more than one function for the spell.

Thanks! Will try what you explained.

EDIT: Unfortunately it didn't seem to work; the enemies inside the AoE doesn't get silenced.
 
Last edited:
Level 15
Joined
Mar 25, 2016
Messages
1,327
Can you upload the map? The MEGA-file is expired. Just use the "Upload a File"-button to directly upload it to hive (easier for people and does not expire).
 
Level 7
Joined
Sep 16, 2016
Messages
185
Can you upload the map? The MEGA-file is expired. Just use the "Upload a File"-button to directly upload it to hive (easier for people and does not expire).

The map isn't really needed. We just need to see the code you made to silence the units in the area.

I uploaded map!

About the Silence code; I can't seem to find it xD
 

Attachments

  • ChoiceBattleRemastered_2.4b.w3x
    12.8 MB · Views: 79
Level 15
Joined
Mar 25, 2016
Messages
1,327
I am not able to open your map (no triggers/imports are loaded) for whatever reason. Can you post the code?

This is how it should look like.
JASS:
set dummy = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),'dumy',x,y,0)
call UnitAddAbility(dummy,'abil')
call IssueTargetOrder(dummy,"soulburn",target)
call UnitApplyTimedLife(dummy,'BTLF')
'dumy' is the raw code of your dummy unit
'abil' is the raw code of your silence spell
"soulburn" is the order string of your silence spell (either soulburn or drunken haze)
target is the target of the silence
 
Status
Not open for further replies.
Top