Wargus / stratagus

The Stratagus strategy game engine
GNU General Public License v2.0
622 stars 119 forks source link

Hello, a question about building control groups #191

Closed Erenussocrates closed 7 years ago

Erenussocrates commented 8 years ago

Hello, it's also bugging my friends who play wargus as well. You know you can assign units and buildings to control groups by control + number. But for some reason, the buildings don't get selected when you press the number, you have to select alt + number in order to select the buildings, and pressing the number only makes you select the most recently trained units from the said building. Do you know what I must do / which file I must edit to swap this control and make it so that building is chosen with just pressing the number, and recently trained units chosen with alt + number?

Mistranger commented 8 years ago

This is Total Annihilation select scheme, I don't know who put it in Stratagus. Remove this in action_train.cpp (maybe somewhere else)

DinkyDyeAussie commented 7 years ago

Why would you want to remove it? Its something that everyone would use. I want to have buildings selectable by pressing a number key too.

It works well for units as you're not madly scrolling around the map trying to select units of the same group that you want.

Ill have a look into it and if I can sort something out.

Andrettin commented 7 years ago

Hey Dinky, I sorted that out in Wyrmsun, by giving the buildings the "IsSelectableByRectangle" tag, and by removing the following code in action_train.cpp (which makes units trained by buildings be placed in the same control group as the building):

    /* Auto Group Add */
    /*
    if (!unit.Player->AiEnabled && unit.GroupId) {
        int num = 0;
        while (!(unit.GroupId & (1 << num))) {
            ++num;
        }
        AddToGroup(&newUnit, 1, num);
    }
Erenussocrates commented 7 years ago

Now I just need to learn how to integrate the modded action_train.cpp into wargus. I also want to make the buildings be able to train same unit when I select more than one of them. I mean for example, when you make barracks selectable by rectangle in units.lua, you are able to select more than one barracks. What I want to do is, when you select two barrackses and select train footman, only one barracks trains that unit in vanilla wargus. I want to make it so that when I select more than one and issue a training command, I want all of the selected ones to train the same unit(s).

Andrettin commented 7 years ago

To do what you want you would need to edit /ui/botpanel.cpp instead. In Wyrmgus I did something like that, replacing the code of the CButtonPanel::DoClicked_Train function with the following:

void CButtonPanel::DoClicked_Train(int button)
{
    CUnitType &type = *UnitTypes[CurrentButtons[button].Value];
    int best_training_place = 0;
    int lowest_queue = Selected[0]->Orders.size();

    for (size_t i = 0; i != Selected.size(); ++i) {
        if (Selected[i]->Type == Selected[0]->Type) {
            int selected_queue = 0;
            for (size_t j = 0; j < Selected[i]->Orders.size(); ++j) {
                if (Selected[i]->Orders[j]->Action == UnitActionTrain) {
                    selected_queue += 1;
                }
            }
            if (selected_queue < lowest_queue) {
                lowest_queue = selected_queue;
                best_training_place = i;
            }
        }
    }

    if (Selected[best_training_place]->CurrentAction() == UnitActionTrain && !EnableTrainingQueue) {
        ThisPlayer->Notify(NotifyYellow, Selected[best_training_place]->tilePos, "%s", _("Unit training queue is full"));
    } else if (ThisPlayer->CheckLimits(type) >= 0 && !ThisPlayer->CheckUnitType(type)) {
        SendCommandTrainUnit(*Selected[best_training_place], type, ThisPlayer->Index, !(KeyModifiers & ModifierShift));
        UI.StatusLine.Clear();
        UI.StatusLine.ClearCosts();
    } else if (ThisPlayer->CheckLimits(type) == -3) {
        if (GameSounds.NotEnoughFood[ThisPlayer->Race].Sound) {
            PlayGameSound(GameSounds.NotEnoughFood[ThisPlayer->Race].Sound, MaxSampleVolume);
        }
    }
}

This code makes it so that when you press the button to train a unit (if multiple barrackses are selected), then it will instruct the barracks that has the least training orders queued to train the new unit (if all barrackses have the same quantity of training orders, it will give the order to the one that comes first in the selection order).

DinkyDyeAussie commented 7 years ago

Ill get that put in wargus/stratagus today mate.

Erenussocrates commented 7 years ago

@DinkyDyeAussie , will you get this last one put in botpanel.cpp, or will you comment out the previous one in action_train.cpp?

DinkyDyeAussie commented 7 years ago

Ill do both when I finish work today and when I know they work with the trunk on my pc ill upload them.

Erenussocrates commented 7 years ago

Okay, I'll be waiting for a notice

DinkyDyeAussie commented 7 years ago

I always thought buildings were selectable by rectangle? Swear they were in the original warcraft 2

DinkyDyeAussie commented 7 years ago

OK so I am testing this code as we speak. To be honest I like the whole building has a number thing so you can easily select it and train units whenever you're away from your base - makes it really convenient.

But the whole select-with-rectangle multiple buildings thing is really not that good. If I want to select a group of units around a barracks - like footman - I use the selection rectangle. Problem is, now buildings can be selected at the same time as units too, resulting in all the units and building selected, which means time wasted unselecting the building.

Again, I love the assigning a number hotkey to the building, that works great. The rest I really don't like. Each to their own I guess. Unless there's a way to make it so if you DO select multiple ground units around a building that can also be selected like this, we test to see if there are any foot units around the building, and, if there is, we dissallow the building to be selected at the same time...

DinkyDyeAussie commented 7 years ago

Also when I was working on code, I saw that both CYCLES_PER_SECOND and FRAMES_PER_SECOND are both set at 30. Wouldn't they both be better at 60? Surely it would make things smoother?

Anyway. Ill upload that code now.

DinkyDyeAussie commented 7 years ago

OK all done. Give it 10 minutes to build and see if it is successful.

Andrettin commented 7 years ago

Hey Dinky, you have a good point about the building being selected together with buildings. I did something like that for Wyrmgus already, making it so a building is selected only if there are no units in the rectangle, and it selects only one building (you can add more buildings of the same unit type to the selection by shift-clicking the others).

This is the code in question in selection.cpp (I've kept the Wyrmgus tags on so that you may more easily see the changes):

/**
**  Toggle the selection of a unit in a group of selected units
**
**  @param unit  Pointer to unit to be toggled.
**  @return      0 if unselected, 1 otherwise
*/
int ToggleSelectUnit(CUnit &unit)
{
    if (unit.Selected) {
        UnSelectUnit(unit);
        return 0;
    }
    //Wyrmgus start
    if (Selected.size() && ((Selected[0]->Type->Building && (!unit.Type->Building || unit.Type != Selected[0]->Type)) || Selected[0]->Type->Building != unit.Type->Building)) {
        return 0;
    }
    //Wyrmgus end
    SelectUnit(unit);
    return 1;
}
int ToggleUnitsByType(CUnit &base)
{
    const CUnitType &type = *base.Type;

    // if unit is a cadaver or hidden (not on map)
    // no unit can be selected.
    if (base.Removed || base.IsAlive() == false) {
        return 0;
    }
    // if unit isn't belonging to the player, or is a static unit
    // (like a building), only 1 unit can be selected at the same time.
    if (!CanSelectMultipleUnits(*base.Player) || !type.BoolFlag[SELECTABLEBYRECTANGLE_INDEX].value) {
        return 0;
    }

    //Wyrmgus start
    if (Selected.size() && ((Selected[0]->Type->Building && (!base.Type->Building || base.Type != Selected[0]->Type)) || Selected[0]->Type->Building != base.Type->Building)) {
        return 0;
    }
    //Wyrmgus end

    if (!SelectUnit(base)) { // Add base to selection
        return 0;
    }
    //
    //  Search for other visible units of the same type
    //

    // select all visible units.
    // StephanR: should be (MapX,MapY,MapX+MapWidth-1,MapY+MapHeight-1) ???
    // FIXME: this should probably be cleaner implemented if SelectUnitsByType()
    // took parameters of the selection rectangle as arguments */
    const CViewport *vp = UI.MouseViewport;
    const Vec2i offset(1, 1);
    const Vec2i minPos = vp->MapPos - offset;
    const Vec2i vpSize(vp->MapWidth, vp->MapHeight);
    const Vec2i maxPos = vp->MapPos + vpSize + offset;
    std::vector<CUnit *> table;

    Select(minPos, maxPos, table, HasSameTypeAs(type));

    // FIXME: peon/peasant with gold/wood & co are considered from
    // different type... idem for tankers
    for (size_t i = 0; i < table.size(); ++i) {
        CUnit &unit = *table[i];

        if (!CanSelectMultipleUnits(*unit.Player)) {
            continue;
        }
        if (unit.IsUnusable()) { // guess SelectUnits doesn't check this
            continue;
        }
        if (&unit == &base) { // no need to have the same unit twice
            continue;
        }
        if (unit.TeamSelected) { // Somebody else onteam has this unit
            continue;
        }
        //Wyrmgus start
        if (unit.Type->Building && Selected.size() && (!Selected[0]->Type->Building || unit.Type != Selected[0]->Type)) {
            continue;
        }
        //don't select units if a building is selected
        if (!unit.Type->Building && Selected.size() && Selected[0]->Type->Building) {
            continue;
        }
        //Wyrmgus end
        if (!SelectUnit(unit)) { // add unit to selection
            return Selected.size();
        }
    }

    NetworkSendSelection(&Selected[0], Selected.size());
    return Selected.size();
}
int AddGroupFromUnitToSelection(CUnit &unit)
{
    unsigned int group = unit.LastGroup;

    if (!group) { // belongs to no group
        return 0;
    }

    //Wyrmgus start
    if (Selected.size() && ((Selected[0]->Type->Building && (!unit.Type->Building || unit.Type != Selected[0]->Type)) || Selected[0]->Type->Building != unit.Type->Building)) {
        return 0;
    }
    //Wyrmgus end

    for (CUnitManager::Iterator it = UnitManager.begin(); it != UnitManager.end(); ++it) {
        CUnit &unit = **it;
        if (unit.LastGroup == group && !unit.Removed) {
            SelectUnit(unit);
            if (Selected.size() == MaxSelectable) {
                return Selected.size();
            }
        }
    }
    return Selected.size();
}
//Wyrmgus start
//static bool SelectOrganicUnitsInTable(std::vector<CUnit *> &table)
static bool SelectOrganicUnitsInTable(std::vector<CUnit *> &table, bool added_table)
//Wyrmgus end
{
    unsigned int n = 0;

    //Wyrmgus start
    //check if has non-building
    bool hasNonBuilding = false;

    if (added_table == false) {
        for (size_t i = 0; i != table.size(); ++i) {
            CUnit &unit = *table[i];

            if (!unit.Type->Building) {
                hasNonBuilding = true;
            }
        }
    }
    //Wyrmgus end

    for (size_t i = 0; i != table.size(); ++i) {
        CUnit &unit = *table[i];

        if (!CanSelectMultipleUnits(*unit.Player) || !unit.Type->BoolFlag[SELECTABLEBYRECTANGLE_INDEX].value) {
            continue;
        }
        if (unit.IsUnusable()) {  // guess SelectUnits doesn't check this
            continue;
        }
        if (unit.TeamSelected) { // Somebody else onteam has this unit
            continue;
        }
        //Wyrmgus start
        //only select buildings if another building of the same type is already selected
        if (added_table == false && unit.Type->Building && ((i != 0 && unit.Type != table[0]->Type) || hasNonBuilding)) {
            continue;
        }
        //Wyrmgus end
        table[n++] = &unit;
        if (n == MaxSelectable) {
            break;
        }
    }
    if (n != 0) {
        table.resize(n);
        return true;
    }
    return false;
}
int SelectUnitsInRectangle(const PixelPos &corner_topleft, const PixelPos &corner_bottomright)
{
    const Vec2i t0 = Map.MapPixelPosToTilePos(corner_topleft);
    const Vec2i t1 = Map.MapPixelPosToTilePos(corner_bottomright);
    const Vec2i range(2, 2);
    std::vector<CUnit *> table;

    Select(t0 - range, t1 + range, table);
    SelectSpritesInsideRectangle(corner_topleft, corner_bottomright, table);

    // 1) search for the player units selectable with rectangle
    //Wyrmgus start
//  if (SelectOrganicUnitsInTable(table)) {
    if (SelectOrganicUnitsInTable(table, false)) {
    //Wyrmgus end
        const int size = static_cast<int>(table.size());
        ChangeSelectedUnits(&table[0], size);
        return size;
    }

    // 2) If no unit found, try a player's unit not selectable by rectangle
    for (size_t i = 0; i != table.size(); ++i) {
        CUnit &unit = *table[i];

        if (!CanSelectMultipleUnits(*unit.Player)) {
            continue;
        }
        // FIXME: Can we get this?
        if (!unit.Removed && unit.IsAlive()) {
            SelectSingleUnit(unit);
            return 1;
        }
    }

    // 3) If no unit found, try a resource or a neutral critter
    for (size_t i = 0; i != table.size(); ++i) {
        CUnit &unit = *table[i];
        // Unit visible FIXME: write function UnitSelectable
        if (!unit.IsVisibleInViewport(*UI.SelectedViewport)) {
            continue;
        }
        const CUnitType &type = *unit.Type;
        // Buildings are visible but not selectable
        if (type.Building && !unit.IsVisibleOnMap(*ThisPlayer)) {
            continue;
        }
        if ((type.GivesResource && !unit.Removed)) { // no built resources.
            SelectSingleUnit(unit);
            return 1;
        }
    }

    // 4) If no unit found, select an enemy unit (first found)
    for (size_t i = 0; i != table.size(); ++i) {
        CUnit &unit = *table[i];
        // Unit visible FIXME: write function UnitSelectable
        if (!unit.IsVisibleInViewport(*UI.SelectedViewport)) {
            continue;
        }
        // Buildings are visible but not selectable
        if (unit.Type->Building && !unit.IsVisibleOnMap(*ThisPlayer)) {
            continue;
        }
        if (unit.IsAliveOnMap()) {
            SelectSingleUnit(unit);
            return 1;
        }
    }
    return 0;
}
int AddSelectedUnitsInRectangle(const PixelPos &corner_topleft, const PixelPos &corner_bottomright)
{
    // Check if the original selected unit (if it's alone) is ours,
    // and can be selectable by rectangle.
    // In this case, do nothing.
    if (Selected.size() == 1
        && (!CanSelectMultipleUnits(*Selected[0]->Player)
            || !Selected[0]->Type->BoolFlag[SELECTABLEBYRECTANGLE_INDEX].value)) {
        return Selected.empty();
    }
    // If there is no selected unit yet, do a simple selection.
    if (Selected.empty()) {
        return SelectUnitsInRectangle(corner_topleft, corner_bottomright);
    }
    const Vec2i tilePos0 = Map.MapPixelPosToTilePos(corner_topleft);
    const Vec2i tilePos1 = Map.MapPixelPosToTilePos(corner_bottomright);
    const Vec2i range(2, 2);
    std::vector<CUnit *> table;

    Select(tilePos0 - range, tilePos1 + range, table);
    SelectSpritesInsideRectangle(corner_topleft, corner_bottomright, table);
    // If no unit in rectangle area... do nothing
    if (table.empty()) {
        return Selected.size();
    }

    // Now we should only have mobile (organic) units belonging to us,
    // so if there's no such units in the rectangle, do nothing.
    //Wyrmgus start
//  if (SelectOrganicUnitsInTable(table) == false) {
    if (SelectOrganicUnitsInTable(table, true) == false) {
    //Wyrmgus end
        return Selected.size();
    }

    for (size_t i = 0; i < table.size() && Selected.size() < MaxSelectable; ++i) {
        //Wyrmgus start
        if (table[i]->Type->Building && Selected.size() && (!Selected[0]->Type->Building || table[i]->Type != Selected[0]->Type)) {
            continue;
        }
        //don't select units if a building is selected
        if (!table[i]->Type->Building && Selected.size() && Selected[0]->Type->Building) {
            continue;
        }
        //Wyrmgus end
        SelectUnit(*table[i]);
    }
    return Selected.size();
}
int SelectGroundUnitsInRectangle(const PixelPos &corner_topleft, const PixelPos &corner_bottomright)
{
    const Vec2i t0 = Map.MapPixelPosToTilePos(corner_topleft);
    const Vec2i t1 = Map.MapPixelPosToTilePos(corner_bottomright);
    const Vec2i range(2, 2);
    std::vector<CUnit *> table;

    Select(t0 - range, t1 + range, table);
    SelectSpritesInsideRectangle(corner_topleft, corner_bottomright, table);

    unsigned int n = 0;
    for (size_t i = 0; i != table.size(); ++i) {
        CUnit &unit = *table[i];

        if (!CanSelectMultipleUnits(*unit.Player) || !unit.Type->BoolFlag[SELECTABLEBYRECTANGLE_INDEX].value) {
            continue;
        }
        if (unit.IsUnusable()) {  // guess SelectUnits doesn't check this
            continue;
        }
        if (unit.Type->UnitType == UnitTypeFly) {
            continue;
        }
        if (unit.TeamSelected) { // Somebody else onteam has this unit
            continue;
        }
        //Wyrmgus start
        if (unit.Type->Building) { //this selection mode is not for buildings
            continue;
        }
        //Wyrmgus end
        table[n++] = &unit;
        if (n == MaxSelectable) {
            break;
        }
    }
    if (n) {
        ChangeSelectedUnits(&table[0], n);
    }
    return n;
}
int SelectAirUnitsInRectangle(const PixelPos &corner_topleft, const PixelPos &corner_bottomright)
{
    const Vec2i t0 = Map.MapPixelPosToTilePos(corner_topleft);
    const Vec2i t1 = Map.MapPixelPosToTilePos(corner_bottomright);
    const Vec2i range(2, 2);
    std::vector<CUnit *> table;

    Select(t0 - range, t1 + range, table);
    SelectSpritesInsideRectangle(corner_topleft, corner_bottomright, table);
    unsigned int n = 0;
    for (size_t i = 0; i != table.size(); ++i) {
        CUnit &unit = *table[i];
        if (!CanSelectMultipleUnits(*unit.Player) || !unit.Type->BoolFlag[SELECTABLEBYRECTANGLE_INDEX].value) {
            continue;
        }
        if (unit.IsUnusable()) { // guess SelectUnits doesn't check this
            continue;
        }
        if (unit.Type->UnitType != UnitTypeFly) {
            continue;
        }
        if (unit.TeamSelected) { // Somebody else onteam has this unit
            continue;
        }
        //Wyrmgus start
        if (unit.Type->Building) { //this selection mode is not for buildings
            continue;
        }
        //Wyrmgus end
        table[n++] = &unit;
        if (n == MaxSelectable) {
            break;
        }
    }
    if (n) {
        ChangeSelectedUnits(&table[0], n);
    }
    return n;
}
int AddSelectedGroundUnitsInRectangle(const PixelPos &corner_topleft, const PixelPos &corner_bottomright)
{
    // Check if the original selected unit (if it's alone) is ours,
    // and can be selectable by rectangle.
    // In this case, do nothing.
    if (Selected.size() == 1
        && (!CanSelectMultipleUnits(*Selected[0]->Player)
            || !Selected[0]->Type->BoolFlag[SELECTABLEBYRECTANGLE_INDEX].value)) {
        return Selected.size();
    }

    // If there is no selected unit yet, do a simple selection.
    //Wyrmgus start
//  if (Selected.empty()) {
    if (Selected.empty() || (Selected.size() && Selected[0]->Type->Building)) {
    //Wyrmgus end
        return SelectGroundUnitsInRectangle(corner_topleft, corner_bottomright);
    }

    const Vec2i t0 = Map.MapPixelPosToTilePos(corner_topleft);
    const Vec2i t1 = Map.MapPixelPosToTilePos(corner_bottomright);
    const Vec2i range(2, 2);
    std::vector<CUnit *> table;

    Select(t0 - range, t1 + range, table);
    SelectSpritesInsideRectangle(corner_topleft, corner_bottomright, table);

    unsigned int n = 0;
    for (size_t i = 0; i < table.size(); ++i) {
        CUnit &unit = *table[i];

        if (!CanSelectMultipleUnits(*unit.Player) ||
            !unit.Type->BoolFlag[SELECTABLEBYRECTANGLE_INDEX].value) {
            continue;
        }
        if (unit.IsUnusable()) {  // guess SelectUnits doesn't check this
            continue;
        }
        if (unit.Type->UnitType == UnitTypeFly) {
            continue;
        }
        if (unit.TeamSelected) { // Somebody else onteam has this unit
            continue;
        }
        //Wyrmgus start
        if (unit.Type->Building) { //this selection mode is not for buildings
            continue;
        }
        //Wyrmgus end
        table[n++] = &unit;
        if (n == MaxSelectable) {
            break;
        }
    }

    // Add the units to selected.
    for (unsigned int i = 0; i < n && Selected.size() < MaxSelectable; ++i) {
        SelectUnit(*table[i]);
    }
    return Selected.size();
}
int AddSelectedAirUnitsInRectangle(const PixelPos &corner_topleft, const PixelPos &corner_bottomright)
{
    // Check if the original selected unit (if it's alone) is ours,
    // and can be selectable by rectangle.
    // In this case, do nothing.
    if (Selected.size() == 1
        && (!CanSelectMultipleUnits(*Selected[0]->Player)
            || !Selected[0]->Type->BoolFlag[SELECTABLEBYRECTANGLE_INDEX].value)) {
        return Selected.size();
    }

    // If there is no selected unit yet, do a simple selection.
    //Wyrmgus start
//  if (Selected.empty()) {
    if (Selected.empty() || (Selected.size() && Selected[0]->Type->Building)) {
    //Wyrmgus end
        return SelectAirUnitsInRectangle(corner_topleft, corner_bottomright);
    }

    const Vec2i t0 = Map.MapPixelPosToTilePos(corner_topleft);
    const Vec2i t1 = Map.MapPixelPosToTilePos(corner_bottomright);
    const Vec2i range(2, 2);
    std::vector<CUnit *> table;

    Select(t0 - range, t1 + range, table);
    SelectSpritesInsideRectangle(corner_topleft, corner_bottomright, table);
    unsigned int n = 0;
    for (size_t i = 0; i < table.size(); ++i) {
        CUnit &unit = *table[i];
        if (!CanSelectMultipleUnits(*unit.Player) ||
            !unit.Type->BoolFlag[SELECTABLEBYRECTANGLE_INDEX].value) {
            continue;
        }
        if (unit.IsUnusable()) {  // guess SelectUnits doesn't check this
            continue;
        }
        if (unit.Type->UnitType != UnitTypeFly) {
            continue;
        }
        if (unit.TeamSelected) { // Somebody else onteam has this unit
            continue;
        }
        //Wyrmgus start
        if (unit.Type->Building) { //this selection mode is not for buildings
            continue;
        }
        //Wyrmgus end
        table[n++] = &unit;
        if (n == MaxSelectable) {
            break;
        }
    }

    // Add the units to selected.
    for (unsigned int i = 0; i < n && Selected.size() < MaxSelectable; ++i) {
        SelectUnit(*table[i]);
    }
    return Selected.size();
}

I think this should be all. If there are any issues let me know!

DinkyDyeAussie commented 7 years ago

I have an issue from the first code box dealing with the multiple building selection. In DoClicked_Train in botpanel.cpp line 1315, there is this statement: SendCommandTrainUnit(*Selected[best_training_place], type, ThisPlayer->Index !(KeyModifiers & ModifierShift));

If I have the !(KeyModifiers & ModifierShift) in the function, it gives the error that the statement doesn't support 4 arguments. Did you modify the original SendCommandTrainUnit function? Let me know.

I'll try that new code now. Give me a bit :+1:

Andrettin commented 7 years ago

Hmm yes, I did, now that you mention it, to allow buildings to train units that belong to another player than the building's own owner (to allow things like a neutral mercenary camp training a unit that will belong to the player who clicked the button, rather than the neutral player).

Just put this instead:

 SendCommandTrainUnit(*Selected[best_training_place], type, !(KeyModifiers & ModifierShift));
DinkyDyeAussie commented 7 years ago

BTW in your code offerings above you doubled up on AddSelectedAirUnitsInRectangleand AddSelectedGroundUnitsInRectangle lol. Got a "function already has a body" error.

Got rid of the two double ups and just tested the compiled code. IT WORKS PERFECT! Thanks again Andrettin! I will commit the changes to the trunk now :+1:

Andrettin commented 7 years ago

Cool :)

About those functions, there is "SelectGroundUnitsInRectangle" and "SelectAirUnitsInRectangle", as well as "AddSelectedGroundUnitsInRectangle" and "AddSelectedAirUnitsInRectangle". Maybe you copied the latter two twice, and left out the former two?

DinkyDyeAussie commented 7 years ago

Phew! Code is in trunk. Ill give it 10 minutes again to see if it has built successfully.

DinkyDyeAussie commented 7 years ago

Yeah now that I think about it, I think I did copy them twice! lol. My bad. It's all working now mate thanks heaps. Erenussocrates is gonna lose it now haha. He'll be very happy.

pasildan commented 7 years ago

dinky ! what's up pal ! erenussocrates is the friend I was telling you about the other day in "click sound" thread. He has been looking for some small bugs in wargus project. I have been trying to build stratagus engine but without success yet, I'm not very familiar with this project yet. I told him about this "alt + number" problem in order to select any buildings, because it's really annoying to use, specially in the hardest difficulties. This is being used in almost any Real Time Strategy Games such as age of empires 2 or StarCraft, it's simply way more intuitive to just selecting a building by only pressing a number... Thank you very much for helping us by the way !

Erenussocrates commented 7 years ago

@DinkyDyeAussie , thank you very much pal. Now, where should I put the new stratagus files in order for my wargus to work the changes? I have a wargus directory which is where the game.exe and files are, and there is a separate stratagus directory outside of wargus directory. I've made changes in stratagus directory in the past, but they were not reflected in the game. So where should I put the stratagus files?

DinkyDyeAussie commented 7 years ago

place the stratagus.exe file in the wargus directory man. Wargus 2.4 has the stratagus.exe file in the same directory.

Hopfully one day they will merge stratatgus into wargus so it just ends up being one file like it is with Andrettin's game Wyrmsun. Til then just keep them together. Let us know how you go.

By the way happy to help you guys out. I struggled for so long to get my wants for wargus implanted. Now I can do it for myself AND others, I'm not letting up! haha.

pasildan commented 7 years ago

I have been playing already wargus project, isn't about launching it or not. What I say is, I don't know how to make a build from stratagus source files yet. I have been looking the install.html instructions but can't build that up yet. Like if you could give me some tips to build stratagus engine I would be really grateful with you ^^

Erenussocrates commented 7 years ago

@DinkyDyeAussie , I just did it now, unfortunately it doesn't work :( buildings still get selected together with units, and when I select two barrackses, second one doesn't train the unit when I issue the command.

Andrettin commented 7 years ago

You have to compile a new executable with the new code first, just putting the new source code files there won't work.

Erenussocrates commented 7 years ago

How do I do that, does reinstalling wargus do the same thing or something?

timfel commented 7 years ago

Re installing, the install.html might not be all the helpful, because it hasn't been updated. The appveyor.yml might be more useful, although you'll have to adapt the script.

@Erenussocrates w.r.t. building queues in multiple buildings, I think @Andrettin's patch does not do what you ask, it still only builds in one barracks, it's just more clever in how to select the best one. To build in all barracks we'll still have to modify the code. Although I would prefer if we keep that change and the changes here behind a preference, so we can still have the old control schema.

Erenussocrates commented 7 years ago

@timfel, I honestly didn't understand anything from what you told me about what I should do with appveyor.yml in that other topic. I don't get the terms about programming dude, I'm new in this. Just straight tell me what I have to do clear and simple, step by step.

DinkyDyeAussie commented 7 years ago

If you just want the new "stratagus.exe file that contains all the changes Andrettin has given me to incorperate, got to tge top of this page, click on the tab labeled "code", then when you're on the next page find the text that reads "2 releases". Click on this and you will get to the download page. Download the file called "compiled binaries" and that contains the latest build of srratagus and the associated libraries. Copy all those files into your argus directory

Erenussocrates commented 7 years ago

@DinkyDyeAussie you are awesome. Thank you for that, thanks to your instructions it works perfectly now. I really appreciate it

DinkyDyeAussie commented 7 years ago

You're welcome mate. Happy to help. Enjoy!

DinkyDyeAussie commented 7 years ago

@Andrettin - how did you merge stratagus and wyrmsun into the one exe file? I'd like it if one day we could do that with stratagus and wargus.

Two different exe files for the one game is a bit rediculous.

pasildan commented 7 years ago

Dinky nothing just happened about using last modified stratagus files. I still have to use alt + number

DinkyDyeAussie commented 7 years ago

Did you download the latest scripts?

pasildan commented 7 years ago

compiled-binaries.zip yeah , still the same :-[

DinkyDyeAussie commented 7 years ago

Nah man the latest wargus scripts. Its ok ill tell you what to do.

Go into your wargus folder, then open up the scripts folder. In that folder is two folders - one called "human" and one called "orc". In each of those folders is a file called "units.lua"

Now open each file in notepad and search for "barracks". When you it in each you need to add the line - SelectableByRectangle = true, - make sure to include the coma at the end too or else it won't run.

Just put it above the line "Sounds = {

Do that in both files and it should work. Let us know how you go.

Andrettin commented 7 years ago

@DinkyDyeAussie Which exes are you talking about? Stratagus.exe and Wargus.exe are the same thing, the thing is that Wargus has a installer.

pasildan commented 7 years ago

I tried previously that sentence Dinky and it makes some kind of new bugs. 1) I can click buildings with a single number but then it selects each unit from a building + building it self but I can select all of them by one single number (not including Alt). 2) Now units + the exact modified building are selected into a box.

DinkyDyeAussie commented 7 years ago

Follow my instructions above about getting the newest stratagus.exe file. That's what you need.

DinkyDyeAussie commented 7 years ago

@Andrettin that is true but wargus doesn't have the code in it that stratagus has. I suppose tge installer is needed for wargus due to it having to extract the warcraft 2 data. Idk. You wyrmsun game has just "wyrmsun.exe" and that's it but you dont need an extractor...

Andrettin commented 7 years ago

"Wargus.exe" is just a renamed "stratagus.exe" with a different icon. Not sure what you mean about it not having the same code?

DinkyDyeAussie commented 7 years ago

Same sourcecode.

pasildan commented 7 years ago

Hey dinky, would you mind to make a small tutorial in order to install stratagus? This is the only thing I need help with, later I can take a look for myself in order to fix this group controls problem :] Would appreciate it so much. I don't understand at all stratagus/install.html

DinkyDyeAussie commented 7 years ago

Are you using windows to play the game?

pasildan commented 7 years ago

of course !

DinkyDyeAussie commented 7 years ago

Cool man just checkin. Ill do a video tutorial this arvo for everyone.

Erenussocrates commented 7 years ago

Yeah, dude that would be fantastic. I personally don't remember how I've installed wargus/stratagus at all neither, but when I looked at that install.html, I didn't understand anything neither. Somethings should be told more clearly and in a less technical language for us noobs x'D Btw thanks again for that group control fix.

pasildan commented 7 years ago

you are the VERY BEST !! I'm not complaining about developers instructions... I checked out already both /install.html and /HOW_TO_RELEASE and I'm just not familiar with these tools yet, so I don't understand at all what I have to do. Thank you so much, really I appreciate so much your help.

DinkyDyeAussie commented 7 years ago

No problems guys it's all I want too.