• 🏆 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!

Adding a new race trough a global script, is it possible?

Status
Not open for further replies.
Level 1
Joined
Apr 14, 2013
Messages
7
Hi everyone, my name is John and I used to play Warcraft 3 all the time, be it SP or MP trough Garena.. I also used to toy with the world editor here and there, creating new races, spells, units and whatnot.

To get to the point, I got interested in modding (and playing) the game again, and as the title suggests, my question is pretty straightforward.

Is there any possible way to create a global script, be it trough an ".exe" file or direct scripting of the main files, to implement a new race? The problem why I stopped modding Warcraft is because I was never interested in creating a whole new race for just ONE map. The idea of making a new playable race and the selecting them in the race menu always sounded simple to me, but little did I know then how complicated that might be (or might not?). When I saw that there were no races to download (except for a one map only race) I lost hope, but then I saw "Frozenfire's Addon Race pack" and it got me interested.

The way he added the race is (my guess) trough a global game script (I can't even guess what file he edited) where when you set to "Night elf" and "handicap" to 90% that you play as the Naga, not the Night elf. Are there any tutorials on how you can create a function like that or does anyone have any ideas? Is making something like this really that complicated?

Any help appreaciated :vw_wtf:!
 
Using handicap to change the played race is pretty simple since you can retrieve the handicap of a player with triggers. Another guy could explain you better than me how to do it.

If you want to add races in the "race" button, it will definitely require the player to import a custom file as a W3 add-on (maybe not a whole .exe though).
If you're going for that, you'll need to edit mainly 1 file :
UI\FrameDef\Glue\PlayerSlot.fdf

It is in one of your MPQ archives (search for a MPQ Browser if you don't have any yet). It can be opened with a simple text editor. Search for those lines and add a race :
Code:
    Frame "POPUPMENU" "RaceMenu" INHERITS WITHCHILDREN "PlayerSlotPopupMenu" {
        Width 0.10,
        UseActiveContext,
        SetPoint LEFT, "NameMenu", RIGHT, 0.0, 0.0,

        PopupMenuFrame "RacePopupMenuMenu",
        Frame "MENU" "RacePopupMenuMenu" INHERITS WITHCHILDREN "StandardPopupMenuMenuTemplate" {
            UseActiveContext,

            MenuItem "RANDOM",     -2,
            MenuItem "HUMAN",      -2,
            MenuItem "ORC",        -2,
            MenuItem "UNDEAD",     -2,
            MenuItem "NIGHT_ELF",  -2,
        }
    }

I don't know how to link the new race to a custom race in-game. Maybe they are automatically linked with "ConvertRace( i )" (such as "ConvertRace(1)==HUMAN", "ConvertRace(2)==ORC", etc...) but that's something to check.

"RANDOM", "HUMAN", "ORC", etc... are global strings defined in the file "UI\FrameDef\GlobalStrings.fdf". You may put your custom race name directly in the "PlayerSlot.fdf" or properly define a new global string as Blizzard did (it was better for them concerning translations).
 
Level 1
Joined
Apr 14, 2013
Messages
7
I open up "war3.mpq" and go to "UI\FrameDef\Glue\PlayerSlot.fdf". Problem is when I add the line ex. "MenuItem "TEST", -2," and save the file it doesn't actually save it. It just goes back to the normal 4 races.

Also as you said, how would I convert them together so that when I do select "TEST" that that race with those units would be played? What I mean, if I create the race in one empty map in world editor, how would I separate those files so that I can put a variable in a global script to load them? Is that possible? I'm pretty new to this warcraft scripting, are there any tuts to help me understand how the whole script structure works?
 
You add to select "edit" to edit your post as well instead of double-posting :p

Put that in an empty map, play the red player with the race of your choice, and tell me what you got :
  • Test
    • Events
      • Map Initialization
    • Conditions
    • Actions
      • Custom script: local integer i=0
      • Custom script: loop
      • Custom script: exitwhen i>=10
      • Custom script: if GetPlayerRace(Player(0))==ConvertRace(i) then
      • Custom script: call BJDebugMsg("You play with the race number "+I2S(i))
      • Custom script: return
      • Custom script: endif
      • Custom script: set i=i+1
      • Custom script: endloop
      • Custom script: call BJDebugMsg("Cannot get the race number")
 
Level 1
Joined
Apr 14, 2013
Messages
7
Well when I put all those

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

globals
// Generated
trigger gg_trg_Melee_Initialization = null
endglobals

function InitGlobals takes nothing returns nothing
endfunction

function Trig_Melee_Initialization_Actions takes nothing returns nothing
local integer i=0
loop
exitwhen i>=10
if GetPlayerRace(Player(0))==Convertrace(i) then
call BJDebugMsg("You play with the race number "+I2S(i))
return
endif
set i=i+1
endloop
call BJDebugMsg("Cannot get the race number")
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

it pops up two errors

Line 19: Expected a name
Line: 22: Expected a loop


I'm currently trying to make the "Demon" race playable as a fifth option, even though I'm not sure how to connect the fifth menu option "DEMON" with that race itself. I can't seem to even select it, it just goes to random, and when I put it above "MenuItem "HUMAN", -2," it acts as if I selected actually humans. Maybe something with the global script would help..

Also sorry for double post :p.
 
Level 1
Joined
Apr 14, 2013
Messages
7
If it is a melee map, then you could just copy paste the terrain and paste it at the map with custom units and buildings.

Yes I know, but I'm looking for a way to have a custom race selectable from the in game menu, or at least be able to set it trough "handicap" like the naga mod. I'm having trouble with some pretty basic stuff, but I'll get around it tomorrow, I'm tired as hell. I'll read some tuts I found here and go from there. There's gotta be a way to make this happen.

Thanks guys for the replies, goodnight :vw_sleep:.
 
Level 1
Joined
Apr 14, 2013
Messages
7
Ok so I figured out how to make a default character (ex. or peon or grunt) spawn instead of the regular race under "handicap". I actually took the "RaceAddon v1.1" and had it as a template because my scripting skills are poor.

My next big problem is, how could I load up a "custom" made character into the game? In world editor, I made a simple orc peon from the campaign and gave him the option to construct a town hall. When I finished I exported "All objects data" and imported it in the "Al editor" so I could export the Al script (which I named "TEST").

After that I opened up "RaceAddonV1.1" with an mpq opener and put the "TEST" in there. I replaced the "naga.ai" with my "TEST.ai", and simply changed the ID of the naga town hall to the default one. The problem I'm facing is when I make a custom character the ID's are always the same ex. "n000". "n000" is already reserved for something else, and when I start up the game it as expected spawns that other object.

My question is if there is a way to export the custom unit as a separate file that I can put in some folder and then merge it with a function in "blizzard" with it's separate unique ID? I have no other idea how to make this work otherwise, I can't understand how the author of "RaceAddonV1.1" made the custom characters playable with their own ID without making completely new character models etc. World editor let's me export only ".W3O" and "W3U" files which can only be opened in the world editor... any suggestions???
 
Status
Not open for further replies.
Top