Ok. I've got a pistol trigger i made in jass here are the 2 i created. My question is the 2nd one works better then the 1st one because if the player does not have the required amount of gold, then it will issue the unit to Hold Position causing the ability to stop, is there a way to combine
and so that if it returns false then it will do instead of me using this in the acaul action of the trigger
and
JASS:
return i==039;A001039; or i==039;A02C039;
JASS:
if udg_Rounds<i>>=4 then</i>
JASS:
call IssueImmediateOrder(u,"holdposition")
JASS:
if udg_Rounds<i>>=4 then
call AttachSoundToUnit(gg_snd_Pistol,u)
call SetSoundVolume(gg_snd_Pistol, 100)
call StartSound(gg_snd_Pistol)
set udg_Rounds<i> = udg_Rounds<i> - 3
call SetPlayerState(p,PLAYER_STATE_RESOURCE_GOLD,udg_Rounds<i>)
else
call IssueImmediateOrder(u,"holdposition")</i></i></i></i>
JASS:
function PistolFireConditions takes nothing returns boolean
local integer i = GetSpellAbilityId()
local player p = GetTriggerPlayer()
local integer id = GetConvertedPlayerId(p)
return udg_Rounds[id]>=4 and i==039;A001039; or i==039;A02C039;
endfunction
function PistolFire takes nothing returns nothing
local unit u = GetTriggerUnit()
local player p = GetOwningPlayer(u)
local integer i = GetConvertedPlayerId(p)
call AttachSoundToUnit(gg_snd_Pistol,u)
call SetSoundVolume(gg_snd_Pistol, 100)
call StartSound(gg_snd_Pistol)
set udg_Rounds<i> = udg_Rounds<i> - 5
call SetPlayerState(p,PLAYER_STATE_RESOURCE_GOLD,udg_Rounds<i>)
set u = null
endfunction
//===========================================================================
function InitTrig_Pistol takes nothing returns nothing
set gg_trg_Pistol = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( gg_trg_Pistol, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(gg_trg_Pistol,Condition(function PistolFireConditions))
call TriggerAddAction(gg_trg_Pistol,function PistolFire)
endfunction</i></i></i>
and
JASS:
function PistolFireConditions takes nothing returns boolean
local integer i = GetSpellAbilityId()
local player p = GetTriggerPlayer()
local integer id = GetConvertedPlayerId(p)
return i==039;A001039; or i==039;A02C039;
endfunction
function PistolFire takes nothing returns nothing
local unit u = GetTriggerUnit()
local player p = GetOwningPlayer(u)
local integer i = GetConvertedPlayerId(p)
if udg_Rounds<i>>=4 then
call AttachSoundToUnit(gg_snd_Pistol,u)
call SetSoundVolume(gg_snd_Pistol, 100)
call StartSound(gg_snd_Pistol)
set udg_Rounds<i> = udg_Rounds<i> - 3
call SetPlayerState(p,PLAYER_STATE_RESOURCE_GOLD,udg_Rounds<i>)
else
call IssueImmediateOrder(u,"holdposition")
set u = null
endfunction
//===========================================================================
function InitTrig_Pistol takes nothing returns nothing
set gg_trg_Pistol = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( gg_trg_Pistol, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(gg_trg_Pistol,Condition(function PistolFireConditions))
call TriggerAddAction(gg_trg_Pistol,function PistolFire)
endfunction</i></i></i></i>