| 07-04-2002, 05:08 PM | #1 |
Guest | I've already posted this on Blizzard's forum.. But I guess I might as well post it here too. The more people that nag at Blizzard, the better chance there is of the feature being added: First of all, I am a programmer (and have been for 4 years), and am used to confusing situations. But trying to mak loops solely in the actions field is confusing the heebie-jeebies out of me, and does not allow for much flexibility. I would greatly appreciate it if actions could execute events (in some form), or add a scripting language to your editor. eg. I'm trying to do something like this: for(int x=0;x<7;x++){ for(int y=0;y<7;y++){ if(UnitInZone(utUnitSpawner, // Gets complicated here pZoneGridArray[x+y*7]) PlaceUnit(utUnitToSpawn, CenterOf(pZoneGridArray[x+y*7])); } } In code it's simple.. But I dare you to try to do that in the triggers module. Thank you. |
| 07-04-2002, 05:17 PM | #2 |
Thats why they have custom text code form. They realize that eventually it just gets too complicated for the wizard to handle it. Also to turn on an event (trigger) there is turn on and run trigger. |
| 07-04-2002, 05:45 PM | #3 |
Guest | Oh damn! I can't believe I missed those. Thanks ;) |
| 07-04-2002, 05:58 PM | #4 |
Code:
function Trig_Test_Copy_Func001003003001 takes nothing returns boolean
return ( IsUnitInGroup(udg_UnitSpawner, GetUnitsInRectAll(udg_ZoneGridArray[( GetForLoopIndexA() + ( GetForLoopIndexB() * 7 ) )])) == true )
endfunction
function Trig_Test_Copy_Actions takes nothing returns nothing
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 6
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
set bj_forLoopBIndex = 1
set bj_forLoopBIndexEnd = 6
loop
exitwhen bj_forLoopBIndex > bj_forLoopBIndexEnd
if ( Trig_Test_Copy_Func001003003001() ) then
call CreateNUnitsAtLoc( 1, udg_UnitToSpawn, GetOwningPlayer(udg_UnitSpawner), GetRectCenter(udg_ZoneGridArray[( GetForLoopIndexA() + ( GetForLoopIndexB() * 7 ) )]), bj_UNIT_FACING )
else
call DoNothing( )
endif
set bj_forLoopBIndex = bj_forLoopBIndex + 1
endloop
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
endfunction
//===========================================================================
function InitTrig_Test_Copy takes nothing returns nothing
set gg_trg_Test_Copy = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_Test_Copy, 2 )
call TriggerAddAction( gg_trg_Test_Copy, function Trig_Test_Copy_Actions )
endfunction
It is a periodic event firing every 2 seconds. There are many many other more efficient ways of doing what you want, but you asked for it this way so here it is. This is what it looked like before conversion into custom text: Code:
Event - Time - every 2 seconds of game time Actions - For each (integer A) from 1 to 6, do (for each (integer b) from 1 to 6, do (if ((UnitSpawner is in (Units in ZoneGridArray[(((Integer A) + ((Integer B) x 7))])) Equal to True) Then do (Unit - create 1 UnitToSpawn for (Owner of UnitSpawner) at (Center of (ZoneGridArray[(((Integer A) + ((Integer B) x 7))] facing Default building facing degrees. Play with the editor a little. It is a lot more versatile, and IMO newbie friendly, than it appears. With flexibility and power comes a price. In this case, a sharper learning curve. If you already know c/c++, you shouldn't have a problem learning how to work WE and JASS scripts. Btw, it took me longer to edit this post to make it look correctly than to create it in the editor. |
| 07-04-2002, 09:02 PM | #5 |
Guest | Ack, damn VB-style scripting. Why couldn't they just make it C++ style? Anyways, what are some more efficient ways? Thanks btw. |
| 07-04-2002, 09:28 PM | #6 |
Becuase If the editor was in C++ and you never touched programing Then you'd probably rack your brain for days trying to figure it out. It seems that the "wizard" is very friendly for users, and custom text is used to make things alot more readable after extremely nested functions. |
| 07-05-2002, 02:56 AM | #7 |
So there aren't really many many ways of making it better. But there is a better way. If you don't mind a bit of clicking, the better way would be to use event - unit enters region. Then use the action to spawn off whatever units you need. You can even fit all the events into 1 trigger if you only need to spawn 1 type of unit. A) It is easier to read B) It will take advantage of war3's multithreaded triggers. You'll never miss an unit entering a region. C) Since you're a programmer, just do a big-O analysis and you'll see the number of wasted cycles by polling. I don't think it is fair to compare a scripting language for a game to C++. It's like comparing notepad to MS Word. Even if you don't want all the functionalities of C++, some guy will eventually go, how come this and this isn't supported it is the same as C++! Besides, it all comes down to the cost and benefit ratio. It's just not worth it for Blizzard. |
| 07-05-2002, 03:06 AM | #8 |
Guest | I simply meant that they should use the C++ style instead of this loop/endloop garbage. I personally would prefer to say while(){}. Also, what does cutting costs have to do with this? All (programmer x) would have to do is change how the code is parsed - a feat which would take a day tops. |
| 07-05-2002, 03:59 AM | #9 |
Guest | Maybe thats because mr. programmer x didnt design the game, but left that to dumb artists who, not quite unlike me, can easily struggle to learn something as simple as even the scripting in this editor to its fullest extend. Also, though u could probably pinpoint us to a good few places in the game where all sorts of functionalities couldave been very usefull, had the editor have them, they did manage to create at least what i think to be an interesting game without all that, so it could possibly be that they had no need for it. Furthermore, if you are that discontent with the editor, i dont think Blizzard would really mind if u started recreating this game in C++ or any other language for that matter, be it a scripting language or not. |
| 07-05-2002, 04:08 AM | #10 |
Don't we all wish it was that easy. Lets just change the way COBOL source is parsed so all C/C++ programmers can now code in COBOL. |
| 07-05-2002, 06:27 AM | #11 |
Mr.123: *shudder* |
| 07-05-2002, 08:22 AM | #12 |
Guest | Mr.123 - LOL, actually that would be pretty cool. Oberon - Actually I am creating my own game ;) I don't really have the time or patience to learn a language that would only distract me from my work. So I'll just do as I did with the Starcraft editor - absolutely nothing. I learned the basics.. but that's about it. Hopefully you guys will create some good maps. Btw, that reminds me, could someone please try to replicate sunken defense 6 way from stracraft? NOTE: It was 4:30am when I wrote this message; I am starting to see things, and I can barely remember what I wrote.. So please bare with me. |
