The 3rd Age

The Wars of Arda

The Wars of Arda

A huge expansion for RotWK, adding multiple eras, numerous new factions and a full campaign.

Button for The 3rd AgeButton for The Dwarf HoldsButton for The Elven AllianceButton for Helm's Deep Last HopeButton for GothmogtheOrcButton for BFME+Button for The Four AgesButton for HDR HeadquartersButton for Middle Earth CenterButton for Project Perfect Mod

Become an affiliate!

   

Quick Lists

Top Rated Popular New Updated Last Comments Users

Register and log in to move these advertisements down

Capture Flags for new Factions

Avatar of Fingulfin

Fingulfin

Category: Code
Level: Beginner
Created: Thursday March 29, 2007 - 9:08
Updated: Monday April 9, 2007 - 9:23
Views: 5587
Summary: Giving a new faction it's own capture flag for outposts, inns, etc.

Rating

Staff says

3.9

Members say

3.5

Average

3.8/5.0

9 votes

Today, I did a little research into the capture flag. After examining all the codes in relation to it that I could, I found a way to add a flag for new factions! Don't believe me?
Screenshot
Ta-da! I am almost sure no one else has done this...

Want to know how to do it for your mod?
EXPLANATION: It is actually really simple. While browsing through captureflag.ini, I saw this:
              
Code
    Behavior = AIUpdateInterface ModuleTag_03
        AILuaEventsList        = CaptureFlagFunctions
    End

Well, I had seen this a million times before, so I didn't think anything of it the first ka-jillion times I saw it. However, that was because I had no clue what on earth the LUA did. After seeing 2Play's and TDP's orcs, and hearing how they did it, I thought maybe I should check it out. Well, in scripts.lua, I saw this code:
              
Code
function OnCaptureFlagGenericEvent(self,data)
    local str = ObjectCapturingObjectPlayerSide(self)
    if str == nil then
        str = ObjectPlayerSide(self)
    end


    ObjectHideSubObjectPermanently( self, "FLAG_ISENGARD", true)
    ObjectHideSubObjectPermanently( self, "FLAG_MORDOR", true)
    ObjectHideSubObjectPermanently( self, "FLAG_WILD", true)
    ObjectHideSubObjectPermanently( self, "FLAG_MEN", true)
    ObjectHideSubObjectPermanently( self, "FLAG_ELVES", true)
    ObjectHideSubObjectPermanently( self, "FLAG_DWARVES", true)
    ObjectHideSubObjectPermanently( self, "FLAG_ANGMAR", true)

    if str == "Isengard" then
        ObjectHideSubObjectPermanently( self, "FLAG_ISENGARD", false)
    elseif str == "Mordor" then
        ObjectHideSubObjectPermanently( self, "FLAG_MORDOR", false)
    elseif str == "Men" then
        ObjectHideSubObjectPermanently( self, "FLAG_MEN", false)
    elseif str == "Dwarves" then
        ObjectHideSubObjectPermanently( self, "FLAG_DWARVES", false)
    elseif str == "Elves" then
        ObjectHideSubObjectPermanently( self, "FLAG_ELVES", false)
    elseif str == "Wild" then
        ObjectHideSubObjectPermanently( self, "FLAG_WILD", false)
    elseif str == "Angmar" then
        ObjectHideSubObjectPermanently( self, "FLAG_ANGMAR", false)
    else
        ObjectHideSubObjectPermanently( self, "FLAG_NEUTRAL", false)
    end
end

This looked very interesting, so I couldn't help but extract the Capture flags W3Ds and open em up in RenX. Here is what I saw: The Flag Pole, and the "Neutral Flag", then all the Flags. I Imported the SKL file, and saw how the bones were arranged. Thats when it hit me that I could make one for Rohan. I quickly made Rohan a flag, stuck a texture onto it, and bound. (When I bound I just bound all the flags to one of the bones; I didn't want to sit there all night binding them to their individual bones. No Negative effects have turned up because of this.). I added it into my .BIG, and made an asset. Then, I edited my LUA to look like this:
              
Code
function OnCaptureFlagGenericEvent(self,data)
    local str = ObjectCapturingObjectPlayerSide(self)
    if str == nil then
        str = ObjectPlayerSide(self)
    end


    ObjectHideSubObjectPermanently( self, "FLAG_ISENGARD", true)
    ObjectHideSubObjectPermanently( self, "FLAG_MORDOR", true)
    ObjectHideSubObjectPermanently( self, "FLAG_WILD", true)
    ObjectHideSubObjectPermanently( self, "FLAG_MEN", true)
    ObjectHideSubObjectPermanently( self, "FLAG_ELVES", true)
    ObjectHideSubObjectPermanently( self, "FLAG_DWARVES", true)
    ObjectHideSubObjectPermanently( self, "FLAG_ANGMAR", true)
    ObjectHideSubObjectPermanently( self, "FLAG_ROHAN", true)

    if str == "Isengard" then
        ObjectHideSubObjectPermanently( self, "FLAG_ISENGARD", false)
    elseif str == "Mordor" then
        ObjectHideSubObjectPermanently( self, "FLAG_MORDOR", false)
    elseif str == "Men" then
        ObjectHideSubObjectPermanently( self, "FLAG_MEN", false)
    elseif str == "Dwarves" then
        ObjectHideSubObjectPermanently( self, "FLAG_DWARVES", false)
    elseif str == "Elves" then
        ObjectHideSubObjectPermanently( self, "FLAG_ELVES", false)
    elseif str == "Wild" then
        ObjectHideSubObjectPermanently( self, "FLAG_WILD", false)
    elseif str == "Rohan" then
        ObjectHideSubObjectPermanently( self, "FLAG_ROHAN", false)
    elseif str == "Angmar" then
        ObjectHideSubObjectPermanently( self, "FLAG_ANGMAR", false)
    else
        ObjectHideSubObjectPermanently( self, "FLAG_NEUTRAL", false)
    end
end

Put it in-game, and tested. Viola! A capture flag for a new faction!

Comments

Display order: Newest first

OmegaDelta007 - Sunday October 10, 2010 - 7:32

Can't you just use this code instead of editing W3d files:

Code:
[Texture = Old texture 0 New texture 0
Required upgrade = FactionName_upgrade]

OR

[Random Texture = Old texture 0 New texture 0
Required upgrade = FactionName_upgrade]

Can you tell me if this code or another code I could use, rather then editing W3d files.

m@tt (Team Chamber Member) - Wednesday May 28, 2008 - 15:30

Notepad

lycan - Wednesday May 28, 2008 - 9:22

grrr how do i open scripts.lua

Mathijs (Division Leader) - Saturday June 2, 2007 - 12:20

Yay, gonna make a bunch of new flags for Visions now. :)

Go to top

 

"One site to rule them all, one site to find them,
one site to host them all, and on the network bind them."

 
17:28:20