- Joined
- Jan 12, 2010
- Messages
- 454
Basically what I want accomplish is to add a muzzle flash special effect every time a unit carrying a machine gun fires his weapon.
I've seen it done in at least a few maps, and the open source one I looked at showed it was done with JASS. I don't understand JASS for the life of me, but here’s the JASS text from trigger creating the weapon effect(s):
I'd greatly appreciate if someone could show me how do this with MUI (If its possible) and how to do it with more than one type of gun flash, for the moment all of the units in my map carry fixed weapons attached to their models.
Any help would be wonderful.
I've seen it done in at least a few maps, and the open source one I looked at showed it was done with JASS. I don't understand JASS for the life of me, but here’s the JASS text from trigger creating the weapon effect(s):
JASS:
//TESH.scrollpos=0
//TESH.alwaysfold=0
library GunFlashes initializer Init requires GlobalFuncs
//TRIG: FI, Cond: dq, Func: kq
private function Conditions takes nothing returns boolean
local unit u=GetAttacker()
local player p=GetOwningPlayer(u)
local integer index=GetPlayerId(p)+1
if IsPlayerInForce(p,PLAYER_JAMMED)==false and IsPlayerInForce(p,BURST_WAIT)==false and IsUnitInGroup(u,NADING)==false and IsUnitInGroup(u,SAFETY)==false and IS_LINKING_BELTS[index]==false and CURRENT_AMMO[index]>0 or IsUnitType(u,UNIT_TYPE_HERO)==false then
set u=null
return true
endif
set u=null
return false
endfunction
private function Actions takes nothing returns nothing
local unit u=GetAttacker()
local integer id=GetUnitTypeId(u)
if id=='H000' or id=='H011' or id=='H00J' or id=='H00I' or id=='H00C' or id=='H00D' then
call DestroyEffect(AddSpecialEffectTarget("war3mapImported\\Gunshot Effect.MDX",u,"weapon"))
endif
if id=='H001' or id=='H00P' then
call DestroyEffect(AddSpecialEffectTarget("war3mapImported\\MachineGunEffect.MDX",u,"weapon"))
endif
if id=='H008' or id=='H01I' then
call DestroyEffect(AddSpecialEffectTarget("war3mapImported\\SMG Gunshot.MDX",u,"weapon"))
endif
if id=='H00H' and GetUnitAbilityLevel(u,'A074')==0 then
call DestroyEffect(AddSpecialEffectTarget("war3mapImported\\SniperEffectAttachment.MDX",u,"weapon"))
endif
if id=='H00N' then
call DestroyEffect(AddSpecialEffectTarget("war3mapImported\\ShotgunEffect.MDX",u,"weapon"))
endif
set u=null
endfunction
// Initializer
private function Init takes nothing returns nothing
local trigger T = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(T,EVENT_PLAYER_UNIT_ATTACKED)
call TriggerAddCondition(T,Condition(function Conditions))
call TriggerAddAction(T,function Actions)
endfunction
endlibrary
I'd greatly appreciate if someone could show me how do this with MUI (If its possible) and how to do it with more than one type of gun flash, for the moment all of the units in my map carry fixed weapons attached to their models.
Any help would be wonderful.
Last edited: