The cries of the woods
Would you like to react to this message? Create an account in a few clicks or log in to continue.

The cries of the woods

A mod of the popular game Warcraft 3. The mod features a new campaign, new units and a new soundtrack.
 
HomeLatest imagesSearchRegisterLog in

 

 new energy harvesting trigger

Go down 
AuthorMessage
Kerloc
Admin
Kerloc


Posts : 8
Join date : 2009-08-23
Location : Rostock, Germany

new energy harvesting trigger Empty
PostSubject: new energy harvesting trigger   new energy harvesting trigger I_icon_minitimeSun Aug 23, 2009 6:07 pm

i have changed the trigger again - the food costs are calculated now

here is the trigger (converted from gui to jass):

function Trig_Energy_Harvesting_Func001Func001Func004C takes nothing returns boolean
if ( not ( GetPlayerState(Player(0), PLAYER_STATE_RESOURCE_FOOD_USED) > 50 ) ) then
return false
endif
if ( not ( GetPlayerState(Player(0), PLAYER_STATE_RESOURCE_FOOD_USED) <= 80 ) ) then
return false
endif
return true
endfunction

function Trig_Energy_Harvesting_Func001Func001Func006C takes nothing returns boolean
if ( not ( GetPlayerState(Player(0), PLAYER_STATE_RESOURCE_FOOD_USED) > 80 ) ) then
return false
endif
return true
endfunction

function Trig_Energy_Harvesting_Func001Func001C takes nothing returns boolean
if ( not ( GetUnitTypeId(GetEnumUnit()) == 'n002' ) ) then
return false
endif
return true
endfunction

function Trig_Energy_Harvesting_Func001A takes nothing returns nothing
if ( Trig_Energy_Harvesting_Func001Func001C() ) then
// Setup of the Costs (food factor)
// 30%
set udg_Energy_harvesting_food_factor = 1.00
if ( Trig_Energy_Harvesting_Func001Func001Func004C() ) then
set udg_Energy_harvesting_food_factor = 0.70
else
endif
// 60%
if ( Trig_Energy_Harvesting_Func001Func001Func006C() ) then
set udg_Energy_harvesting_food_factor = 0.40
else
endif
// :::
set udg_Energy_harvest_value = ( ( 15.00 + I2R(udg_Research_improved_meditation) ) * udg_Energy_harvesting_food_factor )
call AdjustPlayerStateBJ( R2I(udg_Energy_harvest_value), Player(0), PLAYER_STATE_RESOURCE_LUMBER )
// Floating text und visual things
call CreateTextTagLocBJ( ( "+" + I2S(R2I(udg_Energy_harvest_value)) ), GetUnitLoc(GetEnumUnit()), 30.00, 10, 30.00, 30.00, 100, 30.00 )
call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 55.00, 90 )
call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 5 )
call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
call AddSpecialEffectLocBJ( GetUnitLoc(GetEnumUnit()), "Abilities\\Spells\\Undead\\ReplenishMana\\ReplenishManaCasterOverhead.mdl" )
call SetUnitAnimation( GetEnumUnit(), "Attack spell" )
else
endif
endfunction

function Trig_Energy_Harvesting_Actions takes nothing returns nothing
call ForGroupBJ( GetUnitsInRectAll(GetEntireMapRect()), function Trig_Energy_Harvesting_Func001A )
endfunction

//===========================================================================
function InitTrig_Energy_Harvesting takes nothing returns nothing
set gg_trg_Energy_Harvesting = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_Energy_Harvesting, 15.00 )
call TriggerAddAction( gg_trg_Energy_Harvesting, function Trig_Energy_Harvesting_Actions )
endfunction
Back to top Go down
https://tcotw.board-directory.net
 
new energy harvesting trigger
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
The cries of the woods :: development :: triggers-
Jump to: