Units have action meter

Farban

New Member
Reaction score
0
Hello

I am making a Mod using the Starcraft 2 editor. The mod is bascially turning the real time stragedy element of Starcraft 2 into a turn based stragdy game. One part of this will involve a action cost for each unit as they move/ attack etc. A unit moves their action cost decreases. The player then clicks next turn which then replenishes the action cost.

What triggers, actions would I need to look into, would I need to make custom abilties, which would be the best method to acheive this. Just trying to get a brief insight, which would speed up how I want to achive this.

Thanks for any suggestions
 

MissKerrigan

Active Member
Reaction score
23
Can you more specify your question?

What kind of cost do you want to add exactly when units moving?
 

Farban

New Member
Reaction score
0
Just like a number cost. So at the start of a turn the unit is assigned a action value, say 100, and then this is deducted every time the unit moves. So for every step the unit moves 1 point is deducted from the action total, if the unit attacks once then 10 points is removed. Until the unit can no longer perform a action until the next turn in which the action total is reset back to 100. Just trying to think of how to measure unit movement and turn it into a counter that can count down.
 

Siretu

Starcraft 2 Editor Moderator
Reaction score
293
You can use one of the unused resources. Assuming you're already using Vespsene gas and Minerals, you can choose between Terrazine and Custom Resource(this is just a normal resource like the other three). Let's assume you use Terrazine.

When the player clicks next turn, set the player's terrazine resource to 100.

For the attack, go into the unit's weapon and modify the Cost: Cost + field. You might want to modify CWeapon, I think that should modify the cost of all weapons(if that's what you want).

Moving is a bit more difficult. It should be possible to do entirely in the data editor though. For the sake of simplicity, I'll explain it with the addition of a simple trigger.

First we need a validator. A validator is used to validate if something is true or not. It's kind of like a condition in the trigger editor. We want a validator to check when the player runs out of terrazine, because if the unit runs out of terrazine while moving, we want it to stop. Create the validator and make sure the type is Player Compare Resource. Set Validator: Player + to Caster and Validator: Resource to Terrazine.

Create a new effect of the Modify Player type. Modify the Effect: Resources + and set the Terrazine field to -1. Set the Effect: Player + to Caster.

Create a new effect of the Remove Behavior type. Set the Unit: Unit + to Caster.

Create a new effect of the Issue Order type. Set the Ability: Ability to Stop and the Unit: Unit + to Caster.

Create a new effect of the Switch type. Open the Effect: Cases + field. Create a new case and set the effect to the Issue Order effect you created. Set the validator to the resource validator you created. Create another case and set the effect to the Remove Behavior effect you created and the validator to NotMoving. This makes sure the unit isn't moving. Press okay to close the Effect: Cases + field. Set the Effect: Default to the Modify Player effect you made.

Create a new behavior of the buff type. Set the Stats: Period to the time between each point is removed. 1 would be a good value to try first. Set the Effect: Effect - Periodic to the switch effect you created.

Go back to your Remove Behavior effect and set the Behavior: Behaviors field to the behavior you just created.

Finally, you need a simple trigger that looks something like:
Move cost
Events
Unit - Any Unit uses Move at Generic6 - Complete stage (Ignore shared abilities)
Local Variables
Conditions
Actions
Unit - Add 1 *Your_Behavior* to (Triggering unit) from (Triggering unit)
So let's see if I can explain what's actually going on here. The trigger starts the entire thing. When a unit is ordered to move, you add the behavior to it. The behavior will execute the switch effect every second, since it's the behaviors periodic effect. The switch is like a big switch case in the trigger editor. It will first check if the player has 0 terrazine. This means the player is out of action points. In that case, we want to stop the unit since it has no actions left. We do this by running an Issue Order effect, ordering it to stop.
If the player doesn't have 0 terrazine, it'll check if the unit is standing still. If the unit is standing still, we want to remove the behavior from the unit so it stops losing terrazine/action points. We remove the behavior with a simple Remove Behavior effect. If the unit is not standing still and the player doesn't have 0 Terrazine, it will run the default effect. This is the modify player effect which will lower the terrazine of the player.
 
General chit-chat
Help Users

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top