| 08-20-2004, 05:23 AM | #1 |
If anyone would do me a huge favor and clean this up, I would be greatly appreciated... I did it the gui, then changed it to jass and one or two small changes so it still has a bunch of udg's for locals... Also, if it would help if posted the original gui along with the converted jass, please let me know. It looks kinda big, but I am sure someone that knows jass pretty well could shrink it down a good chunk. If it helps... what most of it is, is when a transport is upgraded, it saves the unit types that were in the transport, then creates units and loads them into the new transport (I need to use locals, since multiple "bunkers" can be selected and upgraded, so using a trigger with globals only works for one of them.) All I can really do is give rep, but if someone really needs more, I may be willing to trade a custom tileset of your choice (pm me). (if it will take a while, but you have at least started, please let me know) Hopefully this will help me get a little bit better grasp on jass too.... I never was good at programing, but logic is usually no problem. Thanks in advance (hopefully). Edit: This code does not work how it is intended (see above) so if someone can also make the changes needed the script to save unit types, then recreate units and load them into the new unit, that would be awesome... Code:
function Trig_Begin_Upgrade_Bunker_Copy_Copy_Func046C takes nothing returns boolean
if ( ( GetUnitTypeId(GetTriggerUnit()) == 'h03S' ) ) then
return true
endif
if ( ( GetUnitTypeId(GetTriggerUnit()) == 'h040' ) ) then
return true
endif
if ( ( GetUnitTypeId(GetTriggerUnit()) == 'h03U' ) ) then
return true
endif
if ( ( GetUnitTypeId(GetTriggerUnit()) == 'h03V' ) ) then
return true
endif
if ( ( GetUnitTypeId(GetTriggerUnit()) == 'h03W' ) ) then
return true
endif
if ( ( GetUnitTypeId(GetTriggerUnit()) == 'h03T' ) ) then
return true
endif
if ( ( GetUnitTypeId(GetTriggerUnit()) == 'h03Z' ) ) then
return true
endif
if ( ( GetUnitTypeId(GetTriggerUnit()) == 'h02E' ) ) then
return true
endif
if ( ( GetUnitTypeId(GetTriggerUnit()) == 'h03X' ) ) then
return true
endif
if ( ( GetUnitTypeId(GetTriggerUnit()) == 'h03Y' ) ) then
return true
endif
return false
endfunction
function Trig_Begin_Upgrade_Bunker_Copy_Copy_Conditions takes nothing returns boolean
if ( not Trig_Begin_Upgrade_Bunker_Copy_Copy_Func046C() ) then
return false
endif
return true
endfunction
function Trig_Begin_Upgrade_Bunker_Copy_Copy_Func007002002 takes nothing returns boolean
return ( IsUnitInTransportBJ(GetFilterUnit(), GetTriggerUnit()) == true )
endfunction
function Trig_Begin_Upgrade_Bunker_Copy_Copy_Actions takes nothing returns nothing
local string udg_bunker1
local string udg_bunker2
local string udg_bunker3
local string udg_bunker4
local string udg_bunker5
set udg_TempPoint = GetUnitLoc(GetTriggerUnit())
set udg_TempUnitGroup = GetUnitsOfPlayerMatching(GetTriggerPlayer(), Condition(function Trig_Begin_Upgrade_Bunker_Copy_Copy_Func007002002))
call PauseUnitBJ( true, GetTriggerUnit() )
set udg_tempunit = GroupPickRandomUnit(udg_TempUnitGroup)
set udg_bunker1 = UnitId2StringBJ(GetUnitTypeId(udg_tempunit))
call GroupRemoveUnitSimple( udg_tempunit, udg_TempUnitGroup )
call RemoveUnit( udg_tempunit )
set udg_tempunit = GroupPickRandomUnit(udg_TempUnitGroup)
set udg_bunker2 = UnitId2StringBJ(GetUnitTypeId(udg_tempunit))
call GroupRemoveUnitSimple( udg_tempunit, udg_TempUnitGroup )
call RemoveUnit( udg_tempunit )
call UnitSetUpgradeProgress( GetTriggerUnit(), 80 )
set udg_tempunit = GroupPickRandomUnit(udg_TempUnitGroup)
set udg_bunker3 = UnitId2StringBJ(GetUnitTypeId(udg_tempunit))
call GroupRemoveUnitSimple( udg_tempunit, udg_TempUnitGroup )
call RemoveUnit( udg_tempunit )
set udg_tempunit = GroupPickRandomUnit(udg_TempUnitGroup)
set udg_bunker4 = UnitId2StringBJ(GetUnitTypeId(udg_tempunit))
call GroupRemoveUnitSimple( udg_tempunit, udg_TempUnitGroup )
call RemoveUnit( udg_tempunit )
set udg_tempunit = GroupPickRandomUnit(udg_TempUnitGroup)
set udg_bunker5 = UnitId2StringBJ(GetUnitTypeId(udg_tempunit))
call GroupRemoveUnitSimple( udg_tempunit, udg_TempUnitGroup )
call RemoveUnit( udg_tempunit )
call PauseUnitBJ( false, GetTriggerUnit() )
call PolledWait( 0.30 )
call CreateNUnitsAtLoc( 1, String2UnitIdBJ(udg_bunker1), GetTriggerPlayer(), udg_TempPoint, bj_UNIT_FACING )
call IssueTargetOrderBJ( GetTriggerUnit(), "load", GetLastCreatedUnit() )
call CreateNUnitsAtLoc( 1, String2UnitIdBJ(udg_bunker2), GetTriggerPlayer(), udg_TempPoint, bj_UNIT_FACING )
call IssueTargetOrderBJ( GetTriggerUnit(), "load", GetLastCreatedUnit() )
call CreateNUnitsAtLoc( 1, String2UnitIdBJ(udg_bunker3), GetTriggerPlayer(), udg_TempPoint, bj_UNIT_FACING )
call IssueTargetOrderBJ( GetTriggerUnit(), "load", GetLastCreatedUnit() )
call CreateNUnitsAtLoc( 1, String2UnitIdBJ(udg_bunker4), GetTriggerPlayer(), udg_TempPoint, bj_UNIT_FACING )
call IssueTargetOrderBJ( GetTriggerUnit(), "load", GetLastCreatedUnit() )
call CreateNUnitsAtLoc( 1, String2UnitIdBJ(udg_bunker5), GetTriggerPlayer(), udg_TempPoint, bj_UNIT_FACING )
call IssueTargetOrderBJ( GetTriggerUnit(), "load", GetLastCreatedUnit() )
set udg_tempunit = null
call RemoveLocation( udg_TempPoint )
call DestroyGroup( udg_TempUnitGroup )
endfunction
//===========================================================================
function InitTrig_Begin_Upgrade_Bunker_Copy_Copy takes nothing returns nothing
set gg_trg_Begin_Upgrade_Bunker_Copy_Copy = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Begin_Upgrade_Bunker_Copy_Copy, EVENT_PLAYER_UNIT_UPGRADE_START )
call TriggerAddCondition( gg_trg_Begin_Upgrade_Bunker_Copy_Copy, Condition( function Trig_Begin_Upgrade_Bunker_Copy_Copy_Conditions ) )
call TriggerAddAction( gg_trg_Begin_Upgrade_Bunker_Copy_Copy, function Trig_Begin_Upgrade_Bunker_Copy_Copy_Actions )
endfunction
|
| 08-20-2004, 08:10 PM | #2 |
NM, I got it myself.... WOOO HOOO... go me ^_^ |
