I'm new to this community, used to script in WC3 but never truly finished anything. I'd like to take my ideas and put them into Starcraft, or at least just get back into scripting. So far, the only thing hindering me is the massively confusing data editor haha..
My problem is when I try and use
UnitGroupLoopBegin
This gives me incorrect parameter error.
I converted some GUI for the UnitGroupLoopBegin and all the parameters, the only thing I changed was
the point (blast) which was called and used multiple times before in the trigger. Also tried modifying the script in various manners and just can't get it to work right.
What I'm attempting is to pick all units in the region and use a trigger to move them at an angle away from
the blast until they're out of the radius, in case that helps. The script is down below.
All variables are called already
UnitGroupLoopBegin(UnitGroup(null,c_playerAny,RegionCircle(blast,1.3),UnitFilter(0,0,(1<<c_targetFilterPlayer)|(1<<c_targetFilterAlly),0));{// loop begins;while(!UnitGroupLoopDone())// picks all units in moved, then moves them, hopefully ends the loop;{libNtve_gf_PauseUnit(UnitGroupLoopCurrent(),true);Wait(0.05,c_timeGame);blastangle=AngleBetweenPoints(blast),UnitGetPosition(UnitGroupLoopCurrent()));UnitSetPosition(UnitGroupLoopCurrent(),PointWithOffsetPolar(UnitGetPosition(UnitGroupLoopCurrent())),0.2,blastangle,true);Wait(0.05,c_timeGame);libNtve_gf_PauseUnit(UnitGroupLoopCurrent(),false);UnitGroupLoopStep();}
@unclesatan: Go You cannot declare a variable in a parameter, like you do with:
RegionCircle(pointblast,1.3)
That was simply the result of me mussing with the code trying to get it to work. Whether or not it is point blast, or simply blast (the variable I already declared at the top of the script with the rest of them), it still gives me invalid parameter list. Sorry for the confusion there. I updated my code
I do now realize that I was attempting to declare a variable there, but like I said it did not change the error message for some reason.
I´m not seeing an invalid parameter but you've an opening bracket after the UnitGroupLoopBegin, which should not be there. And there is no UnitGroupLoopEnd after while loop.
Edit: Are the variables you are using created via the gui? If so, then their name comes with a prefix: gv_. The name would be then gv_blast. I also believe you're missing a ")" at the end of the function.
The variables I used were called at the top of the trigger like so
point blast;
fixed angle;
etc.
I'll check the bracket and the parenthesis
Ok so when I did that, it then gave me invalid parameter and too many parameters errors.
The only thing I can think of is there is something wrong with my trigger initializations and such, because I don't quite understand that process yet. Here is the whole script.
//==================================================================================================// // Script // // Name: Ability// Use: Create a trigger driven ability or two to sharpen your scripting skills, recall WC3 skills and methods//==================================================================================================include"TriggerLibs/NativeLib"//--------------------------------------------------------------------------------------------------// Library Initialization//--------------------------------------------------------------------------------------------------voidInitLibs(){libNtve_InitLib();}//--------------------------------------------------------------------------------------------------// Trigger Variables//--------------------------------------------------------------------------------------------------triggergt_Init;triggergt_KamehamehaCast;//--------------------------------------------------------------------------------------------------// Trigger: Init//--------------------------------------------------------------------------------------------------boolgt_Init_Func(booltestConds,boolrunActions){// Actionsif(!runActions){returntrue;}libNtve_gf_CreateUnitsWithDefaultFacing(1,"Goku",0,1,UnitGetPosition(UnitFromId(14)));returntrue;}//--------------------------------------------------------------------------------------------------voidgt_Init_Init(){gt_Init=TriggerCreate("gt_Init_Func");TriggerAddEventMapInit(gt_Init);}//--------------------------------------------------------------------------------------------------// Trigger: Kamehameha Cast // Written by Unclesatan//--------------------------------------------------------------------------------------------------boolgt_KamehamehaCast_Func(booltestConds,boolrunActions){unitcaster;intrange;intdistance;fixedcasterangle;fixedblastangle;pointblast;//unitgroup moved;pointblastoffset;// Actionsif(!runActions){returntrue;}//^^^^^^^^^^^^^^^^^^-- Defines whether or not the events come back true, then runs the rest of the triggercaster=EventUnit();range=40;distance=0;casterangle=UnitGetFacing(caster);// POINT RNG FILTERblast=UnitGetPosition(caster);// V V vwhile((distance<range)){// while loop, will set the offset of the blast, get units near the blast put them in a unit group// creates an effect at the blast offset, pick each unit in the unit group and push them away at the angle of the blast// will repeat every 0.15 secblastoffset=PointWithOffsetPolar(blast,1.0,casterangle);blast=blastoffset;PlayerCreateEffectPoint(1,"KamehamehaDummyBlast",blast);UnitGroupLoopBegin(UnitGroup(null,c_playerAny,RegionCircle(blast,1.3),UnitFilter(0,0,(1<<c_targetFilterPlayer)|(1<<c_targetFilterAlly),0)));// loop begins;while(!UnitGroupLoopDone())// picks all units in moved, then moves them, hopefully ends the loop;{libNtve_gf_PauseUnit(UnitGroupLoopCurrent(),true);Wait(0.05,c_timeGame);blastangle=AngleBetweenPoints(blast),UnitGetPosition(UnitGroupLoopCurrent()));UnitSetPosition(UnitGroupLoopCurrent(),PointWithOffsetPolar(UnitGetPosition(UnitGroupLoopCurrent())),0.2,blastangle,true);Wait(0.05,c_timeGame);libNtve_gf_PauseUnit(UnitGroupLoopCurrent(),false);UnitGroupLoopStep();}UnitGroupLoopEnd();distance=(distance+1)Wait(0.15,c_timeGame);}else(){}// -------------------------------------=-=-=-=DEFINING EVENTS=-=-=-=------------------------------------------voidgt_KamehamehaCast_Init(){// initializes the trigger for usegt_KamehamehaCast=TriggerCreate("gt_KamehamehaCast_Func");// actually spawns the trigger, like variables must be called first TriggerAddEventUnitAbility(gt_KamehamehaCast,null,AbilityCommand("Kamehameha",0),c_abilEffectStageFinish,true);}//--------------------------------------------------------------------------------------------------// Trigger Initialization APPARENTLY must be at the bottom of the script or something//------------------------------------------------- -------------------------------------------------voidInitTriggers(){//ALL your triggers must be initialized here. Unknown if you can initialize triggers after a certain period of time for efficiency.gt_KamehamehaCast_Init();}
The else can be removed as it is not used. Lastly, the "InitTriggers" as well as the "InitLibs" can also be removed as this is generated by the editor. You a initialization function in the bar at the bottom.
Awesome, thank you very much for your replies! I've learned alot just from the few posts you've made!
Ok so I removed the bracket, I moved the bracket to make the angle actually calculate, fixed the polar offsets, removed the else. For some reason the unit filter is still giving me errors.
while((distance<range)){// while loop, will set the offset of the blast, get units near the blast put them in a unit group// creates an effect at the blast offset, pick each unit in the unit group and push them away at the angle of the blast// will repeat every 0.15 secblastoffset=PointWithOffsetPolar(blast,1.0,casterangle);blast=PointWithOffsetPolar(blast,1.0,casterangle);PlayerCreateEffectPoint(1,"KamehamehaDummyBlast",blast);UnitGroupLoopBegin(UnitGroup(null,c_playerAny,RegionCircle(blast,1.3),UnitFilter(0,0,(1<<c_targetFilterAlly),(1<<(c_targetFilterDead-32));// loop begins;while(!UnitGroupLoopDone())// picks all units in moved, then moves them, hopefully ends the loop;{libNtve_gf_PauseUnit(UnitGroupLoopCurrent(),true);Wait(0.05,c_timeGame);blastangle=AngleBetweenPoints(blast,UnitGetPosition(UnitGroupLoopCurrent()));UnitSetPosition(UnitGroupLoopCurrent(),PointWithOffsetPolar(UnitGetPosition(UnitGroupLoopCurrent()),0.2,blastangle)true);Wait(0.05,c_timeGame);libNtve_gf_PauseUnit(UnitGroupLoopCurrent(),false);UnitGroupLoopStep();}UnitGroupLoopEnd();distance=(distance+1)Wait(0.15,c_timeGame);}
I think I figured out what's wrong, but no idea how to fix it. I commented out the entire unitgroup loop and found that the Wait code was giving me an error for wrong variable. c_timeGame and c_playerAny are what are giving me errors. Why are natives giving me errors? lol
So I'm still getting errors on the native variables I use in this.
c_timeGame
c_playerAny gives me errors too
c_abilEffectStageFinish also
Am I initializing native libs wrong or what? I've tried alot of different things, it's giving me the same error and I'm almost 100% sure it's because the natives aren't being used properly.
//--------------------------------------------------------------------------------------------------// Custom Script: Kamehameha//--------------------------------------------------------------------------------------------------boolgt_KamehamehaCast_Func(booltestConds,boolrunActions){unitcaster;intrange;intdistance;fixedcasterangle;fixedblastangle;pointblast;unitgroupmoved;pointblastoffset;// Actionsif(!runActions){returntrue;}//^^^^^^^^^^^^^^^^^^-- Defines whether or not the events come back true, then runs the rest of the triggercaster=EventUnit();range=40;distance=0;casterangle=UnitGetFacing(caster);// POINT RNG FILTERblast=UnitGetPosition(caster);// V V vwhile((distance<range)){// while loop, will set the offset of the blast, get units near the blast put them in a unit group// creates an effect at the blast offset, pick each unit in the unit group and push them away at the angle of the blast// will repeat every 0.15 secblastoffset=PointWithOffsetPolar(blast,1.0,casterangle);blast=PointWithOffsetPolar(blast,1.0,casterangle);PlayerCreateEffectPoint(1,"KamehamehaDummyBlast",blast);UnitGroupLoopBegin(UnitGroup(null,c_playerAny,RegionCircle(blast,1.3),UnitFilter(0,0,(1<<c_targetFilterAlly),(1<<(c_targetFilterDead-32));// loop begins;while(!UnitGroupLoopDone())// picks all units in moved, then moves them, hopefully ends the loop;{libNtve_gf_PauseUnit(UnitGroupLoopCurrent(),true);Wait(0.05,c_timeGame);blastangle=AngleBetweenPoints(blast,UnitGetPosition(UnitGroupLoopCurrent()));UnitSetPosition(UnitGroupLoopCurrent(),PointWithOffsetPolar(UnitGetPosition(UnitGroupLoopCurrent()),0.2,blastangle)true);Wait(0.05,c_timeGame);libNtve_gf_PauseUnit(UnitGroupLoopCurrent(),false);UnitGroupLoopStep();}UnitGroupLoopEnd();distance=(distance+1)Wait(0.15,c_timeGame);}// -------------------------------------=-=-=-=DEFINING EVENTS=-=-=-=------------------------------------------voidgt_KamehamehaCast_Init(){// initializes the trigger for usegt_KamehamehaCast=TriggerCreate("gt_KamehamehaCast_Func");// actually spawns the trigger, like variables must be called first TriggerAddEventUnitAbility(gt_KamehamehaCast,null,AbilityCommand("Kamehameha",0),c_abilEffectStageFinish,true);}//--------------------------------------------------------------------------------------------------// Custom Script Initialization//--------------------------------------------------------------------------------------------------voidInitCustomScript(){}//--------------------------------------------------------------------------------------------------// Trigger: Init//--------------------------------------------------------------------------------------------------boolgt_Init_Func(booltestConds,boolrunActions){// Actionsif(!runActions){returntrue;}libNtve_gf_CreateUnitsWithDefaultFacing(1,"Goku",0,1,UnitGetPosition(UnitFromId(14)));returntrue;}//--------------------------------------------------------------------------------------------------voidgt_Init_Init(){gt_Init=TriggerCreate("gt_Init_Func");TriggerAddEventMapInit(gt_Init);}//--------------------------------------------------------------------------------------------------// Trigger Initialization//--------------------------------------------------------------------------------------------------voidInitTriggers(){gt_Init_Init();gt_KamehamehaCast_Init}//--------------------------------------------------------------------------------------------------// Map Initialization//--------------------------------------------------------------------------------------------------voidInitMap(){InitLibs();InitCustomScript();InitTriggers();}
Line 21: Missing semicolon after trigger gt_KamehamehaCast
Line 59: Missing ),-1)) after the UnitFilter, UnitGroup expects a MaxCount Parameter.
Line 67: Missing comma between blastangle) true
Line 73: Missing semicolon after distance = (distance + 1)
Line 76: Missing return and }, you never close the function, also all code paths need to return a boolean
Line 113: Missing (); after gt_KamehamehaCast_Init
Line 21: Missing semicolon after trigger gt_KamehamehaCast
Line 59: Missing ),-1)) after the UnitFilter, UnitGroup expects a MaxCount Parameter.
Line 67: Missing comma between blastangle) true
Line 73: Missing semicolon after distance = (distance + 1)
Line 76: Missing return and }, you never close the function, also all code paths need to return a boolean
Line 113: Missing (); after gt_KamehamehaCast_Init
I managed to locate all of those errors a while ago and fix them, the only issue now is making the data editor do what I want it to. Thank you all for your help and tips, I learned alot. Expect to see a map from me sometime in the future.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I'm new to this community, used to script in WC3 but never truly finished anything. I'd like to take my ideas and put them into Starcraft, or at least just get back into scripting. So far, the only thing hindering me is the massively confusing data editor haha..
My problem is when I try and use UnitGroupLoopBegin
This gives me incorrect parameter error. I converted some GUI for the UnitGroupLoopBegin and all the parameters, the only thing I changed was the point (blast) which was called and used multiple times before in the trigger. Also tried modifying the script in various manners and just can't get it to work right.
What I'm attempting is to pick all units in the region and use a trigger to move them at an angle away from the blast until they're out of the radius, in case that helps. The script is down below.
All variables are called already
@unclesatan: Go You cannot declare a variable in a parameter, like you do with:
That was simply the result of me mussing with the code trying to get it to work. Whether or not it is point blast, or simply blast (the variable I already declared at the top of the script with the rest of them), it still gives me invalid parameter list. Sorry for the confusion there. I updated my code
I do now realize that I was attempting to declare a variable there, but like I said it did not change the error message for some reason.
A unitgroup loop should look like this:
I´m not seeing an invalid parameter but you've an opening bracket after the UnitGroupLoopBegin, which should not be there. And there is no UnitGroupLoopEnd after while loop.
Edit: Are the variables you are using created via the gui? If so, then their name comes with a prefix: gv_. The name would be then gv_blast. I also believe you're missing a ")" at the end of the function.
@Exaken: Go
The variables I used were called at the top of the trigger like so
point blast; fixed angle; etc.
I'll check the bracket and the parenthesis
Ok so when I did that, it then gave me invalid parameter and too many parameters errors.
The only thing I can think of is there is something wrong with my trigger initializations and such, because I don't quite understand that process yet. Here is the whole script.
Sorry if it's huge or a mess.
Well, I figured it was the unit filter in that line. This is a correct unit filter:
You can also remove one "(" at the end. Also in this line you'll need to remove the bracket after blast.
And in this line the bracket after UnitGroupLoopCurrent needs to be moved to after blastangle, to close PointWithOffsetPolar correctly.
The else can be removed as it is not used. Lastly, the "InitTriggers" as well as the "InitLibs" can also be removed as this is generated by the editor. You a initialization function in the bar at the bottom.
Awesome, thank you very much for your replies! I've learned alot just from the few posts you've made!
Ok so I removed the bracket, I moved the bracket to make the angle actually calculate, fixed the polar offsets, removed the else. For some reason the unit filter is still giving me errors.
I think I figured out what's wrong, but no idea how to fix it. I commented out the entire unitgroup loop and found that the Wait code was giving me an error for wrong variable. c_timeGame and c_playerAny are what are giving me errors. Why are natives giving me errors? lol
So I'm still getting errors on the native variables I use in this.
c_timeGame c_playerAny gives me errors too c_abilEffectStageFinish also
Am I initializing native libs wrong or what? I've tried alot of different things, it's giving me the same error and I'm almost 100% sure it's because the natives aren't being used properly.
There is the entirity of the script in the map.
Line 21: Missing semicolon after trigger gt_KamehamehaCast
Line 59: Missing ),-1)) after the UnitFilter, UnitGroup expects a MaxCount Parameter.
Line 67: Missing comma between blastangle) true
Line 73: Missing semicolon after distance = (distance + 1)
Line 76: Missing return and }, you never close the function, also all code paths need to return a boolean
Line 113: Missing (); after gt_KamehamehaCast_Init
I managed to locate all of those errors a while ago and fix them, the only issue now is making the data editor do what I want it to. Thank you all for your help and tips, I learned alot. Expect to see a map from me sometime in the future.