• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

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