View Single Post
Old 04-15-2010, 05:46 PM   #2
Michael Peppers
Lepus?
 
Michael Peppers's Avatar
 
Join Date: Jan 2009
Posts: 1,308

Michael Peppers is a jewel in the rough (188)Michael Peppers is a jewel in the rough (188)Michael Peppers is a jewel in the rough (188)

Default

This will take some time... alright, let's start, shall we? =)

Open the map with JNGP.

First of all, delete the Map Initialization trigger in the trigger editor... COMPLETELY. BASH IT, SMASH IT!!!!!!111!!1!
(Sorry, but that's fun =P)

Create a trigger called "CustomRaceSystem", convert it into custom script, delete everything that's in it and paste the Custom Race System there.

Create another trigger, convert it and delete everything etc. then add this:
Collapse JASS:
library YourRaceSetup initializer Init requires CustomRaceSystem
    
    private function Init takes nothing returns nothing
        local CustomRace c = CustomRace.registerAll("Your Race Name",RACE_NIGHTELF) //Use this if you want your race to overwrite the Night Elves. The first value is the name of your race.
//        local CustomRace c = CustomRace.create("Your Race Name",RACE_NIGHTELF,0.9) //Uncomment this and delete the line above if your race shouldn't overwrite the Night Elves. The first value is the name of your race, don't forget the "", the third one (0.9) is the handicap value, in this case 90%
        call c.setTownHall('etol')                  // Put the rawcode of your townhall here
        call c.addWorkerType('ewsp',c.NEAR_MINE,5)  // Worker rawcode
        call c.addHeroType('Ekee')                  // 1st Hero rawcode
        call c.addHeroType('Emoo')                  // 2nd Hero rawcode
        call c.addHeroType('Edem')                  // 3rd Hero rawcode
        call c.addHeroType('Ewar')                  // 4th Hero rawcode
        call c.setAIScript("elf.ai")                // Path to the AI script has to be put between the ""
    endfunction
    
endlibrary
Do everything I've written in the comments and you're set.

The AI is optional; if you don't have one remove the c.setAIScript() line.
Also remember that in JASS strings the slashes of the paths are doubled; for example 'MyStuff\MyAI.ai' becomes: "MyStuff\\MyAI.ai"

Whew! Speed typing tires me.

EDIT: If your race mines gold ala Night Elves use this script instead of the one above:
Collapse JASS:
library YourRaceSetup initializer Init requires CustomRaceSystem
    
    private function EntangleGoldMine takes player play, group workers, unit goldmine, unit townhall, unit randhero returns nothing
        call SetUnitPosition(townhall,GetUnitX(goldmine),GetUnitY(goldmine))
        call IssueTargetOrder(townhall, "entangleinstant", goldmine)
        call DestroyGroup(workers)
    endfunction

    private function Init takes nothing returns nothing
        local CustomRace c = CustomRace.registerAll("Your Race Name",RACE_NIGHTELF) //Use this if you want your race to overwrite the Night Elves. The first value is the name of your race.
//        local CustomRace c = CustomRace.create("Your Race Name",RACE_NIGHTELF,0.9) //Uncomment this and delete the line above if your race shouldn't overwrite the Night Elves. The first value is the name of your race, don't forget the "", the third one (0.9) is the handicap value, in this case 90%
        call c.setTownHall('etol')                  // Put the rawcode of your townhall here
        call c.addWorkerType('ewsp',c.NEAR_MINE,5)  // Worker rawcode
        call c.addHeroType('Ekee')                  // 1st Hero rawcode
        call c.addHeroType('Emoo')                  // 2nd Hero rawcode
        call c.addHeroType('Edem')                  // 3rd Hero rawcode
        call c.addHeroType('Ewar')                  // 4th Hero rawcode
        call c.setCallback(CustomRaceCall.EntangleGoldMine)
        call c.setAIScript("elf.ai")                // Path to the AI script has to be put between the ""
    endfunction
    
endlibrary
__________________
Projects:Tutorials: Competitive AI Step by Step with AI Editor (Pending)
Resources: [AI Script] Michael Peppers's Melee AI template (Pending)
Michael Peppers is offline   Reply With Quote