你的评论

Thanks!

Regarding the spell casting:

I had a number of ideas to use for this, below is one of them - perhaps you know of a way to execute this idea somehow?


I wanted to recreate the Dungeon Keeper 2 secret level where you smack a boulder as if you were playing golf.  However, for the recreation, I was using shockwave and a unit.  Since shockwave casts in the center of the tile, it makes it hard to "aim" (push the unit/"ball" in a specific direction).  Further since the shockwave doesn't work on lava/water/walls/etc, it limits the creativeness of the map.  Example: if unit is in a corner, you can't cast shockwave on the edge of the wall/corner since it defaults to the center of the tile, so the unit/"ball" is forever stuck in the corner.

I have a script that triggers whenever the player clicks.  Whenever they click, it "casts" shockwave on the triggering entity (tile).

Is there a way to force shockwave to cast where the player clicked instead of the center of the tile?

Awesome!  Thank you so much!

Note: long post.  I sort of got carried away while describing my thoughts.  Feel free to ignore, lol.


Brief edit: idea was to have 1 list with triggering blocks and n+ lists that correspond to each triggering block, then some scripts to loop through and find/set the correct list associated with a triggering block.  Instead of creating many "cloned" scripts that look for exactly 1 triggering block and contain the corresponding list within that script.


As you said, 2D arrays aren't possible in MS - unless they allow you to retrieve list content by list id or allow lists to contain other lists.  :(



Multidimensional array example:


40 different tiles that trigger when entered and reveal a small area nearby.  You can create 40 different scripts to accomplish this (1 for each trigger block), or 1 multidimensional array and a few scripts to loop it.


List1: contains trigger tile locations


List2,3,4,5+: contains reveal tile locations


The index of List1 relates to which ListX to use.  Ie. List1[n] and List(n+1) are related.  So if index=10, List1[10] contains a trigger block, and List11 contains the reveal tiles for that block.  A 2D array would be a lot easier: List[index][0] = trigger block; List[index][1] = reveal blocks.


In a typical OOP language, you could easily do this without arrays and just create an object to hold this data.  (Ie. Object[index].trigger and Object[index].reveal)  However MightyScript doesn't allow you to create objects, so you need to use lists/arrays.  However MightyScript doesn't allow you search a list/array for a value and get the index of that value, and you can only set the index and use it with the pick action to get list content.  (Note: you can look if a block exists in a List, but you can't get the index of that block in the list)  SO... the solution becomes...


Number Index = 0
Number Count = List1 length
String List0 = contains IDs for each reveal list
World Object List1 = as above; trigger tiles
World Object List2,3,4,5+ = as above; reveal tiles
World Object TempList1 = used as a variable to be used between multiple scripts
World Object TempList2 = used as a variable to be used between multiple scripts
Timer Loop = trigger 40, automatically loop, 0seconds


Ie.
List1 has ID=10 and looks like {block1,block2,block3,...}
List2,3,4 have ID=20,21,22 respectively and contain the reveal blocks for block1/2/3 respectively
List0 has ID=1 and contains the IDs for List2,3,4; it looks like {20,21,21}
Count = 3


The index value of List0 and List1 are related.  List1[index] = trigger block; List0[index] = list id containing reveal blocks, it might look something like GetListFromId(List0[index]) in code.


We have some scripts:


1. Trigger Script: trigger when one of the blocks in List1 is entered; store/set/output the triggering block to TempList1 (set, not add), set Index=0, set Count=List1.length, manual trigger 10


2. Loop Script 1 ("search array and get index"): trigger on 10; "number" condition to check if index < count; use pick action (index,input=List1,output=TempList2,set); manual trigger 20


3. Loop Script 2 (if then): trigger on 20; "exists in list" condition to check if TempList1 exists TempList2 (ie. triggering block = list1[index] block); if success, manual trigger 30


4. Loop Script 2b (else): trigger on 20; same "exists in list" condition as above but inverted; if "fails" (inverted success), index+1, manual trigger 10


5. Reveal Script: trigger on 30; pick action (index,input=List0,output=TempList1,set),  index=0, count=TempList1.length, start loop timer   (this script won't work unless you can get the list from ID in list0; just an example or whatever)


6. Reveal Loop Script 1 (index < count): trigger on 40; "Number" condition to check if index < count; pick action (index,input=TempList1,output=TempList2), reveal action(center block = TempList2, range=0, reveal=true), index+1


7. Reveal Loop Script 2 (index >= count): trigger on 40; "Number" condition to check if index >= count; stop timer



What happens:

1. When a block is entered, its world object is stored in TempList1 and triggers Loop Script 1
2. When Loop Script 1&2 are triggered, it checks if List1[index]==TempList1, if true, TempList1=ListWithID(List0[index]) (the current index is the ListID that contains the reveal blocks) and then triggers the reveal loop; if false, it increases the index by 1 and checks the next value;  the loop exists when index>count (nothing found)
3. When Reveal Loop Script 1&2 are triggered, it sets index=0 and count=length of reveal array, then loops through each block (since the reveal action only works on the first value in an array)



How it looks like in another language:


Object block1 = triggering block object;
for (i=0; i < list1.length; i++){
   Object block2 = list1[i];
   if (block1==block2){
      Object reveal_array = GetListFromId(list0[i]);  // ie. List with ID=20,21,22
      for (j=0; j < reveal_array.length; j++){
         RevealFunction(reveal_array[j]);
      }
   }
}

While that may seem like a lot of code/annoyance for such a simple task... it is much easier to manage than creating a script for each "trigger block" as managing scripts in MightyScript is a pain, while managing individual lists is much easier.



TL;DR: Looping through 2D arrays in MightyScript is not currently possible since you can't get a list by ID.

Haha - it is a minor annoyance but once you know about it, you know not to do it again.  If not a fix, perhaps include it as a map making note in your mightyscript tutorial (if it includes a section on map making).

wall bug.jpg

Here is an example of the wall graphical glitch.  Here I had mass-replaced the impenetrable rock with dirt, then I mass-replaced the dirt with impenetrable rock.  The graphic glitch appeared.  The small area of rock that isn't affected by the glitch (bottom-center of impenetrable rock) is not part of the glitch as I edited that portion of the map by placing the block one by one to test if the graphical glitch affected single block placement.


Theory: perhaps this glitch is related to mass replacing or drag-box placing methods.  It doesn't appear to occur with single block placement.

Adding some more issues:


New test map from above:

testing_edit_76561197993291628.meta
testing_edit_76561197993291628

12. In this test map, door1 (brimstone) spawns a party and within the party action I add it to the Units list.  This appears to be done correctly when looking at the debug console / vars.  Door2 starts a timer that triggers every 1 second and kills the first entity in the Units list then recounts the list size.  This causes the list to shorten (the entity is automatically removed from the list when it dies - done by your code).  The kill loop is setup to deactivate when the Unit list length = 0.  However as you can see when you run the script with more than 6+ units is that it successfully kills off all the units except for 3 of them.  Those 3 are not in the Units list, however the Units list has a length of "3" because it appears as [;;], meaning that there are 3 null/empty cells in the list.  (And thus the kill loop never exits because the list appears to have 3 units in it)


13. Not on the test map, but an issue.  The "build defense" action doesn't work with triggering entity for whatever reason.  Ie. Script: Trigger = On Defense Built; Action = Build Defense (target = triggering entity).  Now build a defense (ie. door or cannon) and it will remain as a blueprint but the script will still trigger.


14. Wall graphic glitch: I wanted to talk more about #6 above.  It doesn't always bug out, like in the example I provided - I tested it again and it didn't bug out.  I think it has to do with specific tiles/blocks.  I've noticed it mainly with empire walls if that helps.


15. Objective icons don't work.  Or maybe I don't know how to show them??


16. Can you have a graphic to show when a script/variable/etc is disabled / turned off in MightyScript?


17. Via mightyscript, would it possible to make spells like shockwave target the specific x/y coordinate instead of the center of the tile it was cast on?


18. Via mightyscript, would it possible to allow spells like shockwave to be cast anywhere regardless of who owns the tile/block.  Ie. Allow casting of spells on lava/walls/enemy-tiles/etc


19. Via mightyscript, would it be possible to combine vfx and physical effects to create new spells/interactions?  ie. physical effects like knockback/push/pull, slow/fast (temporary speed adjustments), attack/def up/down (temporary), scale adjustments of effected entities (temporary).


20. List issues: Further to my post above, I notice that a lot of actions accept lists BUT they only affect the first entity in the list.  I hope this isn't intentional and will be fixed.  Examples: anything affecting entities (set hp/stats/ai/teleport/etc); casting spells (ie. casting a spell on everyone in a list doesn't work, even when using the new "group number" thingy in the spell action); kill/ko/damage actions only affect the first entity; as described above, actions that use the list for targeting, some only use the first entity in the list, such as when spawning a party or defense, yet other actions like change blocks will affect all entities in the list.


21. Random gold tool gets stuck on max gold when combined with shift+drag.  I can't always reproduce, but sometimes I have noticed it only pasting max gold (5k?) tiles while dragging with the shift modifier.


22. Action parameters in magic finder don't always update properly when you select multiple variables and try to deselect/reselect variables.  I don't know how to explain this properly but it is annoying.  ie. Some action allows you to select multiple targets and you choose 3 variables/lists.  Then you decide to unselect 2 variables, so you go to the magic finder and choose "selection" and deselect two variables, then you navigate out of "selection" and go to another folder/path like "lists" or "numbers" and the previously unselected variables are still selected under the different heading.  However they aren't actually selected - it is a visual bug and the path/folder view hasn't updated.  So you unselect them again thinking that they are still selected.... which just makes them selected again (in the code).  Thus when you exit the magic finder, you find that you haven't unselected the 2 variables.  This occurs in other ways, but I think you can understand the issue.


Thanks!

What about adding in some player friendly commands like clear; toggleai; setgold; setmana; showmap (turn off fog of war?); etc.  Stuff that can be used to test your map without using mutators.  OR not a debug console but a "test console" so you can log/output stuff and maybe have a few friendly gui buttons.  I can do a simple mockup if you like.  Since your ui uses css, perhaps I can submit some code and you can add functionality to it?

I already know the password - I just don't want to enter it every time I open the debug console ;)  Perhaps you can add a start option like "-debug" that allows use of the console without constant password entry ;)


OR make some commands non-password protected such as clear for example.  But there a ton of useful commands such as adjusting stuff that can be done in mighyscript but not godmode such as changing gold or mana; turning off the ai; changing teams; completing potions/rituals; etc.

Did you load my map and run it?  Did the imps not spawn when the export failed?


The map was partially being used to test empire vs. underlord stuff (like how empire undead units don't lose health and rage when spawned via mightyscript).  That is why ai4 was being used (because I was seeing if setting it to empire terrain would make it follow empire undead mechanics).



UserEcho 的客户支持