Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: The Freeze Spell
The Freeze Spell
Apr 26 2014, 3:57 am
By: DoomDoomDoom  

Apr 26 2014, 3:57 am DoomDoomDoom Post #1



Hello people of Bnet. I have been messing around with a "freeze spell" that binds the target in an area so it cant move. I know that with hyper triggers and making the unit move into water or some other terrain it freezes it. However it still attacks. AND after messing around with it with my friends I noticed that units such as ghosts, marines, wraiths, battle crusers miss their shots completely or just get their attacks absorbed into thin air and makes the guy look like hes just raising his weapon doing nothing. My spell has 3 parts. Someone please tell me what I'm doing wrong so I can make the unit freeze but let other ranged units (Like the caster's own) be able to attack without acting stupid XD (I dont know the template so I will do my best to put it on here)

- Spell Part 1-
Players 1(Checked)
Conditions: P.1 commands at least 1 Marine.
P.1 brings at most 0 men to "P.1 Master Spell Activating"

Actions: Move 1 men for P.1 at "P.1 Master Spell" to "P.1 Master Spell Activating"
Preserve Trigger


-Spell Part 2-
Players 1(Checked)
Conditions: P.1 brings at least 1 Marine to "P.1 Master Spell Activating"

Actions: Move all men for p.2 at "P.1 Follow A4" to "Freeze Spell"
Move all men for p.3 at "P.1 Follow A4" to "Freeze Spell"
Move all men for p.4 at "P.1 Follow A4" to "Freeze Spell"
Move all men for p.5 at "P.1 Follow A4" to "Freeze Spell"
Move all men for p.6 at "P.1 Follow A4" to "Freeze Spell"
Move all men for p.7 at "P.1 Follow A4" to "Freeze Spell"
Move all men for p.8 at "P.1 Follow A4" to "Freeze Spell"
Modify death counts for p.1 Add one for alan turret
Preserve trigger


-Spell Part 3-
Players 1 (Checked)
Actions: P.1 has suffered at least 60 deaths of alan turret

Conditions: Modify death counts for p.1 Set to 0
Kill one marine at "p.1 master spell activating"
Preserve trigger



Whew well that is it. XD. Can someone tell me what I did wrong or what I should do? Thanks People Of Sen :D



None.

Apr 26 2014, 4:14 am lil-Inferno Post #2

Just here for the pie

Constantly moving a unit to any location will make it so only melee units can damage it (though ranged units will sometimes hit the unit on certain frames). If you want to simulate "freezing" the unit then you could give it to another player (let's say player 9), center a location on it, then move it to that location (to stop any patrols/movements/whatever they're doing). After a timer is up, give them back to the original player.




Apr 26 2014, 4:17 am DoomDoomDoom Post #3



Quote from lil-Inferno
Constantly moving a unit to any location will make it so only melee units can damage it (though ranged units will sometimes hit the unit on certain frames). If you want to simulate "freezing" the unit then you could give it to another player (let's say player 9), center a location on it, then move it to that location (to stop any patrols/movements/whatever they're doing). After a timer is up, give them back to the original player.
I know that is a way but what if there are multiple units say like 20 of them? 20 lings? how I do send them all to P.9 then give them all back to the correct player? :(



None.

Apr 26 2014, 4:49 am lil-Inferno Post #4

Just here for the pie

Quote from DoomDoomDoom
Quote from lil-Inferno
Constantly moving a unit to any location will make it so only melee units can damage it (though ranged units will sometimes hit the unit on certain frames). If you want to simulate "freezing" the unit then you could give it to another player (let's say player 9), center a location on it, then move it to that location (to stop any patrols/movements/whatever they're doing). After a timer is up, give them back to the original player.
I know that is a way but what if there are multiple units say like 20 of them? 20 lings? how I do send them all to P.9 then give them all back to the correct player? :(
You could apply Binary Countoffs to accommodate any number of units. If the freezing units are owned by different players then you could give to them a corresponding player; some player could map to player 9, another to player 10, and another to player 11, etc.




Apr 26 2014, 7:00 am Azrael Post #5



Quote from lil-Inferno
You could apply Binary Countoffs to accommodate any number of units. If the freezing units are owned by different players then you could give to them a corresponding player; some player could map to player 9, another to player 10, and another to player 11, etc.

How is there an "etc" here? There are 8 normal players and 3 unused players to map them to: Player 9, Player 10, and Player 11. I'm not sure what "etc" would entail.

I'm also unsure how binary countoffs factor into giving all units from one player to another. There's already an action for giving all units from one player to another.

There's not really a perfect way to freeze the men of 8 different players simultaneously. I'd suggest trying the following and seeing if you like the result.

Make a trigger owned by every player which does the following:

  • Give 1 [men] owned by Current Player at Anywhere to Player 9.
  • Center LocationX on [men] owned by Player 9 at Anywhere.
  • Order all [men] owned by Player 9 at LocationX: Move to LocationX.
  • Give 1 [men] owned by Player 9 at LocationX to Player 10.
  • Preserve trigger.

Then copy this trigger a bunch of times. Figure out the maximum number of units that might ever be frozen for a single player, that's how many copies you need.

After those, make a trigger to "Give all [men] owned by Player 10 at Anywhere to Current Player."

This will freeze and change ownership of the units 12 times a second, while maintaining the players' colors. Additionally, it forces constant deselection, so players aren't able to spam orders to try to circumvent the freeze.

It might have a performance impact (causing apparent lag) depending on how many units and players are involved, and you might still not be satisfied with the units' behaviors while frozen. For these reasons, you should give it a test run before building a map around it, to find out if those issues are present.

It's fairly easy to implement this system, so I'd suggest just throwing it into the map to see how you feel about the results.




Apr 26 2014, 12:53 pm lil-Inferno Post #6

Just here for the pie

Quote from Azrael
How is there an "etc" here? There are 8 normal players and 3 unused players to map them to: Player 9, Player 10, and Player 11. I'm not sure what "etc" would entail.
Player 12 is another option, but since player 12 gets all of the units of players who leave, I left it out. He could also use any spare normal players if necessary.

Quote from Azrael
I'm also unsure how binary countoffs factor into giving all units from one player to another. There's already an action for giving all units from one player to another.
I said to apply binary countoffs because he needed to freeze all of them in place at once and not have to constantly move them.

Quote from Azrael
Then copy this trigger a bunch of times. Figure out the maximum number of units that might ever be frozen for a single player, that's how many copies you need.
Applying binary countoffs to your solution could help to minimize the amount of triggers needed if you give the unit to say, player 11 instead, and then give all of the player 11 units back to player 10 at the end of the trigger cycle. This would have an efficiency impact, though.

Post has been edited 1 time(s), last time on Apr 26 2014, 1:00 pm by lil-Inferno.




Apr 26 2014, 3:17 pm DoomDoomDoom Post #7



Thanks guys :D I'll try both of them.



None.

Apr 26 2014, 3:19 pm Azrael Post #8



Quote from lil-Inferno
Quote from Azrael
How is there an "etc" here? There are 8 normal players and 3 unused players to map them to: Player 9, Player 10, and Player 11. I'm not sure what "etc" would entail.
Player 12 is another option, but since player 12 gets all of the units of players who leave, I left it out.

Right, which is why Player 12 wouldn't work: If anyone left while Player 12 was being used to freeze units, the system would assume their units belonged to the frozen player.

Quote from lil-Inferno
He could also use any spare normal players if necessary.

He mentioned that there aren't any spare players, which is why I was wondering what "etc" would let him map all 8 players (or even an additional player) :P

Quote from lil-Inferno
Quote from Azrael
I'm also unsure how binary countoffs factor into giving all units from one player to another. There's already an action for giving all units from one player to another.
I said to apply binary countoffs because he needed to freeze all of them in place at once and not have to constantly move them.

Quote from Azrael
Then copy this trigger a bunch of times. Figure out the maximum number of units that might ever be frozen for a single player, that's how many copies you need.
Applying binary countoffs to your solution could help to minimize the amount of triggers needed if you give the unit to say, player 11 instead, and then give all of the player 11 units back to player 10 at the end of the trigger cycle.

I'm still not seeing how you'd apply binary countoffs though. Every unit needs a location centered on it individually, and needs to be ordered there individually. There's no way to use one trigger to freeze multiple units, unless you just combine the actions of multiple triggers into one trigger; in which case, it would still make more sense to put the maximum number of actions into every trigger.

Binary countoffs are only useful when the values being handled aren't trivial. In this case, the number of units doesn't matter, so I'm not sure how you'd expect to condense this system by using them.




Apr 26 2014, 5:40 pm DoomDoomDoom Post #9



Gah I dont know what I'm doing wrong here.
------------------
P.1 checked
Conditions:
P.1 brings at least 1 marine to P.1 Master Spell Activating

Actions:
Modify death counts for p.1 add 1 for alan turret
Modify death counts for p.2 add 1 for catina


-----------------------
P.2 checked
Conditions:
P.2 has suffered at least 1 death of catina
Give 1 men owned by current player at "p.1 master follow a4" to p.9
center location "freeze spell" on men owned by p.9 at "p.1 master follow a4"
issue order to all men owned by p.9 at anywhere , move to "freeze spell"
preserve trigger

---------------------
P.2 checked
conditions:
p.2 has suffered at least 60 deaths of catina

actions:
give all men owned by p.10 at anywhere to current player
preserve trigger

-----------
p,1 checked

condtions:
P,1 has suffered at least 60 deaths of alan turret

actions:

Modify death counts for p.1 set to 0 for alan turret
kill 1 marine at"p.1 master spell activating for p.1"
preserve trigger



The problem is not only is the timer for the marine going haywire and 10x faster than it should but the units given to p.10 dont get given back. they just keep circulating



None.

Apr 26 2014, 7:04 pm Azrael Post #10



You want to set deaths of Cantina to 0 after giving the player their units back. That's why it isn't stopping.

Additionally, before killing the Marine, give it to a different player. Dead units tend to linger beyond the cycle you kill them. Their exploding body can be detected as still there on the cycle after you've killed them.

It also doesn't look like you need to use two different DCs for this. You could check "deaths of Cantina is exactly 60" for both of the triggers, and have the second trigger set it back to 0.

Lastly, you should try to make your triggers as accurate as possible. This timer is meant to go up to 60 and then reset back to 0; it can never reach 61. You should use "has suffered exactly 60 deaths" instead of "at least 60 deaths", unless your timer can increase by more than 1 at a time (or if you might change it to do that in the future, like a "speed up" ability).

Basically, you don't want your triggers taking impossible situations into account, because it can hide the symptoms of underlying/undiscovered bugs (or even cause unintended problems itself). Although future flexibility trumps everything, so ensure you're not sacrificing easily adaptable/adjustable/upgradeable systems for the sake of perfectly accurate code.

For example, you said it seems your timer is running too fast. This could mean it's increasing too fast because of some other trigger you forgot about; if it was skipping from 58 Cantina DCs straight to 61, you'd be immediately aware there's a problem if you're using "exactly 60" since it would never even try to reset anything, and you could quickly solve it. If it's "at least 60", then that symptom (from what's potentially a much larger issue) might go unnoticed until you're so far into development that fixing the system is extremely difficult.

On a side note, 60 DCs is 5 seconds in real time so that's how long your timer should be lasting.

Let us know how it works after taking those things into account.

Post has been edited 2 time(s), last time on Apr 26 2014, 7:16 pm by Azrael.




Apr 27 2014, 2:42 am DoomDoomDoom Post #11



Quote from Azrael
You want to set deaths of Cantina to 0 after giving the player their units back. That's why it isn't stopping.

Additionally, before killing the Marine, give it to a different player. Dead units tend to linger beyond the cycle you kill them. Their exploding body can be detected as still there on the cycle after you've killed them.

It also doesn't look like you need to use two different DCs for this. You could check "deaths of Cantina is exactly 60" for both of the triggers, and have the second trigger set it back to 0.

Lastly, you should try to make your triggers as accurate as possible. This timer is meant to go up to 60 and then reset back to 0; it can never reach 61. You should use "has suffered exactly 60 deaths" instead of "at least 60 deaths", unless your timer can increase by more than 1 at a time (or if you might change it to do that in the future, like a "speed up" ability).

Basically, you don't want your triggers taking impossible situations into account, because it can hide the symptoms of underlying/undiscovered bugs (or even cause unintended problems itself). Although future flexibility trumps everything, so ensure you're not sacrificing easily adaptable/adjustable/upgradeable systems for the sake of perfectly accurate code.

For example, you said it seems your timer is running too fast. This could mean it's increasing too fast because of some other trigger you forgot about; if it was skipping from 58 Cantina DCs straight to 61, you'd be immediately aware there's a problem if you're using "exactly 60" since it would never even try to reset anything, and you could quickly solve it. If it's "at least 60", then that symptom (from what's potentially a much larger issue) might go unnoticed until you're so far into development that fixing the system is extremely difficult.

On a side note, 60 DCs is 5 seconds in real time so that's how long your timer should be lasting.

Let us know how it works after taking those things into account.
I added them all in but it still deosnt work. Can you see what im doing wrong? p.1 is the only one right now that can do the freeze spell. its the barracks and you make a rine to activate.

Attachments:
NF.scm
Hits: 4 Size: 72.25kb



None.

Apr 27 2014, 3:20 am DoomDoomDoom Post #12



Im using 2 dcs because 7 players start with the same spell.



None.

Apr 27 2014, 3:36 am lil-Inferno Post #13

Just here for the pie

This is a bit sidetracked but you use up way more locations than you actually need by having 9 locations for each player's menu, and that's really sloppy. You could easily cut that down to just one that works for everyone, and it'd make it a lot simpler to work with. Always have ease of use and modularity in mind. You also have triggers with player 9 checked off, but player 9 can't run triggers so they're cluttering everything up. I took the liberty of cleaning everything sloppy up for you since I need something to do before going to bed, but I also removed all the comments in the triggers. They should be easy to read now, though.

Do note that I (possibly) didn't fix the problem you posted, and any bugs that were already there are probably still there. I simply cleaned up your triggers to make them work for all players. If you have any questions about my changes or if anything I did was unintended by you then PM me. Maybe your problem will be easier to fix now.

Attachments:
NF Inferno.scx
Hits: 5 Size: 70.69kb

Post has been edited 3 time(s), last time on Apr 27 2014, 4:24 pm by lil-Inferno.




Apr 27 2014, 5:32 pm DoomDoomDoom Post #14



Wasnt fixed. Ill just copy your edited ver once more and delete and redo all the triggers. (As in use the ones you set up but remake them in the same way



None.

Apr 27 2014, 5:51 pm Azrael Post #15



Quote from DoomDoomDoom
Wasnt fixed. Ill just copy your edited ver once more and delete and redo all the triggers. (As in use the ones you set up but remake them in the same way

There was an issue with the edited version you got from him. He updated it to fix the problem, so you should get the new attachment.

I'll take a look at it now and tell you why it isn't working.

On a side note, you don't need multiple DCs for multiple players. Each player has their own DC for every unit. You can use Cantina for every player at the same time.




Apr 27 2014, 6:29 pm DoomDoomDoom Post #16



Oh. I didnt know that,



None.

Apr 28 2014, 4:25 am Azrael Post #17



Well, it's unfreezing after 30 seconds now (360 DCs). The reason it was going too fast before is because you were adding DCs too fast: The trigger adding +1 DC for Player 2 was being run by Player 1, Player 2, and Player 8. Inferno's updated version prevents this by using "Current player" and "Foes", so it's only being added once.

Earlier I said to change "at least" to "exactly". If you'd done this, the reason it was breaking would have become obvious.

Quote from Azrael
For example, you said it seems your timer is running too fast. This could mean it's increasing too fast because of some other trigger you forgot about; if it was skipping from 58 Cantina DCs straight to 61, you'd be immediately aware there's a problem if you're using "exactly 60" since it would never even try to reset anything, and you could quickly solve it. If it's "at least 60", then that symptom (from what's potentially a much larger issue) might go unnoticed until you're so far into development that fixing the system is extremely difficult.

This is exactly what was happening; your Cantina DCs were literally skipping from 58 straight to 61. This is why you shouldn't use "at least <maximum>" and "at most <minimum>" conditions, and should use "exactly" instead, in order to avoid issues like this.

One really terrible offender is "at most 0". This is a pretty ridiculous condition, since negative values are impossible. It also has the added benefit of potentially breaking your map, because "at most" doesn't handle units the same way as "exactly". These should be changed as well.

Unfortunately, I saved the worst for last. The map doesn't work the way it appears to work right now; if units are ever frozen for different players at the same time, it will give all the units to one of those players when they unfreeze. This is obviously not what you want to happen.

Here are the two most practical solutions:

1) Make it so all of a player's units are frozen, never only some of them.
2) Make it so only 3 different players can have frozen units at the same time.

There are other possibilities if neither of those options will work for what you're planning, but the alternatives would be much more complex and time-consuming. Both of these solutions are extremely fast and easy to implement.

On a side note, what is the maximum number of units you imagine a player could ever have frozen at the same time? I'm wondering how many units players will have in addition to their Civilian.

Post has been edited 1 time(s), last time on Apr 28 2014, 6:27 am by Azrael.




Apr 28 2014, 7:21 pm DoomDoomDoom Post #18



Quote from Azrael
Well, it's unfreezing after 30 seconds now (360 DCs). The reason it was going too fast before is because you were adding DCs too fast: The trigger adding +1 DC for Player 2 was being run by Player 1, Player 2, and Player 8. Inferno's updated version prevents this by using "Current player" and "Foes", so it's only being added once.

Earlier I said to change "at least" to "exactly". If you'd done this, the reason it was breaking would have become obvious.

Quote from Azrael
For example, you said it seems your timer is running too fast. This could mean it's increasing too fast because of some other trigger you forgot about; if it was skipping from 58 Cantina DCs straight to 61, you'd be immediately aware there's a problem if you're using "exactly 60" since it would never even try to reset anything, and you could quickly solve it. If it's "at least 60", then that symptom (from what's potentially a much larger issue) might go unnoticed until you're so far into development that fixing the system is extremely difficult.

This is exactly what was happening; your Cantina DCs were literally skipping from 58 straight to 61. This is why you shouldn't use "at least <maximum>" and "at most <minimum>" conditions, and should use "exactly" instead, in order to avoid issues like this.



One really terrible offender is "at most 0". This is a pretty ridiculous condition, since negative values are impossible. It also has the added benefit of potentially breaking your map, because "at most" doesn't handle units the same way as "exactly". These should be changed as well.

Unfortunately, I saved the worst for last. The map doesn't work the way it appears to work right now; if units are ever frozen for different players at the same time, it will give all the units to one of those players when they unfreeze. This is obviously not what you want to happen.

Here are the two most practical solutions:

1) Make it so all of a player's units are frozen, never only some of them.
2) Make it so only 3 different players can have frozen units at the same time.

There are other possibilities if neither of those options will work for what you're planning, but the alternatives would be much more complex and time-consuming. Both of these solutions are extremely fast and easy to implement.

On a side note, what is the maximum number of units you imagine a player could ever have frozen at the same time? I'm wondering how many units players will have in addition to their Civilian.
The max amount of units for player 1-7 is 2. P.8 has... umlimited?
If what I want isnt possible I'll just take out the spell completely. Thanks anyway. I have about 50 diffent spells to add in so if this doesnt work its ok.
each civilain will obtain a "servant" which is their second unit. Then 7 players fight to the death until only one of them and the computer remains.

Post has been edited 1 time(s), last time on Apr 28 2014, 7:43 pm by DoomDoomDoom.



None.

Apr 28 2014, 8:19 pm Azrael Post #19



Is there a specific unit for the "servant", or some selection of specific units?

Are there specific units used by Player 8?

Will Player 8 ever own any of the "servant" units?

Should frozen players still be able to cast spells?

What are the maximum number of units which Player 8 might ever have inside another player's A4 location (aka, most P8 units that can become frozen at the same instant)?

The answers to these questions will be necessary for designing the best implementation of this system. With what you've said so far, I believe it's possible to create a system which does exactly what you want.




Apr 28 2014, 8:29 pm DoomDoomDoom Post #20



Quote from Azrael
Is there a specific unit for the "servant", or some selection of specific units?

Are there specific units used by Player 8?

Will Player 8 ever own any of the "servant" units?

Should frozen players still be able to cast spells?

What are the maximum number of units which Player 8 might ever have inside another player's A4 location (aka, most P8 units that can become frozen at the same instant)?

The answers to these questions will be necessary for designing the best implementation of this system. With what you've said so far, I believe it's possible to create a system which does exactly what you want.
There are 7 servants in the map. 1 for each player to find and pick.
P.8 will own around 12 types of units and about 20 types of buildings
P.8 will never own a servant
Frozen players with spells. Im thinking about it. Whatever way could work is fine with me
I dont understand your last question



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[01:53 am]
Ultraviolet -- :lol:
[06:51 pm]
Vrael -- It is, and I could definitely use a company with a commitment to flexibility, quality, and customer satisfaction to provide effective solutions to dampness and humidity in my urban environment.
[06:50 pm]
NudeRaider -- Vrael
Vrael shouted: Idk, I was looking more for a dehumidifer company which maybe stands out as a beacon of relief amidst damp and unpredictable climates of bustling metropolises. Not sure Amazon qualifies
sounds like moisture control is often a pressing concern in your city
[06:50 pm]
Vrael -- Maybe here on the StarEdit Network I could look through the Forums for some Introductions to people who care about the Topics of Dehumidifiers and Carpet Cleaning?
[06:49 pm]
Vrael -- Perhaps even here I on the StarEdit Network I could look for some Introductions.
[06:48 pm]
Vrael -- On this Topic, I could definitely use some Introductions.
[06:48 pm]
Vrael -- Perhaps that utilizes cutting-edge technology and eco-friendly cleaning products?
[06:47 pm]
Vrael -- Do you know anyone with a deep understanding of the unique characteristics of your carpets, ensuring they receive the specialized care they deserve?
[06:45 pm]
NudeRaider -- Vrael
Vrael shouted: I've also recently becoming interested in Carpet Cleaning, but I'd like to find someone with a reputation for unparalleled quality and attention to detail.
beats me, but I'd make sure to pick the epitome of excellence and nothing less.
[06:41 pm]
Vrael -- It seems like I may need Introductions to multiple companies for the Topics that I care deeply about, even as early as Today, 6:03 am.
Please log in to shout.


Members Online: Roy, Ultraviolet