Tutorial : How to play against ai

Started by redspike474, February 27, 2010, 02:26:50 AM

Previous topic - Next topic

Odoyle721


Valkirie

In each map we can find.


<Point id="1" position="41.5,21.5,0" scale="1,1,1" type="StartLoc" name="Start Location 001" color="0,0,0,0"/>
<Point id="2" position="49.5,114.5,0" scale="1,1,1" type="StartLoc" name="Start Location 002" color="0,0,0,0"/>
<Point id="3" position="134.5,114.5,0" scale="1,1,1" type="StartLoc" name="Start Location 003" color="0,0,0,0"/>
<Point id="4" position="126.5,21.5,0" scale="1,1,1" type="StartLoc" name="Start Location 004" color="0,0,0,0"/>

What about replacing the Location 002/003/004 by:

<Unit id="9997" position="49.5,114.5,0"  scale="1,1,1" unitType="Hatchery" player="2"/>
<Unit id="9998" position="134.5,114.5,0"  scale="1,1,1" unitType="Nexus" player="3"/>
<Unit id="9999" position="126.5,21.5,0"  scale="1,1,1" unitType="CommandCenter" player="4"/>



Possible somehow ?

2g4u

I am 90% done with a custom map in which the goal is to reach the center and eliminate all the troops there. Ofc no victory or defeat conditions.
"Only two things are infinite, the universe and human stupidity, and I'm not sure about the former!" Albert Einstein

aimaimaim

woooooooooooooooooo

LOVE FORE DEVS!!!!

kdronez

Strange,but when I edit Objects file and put it back in the s2ma file my Sc crash.
I think that even if you guys add 2nd AI player it wont start to build or do smth becouse with this crack you start the game after its finished :>(it says victory xD ) so after that the AI dont do anything becouse the game has ended :>.
And one more think 939af36920bfbb04566fcc1f894a15404fba8e93a33ca4b52782078d65968e70 is s2ma fail,but when you open it with winmpq it shows different files inside it.

Blackcode

Quote from: kdronez on February 27, 2010, 06:58:23 AM
Strange,but when I edit Objects file and put it back in the s2ma file my Sc crash.
I think that even if you guys add 2nd AI player it wont start to build or do smth becouse with this crack you start the game after its finished :>(it says victory xD ) so after that the AI dont do anything becouse the game has ended :>.
And one more think 939af36920bfbb04566fcc1f894a15404fba8e93a33ca4b52782078d65968e70 is s2ma fail,but when you open it with winmpq it shows different files inside it.


the crash it's because you still have your map open in winmpq... close winmpq before opening the map in sc2.
And "game finished" is because you ahve only 1 player on the map

2g4u

http://darkblizz.org/Forum2/index.php?topic=568.0

Check it out, its Lost Temple and in the middle I got a surprise for you. Better to go there prepared :D
"Only two things are infinite, the universe and human stupidity, and I'm not sure about the former!" Albert Einstein

tomsons26

the war3 map script
//===========================================================================
//
// Just another Warcraft III map
//
//   Warcraft III map script
//   Generated by the Warcraft III World Editor
//   Date: Sat Feb 27 14:02:30 2010
//   Map Author: Unknown
//
//===========================================================================

//***************************************************************************
//*
//*  Global Variables
//*
//***************************************************************************

globals
    // Generated
    trigger                 gg_trg_Melee_Initialization = null
endglobals

function InitGlobals takes nothing returns nothing
endfunction

//***************************************************************************
//*
//*  Unit Creation
//*
//***************************************************************************

//===========================================================================
function CreateBuildingsForPlayer0 takes nothing returns nothing
    local player p = Player(0)
    local unit u
    local integer unitID
    local trigger t
    local real life

    set u = CreateUnit( p, 'htow', 320.0, 64.0, 270.000 )
endfunction

//===========================================================================
function CreateBuildingsForPlayer1 takes nothing returns nothing
    local player p = Player(1)
    local unit u
    local integer unitID
    local trigger t
    local real life

    set u = CreateUnit( p, 'ogre', -512.0, -192.0, 270.000 )
    set u = CreateUnit( p, 'otto', -1024.0, -64.0, 270.000 )
endfunction

//===========================================================================
function CreateUnitsForPlayer1 takes nothing returns nothing
    local player p = Player(1)
    local unit u
    local integer unitID
    local trigger t
    local real life

    set u = CreateUnit( p, 'opeo', -367.2, 141.4, 352.793 )
endfunction

//===========================================================================
function CreatePlayerBuildings takes nothing returns nothing
    call CreateBuildingsForPlayer0(  )
    call CreateBuildingsForPlayer1(  )
endfunction

//===========================================================================
function CreatePlayerUnits takes nothing returns nothing
    call CreateUnitsForPlayer1(  )
endfunction

//===========================================================================
function CreateAllUnits takes nothing returns nothing
    call CreatePlayerBuildings(  )
    call CreatePlayerUnits(  )
endfunction

//***************************************************************************
//*
//*  Triggers
//*
//***************************************************************************

//===========================================================================
// Trigger: Melee Initialization
//
// Default melee game initialization for all players
//===========================================================================
function Trig_Melee_Initialization_Actions takes nothing returns nothing
    call MeleeStartingVisibility(  )
    call MeleeStartingHeroLimit(  )
    call MeleeGrantHeroItems(  )
    call MeleeStartingResources(  )
    call MeleeClearExcessUnits(  )
    call MeleeStartingUnits(  )
    call MeleeStartingAI(  )
    call MeleeInitVictoryDefeat(  )
endfunction

//===========================================================================
function InitTrig_Melee_Initialization takes nothing returns nothing
    set gg_trg_Melee_Initialization = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Melee_Initialization, function Trig_Melee_Initialization_Actions )
endfunction

//===========================================================================
function InitCustomTriggers takes nothing returns nothing
    call InitTrig_Melee_Initialization(  )
endfunction

//===========================================================================
function RunInitializationTriggers takes nothing returns nothing
    call ConditionalTriggerExecute( gg_trg_Melee_Initialization )
endfunction

//***************************************************************************
//*
//*  Players
//*
//***************************************************************************

function InitCustomPlayerSlots takes nothing returns nothing

    // Player 0
    call SetPlayerStartLocation( Player(0), 0 )
    call ForcePlayerStartLocation( Player(0), 0 )
    call SetPlayerColor( Player(0), ConvertPlayerColor(0) )
    call SetPlayerRacePreference( Player(0), RACE_PREF_HUMAN )
    call SetPlayerRaceSelectable( Player(0), true )
    call SetPlayerController( Player(0), MAP_CONTROL_USER )

    // Player 1
    call SetPlayerStartLocation( Player(1), 1 )
    call ForcePlayerStartLocation( Player(1), 1 )
    call SetPlayerColor( Player(1), ConvertPlayerColor(1) )
    call SetPlayerRacePreference( Player(1), RACE_PREF_ORC )
    call SetPlayerRaceSelectable( Player(1), true )
    call SetPlayerController( Player(1), MAP_CONTROL_COMPUTER )

endfunction

function InitCustomTeams takes nothing returns nothing
    // Force: TRIGSTR_003
    call SetPlayerTeam( Player(0), 0 )
    call SetPlayerTeam( Player(1), 0 )

endfunction

//***************************************************************************
//*
//*  Main Initialization
//*
//***************************************************************************

//===========================================================================
function main takes nothing returns nothing
    call SetCameraBounds( -3328.0 + GetCameraMargin(CAMERA_MARGIN_LEFT), -3584.0 + GetCameraMargin(CAMERA_MARGIN_BOTTOM), 3328.0 - GetCameraMargin(CAMERA_MARGIN_RIGHT), 3072.0 - GetCameraMargin(CAMERA_MARGIN_TOP), -3328.0 + GetCameraMargin(CAMERA_MARGIN_LEFT), 3072.0 - GetCameraMargin(CAMERA_MARGIN_TOP), 3328.0 - GetCameraMargin(CAMERA_MARGIN_RIGHT), -3584.0 + GetCameraMargin(CAMERA_MARGIN_BOTTOM) )
    call SetDayNightModels( "Environment\\DNC\\DNCLordaeron\\DNCLordaeronTerrain\\DNCLordaeronTerrain.mdl", "Environment\\DNC\\DNCLordaeron\\DNCLordaeronUnit\\DNCLordaeronUnit.mdl" )
    call NewSoundEnvironment( "Default" )
    call SetAmbientDaySound( "LordaeronSummerDay" )
    call SetAmbientNightSound( "LordaeronSummerNight" )
    call SetMapMusic( "Music", true, 0 )
    call CreateAllUnits(  )
    call InitBlizzard(  )
    call InitGlobals(  )
    call InitCustomTriggers(  )
    call RunInitializationTriggers(  )

endfunction

//***************************************************************************
//*
//*  Map Configuration
//*
//***************************************************************************

function config takes nothing returns nothing
    call SetMapName( "Just another Warcraft III map" )
    call SetMapDescription( "Nondescript" )
    call SetPlayers( 2 )
    call SetTeams( 2 )
    call SetGamePlacement( MAP_PLACEMENT_USE_MAP_SETTINGS )

    call DefineStartLocation( 0, 512.0, -448.0 )
    call DefineStartLocation( 1, -832.0, 256.0 )

    // Player setup
    call InitCustomPlayerSlots(  )
    call SetPlayerSlotAvailable( Player(0), MAP_CONTROL_USER )
    call SetPlayerSlotAvailable( Player(1), MAP_CONTROL_COMPUTER )
    call InitGenericPlayerSlots(  )
endfunction


kewickviper

From the looks of it some of the functions correlate from War3 to SC2. It would be worth checking if     call SetPlayerController( Player(0), MAP_CONTROL_USER ) works in SC2 to set a player to computer.

kdronez

the crash it's because you still have your map open in winmpq... close winmpq before opening the map in sc2.
And "game finished" is because you ahve only 1 player on the map
[/quote]
I close the winmpq and have the same problem when I started SC 2. NVM I will w8 for some1 to make a map xD.

ooni

#25
Quote from: kewickviper on February 27, 2010, 07:14:09 AM
From the looks of it some of the functions correlate from War3 to SC2. It would be worth checking if     call SetPlayerController( Player(0), MAP_CONTROL_USER ) works in SC2 to set a player to computer.
Obviously not.
Let's say SetPlayerController is the correct function, MAP_CONTROL_USER is wc3 constant. SC2 Constant start with c_ and all lower cases with different names. Curse you Blizzard!


Quote from: kdronez on February 27, 2010, 07:20:01 AM
the crash it's because you still have your map open in winmpq... close winmpq before opening the map in sc2.
And "game finished" is because you ahve only 1 player on the map
I close the winmpq and have the same problem when I started SC 2. NVM I will w8 for some1 to make a map xD.

Remember the Blizzard game MPQ directory rule. If you have a file that duplicate file in any installation folder it automatically overrides any other file with the same name. Check if you saved your edited files in the installation folder aka Program Files\Starcraft Beta

http://forums.starcraft.org/showthread.php?t=44080
Found the list of functions. None of them really useful for our purposes. (unless you are willing to make AI from scratch)

tomsons26


    // Player setup
    call InitCustomPlayerSlots(  )
    call SetPlayerSlotAvailable( Player(0), MAP_CONTROL_USER )
    call SetPlayerSlotAvailable( Player(1), MAP_CONTROL_COMPUTER )
    call InitGenericPlayerSlots(  )
endfunction

all Player setup works but is get no base fow is not reviled etc bugs

BTW if the code is the same like in War3x we can get the game to revile FOW

tomsons26


LoneWolf

Damn, I wish I had more time to crack at this. All I managed to do was to start the game with no players at all and start the game with me having 2 bases right next to eachother, lol.

Darkmapper

Well basicly we could just try some ids out, hope to find out what each is.
But if you can place units by knowing their ID, could it be possilbe that we can add units like lurker Terra-Tron medics firebats, and some april fool units?
Just an idea, and i think its worth to find out.