HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Help with a JASS trigger

01-20-2004, 12:53 AM#1
Huh
OK first off I'm not sure if this should be here, or in Map Development forum, or elsewhere but i figured HEY its Jass related so this is a good place to start.

I'm trying to use Darky27's "treeseed" trigger in my map and he seems to have no problem with it in the email i got from him. It's pretty awesome and ALMOST perfect for what i need for my map. Problem is that the trees grow too slow, aaaand its the wrong kind of tree. Basically I want to swap out the current tree (which appears to be a Barren tree base) with an Ashenvale Tree Base or a Village Tree Base and decrease the grow time to maybe 8-10 seconds. Thats about it. Oh ya and i dont think this is trigger related but I want to make the item have unlimited charges. OOk heres the script.

//===========================================================================
// Trigger: Tree Seed
// Script Author: Darky27
// Email: [email protected]
// Info: Plants Trees
//===========================================================================

function Trig_Tree_Seed_Conditions takes nothing returns boolean
return ( GetItemTypeId(GetManipulatedItem()) == 'I000' )
endfunction

function Trig_Tree_Seed_Actions takes nothing returns nothing
local unit hero = GetManipulatingUnit()
// Change "LTlt" to another Tree... for other tilesets
call CreateDestructableLoc( 'BTtw', GetUnitLoc(udg_ItemSummons ), GetRandomDirectionDeg(), GetRandomReal(0.80, 1.20), GetRandomInt(0, 9) )
call SetDestructableAnimationBJ( GetLastCreatedDestructable(), "birth" )
call AddSpecialEffectLocBJ( GetDestructableLoc(GetLastCreatedDestructable()), "Abilities\\Spells\\Human\\Resurrect\\Resurrecttarget.mdl" )
call RemoveUnit( udg_ItemSummons )
endfunction

function Trig_Tree_Seed_Summon_Conditions takes nothing returns boolean
return ( GetUnitTypeId(GetSummonedUnit()) == 'nglm' )
endfunction

function Trig_Tree_Seed_Summon_Actions takes nothing returns nothing
set udg_ItemSummons = GetSummonedUnit()
endfunction

//===========================================================================
function InitTrig_Tree_Seed takes nothing returns nothing
local trigger Tree_Seed_Summon = CreateTrigger( )
local trigger Tree_Seed_Timer = CreateTrigger( )
local integer i = 0
set gg_trg_Tree_Seed = CreateTrigger( )
loop
exitwhen i > 11
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Tree_Seed, Player(i), EVENT_PLAYER_UNIT_USE_ITEM )
call TriggerRegisterPlayerUnitEventSimple( Tree_Seed_Summon, Player(i), EVENT_PLAYER_UNIT_SUMMON )
set i = i + 1
endloop
call TriggerAddCondition( gg_trg_Tree_Seed, Condition( function Trig_Tree_Seed_Conditions ) )
call TriggerAddAction( gg_trg_Tree_Seed, function Trig_Tree_Seed_Actions )
call TriggerAddCondition( Tree_Seed_Summon, Condition( function Trig_Tree_Seed_Summon_Conditions ) )
call TriggerAddAction( Tree_Seed_Summon, function Trig_Tree_Seed_Summon_Actions )
endfunction

END OF CODE


.. ok thats it, have at it :))

-Huh
01-20-2004, 03:41 AM#2
Huh
hate to bump this but im just replying to say i figured this one out on my own, thanks anyways people :)
01-22-2004, 02:55 PM#3
Kerry
Look at this comment;

// Change "LTlt" to another Tree... for other tilesets

So just change that, to find out the ID's for the tree's press ctrl+d in the object editor to show raw values. Though in this case Darky use 'BTtw' so change that value.

To change the growth time you have to add a function that speeds up the tree's animation;

call SetDestAnimationSpeedPercent( GetLastCreatedDestructable(), 150.00 )

Change 150 to whatever you want, it's a percentual value. (150% faster animation)


I added that line and I changed the tree to ATtr wich is a Ashenvale Tree Wall.

If it doesn't work be sure to tell me.

*EDIT* The code wouldn't stop to mess up when I posted it here so I save it to a .txt document... be sure to turn off word wrap, see next post VV
01-22-2004, 03:02 PM#4
Kerry
Here's the file.
01-22-2004, 03:12 PM#5
Huh
Wow thanks for doing all that. I really should've replied here but I wound up just having a friend help me dissect the trigger piece by piece, and re-writing it using normal triggers in the TFT WE.

Took me about an hour since I had never messed with JASS but all in all it wasnt too hard. Plus since I have it as a normal trigger now its easier to go in and edit values (i decided to change it from an item to an ability with custom cooldown, etc . even added in a gold cost to use it).

I feel bad you did all that to help me and I didnt need help anymore lol. Hey , its an awfully cool trigger though isnt it :). That darky27 is pretty good.

-Huh
01-26-2004, 02:54 PM#6
Kerry
Hehe, no problem :)