Completed - Resolved

MightyScript: Lots of Issues

journeywithin 5 years ago updated by anonymous 4 years ago 11

If you want these in separate tickets, let me know.  Some of the issues are seen in the attached test map:


1. Obsidian placed with the map editor and then changed with the action "block to type" (in this case, using a world object list as the selected tiles) causes all other obsidian near the selected tiles to detonate (including the ones that were suppose to be changed).

Reproduction: see test map.  Click the door with the brimstone around it, it will change some tiles to earth, but this causes all the obsidian to detonate.  Clicking the adjacent door will replace everything with "script placed obsidian" and if you try the brimstone door again, it changes the tiles as expected.

2. Spawn Defense doesn't work with lists.

Reproduction: see test map.  The 2 doors near the edge of the map are setup to spawn doors when clicked.  One of them spawns using a list and one spawns using a selected tile.  Furthermore, all doors send a console debug message, however the one that tries to spawn the doors via a list does not send a console message (since it appears it causes an error and stops the rest of the actions from firing).

3. Spawn Party doesn't work with lists that contain multiple locations

Reproduction: see test map.  Edit the script for door3 and add a spawn party action.  Use party 1 and use list "Spawners" which contains 3 preselected tiles.  When you click the door, it spawns the party at the first tile and ignores the next 2.

4. Units will attack "shielded doors".  Not sure if this occurs with other attackable objects, but doors that are shielded with the action "create shield dependency" are still targeted by units.  The units do no damage, but they will still target it and try to attack it.

5. Some actions that only allow 1 object to be used (ie. set block type) allow for multiple selections in the magic finder.  Not sure if this is intended or not.  Example of how multiple selections could work: If you select dirt/earth/water in "set block type", then it could randomly choose one of those blocks when changing a block type.

6. Multiple graphical glitches when changing from one type of block to another using either the map editor (ie. manually changing a block type) or using the "set block type" action.  The glitches I noticed were when changing a faction owned tile to a neutral tile, then the neutral tile has "faction walls" when it shouldn't.

Reproduction: place a 5x5 claimed tile for the empire, then place an earth tile in the same 5x5 space but for "terrain" or "neutral".  The 5x5 area will still have "empire walls" everywhere.

Fix? It seems like the tile's properties aren't being reset for "wall graphic" and thus the wall graphic is still referencing the previous owner (empire).

7. You can't place sacred ground (manually) on tiles that have gold piles.

Reproduction: see test map.  The area where the sacred ground is has a bunch of gold piles (it use to be a vault that I replaced with claimed tiles).  Try placing a sacred ground on a tile with a gold pile and you can't.

Fix?  Can you just delete the gold pile when sacred earth is placed?  (or any other objects that may stop you from placing a tile manually)

8. Gold pile graphics disappear in the map editor but the object still exists.

Reproduction: see test map.  The area surrounded by the sacred ground.   On my view, the area near the wall has gold piles but no graphics for the gold piles.  Not sure what caused this.  The whole area where the gold piles are use to be vaults that were replaced by claimed tiles.

9. Suggestion: highlight objects selected by magic finder.  When using the "set reveal" action and selecting an inhibitor, the tile/inhibitor is not highlighted.  I have no idea if this is a bug or not.  IMO the tile or the inhibitor should be highlighted to indicate the center of the reveal.

10. Lists (arrays) need a lot of work imo.  They have such potential but MS lacks the actions to work with them.  I wrote a post on the steam forums about this but I'll briefly echo my thoughts below:

i. No ability to loop through lists (ie. think "arrays").  It'd be nice to have an action that "loop through list, set/get a variable/pointer and activate a trigger".  Thus you could say loop through a list of world objects, get each object, set/store that object into a new list (ie. like the pick action) and then fire a trigger.  A new script with the trigger can then access the stored object and do actions against it.

ii. No way to get and use a list id.  It would be super helpful if there was a way to get/store a list when given multiple lists.  This could be a new output type (ie. instead of triggering entity, we have list(s) that contain triggering entity).  Example of how I would use it: I have 20 lists that each have some blocks in them (some have the same blocks).  Whenever one of these blocks is changed (ie. claimed), I want to be able to get/store the lists with that block and be able to do actions on it.

Pseudo code: trigger: "on block type change" where 'what block' = '20 lists' (so when a block changes, we look through all the lists to see if the block is in those lists) and 'output' = 'new type: lists with trigger entity' (which gets set/stored in a temp list and contains only the lists which had the triggering block); then action could be something like (numberA = count list (output list)), (spawn party at some spot; execute numberA times) and (delete all entities in output lists).

iii. Lists have specific data types.  Can we have a dynamic list that works with all data types (numbers, strings, objects, etc) and then you program a function to get the data type of the cell being accessed and ignore that cell if it is trying to be used wrong.  ie. list = ["String", 10, 20.2, {location object}].  If I try to spawn a party using the list, then cells 0,1,2 are ignored but 3 is fine.  If I output the list to console, then 0,1,2 are outputed and 3 shows "game object" or whatever.

iv. No multidimensional lists.  It'd be awesome to be able to store lists inside of lists and then loop through them for other things.  I imagine this wouldn't be hard to add?  The usage would be more beneficial for dynamic adding/removing of data.  ie. Each time I create a "spawn party wave", I add their entities to a list and add that list to a "total wave list" where each cell/index/whatever contains a list of entities spawned together.  I could select an index and delete/destroy all the entities in that single list.

11. String substitution/replacing only works for objectives and announcements.  I looked at your code with dnspy and noticed how you use string.replace for stuff like "P1Color" but it isn't a global function, just limited to a single object.  I think you should have a custom function that applies to all strings so you can use this sub/replace code wherever mightyscript would allow it.  This would allow for using the code in other areas like debug/console, objective title/description, chat message, etc.  Further, it means you can add additional replace/sub options more easily.

Ideas:  I would love to see some additional usage like being able to access variables/objects (created in MS) via id.  ie. if I wanted to show a number variable in debug console using the debug action, then I wish I could write something like "Test Number {Number:25}" to output "Test Number 200" where the number with id 25 = "200".

Simplified: {"Type":"ID"} returns variable/object with id.  Such as {List:5} prints out all the IDs/names from the list where ID=5.  Or {Timer:2} outputs the timer(id=2) state (running/stopped) and time.  Or {Switch:1} outputs the boolean of switch(id=1) (true/false).

TL;DR: I spent 6 hours in the map editor today and noticed a few bugs.  I wish there was some additional functionality so I can make better maps!

PS: I LOVE the new changes to MS/editor with the recent patch.  There are some nice quality of life improvements.  I like the direction you are going with the editor and hope to see further improvements in the coming months.

Game Version:
Steam Public

Adding some more issues:

New test map from above:


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.



15 - Objective icons only work when "is achievement" is set to true. When the player completes the mission, the achievements will be shown on the right-hand side of the screen, using the icons chosen here.

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.

Pfiou boy that's a massive ticket ~~

1) This is by design, if you're modifying brimstone?obsidian at runtime you need to be able to replace the whole lot


3) I can't support that, spawn party can take time, so I can't spin it up in different location. I made it pick a random location if you supply a list

4) This is by design, to prevent unit getting hammered by a shielded unit/defence without even retaliating. They're not all smart, they need the player to make life decisions ;)

5) Mostly use random now when applicable

6)14) I focused on mightyscript for this ticket so I left the visuals for another ticket

7) This is by design, we don't want to delete objects for the player, what if they were part of MS, or part of the map design for some reason. But here you can't place sacred ground because item would then not be pickable by workers

8) I fixed that

9) Fixed, Set Revealer now allow attackable props

10) I can't support all of that that late in the project, but I fixed the PickList and added a Clear to modify list, and made where applicable use of random pick within a list

11) This would be inefficient to make any string flowing in MS to have a multi string.Replace pass ^^' And it might not be always applicable.

12) Fixed, with caveheat. Spawn Party is a weirdo because of its original flawed requirement. Party Units need an ID to be handled in MS during edit mode, but at runtime there can be multiple instance of them. That's where the fun starts. Originally spawn party was meant for wave spawning, which meant the previous wave should/would (flawed as said) die before the new wave. But now supporting multi instance coming from the same ID is not maintainable in the current state/design of MS.

So the fix is when I check for an ID, if it is a party unit, I first check if the original ID still exists and deal with it otherwise return the latest. And that's the caveheat, I still have no support if you have 3 party unit living at the same time. The middle one would get ignored even when the 1 one dies / get disposed

13) Spawn defence / Build defence combo require a small wait before build, we delay the AI by one tick so when you try to build instantly, the AI is not there yet to receive the signal. That's rubbish and I could queue up some command but the side effects are not worth it.

15) Thanks to Kasrkin84 for the answer

16) You can create a flag to keep track of it and watch it in debug console

17) It's tile based or physical object, so you can still target units/moving things

18) By design no, and changing that would be difficult as it is deep rooted in the checks

19) You can listen to any spell cast and add effects to it, with any action available

20) I can't replicate that, if I use a list for Set Health for example they're all getting the effect correctly.

21) I couldn't replicate

22) I'm creating a ticket for that internally, I'll get to it later


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?


Alright I'm a sucker ! I added that ; )

YOU ROCK!! :) :) :)

Completed - Resolved