• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

no attack

Status
Not open for further replies.
Level 2
Joined
Jun 25, 2004
Messages
19
hey there are those games that, when your "bullets" (gold) is down to zero, your guy can't attack ppl, how do i do the no attacking part, i have the no gold part, but i can't figure out the no attacking part.
 
Level 12
Joined
Jul 2, 2004
Messages
471
This should be in the trigger forum!

Trigger 1

Event:
If your units is attacking

Conditions:
Attacking unit equal your units

Actions:
Set players gold: gold - 1

Trigger 2

Event:
If your gold is equal to 0

Actions:
Set your enemy to allies

I have not WE open, so go and find the triggers.
 
Level 2
Joined
Jan 3, 2005
Messages
19
ok Emergancy did not help you much so i will...





AntiAttack
Events
Unit - A unit Is attacked

Conditions
((Triggering player) Current lumber) Less than or equal to 0
(Unit-type of (Triggering unit)) Equal to Rpger (Ranger)
(Item-type of (Item being manipulated)) Equal to Bow
Actions
Unit - Order (Attacking unit) to Stop
Player - Make (Triggering player) treat Player 12 (Brown) as an Ally
__________________________________________

And heres a simple jass thing for the attacking
__________________________________________


function Trig_Attacking_Conditions takes nothing returns boolean
if ( not ( GetPlayerState(GetTriggerPlayer(), PLAYER_STATE_RESOURCE_LUMBER) >= 1 ) ) then
return false
endif
if ( not ( GetUnitTypeId(GetTriggerUnit()) == 'E005' ) ) then
return false
endif
return true
endfunction

function Trig_Attacking_Actions takes nothing returns nothing
call SetPlayerStateBJ( GetTriggerPlayer(), PLAYER_STATE_RESOURCE_LUMBER, -1 )
endfunction

//===========================================================================
function InitTrig_Attacking takes nothing returns nothing
set gg_trg_Attacking = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Attacking, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_Attacking, Condition( function Trig_Attacking_Conditions ) )
call TriggerAddAction( gg_trg_Attacking, function Trig_Attacking_Actions )
endfunction


nuthin to it


[/img]
 
Status
Not open for further replies.
Top