Jump to content


Photo

BFME II Tutorial - Capture Flags for new Factions!


  • Please log in to reply
30 replies to this topic

#1 Fingulfin

Fingulfin

    I Like Pi3. Do you?

  • Hosted
  • 1,752 posts
  • Location:California, USA
  • Projects:Staying Alive.
  •  This place looks familiar. I can't remember why.

Posted 08 December 2006 - 04:43 AM

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?
Posted Image
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:
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:
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:
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!

Edited by Solinx, 14 January 2007 - 03:18 PM.

Posted Image
--------------------------------------
"You look like a ghost of your former self..."

#2 {IP}Sauron

{IP}Sauron

    title available

  • Hosted
  • 391 posts
  • Location:Denmark
  •  Istari Productions Leader

Posted 08 December 2006 - 08:57 AM

amazing :p
"A still more glourious dawn awaits. Not a sunrise, but a galaxy-rise. A morning filled with 400 billion suns." - Carl Sagan
Posted Image

#3 zimoo

zimoo

    Ecthelion of the Fountain

  • Project Team
  • 2,009 posts
  • Location:Devon, England
  • Projects:Lurking until the off topic begins...
  •  Guardian of the Books

Posted 08 December 2006 - 10:16 AM

Figured this out ages ago, but good job I guess :p
Posted Image
Posted Image
Posted Image
Posted Image
Posted Image
Posted Image

Playing games? Ah, you'll never be a good modder if you get involved in actually playing them!


#4 Pixel

Pixel

  • Hosted
  • 2,451 posts
  • Location:London, UK

Posted 08 December 2006 - 11:41 AM

Good job! This can help some people wanting to do this i guess.

#5 Theo

Theo

    Hey look, im a VIP.

  • Members
  • 222 posts
  • Location:Sheffield, Uk,
  • Projects:Being lazy.

Posted 08 December 2006 - 01:13 PM

Good job, i never knew this but now my fellowship can have a flag atleast!

#6 General Otmin

General Otmin

    Prince of Vampires

  • Members
  • 353 posts
  • Location:My own little world
  • Projects:*Trinity Wars*
  •  Mapper/Modeler/Coder

Posted 08 December 2006 - 01:44 PM

yay Fing :)



Posted Image

Trinity Wars

92% of teens have moved onto rap. If you are part of the 8% that still listen to real music, copy and paste this into your signature


#7 Grim

Grim

    Mad Axe

  • Project Team
  • 537 posts
  •  T3A Team Chamber Member
  • Division:T3A Moderator

Posted 08 December 2006 - 02:33 PM

You lack humility :) but congrats for sharing your discoveries and explain them.
This one deserves to be added to the new faction tuts.
Posted Image

#8 Stealthsnake

Stealthsnake

    Battles of Gondor mod leader

  • Hosted
  • 976 posts
  • Location:United Kingdom
  • Projects:Battles of Gondor
  •  coder, skinner, mapper, graphics

Posted 08 December 2006 - 02:41 PM

i also knew about this, but by the soudns of it alot did not, so goob job :)
Posted Image
Posted Image
a mod for rotwk, includes Harad, Rhun, Rohan and Southern Fiefdoms Factions, beta released, site/forums for the mod is here.

#9 Fingulfin

Fingulfin

    I Like Pi3. Do you?

  • Hosted
  • 1,752 posts
  • Location:California, USA
  • Projects:Staying Alive.
  •  This place looks familiar. I can't remember why.

Posted 08 December 2006 - 06:03 PM

lol... Last time I checked nobody knew :) As for Grim, I do lack humility a bit I guess.... I am just happy when I come up with something. I think the biggest "up" to my announcing discoveries to the world are that newer modders can actually learn from them. One of the biggest things I have heard from new modders is that they are disappointed that we (the pros) come up with great techniques, and find out little secrets and them keep them to ourselves. I, however braggy it may sound, try as hard as possible to compile everything I learn into tutorials, so that future generations may learn from it. It might not seem like I have released that many tutorials, but I have like 20 of them that are WiPs... Whatever ;)
Posted Image
--------------------------------------
"You look like a ghost of your former self..."

#10 zimoo

zimoo

    Ecthelion of the Fountain

  • Project Team
  • 2,009 posts
  • Location:Devon, England
  • Projects:Lurking until the off topic begins...
  •  Guardian of the Books

Posted 08 December 2006 - 06:10 PM

If that was aimed at me/Tom not posting about this, I actually though it was relatively straight forward, and expected most people to know :/. Oh well, I suck at writing tutorials anyway.
Posted Image
Posted Image
Posted Image
Posted Image
Posted Image
Posted Image

Playing games? Ah, you'll never be a good modder if you get involved in actually playing them!


#11 Fingulfin

Fingulfin

    I Like Pi3. Do you?

  • Hosted
  • 1,752 posts
  • Location:California, USA
  • Projects:Staying Alive.
  •  This place looks familiar. I can't remember why.

Posted 08 December 2006 - 06:38 PM

Thats the problem with modders. We all expect people to look at something and for it to auto-matically make sense. Not everyone is at our level of skill. I wonder why people assume that most modding principles are straight forward... If they were straight forward, then why are there still newbies? There are some magnificent people who can look at a segment of code for the first time and understand it. Sadly, the number of that group of people is extremely small. I mean, extremely. How else is anyone supposed to learn what modding is? If you discover something that doesn't look like it has been found before (do a search for it, if no topics turn up, then it hasn't been found) post it! Just say, "Look, I got a capture flag in game. I did it by editing the LUA." If you had said that, (two sentences) I could have saved myself from much headache. Try not to take anything for granted. Someone who is familiar with INI coding might look over that piece of code and have no idea it could be edited. I didn't even know what .BIG the LUA was located in before last night! The only reason I even dreamed that it could be linked to the LUA was because of 2Play's randomizing script... How do you expect anyone new to modding to find that out? For all I knew, the LUA was something hidden in game.dat, uneditable to modders. . .
Posted Image
--------------------------------------
"You look like a ghost of your former self..."

#12 Bart

Bart

  • Network Leaders
  • 8,524 posts
  • Location:The Netherlands
  • Division:Revora
  • Job:Network Leader

Posted 08 December 2006 - 07:42 PM

i'm glad you learned something from my script, but in my turn (sp?), i learned that stuff from DLotS
bartvh | Join me, make your signature small!
Einstein: "We can’t solve problems by using the same kind of thinking we used when we created them."

#13 Phil

Phil

    Force Majeure

  • Network Leaders
  • 7,969 posts
  • Location:Switzerland
  • Projects:Revora, C&C:Online
  •  Thought Police
  • Division:Revora
  • Job:Network Leader
  • Donated
  • Association

Posted 08 December 2006 - 07:46 PM

but in my turn (sp?), i learned that stuff from DLotS

I can say that I discovered it myself, but there were already a lot of people knowing it before me. You're never the first one when it comes to coding :)

revorapresident.jpg
My Political Compass

Sieben Elefanten hatte Herr Dschin
Und da war dann noch der achte.
Sieben waren wild und der achte war zahm
Und der achte war's, der sie bewachte.


#14 Hostile

Hostile

    Benefitting Humanity Simply by Showing Up!

  • Veterans
  • 9,551 posts
  • Location:Washington DC
  •  T3A Founder
  • Division:Revora
  • Job:Global Administrator
  • Donated
  • Association

Posted 09 December 2006 - 02:55 AM

I think he did a good job, he figured it out on his own and came here to share. That's what this place is allow about. Great job Fin. I share your enthusiasm for making, the obsure, understandable for new modders.

I suggest to admins this be tweaked and make into a tutorial for BFME2.

#15 wiz1

wiz1

    Wiz1

  • Members
  • 148 posts
  • Location:South Bend, IN

Posted 09 December 2006 - 02:20 PM

does it need skining?
Posted Image

#16 Fingulfin

Fingulfin

    I Like Pi3. Do you?

  • Hosted
  • 1,752 posts
  • Location:California, USA
  • Projects:Staying Alive.
  •  This place looks familiar. I can't remember why.

Posted 09 December 2006 - 07:39 PM

There are plenty of Rohan Banners in-game, take your pick and UV map a flag to match :p I simply made a 2-D Flag shape, made it 3D, copied it and flipped it, attached them together and UV mapped them to match a Rohan Banner texture I extracted. Overall it took around an hour (including the binding and whatnot) :rolleyes:
Posted Image
--------------------------------------
"You look like a ghost of your former self..."

#17 Solinx

Solinx

    .

  • Undead
  • 3,100 posts
  • Location:The Netherlands
  • Projects:Real Life
  • Division:Revora
  • Job:Retired Leader / Manager

Posted 10 December 2006 - 01:19 PM

Thanks Fin, I was one of those who didn't know :)

Next step: Make capturing flags a mission, then make the one who holds all flags the winner of a skirmish game.

Result: Capture the flag with BFME 2

I think you can do both, knowing you are good with WB.

Solinx
Posted Image

"An expert is a man who has made all the mistakes which can be made in a very narrow field." - Niels Bohr


#18 Joe

Joe

    title available

  • Project Team
  • 886 posts
  • Location:England
  • Projects:Real Life

Posted 13 December 2006 - 07:29 PM

Will make this into more of a tutorial soon, then post on main site, if thats ok with you Fin, or you can make it more of a tutorial your self
Posted Image
Posted Image
Posted Image

#19 Fingulfin

Fingulfin

    I Like Pi3. Do you?

  • Hosted
  • 1,752 posts
  • Location:California, USA
  • Projects:Staying Alive.
  •  This place looks familiar. I can't remember why.

Posted 13 December 2006 - 07:52 PM

I'll do it :ohmy:
Posted Image
--------------------------------------
"You look like a ghost of your former self..."

#20 King Thranduil

King Thranduil

    King of Mirkwood

  • Members
  • 149 posts
  • Location:Mirkwood Forest

Posted 16 December 2006 - 08:22 PM

Hmm...Maybe someone could use this to create a proper flag for the Arnor faction?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users