• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[General] Need help for custom races, also AI

Status
Not open for further replies.
Level 1
Joined
Oct 15, 2013
Messages
3
So here is the problem: i created "custom" races for the ai to control, i used the ai editor for this.
They worked almost flawlessly, but that was because i used default stuff, slightly modified.
So the races that did manage to work were: high elves, chaos orcs and corrupt elves.
But then i began to have problems with the following: naga and draenei.

The thing is that those 2 races don't start with the right building, they both start with the human town hall instead of using the naga and draenei ones.
I was tinkering around with the ai editor and i changed the starter building, but that did not work.
I want these 2 races to use their respective town halls, naga and draenei were used in the campaign and the units are in the world editor, not custom.
So do i have to use triggers for this or not? i really don't mind as long as i get these 2 races (and future ones perhaps) working.
 
The thing is that those 2 races don't start with the right building, they both start with the human town hall instead of using the naga and draenei ones.
You need to trigger that by yourself, Blizzard's Melee Spawning only supports (Human, Orcs, Undead, Nightelf) and some trollish sheep stuff.
Easiest would be to replace wokers/townhall after spawining with race starting units.
 
The Trollish sheep spawn
JASS:
//===========================================================================
// Starting Units for Players Whose Race is Unknown
//   - 12 Sheep, placed randomly around the start location
//
function MeleeStartingUnitsUnknownRace takes player whichPlayer, location startLoc, boolean doHeroes, boolean doCamera, boolean doPreload returns nothing
    local integer index

    if (doPreload) then
    endif

    set index = 0
    loop
        call CreateUnit(whichPlayer, 'nshe', GetLocationX(startLoc) + GetRandomReal(-256, 256), GetLocationY(startLoc) + GetRandomReal(-256, 256), GetRandomReal(0, 360))
        set index = index + 1
        exitwhen index == 12
    endloop

    if (doHeroes) then
       // Give them a "free hero" token, out of pity.
        call SetPlayerState(whichPlayer, PLAYER_STATE_RESOURCE_HERO_TOKENS, bj_MELEE_STARTING_HERO_TOKENS)
    endif

    if (doCamera) then
       // Center the camera on the initial sheep.
        call SetCameraPositionLocForPlayer(whichPlayer, startLoc)
        call SetCameraQuickPositionLocForPlayer(whichPlayer, startLoc)
    endif
endfunction
What the default Melee Trigger calls.
JASS:
//===========================================================================
function MeleeStartingUnits takes nothing returns nothing
    local integer  index
    local player   indexPlayer
    local location indexStartLoc
    local race     indexRace

    call Preloader( "scripts\\SharedMelee.pld" )

    set index = 0
    loop
        set indexPlayer = Player(index)
        if (GetPlayerSlotState(indexPlayer) == PLAYER_SLOT_STATE_PLAYING) then
            set indexStartLoc = GetStartLocationLoc(GetPlayerStartLocation(indexPlayer))
            set indexRace = GetPlayerRace(indexPlayer)

           // Create initial race-specific starting units
            if (indexRace == RACE_HUMAN) then
                call MeleeStartingUnitsHuman(indexPlayer, indexStartLoc, true, true, true)
            elseif (indexRace == RACE_ORC) then
                call MeleeStartingUnitsOrc(indexPlayer, indexStartLoc, true, true, true)
            elseif (indexRace == RACE_UNDEAD) then
                call MeleeStartingUnitsUndead(indexPlayer, indexStartLoc, true, true, true)
            elseif (indexRace == RACE_NIGHTELF) then
                call MeleeStartingUnitsNightElf(indexPlayer, indexStartLoc, true, true, true)
            else
               call MeleeStartingUnitsUnknownRace(indexPlayer, indexStartLoc, true, true, true)
            endif
        endif

        set index = index + 1
        exitwhen index == bj_MAX_PLAYERS
    endloop
 
Status
Not open for further replies.
Top