HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Strange coding problem (CODE SPAM ALERT)

06-09-2003, 04:11 PM#1
Ultramagnetic
okay, very weird... I made this code in a test map, BUT when I tried to port it over to a beta version of a map I'm making it just does NOT work... The added actions don't work atleast.

And I have no idea why. Can somebody maybe come up with a reason?


function Trig_FastForward_Conditions takes nothing returns boolean
return ( ( GetIssuedOrderIdBJ() == String2OrderIdBJ("unholyfrenzy") ) and ( GetUnitTypeId(GetOrderedUnit()) == 'Hamg' ) )
endfunction

function Trig_LVL1 takes nothing returns boolean
return ( udg_SpellLVL[1] == 1 )
endfunction

function Trig_LVL2 takes nothing returns boolean
return ( udg_SpellLVL[1] == 2 )
endfunction

function Trig_LVL3 takes nothing returns boolean
return ( udg_SpellLVL[1] == 3 )
endfunction

function Trig_FastForward_Actions takes nothing returns nothing
local real mana = GetUnitStateSwap(UNIT_STATE_MANA, GetOrderedUnit())
local unit caster = GetOrderedUnit()
set udg_SpellCast[1] = true
loop
exitwhen (( mana > GetUnitStateSwap(UNIT_STATE_MANA, caster)) or (udg_SpellCast[1] == false))
call TriggerSleepAction( 0.01 )
endloop
if (udg_SpellCast[1] == false) then
return
endif
if ( Trig_LVL1() ) then
set udg_Booster = GetLastCreatedUnit()
call CreateNUnitsAtLocFacingLocBJ( 1, 'eC01', Player(PLAYER_NEUTRAL_AGGRESSIVE), GetUnitLoc(GetTriggerUnit()), GetUnitLoc(GetTriggerUnit()) )
call IssueTargetOrderBJ( GetLastCreatedUnit(), "slow", GetOrderTargetUnit() )
call TriggerSleepAction( 1.00 )
call KillUnit( GetLastCreatedUnit() )
else
call DoNothing( )
endif
if ( Trig_LVL2() ) then
set udg_Booster = GetLastCreatedUnit()
call CreateNUnitsAtLocFacingLocBJ( 1, 'eC02', Player(PLAYER_NEUTRAL_AGGRESSIVE), GetUnitLoc(GetTriggerUnit()), GetUnitLoc(GetTriggerUnit()) )
call IssueTargetOrderBJ( GetLastCreatedUnit(), "slow", GetOrderTargetUnit() )
call TriggerSleepAction( 1.00 )
call KillUnit( GetLastCreatedUnit() )
else
call DoNothing( )
endif
if ( Trig_LVL3() ) then
set udg_Booster = GetLastCreatedUnit()
call CreateNUnitsAtLocFacingLocBJ( 1, 'eC03', Player(PLAYER_NEUTRAL_AGGRESSIVE), GetUnitLoc(GetTriggerUnit()), GetUnitLoc(GetTriggerUnit()) )
call IssueTargetOrderBJ( GetLastCreatedUnit(), "slow", GetOrderTargetUnit() )
call TriggerSleepAction( 1.00 )
call KillUnit( GetLastCreatedUnit() )
else
call DoNothing( )
endif
endfunction

//===========================================================================
function InitTrig_FastForwardCode takes nothing returns nothing
set gg_trg_FastForwardCode = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_FastForwardCode, Player(0), EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER )
call TriggerAddCondition( gg_trg_FastForwardCode, Condition( function Trig_FastForward_Conditions ) )
call TriggerAddAction( gg_trg_FastForwardCode, function Trig_FastForward_Actions )
endfunction
06-09-2003, 04:17 PM#2
Earth-Fury
doas it have global variables you dont have properly named?
06-09-2003, 04:35 PM#3
Ultramagnetic
no, because the trigger wouldn't enable if they were set wrong, or named wrong in the actual code.


I think it may have something to do with the forces i have set in the map, but I don't see how. It's standard AOS forces. 5 human players + 1 comp with shared vision and allied victory set.
06-10-2003, 01:25 AM#4
Ultramagnetic
okay, despite my better judgement, I'm going to attach the two maps in question, one is a test map, the other is a beta of the map I'm workin' on with .slks n such impanted in them both already.


I'm not about to go crazy for another whole week just trying to get a custom spell to trigger when I already had it triggering, so please if somebody could just look at this for me, that'd be great.
06-10-2003, 01:31 AM#5
Ultramagnetic
and here's the beta map:
06-10-2003, 01:57 PM#6
Haud
This post seemed to be neglected so I took a look at it and put in a fix. You'll kick yourself when you see your error:ggani: .

Hope this helps.

Edit: Now that I think of it, you might be better off doing call UnitApplyTimedLife( tempU, 1, 1 ) rather than using a wait and then destroying the unit.
06-10-2003, 08:26 PM#7
Ultramagnetic
Well I still don't see EXACTLY where I went wrong, but... If it works, it works, I'm not complainin, heh...

Anyways, thanks, and couldja pls take that file down now. Don't want too many people swipin any terrain ideas 'n such off me. :)

On another note though Maud, you seem to know your way around code. I been lookin' for a guy like you to hop onto this project with me. If you're lookin' for something to get into I have alot of good spell ideas, and I could really use somebody like you to help me along here because things are moving sss s l l o o o o o o o o w w w www with this map cause I'm still a JASS noob, but I have come up with some pretty nifty s**t already regardlees. IF you're interested the offer's there.