HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

help me out plz

04-05-2004, 03:05 AM#1
fugly
this is my first attempt at a jass trigger but i keep on getting a damned error in wc3, memory leak i think, so any tips? The only custom part is the beggning
Trouble happens when 2 of these triggers go off at the same time, cause of variable conflicts, so i turned to jass and local variables. I would explain more but you can probably figure out what going on by looking.
________________________________________________________
PickedPlayerNumber = The player number of the Player being used
*edited*
Code:
function Trig_Undead_create2_Actions takes nothing returns nothing
    local integer x = udg_PickedPlayerNumber
    set udg_HeroCin = true
    call ClearSelectionForPlayer( ConvertedPlayer(x) )
    call AddSpecialEffectLocBJ( GetRectCenter(udg_pXheroLoc[x]), "sharedmodels\\ubirth.mdx" )
    set udg_animatoins[2] = GetLastCreatedEffectBJ()
    call TriggerSleepAction( 7.00 )
    call DestroyEffectBJ( udg_animatoins[2] )
    call TriggerSleepAction( 2.70 )
    // number1
    call AddSpecialEffectLocBJ( PolarProjectionBJ(GetRectCenter(udg_pXheroLoc[x]), 50.00, 180.00), "Objects\\Spawnmodels\\Undead\\UDeathMedium\\UDeath.mdl" )
    call TriggerSleepAction( 0.10 )
    call CreateNUnitsAtLoc( 1, udg_UndeadHrs[1], ConvertedPlayer(udg_PPN[x]), PolarProjectionBJ(GetRectCenter(udg_pXheroLoc[x]), 50.00, 180.00), udg_PlayerHeroFace[x]] )
    call SelectUnitAddForPlayer( GetLastCreatedUnit(), ConvertedPlayer(x) )
    // number2
    call AddSpecialEffectLocBJ( PolarProjectionBJ(GetRectCenter(udg_pXheroLoc[x]), 50.00, 90.00), "Objects\\Spawnmodels\\Undead\\UDeathMedium\\UDeath.mdl" )
    call TriggerSleepAction( 0.10 )
    call CreateNUnitsAtLoc( 1, udg_UndeadHrs[2], ConvertedPlayer(udg_PickedPlayerNumber), PolarProjectionBJ(GetRectCenter(udg_pXheroLoc[x]), 50.00, 90.00), udg_PlayerHeroFace[x] )
    call SelectUnitAddForPlayer( GetLastCreatedUnit(), ConvertedPlayer(udg_PickedPlayerNumber) )
    // number3
    call AddSpecialEffectLocBJ( PolarProjectionBJ(GetRectCenter(udg_pXheroLoc[x]), 50.00, 270.00), "Objects\\Spawnmodels\\Undead\\UDeathMedium\\UDeath.mdl" )
    call TriggerSleepAction( 0.10 )
    call CreateNUnitsAtLoc( 1, udg_UndeadHrs[3], ConvertedPlayer(x), PolarProjectionBJ(GetRectCenter(udg_pXheroLoc[x]), 50.00, 270.00), udg_PlayerHeroFace[x] )
    set udg_HeroCin = false
endfunction

//===========================================================================
function InitTrig_Undead_create2 takes nothing returns nothing
    set gg_trg_Undead_create2 = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Undead_create2, function Trig_Undead_create2_Actions )
endfunction

thx for all help in advance
04-05-2004, 04:55 AM#2
PEON1577
udg_PPNN <-- whats the value of that?

just by quickly looking at the code it looks as though it will run OK, whats the other trig thats conflicting with it creating the error?
04-05-2004, 10:50 PM#3
fugly
Quote:
Originally Posted by wc3jass3
udg_PPNN <-- whats the value of that?

just by quickly looking at the code it looks as though it will run OK, whats the other trig thats conflicting with it creating the error?
thats the index number to integer variable array of PPN
04-05-2004, 11:41 PM#4
Narwanza
This is not working at all. I see why warcraft would crash. Go read a beginners guide to JASS. I can't go any farther until you give me all the values of all the used globals and if they are values assigned at different points in the game, give me the triggers that assign the values.
04-06-2004, 10:25 PM#5
fugly
Narwanza plz stfu, cause this thing actualy does work, exactly to its use, there was a problem in a previous trigger that defined the wrong variable making this trigger crash.
wc3jass3 thx for taking a look.
04-07-2004, 03:54 AM#6
Narwanza
If you thought I was being mean, well, you got the wrong picture. I was saying that your use of local variables was very limited considering you were using 1 in a function that used more than 1 local variable. It could have been a much better function had all values been used as locals, but whatever.
04-07-2004, 10:14 PM#7
fugly
ok ok now that i look you are correct, i see that i made a global variable for no reason, and im gonna edit that, But, my function still worked, even with the global variables, it did not crash warcraft, and it worked in every way that i wanted it. Thx. Don't assume
04-07-2004, 11:42 PM#8
PEON1577
Quote:
Originally Posted by fugly
ok ok now that i look you are correct, i see that i made a global variable for no reason, and im gonna edit that, But, my function still worked, even with the global variables, it did not crash warcraft, and it worked in every way that i wanted it. Thx. Don't assume

give me a map pls and i will try to fix it, usually i'm good at fixing jass stuff - i can't tell by just looking at it or maybe i can but its sooo much easier for me to fix with a map.

just a tip: don't say anything bad about the jass people here, they take offense quite easily and they will just not help you in the end :(

your asking for help and (most) of these people know what they are talking about, take the bad as well as the good from them and just ignore any potential flames :)

also want to tell me what your trying to have this trigger due step by step?
leaking memory doesent give an error (afaik) it just leaks memory, so i bet you did something wrong, ie a syntax error or a subtle error that only affects the game at runtime.
04-08-2004, 12:20 AM#9
fugly
lol thx wc3jass3, and as i said earlier i fixed the problem, it was in a different trigger that calls this function. I also cleaned this trigger due to the criticisem (sp?) of Narwanza
04-08-2004, 12:57 AM#10
PEON1577
Quote:
Originally Posted by fugly
lol thx wc3jass3, and as i said earlier i fixed the problem, it was in a different trigger that calls this function. I also cleaned this trigger due to the criticisem (sp?) of Narwanza

ok! tips for next time:
provide all relivent information
make a map!!
be nice

g/l with the map ^_^
04-08-2004, 11:31 PM#11
fugly
ok this is the same trigger but lemme give some more info
this trigger creates the 3 ROC undead heros in a dramatic manner but it takes a while
it starts with the animation of a new undead building being summoned and then it creates 3 effects with 3 units making it look as if the undead are whats being sumoned
Variables:
pXheroloc[x] = the location where the heros should pop up along with the animations. Since each player has a different one of these the array number represents which region to be used with each different player
udg_undeadhers[x] = the 3 undead heros being called
PickedPlayerNumber = Player number of triggering player
__________
THE PROBLEM: ok now the problem is that the trigger stops working after creating and destroying the first animation. I got a feeling this is something obvious so help plz. BTW Narwanza it did work before just laggy and now i can't get this system to work =(

Code:
function Trig_Undead_create_Actions takes nothing returns nothing
    local integer x = udg_PickedPlayerNumber
    call ClearSelectionForPlayer( Player(x - 1) )
    call AddSpecialEffectLocBJ( GetRectCenter(udg_pXheroLoc[x]), "sharedmodels\\ubirth.mdx" )
    set udg_animatoins[2] = GetLastCreatedEffectBJ()
    call TriggerSleepAction( 7.00 )
    call DestroyEffectBJ( udg_animatoins[2] )
    call TriggerSleepAction( 2.70 ) [color=DarkRed][b]//stops after this mark[/b][/color]
    // number1
    call AddSpecialEffectLocBJ( PolarProjectionBJ(GetRectCenter(udg_pXheroLoc[x]), 50.00, 180.00), "Objects\\Spawnmodels\\Undead\\UDeathMedium\\UDeath.mdl" )
    call CreateNUnitsAtLoc( 1, udg_UndeadHrs[1], Player(x-1), PolarProjectionBJ(GetRectCenter(udg_pXheroLoc[x]), 50.00, 180.00), udg_PlayerHeroFace[x] )
    call SelectUnitAddForPlayer( GetLastCreatedUnit(), Player(x - 1) )
    // number2
    call AddSpecialEffectLocBJ( PolarProjectionBJ(GetRectCenter(udg_pXheroLoc[x]), 50.00, 90.00), "Objects\\Spawnmodels\\Undead\\UDeathMedium\\UDeath.mdl" )
    call TriggerSleepAction( 0.10 )
    call CreateNUnitsAtLoc( 1, udg_UndeadHrs[2], Player(x - 1), PolarProjectionBJ(GetRectCenter(udg_pXheroLoc[x]), 50.00, 90.00), udg_PlayerHeroFace[x] )
    call SelectUnitAddForPlayer( GetLastCreatedUnit(), Player(x - 1) )
    // number3
    call AddSpecialEffectLocBJ( PolarProjectionBJ(GetRectCenter(udg_pXheroLoc[x]), 50.00, 270.00), "Objects\\Spawnmodels\\Undead\\UDeathMedium\\UDeath.mdl" )
    call TriggerSleepAction( 0.10 )
    call CreateNUnitsAtLoc( 1, udg_UndeadHrs[3], Player(x - 1), PolarProjectionBJ(GetRectCenter(udg_pXheroLoc[x]), 50.00, 270.00), udg_PlayerHeroFace[x] )
    call SelectUnitAddForPlayer( GetLastCreatedUnit(), Player(x - 1) )
endfunction

//===========================================================================
function InitTrig_Undead_create takes nothing returns nothing
    set gg_trg_Undead_create = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Undead_create, function Trig_Undead_create_Actions )
endfunction
04-09-2004, 12:00 AM#12
PEON1577
Code:
function Trig_Undead_create_Actions takes nothing returns nothing
    local integer x = udg_PickedPlayerNumber
    call ClearSelectionForPlayer( Player(x - 1) )
    call AddSpecialEffectLocBJ( GetRectCenter(udg_pXheroLoc[x]), "sharedmodels\\ubirth.mdx" )
    call TriggerSleepAction( 10.00 )
    call DestroyEffectBJ( GetLastCreatedEffectBJ() )
    // number1
    call AddSpecialEffectLocBJ( PolarProjectionBJ(GetRectCenter(udg_pXheroLoc[x]), 50.00, 180.00), "Objects\\Spawnmodels\\Undead\\UDeathMedium\\UDeath  .mdl" )
    call TriggerSleepAction( 0.10 )
    call CreateNUnitsAtLoc( 1, udg_UndeadHrs[1], Player(x-1), PolarProjectionBJ(GetRectCenter(udg_pXheroLoc[x]), 50.00, 180.00), udg_PlayerHeroFace[x] )
    call SelectUnitAddForPlayer( GetLastCreatedUnit(), Player(x - 1) )
    call TriggerSleepAction( 2.00 )
    call DestroyEffectBJ( GetLastCreatedEffectBJ() )
    // number2
    call AddSpecialEffectLocBJ( PolarProjectionBJ(GetRectCenter(udg_pXheroLoc[x]), 50.00, 90.00), "Objects\\Spawnmodels\\Undead\\UDeathMedium\\UDeath  .mdl" )
    call TriggerSleepAction( 0.10 )
    call CreateNUnitsAtLoc( 1, udg_UndeadHrs[2], Player(x - 1), PolarProjectionBJ(GetRectCenter(udg_pXheroLoc[x]), 50.00, 90.00), udg_PlayerHeroFace[x] )
    call SelectUnitAddForPlayer( GetLastCreatedUnit(), Player(x - 1) )
    call TriggerSleepAction( 2.00 )
    call DestroyEffectBJ( GetLastCreatedEffectBJ() )
    // number3
    call AddSpecialEffectLocBJ( PolarProjectionBJ(GetRectCenter(udg_pXheroLoc[x]), 50.00, 270.00), "Objects\\Spawnmodels\\Undead\\UDeathMedium\\UDeath  .mdl" )
    call TriggerSleepAction( 0.10 )
    call CreateNUnitsAtLoc( 1, udg_UndeadHrs[3], Player(x - 1), PolarProjectionBJ(GetRectCenter(udg_pXheroLoc[x]), 50.00, 270.00), udg_PlayerHeroFace[x] )
    call SelectUnitAddForPlayer( GetLastCreatedUnit(), Player(x - 1) )
    call TriggerSleepAction( 2.00 )
    call DestroyEffectBJ( GetLastCreatedEffectBJ() )
endfunction

try that ^_^
04-09-2004, 12:29 AM#13
fugly
beutiful expect that the now the effects for each of the heros doesn't show up, and wut was wrong?
but atleast the heros pop up now
edit: scracth that, for some reason there were too many spaces in the file name :\ it works!!
just what was wrong with it in the first place?
04-09-2004, 12:32 AM#14
PEON1577
Quote:
Originally Posted by fugly
beutiful expect that the now the effects for each of the heros doesn't show up, and wut was wrong?
i think its something w/ the effects then :) or its just the sleep thing messing up the trig.

afaik nothings wrong, i just redid part of it (combined some sleep functions).

--- try this --
Code:
[code]
function Trig_Undead_create_Actions takes nothing returns nothing
    local integer x = udg_PickedPlayerNumber
    call ClearSelectionForPlayer( Player(x - 1) )
    call AddSpecialEffectLocBJ( GetRectCenter(udg_pXheroLoc[x]), "sharedmodels\\ubirth.mdx" )
   // call TriggerSleepAction( 10.00 )
    call TriggerSleepAction( 2.00 )
   // call DestroyEffectBJ( GetLastCreatedEffectBJ() )
    // number1
    call AddSpecialEffectLocBJ( PolarProjectionBJ(GetRectCenter(udg_pXheroLoc[x]), 50.00, 180.00), "Objects\\Spawnmodels\\Undead\\UDeathMedium\\UDeath  .mdl" )
  //  call TriggerSleepAction( 0.10 )
    call CreateNUnitsAtLoc( 1, udg_UndeadHrs[1], Player(x-1), PolarProjectionBJ(GetRectCenter(udg_pXheroLoc[x]), 50.00, 180.00), udg_PlayerHeroFace[x] )
    call SelectUnitAddForPlayer( GetLastCreatedUnit(), Player(x - 1) )
   call TriggerSleepAction( 2.00 )
  //  call DestroyEffectBJ( GetLastCreatedEffectBJ() )
    // number2
    call AddSpecialEffectLocBJ( PolarProjectionBJ(GetRectCenter(udg_pXheroLoc[x]), 50.00, 90.00), "Objects\\Spawnmodels\\Undead\\UDeathMedium\\UDeath  .mdl" )
  //  call TriggerSleepAction( 0.10 )
    call CreateNUnitsAtLoc( 1, udg_UndeadHrs[2], Player(x - 1), PolarProjectionBJ(GetRectCenter(udg_pXheroLoc[x]), 50.00, 90.00), udg_PlayerHeroFace[x] )
    call SelectUnitAddForPlayer( GetLastCreatedUnit(), Player(x - 1) )
   call TriggerSleepAction( 2.00 )
  //  call DestroyEffectBJ( GetLastCreatedEffectBJ() )
    // number3
    call AddSpecialEffectLocBJ( PolarProjectionBJ(GetRectCenter(udg_pXheroLoc[x]), 50.00, 270.00), "Objects\\Spawnmodels\\Undead\\UDeathMedium\\UDeath  .mdl" )
   // call TriggerSleepAction( 0.10 )
    call CreateNUnitsAtLoc( 1, udg_UndeadHrs[3], Player(x - 1), PolarProjectionBJ(GetRectCenter(udg_pXheroLoc[x]), 50.00, 270.00), udg_PlayerHeroFace[x] )
    call SelectUnitAddForPlayer( GetLastCreatedUnit(), Player(x - 1) )
    call TriggerSleepAction( 2.00 )
 //   call DestroyEffectBJ( GetLastCreatedEffectBJ() )

endfunction
Quote:
//you'll need to create an array of fx and then destory them at the end of the function, i'm mad so im not going to do it.. hehe :) just see if this trig works.
[/code]
04-09-2004, 12:43 AM#15
fugly
but the effects stop them selves, or is it for memory leaks?