Wc3C.net

Wc3C.net (http://www.wc3c.net/forums.php)
-   Triggers & Scripts (http://www.wc3c.net/forumdisplay.php?f=8)
-   -   How do I implement the Custom Race System? (http://www.wc3c.net/showthread.php?t=109333)

Sunwarrior25 04-15-2010 05:14 PM

How do I implement the Custom Race System?
 
I got the urge to add a custom race based off the Night Elves to a map with my previously created Bandit Race, BUT... The trigger I used didn't replace the units, and I was left with regular Night Elf. So! I decided to try out Archmage Ohwellencaster's (?) Custom Race System.

Unfortunately, regular Warcraft III disabled the trigger I put it in, and JNGP isn't really helping me either (At least, it left the trigger enabled when I saved). Basically, how do I use this? Keep in mind that I'm used to GUI, and have no idea where to put the structs that the API is talking about. The documentation says it replaces the Initialization Trigger, am I supposed to replace it physically? Or...?

I'm confused... :emote_confused:

Michael Peppers 04-15-2010 05:46 PM

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. :emote_sweat:

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

Sunwarrior25 04-15-2010 06:52 PM

Thanks! Now I can get to testing/building this race! :emote_thumbup:

EDIT: Apparently I have to +rep other people before I can +rep you again. :(

Michael Peppers 04-15-2010 06:58 PM

No worries, I can live without rep. =)

Sunwarrior25 04-15-2010 08:50 PM

Whew! Ok.

On a completely unrelated note, I can't seem to balance this new race to an Undead AI rush.

Archmage Owenalacaster 04-15-2010 09:17 PM

Quote:

Originally Posted by Sunwarrior25
EDIT: Apparently I have to +rep other people before I can +rep you again. :(

Hi!

For future reference, please direct CRS questions to the CRS topic so I can actually see them. =)


All times are GMT. The time now is 12:48 AM.

Powered by vBulletin (Copyright ©2000 - 2019, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services