Okay, I'm kind of stuck here. I'm new to the editor and I've been doing kinda okay groping around and figuring things out. But I seem to have run into a wall.
I'm trying to make a mod where your workers are employees that you have to pay to make them happy. I can't even get the beginning functionality of this working very well.
So far I've tried two things.
One: A buff that applies a periodic effect, with the effect being a modify player that subtracts a mineral. The problem with that is that nothing bad happens if you run out of minerals and can't pay your workers. The periodic effect just keeps ticking and your minerals don't go below zero. So I abandoned this idea to try something else.
Two: A buff that applies a periodic effect, with the effect being a "create healer" that costs minerals and heals the unit's own energy. I unchecked the channeling flag because I want the workers to be able to move while healing their energy. (I don't even know if that's what it does.) Then I gave drones a bunch of maximum energy and zero starting energy to test it. But this has a problem too. Every time the periodic effect ticks, the speed of healing goes up. Like it's stacking heal effects rather than just ticking them. So I tried a different way. I limited the periodic effect to being executed one time, and it works exactly how I want it to! It applies a constant heal that periodically subtracts a mineral for each worker that has the buff. But this approach has a problem too. It works "too well", I guess you could say. If you run out of minerals, every worker stops healing its energy, and when you get more minerals, they never start healing again, because the periodic effect was only set to run once!
So I'm stuck trying to solve that problem. One idea I have is a second buff that periodically checks to see if the original has been removed and reapplies it if it has. But I don't know how to do that. Validators only seem to be capable of disabling or removing the buff that they're in. They don't seem to be capable of determining whether a periodic effect should go off.
Is there an easier way to get this to do what I want it to do?
I want the player to be able to increase or decrease the pay their worker gets, so I want this to be stackable or modifiable. But I don't want to have to use triggers for it because I want it to be a mod that can be easily applied to existing melee maps.
I'll figure out how to increase or decrease the pay later, probably with a button on hatcheries, cc's, etc. For now I just want to get this initial thing to work right!
EDIT: I just laughed out loud when I posted this, and saw the title "Trying to implement worker payroll" above my picture of a wolf in a business suit.
EDIT: I just laughed out loud when I posted this, and saw the title "Trying to implement worker payroll" above my picture of a wolf in a business suit.
I just wash dishes at a hotel, haha! But I'm a big fan of free market ideas. I thought it would be cool to make a mod that sort of simulates players having to run a business in a melee game while trying to kill each other. xD If I can get this working, I'll make it so low energy workers are unhappy and they might quit and go work for your opponent.
that is close to what my idea is just not in a business format. an idea for your map would be other players could be customers and if they tip the worker it improves them or if they dont tip it has a negitive affect. and if your going to use a 'food' idea, have it so if the food is cooked good or not. maybe a some food born illness if under cooked, lol.
There's a validator to compare player resources. If you put that in the Deactivate field on a Behavior it won't apply while the validator returns false, but it will still exist and activate the instant the validator returns true.
Place a behavior on workers/units for the "unpaid" state using a validator that checks for minerals=0, then add all the unpleasant effects you like.
Subtract minerals via a stackable buff behavior, which can internally run a persistent effect on the host unit: set the phase/period field like you would for a persistent effect, and set the periodic effect to a modify player effect that removes minerals. You can then set the payroll in discrete increments by adding stacks of the behavior, or use upgrades/triggers/etc to globally modify the period+mineral amount.
Ah, thank you Photoloss. That is... actually very similar to what I had already tried. But I was under the impression that the behavior did the complete opposite of what you're saying with the disable validator. I suppose that would explain the problem I had though. I had it set to check if the resources equaled 0, on my behavior that paid the worker, but the behavior never did anything.
If that's the case, then the editor's interface lied to me. I hovered over that field name with detail view on and it told me that it would disable the behavior if the validator returned false.
Is disable just something that pauses the behavior while the validator is true, and then resumes the behavior while the validator is false? Does that mean that the behavior's used duration and time to next period will pause and resume according to what the disable validator returns?
tdhsst: Naw, I plan on it just being normal melee combat with an added twist. That means that, while similar, it seems we each have our own unique ideas. :P
EDIT: I've been considering something else that I think will make it act more like I want. Your explanation puts my original idea back on the table, but I've been considering a new idea.
A hidden behavior that has a period that places a "Wages" behavior on every 30 second period. The wages behavior has a duration of 30 seconds. Its expire effect is a set effect called "Periodic Pay". That does two behaviors: It removes a mineral from the player and gives the unit ten energy. My Final Effect for the Wages behavior is going to be "Didn't Pay" or whatever negative behavior I settle on. I'm hoping that since Expire Effect's hover text says it goes off if the behavior finishes its duration, that it differentiates between Expiring and being removed, such as by a removal validator. If so, I can have it pay the worker if it expires normally, and apply "Didn't Pay" if it gets removed by a validator that compares the player's resources.
I was indeed already planning on having the Wages buff stack so I could pay the workers more by increasing the number of stacks.
I'm glad to see that you came up with your ideas idea independently. It hints to me that I'm on the right track.
EDIT: Wait... Okay I think my logic was just wrong the whole time, haha. It disables if the behavior returns false, and I was checking to see if minerals equaled 0, which would return true if minerals equaled 0, and return false if minerals were anything other than 0. So my original idea would have worked if I had checked to see if minerals were greater than zero.
Maybe I can use a hybrid between my/your initial idea and what I'm thinking now.
I think behavior duration and period state continue to run while deactivated by the validator, but no modifications apply and no effects execute. I may be wrong though, should be easy to test.
Note that Effect-Final executes even if the behavior timed out, so you'll need another validator to prevent the "didn't pay" debuff from occuring if the player had the money.
Equal periods on the spawner and the running "wages" might cause a problem, as the previous wages may not have expired when the new buff is applied. Depending on the renewal flags this may cause the wage buff to never run its expiry effect.
The way you describe it I don't see an advantage to your system compared to mine, and it's more complicated. Your system could be modified to only check player bankruptcy at payroll time, which mine can't, but the current functionality sounds identical.
As a negative effect apply a neural parasite like buff that sets the owning player to neutral/hostile until the next payroll. Use a Switch effect that is based on your resource amount. If you have the resources it adds energy and removes resources via a Modify Unit and Modify Player effect. The payroll buff itself is disabled as long as the unit has energy but has a very low period. if the player lacks the resources it uses the other branch of the Switch effect that applies energy and a neural parasite like buff that sets the unit to neutral but is removed when the unit has 0 energy.
Rollback Post to RevisionRollBack
Contribute to the wiki (Wiki button at top of page) Considered easy altering of the unit textures?
I've been thinking about it a bit more lately. I think I'm going to avoid the approach of using a negative buff that's disabled while the player has minerals. Because if the player runs out of minerals, all of his workers will get the negative buff simultaneously whether they've been paid or not. Originally I was thinking I wanted something that lets each worker get their pay in sync, but I kinda like the way each individual worker has a separately ticking pay period (that starts when the worker is built). It allows each individual worker to vary on how happy they might be.
I was going to actually go for something along the lines of what DrSuperEvil just posted. Except I didn't know about Switch effects. If it's what I think it is, then that's perfect. I was thinking of having a Payroll buff that ticks and executes a Set effect that contains both the positive and negative effects and use validators to see which one goes off. It sounds like Switch is something that I can use to do that more efficiently.
That way, workers will only get Unpaid if one of their payroll stacks goes off when the player has zero minerals. I can set it to have like a 30 second duration and be only stackable once and not refresh to make it so a worker gets just one Unpaid buff for the duration of their full pay period or something.
I'm thinking the negative effect will just drain like, half the worker's energy. And the worker has a maximum of like 1000 energy, and the positive effect of getting paid restores very little, so that's a big deal. And maybe put in some kind of effect that has a small random chance of going off if the worker is below a certain amount of energy. And that could change the ownership of the worker. I'm also thinking along the lines of adding an issue order effect to tell the worker to Move to a location near an opponent's building when this happens, but I gotta get this payroll thing working before I worry (too much) about that.
I suggest you avoid random chance and force-suicide orders, those can make for very irritating gameplay situations. Unless you don't control workers in the first place and there's many of them, like in a "tug of war" game.
Instead you could make them search for other nearby unhappy workers, and if several of them meet they form a rebellion.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Okay, I'm kind of stuck here. I'm new to the editor and I've been doing kinda okay groping around and figuring things out. But I seem to have run into a wall.
I'm trying to make a mod where your workers are employees that you have to pay to make them happy. I can't even get the beginning functionality of this working very well.
So far I've tried two things.
One: A buff that applies a periodic effect, with the effect being a modify player that subtracts a mineral. The problem with that is that nothing bad happens if you run out of minerals and can't pay your workers. The periodic effect just keeps ticking and your minerals don't go below zero. So I abandoned this idea to try something else.
Two: A buff that applies a periodic effect, with the effect being a "create healer" that costs minerals and heals the unit's own energy. I unchecked the channeling flag because I want the workers to be able to move while healing their energy. (I don't even know if that's what it does.) Then I gave drones a bunch of maximum energy and zero starting energy to test it. But this has a problem too. Every time the periodic effect ticks, the speed of healing goes up. Like it's stacking heal effects rather than just ticking them. So I tried a different way. I limited the periodic effect to being executed one time, and it works exactly how I want it to! It applies a constant heal that periodically subtracts a mineral for each worker that has the buff. But this approach has a problem too. It works "too well", I guess you could say. If you run out of minerals, every worker stops healing its energy, and when you get more minerals, they never start healing again, because the periodic effect was only set to run once!
So I'm stuck trying to solve that problem. One idea I have is a second buff that periodically checks to see if the original has been removed and reapplies it if it has. But I don't know how to do that. Validators only seem to be capable of disabling or removing the buff that they're in. They don't seem to be capable of determining whether a periodic effect should go off.
Is there an easier way to get this to do what I want it to do?
I want the player to be able to increase or decrease the pay their worker gets, so I want this to be stackable or modifiable. But I don't want to have to use triggers for it because I want it to be a mod that can be easily applied to existing melee maps.
I'll figure out how to increase or decrease the pay later, probably with a button on hatcheries, cc's, etc. For now I just want to get this initial thing to work right!
EDIT: I just laughed out loud when I posted this, and saw the title "Trying to implement worker payroll" above my picture of a wolf in a business suit.
EDIT: I just laughed out loud when I posted this, and saw the title "Trying to implement worker payroll" above my picture of a wolf in a business suit.
WOW. where do you work and are they hiring? LOL
I just wash dishes at a hotel, haha! But I'm a big fan of free market ideas. I thought it would be cool to make a mod that sort of simulates players having to run a business in a melee game while trying to kill each other. xD If I can get this working, I'll make it so low energy workers are unhappy and they might quit and go work for your opponent.
@Amaroq64:
that is close to what my idea is just not in a business format. an idea for your map would be other players could be customers and if they tip the worker it improves them or if they dont tip it has a negitive affect. and if your going to use a 'food' idea, have it so if the food is cooked good or not. maybe a some food born illness if under cooked, lol.
There's a validator to compare player resources. If you put that in the Deactivate field on a Behavior it won't apply while the validator returns false, but it will still exist and activate the instant the validator returns true.
Place a behavior on workers/units for the "unpaid" state using a validator that checks for minerals=0, then add all the unpleasant effects you like.
Subtract minerals via a stackable buff behavior, which can internally run a persistent effect on the host unit: set the phase/period field like you would for a persistent effect, and set the periodic effect to a modify player effect that removes minerals. You can then set the payroll in discrete increments by adding stacks of the behavior, or use upgrades/triggers/etc to globally modify the period+mineral amount.
Ah, thank you Photoloss. That is... actually very similar to what I had already tried. But I was under the impression that the behavior did the complete opposite of what you're saying with the disable validator. I suppose that would explain the problem I had though. I had it set to check if the resources equaled 0, on my behavior that paid the worker, but the behavior never did anything.
If that's the case, then the editor's interface lied to me. I hovered over that field name with detail view on and it told me that it would disable the behavior if the validator returned false.
Is disable just something that pauses the behavior while the validator is true, and then resumes the behavior while the validator is false? Does that mean that the behavior's used duration and time to next period will pause and resume according to what the disable validator returns?
tdhsst: Naw, I plan on it just being normal melee combat with an added twist. That means that, while similar, it seems we each have our own unique ideas. :P
EDIT: I've been considering something else that I think will make it act more like I want. Your explanation puts my original idea back on the table, but I've been considering a new idea.
A hidden behavior that has a period that places a "Wages" behavior on every 30 second period. The wages behavior has a duration of 30 seconds. Its expire effect is a set effect called "Periodic Pay". That does two behaviors: It removes a mineral from the player and gives the unit ten energy. My Final Effect for the Wages behavior is going to be "Didn't Pay" or whatever negative behavior I settle on. I'm hoping that since Expire Effect's hover text says it goes off if the behavior finishes its duration, that it differentiates between Expiring and being removed, such as by a removal validator. If so, I can have it pay the worker if it expires normally, and apply "Didn't Pay" if it gets removed by a validator that compares the player's resources.
I was indeed already planning on having the Wages buff stack so I could pay the workers more by increasing the number of stacks.
I'm glad to see that you came up with your ideas idea independently. It hints to me that I'm on the right track.
EDIT: Wait... Okay I think my logic was just wrong the whole time, haha. It disables if the behavior returns false, and I was checking to see if minerals equaled 0, which would return true if minerals equaled 0, and return false if minerals were anything other than 0. So my original idea would have worked if I had checked to see if minerals were greater than zero.
Maybe I can use a hybrid between my/your initial idea and what I'm thinking now.
I think behavior duration and period state continue to run while deactivated by the validator, but no modifications apply and no effects execute. I may be wrong though, should be easy to test.
Note that Effect-Final executes even if the behavior timed out, so you'll need another validator to prevent the "didn't pay" debuff from occuring if the player had the money.
Equal periods on the spawner and the running "wages" might cause a problem, as the previous wages may not have expired when the new buff is applied. Depending on the renewal flags this may cause the wage buff to never run its expiry effect.
The way you describe it I don't see an advantage to your system compared to mine, and it's more complicated. Your system could be modified to only check player bankruptcy at payroll time, which mine can't, but the current functionality sounds identical.
As a negative effect apply a neural parasite like buff that sets the owning player to neutral/hostile until the next payroll. Use a Switch effect that is based on your resource amount. If you have the resources it adds energy and removes resources via a Modify Unit and Modify Player effect. The payroll buff itself is disabled as long as the unit has energy but has a very low period. if the player lacks the resources it uses the other branch of the Switch effect that applies energy and a neural parasite like buff that sets the unit to neutral but is removed when the unit has 0 energy.
Contribute to the wiki (Wiki button at top of page) Considered easy altering of the unit textures?
https://www.sc2mapster.com/forums/resources/tutorials/179654-data-actor-events-message-texture-select-by-id
https://media.forgecdn.net/attachments/187/40/Screenshot2011-04-17_09_16_21.jpg
I've been thinking about it a bit more lately. I think I'm going to avoid the approach of using a negative buff that's disabled while the player has minerals. Because if the player runs out of minerals, all of his workers will get the negative buff simultaneously whether they've been paid or not. Originally I was thinking I wanted something that lets each worker get their pay in sync, but I kinda like the way each individual worker has a separately ticking pay period (that starts when the worker is built). It allows each individual worker to vary on how happy they might be.
I was going to actually go for something along the lines of what DrSuperEvil just posted. Except I didn't know about Switch effects. If it's what I think it is, then that's perfect. I was thinking of having a Payroll buff that ticks and executes a Set effect that contains both the positive and negative effects and use validators to see which one goes off. It sounds like Switch is something that I can use to do that more efficiently.
That way, workers will only get Unpaid if one of their payroll stacks goes off when the player has zero minerals. I can set it to have like a 30 second duration and be only stackable once and not refresh to make it so a worker gets just one Unpaid buff for the duration of their full pay period or something.
I'm thinking the negative effect will just drain like, half the worker's energy. And the worker has a maximum of like 1000 energy, and the positive effect of getting paid restores very little, so that's a big deal. And maybe put in some kind of effect that has a small random chance of going off if the worker is below a certain amount of energy. And that could change the ownership of the worker. I'm also thinking along the lines of adding an issue order effect to tell the worker to Move to a location near an opponent's building when this happens, but I gotta get this payroll thing working before I worry (too much) about that.
I suggest you avoid random chance and force-suicide orders, those can make for very irritating gameplay situations. Unless you don't control workers in the first place and there's many of them, like in a "tug of war" game.
Instead you could make them search for other nearby unhappy workers, and if several of them meet they form a rebellion.