• 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.

Jass Code item Table

Status
Not open for further replies.
Level 5
Joined
Jan 19, 2020
Messages
102
i want add to Jass Code

function Trig_Neutral_Hostile_Drop_Tables_Actions takes nothing returns nothing
local unit u = GetDyingUnit()
local real ux = GetUnitX(u)
local real uy = GetUnitY(u)
local itempool ip = CreateItemPool()

call ItemPoolAddItemType(ip, 'phea', 20) // Chance: 20/20
call PlaceRandomItem(ip,ux,uy)
call DestroyItemPool(ip)

set ip = null
set u = null
endfunction

//===========================================================================
function InitTrig_Neutral_Hostile_Drop_Tables takes nothing returns nothing
set gg_trg_Neutral_Hostile_Drop_Tables = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Neutral_Hostile_Drop_Tables, Player(PLAYER_NEUTRAL_AGGRESSIVE), EVENT_PLAYER_UNIT_DEATH )
call TriggerAddAction( gg_trg_Neutral_Hostile_Drop_Tables, function Trig_Neutral_Hostile_Drop_Tables_Actions )
endfunction

(Unit-type of (Dying unit)) Equal to footman its hfoo, better take that.

so that only if footman dies it will drop an item.

thanks

this jass code is from here
 
Level 20
Joined
Aug 13, 2013
Messages
1,696
After local declarations;
JASS:
if GetUnitTypeId( GetTriggerUnit( ) ) == 'hfoo' then
After the call PlaceRandomItem;
JASS:
endif

Just a tip:
Note that you can just initialize the locals inside the 'if block'
To avoid more function calls... if it's not a footman
 
Status
Not open for further replies.
Top