Beginners Custom CO Tutorial: Difference between revisions

(Part 1 Tutorial)
(Second Part WIP)
Line 3: Line 3:
This is a simple tutorial for beginners, new or fresh coders to want to make their own custom CO in COW
This is a simple tutorial for beginners, new or fresh coders to want to make their own custom CO in COW


So first off you need to have this<syntaxhighlight lang="js">
So first off you need to have this for your beginners setup.<syntaxhighlight lang="js">
var Constructor = function () {
var Constructor = function () {
     this.init = function (co, map) {
     this.init = function (co, map) {
Line 195: Line 195:
//Make sure put that CO_NAME (CO_TEST) in full caps lock in order to getting working
//Make sure put that CO_NAME (CO_TEST) in full caps lock in order to getting working
</syntaxhighlight>Feel free to copy that code block to get started!
</syntaxhighlight>Feel free to copy that code block to get started!
If you got your very first setup (if you got copy it from the code block above) you good to go follow this next step!
== Stats, Co zone & abilities ==
This is the second part of the tutorial is all about stats, CO zone & abilities


Now you need some stats, just mainly your Custom Co D2D, Power & Super Power
Now you need some stats, just mainly your Custom Co D2D, Power & Super Power
Line 205: Line 210:


[[Building]] (Props for income bonus)
[[Building]] (Props for income bonus)
Units also affect on stats as well
[[Naval Units|Naval]]
[[Air Units|Air]]
[[Infantry Units|Infantry]]
[[Ground Units|Ground]]
[[Hovercraft Units|Hover]]


Or you could visit Github for some COs coding Resource work https://github.com/Robosturm/Commander_Wars/tree/master/resources/scripts/cos
Or you could visit Github for some COs coding Resource work https://github.com/Robosturm/Commander_Wars/tree/master/resources/scripts/cos


If you got your very first setup (if you got copy it from the code block above) you good to go follow this next step!
As for abilities there is quite lots cos have unique abilities
 
* Global Damage
* Reinforcements
* Meteor Strike
* Healing
* ects


== Stats, Co zone & abilities ==
For the CO zone effects you need to be like this<syntaxhighlight lang="js">
This is the second part of the tutorial
            if (co.inCORange(Qt.point(defPosX, defPosY), defender))
            {
                return 50;
            }
            break;
//Depends on which CO zone you want "Deffensive(defPosX, defPosY), defender)", "Offensive(atkPosX, atkPosY), attacker)", Luck(posX, posY), unit)
</syntaxhighlight>
[[Category:Modding Tutorials]]
[[Category:Modding Tutorials]]

Revision as of 08:40, 16 December 2023

This is a beginners Custom CO Tutorial work

This is a simple tutorial for beginners, new or fresh coders to want to make their own custom CO in COW

So first off you need to have this for your beginners setup.

var Constructor = function () {
    this.init = function (co, map) {
        co.setPowerStars(3);
        co.setSuperpowerStars(3);
    };

    this.activatePower = function(co, map)
    {
        var dialogAnimation = co.createPowerSentence();
        var powerNameAnimation = co.createPowerScreen(GameEnums.PowerMode_Power);
        dialogAnimation.queueAnimation(powerNameAnimation);

        var units = co.getOwner().getUnits();
        var animations = [];
        var counter = 0;
        units.randomize();
        for (var i = 0; i < units.size(); i++)
        {
            var unit = units.at(i);

            var animation = GameAnimationFactory.createAnimation(map, unit.getX(), unit.getY());
            animation.writeDataInt32(unit.getX());
            animation.writeDataInt32(unit.getY());
            animation.writeDataInt32(2);
            animation.setEndOfAnimationCall("ANIMATION", "postAnimationHeal");
            var delay = globals.randInt(135, 265);
            if (animations.length < 5)
            {
                delay *= i;
            }
            animation.setSound("power0.wav", 1, delay);
            if (animations.length < 5)
            {
                animation.addSprite("power0", -map.getImageSize() * 1.27, -map.getImageSize() * 1.27, 0, 2, delay);
                powerNameAnimation.queueAnimation(animation);
                animations.push(animation);
            }
            else
            {
                animation.addSprite("power0", -map.getImageSize() * 1.27, -map.getImageSize() * 1.27, 0, 2, delay);
                animations[counter].queueAnimation(animation);
                animations[counter] = animation;
                counter++;
                if (counter >= animations.length)
                {
                    counter = 0;
                }
            }
        }
        units.remove();
    };


    this.activateSuperpower = function(co, powerMode, map)
    {
        var dialogAnimation = co.createPowerSentence();
        var powerNameAnimation = co.createPowerScreen(powerMode);
        powerNameAnimation.queueAnimationBefore(dialogAnimation);

        var units = co.getOwner().getUnits();
        var animations = [];
        var counter = 0;
        units.randomize();
        for (var i = 0; i < units.size(); i++)
        {
            var unit = units.at(i);

            var animation = GameAnimationFactory.createAnimation(map, unit.getX(), unit.getY());
            animation.writeDataInt32(unit.getX());
            animation.writeDataInt32(unit.getY());
            animation.writeDataInt32(8);
            animation.setEndOfAnimationCall("ANIMATION", "postAnimationHeal");
            var delay = globals.randInt(135, 265);
            if (animations.length < 7)
            {
                delay *= i;
            }
            if (i % 2 === 0)
            {
                animation.setSound("power12_1.wav", 1, delay);
            }
            else
            {
                animation.setSound("power12_2.wav", 1, delay);
            }
            if (animations.length < 7)
            {
                animation.addSprite("power12", -map.getImageSize() * 2, -map.getImageSize() * 2, 0, 2, delay);
                powerNameAnimation.queueAnimation(animation);
                animations.push(animation);
            }
            else
            {
                animation.addSprite("power12", -map.getImageSize() * 2, -map.getImageSize() * 2, 0, 2, delay);
                animations[counter].queueAnimation(animation);
                animations[counter] = animation;
                counter++;
                if (counter >= animations.length)
                {
                    counter = 0;
                }
            }
        }
        units.remove();
    };

    this.loadCOMusic = function (co, map) {
        // put the co music in here.
        switch (co.getPowerMode()) {
            case GameEnums.PowerMode_Power:
                audio.addMusic("mods/testco/music/cos/Power.mp3", 0, 0);
                break;
            case GameEnums.PowerMode_Superpower:
                audio.addMusic("mods/testco/music/cos/Super.mp3", 0, 0);
                break;
            case GameEnums.PowerMode_Tagpower:
                audio.addMusic("mods/testco/music/cos/Super.mp3", 0, 0);
                break;
            default:
                audio.addMusic("mods/testco/music/cos/Theme.mp3", 0, 0);
                break;
        }
    };

    this.getCOUnitRange = function (co, map) {
        return Number;
    };
    this.getCOArmy = function () {
        return "Vanilla Base Game or custom";
    };
    // CO - Intel
    this.getBio = function (co) {
        return qsTr("Type for your own description");
    };
    this.getLongBio = function(co, map)
    {
        return qsTr("\n\n\"Special Message Quote\"");
    };
    this.getHits = function (co) {
        return qsTr("");
    };
    this.getMiss = function (co) {
        return qsTr("");
    };
    this.getCODescription = function (co) {
        return qsTr("Type for your own description only affect D2D or CO zone Effect");
    };
    this.getLongCODescription = function() {
    return qsTr("\nD2D Effect: \nType your D2D ability") +
           qsTr("\n\nZone Effect: \nType your CO Zone ability");
    };
    this.getPowerDescription = function (co) {
        return qsTr("Type for your own description for power (COP)");
    };
    this.getPowerName = function (co) {
        return qsTr("Name");
    };
    this.getSuperPowerDescription = function (co) {
        return qsTr("Type for your own description for super power (SCOP)");
    };
    this.getSuperPowerName = function (co) {
        return qsTr("Name");
    };
    this.getPowerSentences = function (co) {
        switch (co.getPowerMode()) {
            case GameEnums.PowerMode_Power:
            return [qsTr("Type here for your own power quotes")];
            break;
            case GameEnums.PowerMode_Superpower:
            return [qsTr("Type here for your own super power quotes")];
            break;
            case GameEnums.PowerMode_Tagpower:
            return [qsTr("("Type here for your own tag power quotes")];
            break; 
            }
    };
    this.getVictorySentences = function (co) {
        return [qsTr("Type here for your own victory quotes")];
    };
    this.getDefeatSentences = function (co) {
        return [qsTr("Type here for your own defeat quotes")];
    };
    this.getName = function () {
        return qsTr("Name");
    };
}

Constructor.prototype = CO;
var CO_TEST = new Constructor();
//Make sure put that CO_NAME (CO_TEST) in full caps lock in order to getting working

Feel free to copy that code block to get started!

If you got your very first setup (if you got copy it from the code block above) you good to go follow this next step!

Stats, Co zone & abilities

This is the second part of the tutorial is all about stats, CO zone & abilities

Now you need some stats, just mainly your Custom Co D2D, Power & Super Power

Stats Code Library (D2D, other abilities & ects)

Terrain Codes (Modified terrain itself)

Weather Codes (Weather manipulations)

Building (Props for income bonus)

Units also affect on stats as well

Naval

Air

Infantry

Ground

Hover

Or you could visit Github for some COs coding Resource work https://github.com/Robosturm/Commander_Wars/tree/master/resources/scripts/cos

As for abilities there is quite lots cos have unique abilities

  • Global Damage
  • Reinforcements
  • Meteor Strike
  • Healing
  • ects

For the CO zone effects you need to be like this

            if (co.inCORange(Qt.point(defPosX, defPosY), defender))
            {
                return 50;
            }
            break;
//Depends on which CO zone you want "Deffensive(defPosX, defPosY), defender)", "Offensive(atkPosX, atkPosY), attacker)", Luck(posX, posY), unit)