| 08-13-2006, 05:35 AM | #1 |
Don't flame me or nothing for this, I just thought of something that I thought may work... ~EDIT: the title should probably be "partial multiinstanceablity w/o locals in GUI" If I am correct, multiinstanceability is having a spell able to be casted by more than one unit at the same time, right? So if the spell is only used by one unit per player (like a hero) couldn't you technically use Global Variable Arrays? From what I do know, this would only work if the spell only has once caster per player. If, for example, a player had 2 heros with the same triggered spell, and managed to cast them at the same time, this wouldn't work. But if that player only had 1 hero, and another player had that same hero, and they casted that same spell at the same time, then this should work. I know this isn't the best way, but for people who don't already know a way, or don't know JASS, this could come in handy. Just saying. |
| 08-13-2006, 05:39 AM | #2 |
Array based storage system uses global array only. You need only return H2I and use it inside. |
| 08-13-2006, 11:22 AM | #3 |
Not really, Dark's theory is right, if you use a global array of 12, and store all the neccersary vars in them, then thats fine, its 70% MUI. |
| 08-14-2006, 02:19 AM | #4 |
Yeah, what I'm saying is that this method is simply for maps in which the spell is only used by one unit per player. This wouldn't work otherwise, since the global vars would override themselves, causing problems. So only use this if you don't know how (or don't want to) JASS, and only use it how I stated. I'm surprised at how few people have posted... |
| 08-14-2006, 03:55 AM | #5 |
You could actually take it slightly further than that and use the trick which allows you use GUI functions with local variables, and using very little JASS in the process. That would allow you not only to make some your spells even more multi-instanceable without really using the global arrays at all. Have a global variable array, when you start your spell add a few lines like: Trigger: ![]() Custom Script: local real udg_Reals[0] = 0.
![]() Custom Script: local real udg_Reals[1] = 1.Trigger: Unit - Create 1 unit of type footman at location facing Reals[0]Edit: This does not appear to work. The Custom Script apparently does not parse "[]" as anything valid so it does not seem to work. I think I may have been too tired to have realized what it would imply if it worked as I assumed it would. :/ It would be nice if it functioned in this manner, however, I'm clearly too inexperienced with this method of using local variables to have realized that it would not work. Instead you need to use individual variables and not arrays as there does not appear to be any way to utilize arrays in this fashion. |
| 08-14-2006, 05:14 AM | #6 |
No waits inside == 100% MUI with no any arrays |
| 08-14-2006, 05:32 AM | #7 |
Wow! That parses? Very cool, Naakaloh, I wouldn't have thought [] were valid characters for symbol names. |
| 08-14-2006, 06:05 AM | #8 | |
Quote:
Agreed... I don't encourage using variables in GUI when not really necessary. There are a lot of people who make one trigger spells, need only the caster and dummy units, and they store the caster in a variable (not even the dummies, because they only cast a spell and then disappear) and complain then about the spell not being MUI. When I first saw such a spell I was like And darkwulfy, don't get me wrong but I've been using this for quite some time, in my first GUI spells, before I started learning JASS, and so I don't think this is new stuff. Naakaloh's stuff is newer to me, yet not brand new, since I saw it used before and I find it perfectly logical. In C++ if you had a global and a local with the same name, the local would be prioritary. Apparently JASS inherited this too. :) And even though I totally disagree with GUI, a lot of people still use it so I don't think we should forget about it. I find it good initiative to start this thread, in order to help those people! +rep granted ~Daelin |
| 08-14-2006, 06:19 AM | #9 | |
Quote:
|
| 08-14-2006, 07:20 AM | #10 |
Thanks for the positive reinforcement Daelin. Yeah, I didn't think it was that new, but like I said this is targeted towards those who may need a way and don't already know one. @Naakaloh: wow that's taking it a step further, never would have thought of that... cool. |
| 08-14-2006, 05:42 PM | #11 |
Um, I'm not sure I can take credit for it, I don't actually know if it parses arrays, but I assumed it did. I'll have to check that now. Edit: I just tried it and apparently you can't do it like that, sorry for the confusion, it should still work with non-array variables, unfortunately I can't see any way of demonstrating it doing what PipeDream mentioned, so apparently it checks the arrays before the locals. :/ Though unless I'm mistaken you should still be able to use Trigger: Custom Script: local real udg_real1 = 1. |
| 08-14-2006, 06:01 PM | #12 |
You could still use arrays, just not as nice fitting. I prefer your way Naakaloh, because it saves memory, instead of reserving 8k vars, although, arrays can be handy in loops. So you can also do: Trigger: ![]() Custom Script: local real array udg_MyReal
![]() set MyReal[0] = 50.
![]() set MyReal[500] = -32.2
![]() Wait - Wait MyReal[1] seconds |
| 08-14-2006, 06:07 PM | #13 |
Does that work? Ok, so perhaps I wasn't entirely incorrect. |
| 08-14-2006, 06:09 PM | #14 |
I think so lol =/. Im not sure if arrays work with the GUI global buggy thing. That would work fine without GUI though. Its just can you bug the bug? |
| 08-14-2006, 06:31 PM | #15 | |
Quote:
|
