Jump to content


Photo

A noobie who needs help with WB Scripting


  • Please log in to reply
21 replies to this topic

#1 Pixel Dr

Pixel Dr
  • Members
  • 12 posts

Posted 08 April 2010 - 08:09 AM

Greetings fellow LOTR lovers!

I have been playing BFME 2 for a long time now, and have been designing custom Skirmish Maps for me & my bro.
I have done 2 so far: Valley of Daggers -
Posted ImagePosted Image

& Plains of Airimae -
Posted ImagePosted Image

But now i want to design a single player mission, which is this: The map is a long winding pathway with ambush areas where the player (from point A), has to get to point B surviving a series of attacks. If he reaches the end of the map, he is victorious. I want about X Ambush Attacks, with increasing difficulty & different monsters ie; 1st one is mabye a bunch of small spiders (like 20), 2nd one mabye with more spiders and a couple of Giant ones, 3rd one mabye a couple of goblin battalions etc all the way up to Drakes & Balrogs etc. The "Ambush Attack Point 9" could be player reinforcements before the final Ambush, depending on difficulty.
See below image:
Posted Image

Designing the map itself isn't a problem, and the scripting involved should be very simple. The problem im having is, I don't know how to set it all up. I've read up on most tutorials I can find, but find myself getting frustrated because they don't explain certain things or why it has to be that way. I do understand the following though:

- That for each ambush point there needs to be a trigger area, as well as for "Point B".
- That each of the ambush teams need to be placed onto the map, setting them as "plyrWild" in "Sleep" stance, changing it to "Aggressive" when <LocalPlayer> enters corresponding trigger area.
- That if I do need <LocalPlayer> reinforcements at "Ambush Point 9" instead of an attack, to again place "Civilian/Neutral" battalions that transfer to <LocalPlayer> when entering corresponding trigger area.

But Please could someone help me answer the following?

- I've heard that the map.str file has to be away from the map folder once i've edited it, and am using WB. Putting it back in ONLY when im Testing/Playing the map in BFME 2:ROTWK. Is this true?
- How would the map.ini be written? Is there a Detailed Tutorial on .INI & .STR files out there that will explain it all?
- Do you need to use specific objects / teams ie; a specific Legolas model to use as me (Local Player) with a number of Archer & Warrior Battalions?
- Is there a difference, when designing / scripting between SkirmishElves & PlyrElves, as well as PlyrNeutral & PlyrCivilian?
- How do I code the .INI & .STR files & Script in WB to actually get the map started? Will setting a waypoint & calling it "player_1_start" work with a campaign mission style?
- Can I add Creeps to this Campaign mission? If so, is it a similar setup to Skirmish mode? ie; placing "Lair" objects & assigning it to PlyrCreeps (having setup the appropriate teams)?

Sorry if theres loads of questions, I just need assistance. Could someone please help me with this? I feel like such a noob :(

Thanks in advance ;)
Pixel

Edited by Pixel Dr, 08 April 2010 - 08:48 AM.


#2 Puzzler33

Puzzler33
  • Members
  • 226 posts

Posted 11 April 2010 - 09:19 AM

1 - I've heard that the map.str file has to be away from the map folder once i've edited it, and am using WB. Putting it back in ONLY when im Testing/Playing the map in BFME 2:ROTWK. Is this true?
2 - How would the map.ini be written? Is there a Detailed Tutorial on .INI & .STR files out there that will explain it all?
3 - Do you need to use specific objects / teams ie; a specific Legolas model to use as me (Local Player) with a number of Archer & Warrior Battalions?
4 - Is there a difference, when designing / scripting between SkirmishElves & PlyrElves, as well as PlyrNeutral & PlyrCivilian?
5 - How do I code the .INI & .STR files & Script in WB to actually get the map started? Will setting a waypoint & calling it "player_1_start" work with a campaign mission style?
6 - Can I add Creeps to this Campaign mission? If so, is it a similar setup to Skirmish mode? ie; placing "Lair" objects & assigning it to PlyrCreeps (having setup the appropriate teams)?


1) There is no need to remove the str file from the map folder at any point and it does not affect WB at all as you edit the map (except it recognises the strings of text).

2) There are a couple of tutorials and threads about creating map.str files but it's pretty simple. The easiest way to make an str file is to copy one from another map into your map folder. You can then open this and edit the strings and text to suit your map. If you don't have access to another str file you can create one by making a notepad document, calling it 'map' and setting the file type to '.str'. The way str files work is also quite simple. Each bit of text is formed from three lines. The first is the string, with which to reference the text – this is like a title. You should notice it always starts with 'SCRIPT:' followed by some writing. The second line is quoted your text – this is the body of text that will be displayed. Lastly you always end with 'END'. An example of this would be:

SCRIPT:Mapintro1
"Welcome to map \n I Hope you like it."
END

You would then have a script saying something like 'Display military briefing 'SCRIPT:Mapintro1' for 10 seconds'.
The ' \n ' bit means start a new line.

Hopefully this is explained enough now.

3) When you want to identify the moment when the player is in a trigger area you can use a variety of different scripts to achieve what you want. You can have it so the trigger fires when the hero/heroes are in the area or when all the units which the player owns are in the area, within a certain distance or a proportion of the team is in the area. Some of these will require two or more circumstances to be true, for example the player to have no units in one area and more than [this many] units in another. Just take a look at the IF scripts as you decide how you want it to work.

4) I've never really understood how those players work and so I tend to stick to Player_1 (etc.) for the players, PlyrCreeps for the creeps and PlyrNeutral / PlyrCivilian for neutral/scenery objects/units. My answer is, as a result, pretty much my guesswork and assumptions, but I'd say there is no difference except for the fact that they are different teams (which is pretty obvious) and it is possible that you can only use SkirmishElves when you are playing offline.

5) You will use a fair bit of scripting in this map, a little bit of str coding, but I doubt there will be any real need for ini coding which you can't avoid with scripting, which is good because it's quite complex and if you aren't comfortable with scripting and str coding then it's quite a lot to take in. If you are using RotWK (it sounds like you are) then creating a waypoint called 'Player_1_Start' will create a fortress and 2 builders of the race that the player in that start position has chosen. You will need to have created the skirmish players and deleted players 2, 3 and 4 if you want only one player. (Find it near the bottom of the Edit menu). You probably don't want a fortress or builders in which case you will need to change the waypoint type to 'Beacon'. To kill the builders you will need to make a couple of scripts which I will explain further if necessary (it just takes a while). You will also need to create a building belonging to the player off the border of the map because otherwise the game will start with the player owning no buildings, which the computer will interpret as a defeat. I suggest using a dwarven barracks.

6) Yes. Things like this are best tested for yourself before you ask about them because it is easier and quicker in some cases to learn by experiment.


Any more questions or greater depth into any of these things feel free to ask about.
Posted Image

#3 Pixel Dr

Pixel Dr
  • Members
  • 12 posts

Posted 11 April 2010 - 11:08 AM

Thank you for your detailed reply!!

I will make these changes, and see how it goes !!

#4 Guest_Guest_Pixel Dr_*_*

Guest_Guest_Pixel Dr_*_*
  • Guests

Posted 14 April 2010 - 06:12 PM

Thanks for the info, alot of things are clearer now. I have pretty much set up the map & scripting (phew), but am having trouble with 3 things:

Firstly the builders, how do i disable them ? Is the solution to add something to my map.ini or a THEN condition to my starting script ? if so which one ? The 'Units Cannot build any Buildings' one ?

Secondly, I'm trying to script an event where the <LocalPlayer> enters a specific trigger zone, spawning 2 balrogs on either side, lasting for the rest of the game, but killable by the <LocalPlayer>. I am confused because I saw another topic on this forum dealing with the same thing, but couldn't understand the setup. I'm assuming i need to place the 2 MordorBalrogEgg's near my associated trigger zone, then write a script: IF <LocalPlayer> enters 'X' Area, THEN Spawn the 2 balrogs. The problem is, im not sure which script to use. I couldn't find the right one, can anyone shed a light on this for me ?

Lastly, the spell system. I set up Sciences to be enabled in my start script, but is not working. I don't understand :( lol

Many thanks for your help already buddy/ies. I'll upload my maps when their done if you want, they're cool :p

#5 Puzzler33

Puzzler33
  • Members
  • 226 posts

Posted 14 April 2010 - 07:10 PM

If you already have an ini file then there is a very simple way to disable the builders at the start.

(To be put in your map.ini file:)
PlayerTemplate FactionMen
	StartingUnit1 = NONE
	StartingUnit0 = NONE 
End

PlayerTemplate FactionElves
	StartingUnit1 = NONE
	StartingUnit0 = NONE
End

PlayerTemplate FactionDwarves
	StartingUnit1 = NONE
	StartingUnit0 = NONE
End

PlayerTemplate FactionIsengard
	StartingUnit1 = NONE
	StartingUnit0 = NONE
End

PlayerTemplate FactionMordor
	StartingUnit1 = NONE
	StartingUnit0 = NONE
End

PlayerTemplate FactionWild
	StartingUnit1 = NONE
	StartingUnit0 = NONE
End

PlayerTemplate FactionAngmar
	StartingUnit1 = NONE
	StartingUnit0 = NONE
End
Obviously you don't need the Angmar bit if you're just on the BFME II base game.

If your map can avoid using an ini file (by which I mean your map would be compromised too far beyond what you are happy with if you don't use ini), then I suggest you do it through scripting.

IF
True.

THEN
'Builder': add unit 'AngmarPorter'
'Builder': add unit 'ElvenPorter'
'Builder': add unit 'DwarvenPorter'
'Builder': add unit 'MenPorter'
'Builder': add unit 'IsengardPorter'
'Builder': add unit 'MordorPorter'
'Builder': add unit 'WildPorter'
Set UnitRef 'P1Porter1' to unit of type 'Builder' closest to Team 'Player_1' and owned by the team's player
Set timer 'Delay' to expire in '0.5' seconds

IF
Timer 'Delay' has expired.

THEN
Unit 'P1Porter1' is removed from the map
Set timer 'Delay2' to expire in '0.5' seconds

IF
Timer 'Delay2' has expired.

THEN
Set UnitRef 'P1Porter2' to unit of type 'Builder' closest to Team 'Player_1' and owned by the team's player
Set timer 'Delay3' to expire in '0.5' seconds

IF
Timer 'Delay3' has expired.

THEN
Unit 'P1Porter2' is removed from the map

There are some variations on that but it is the basics of what you need. If the referencing and killing is too close to each other then you can sometimes confuse it, but you can compact this into two scripts (Ref+a+b+c+Kill, Ref+d+e+f+Kill) if you have other things in the middle (shown here as a/b/c/d/e/f).

Bits like:
'Builder': add unit 'MenPorter'
You will find under Scripting>Object Lists - Add a unit to an object list. Object lists are simple ways of grouping units so you don't have to put (in this example) loads more work into tailoring scripts to each player's race.

Setting Unit References is found in Scripting>Referencing If I remember correctly.
Timers are found in Scripting>Timers [Set timer] / Scripting [Timer expired]
Killing units is found in Unit - Action>Damage or Remove (though it may be in Unit - Other if I'm wrong).

About the Balrog thing, you'll need to use ini coding to remove a Balrog's lifespan and make it permanent. Again I would suggest avoiding ini coding where possible, but if not you just need to put in a bit of code for that.......

Could you give a link to the other topic you saw?

To spawn two balrogs you'll need a script like this:
IF
<LocalPlayer> enters 'X' (area)

THEN
Spawn Unit 'Balrog1' of type 'MordorBalrog' at waypoint 'SpawnBalrog1'
Spawn Unit 'Balrog2' of type 'MordorBalrog' at waypoint 'SpawnBalrog2'
You'll find the spawn script in Unit - Other>Spawn [Spawn named unit at waypoint]

This will not give you the cool smashing up from underground effect though which is why I am interested in this other topic.

Is your problem with the spellbook that the spells are disabled (greyed out once you've bought them)? Are you unable to click on the button which allows you to buy spells? Are the spells fine except they are red everywhere on the map or something?

I have an inexplicable problem with my worldbuilder where the spells don't work. I know it started with a particular map and a problematic script (trying to raise the sea level) and somehow affected the following maps in terms of permanently disabling the spellbook. It stopped affecting my maps after a while and has resurfaced on my most recent map but only affecting players 3 to 6 (thankfully the players I wanted to be unable to use spellbook powers).

Have you:
Enabled the spellbook?
Tried (individually) making some/all the spells activated?
Thought about leaving it as is (for now, at least)?

Edited by Puzzler33, 14 April 2010 - 07:30 PM.

Posted Image

#6 Guest_Guest_*

Guest_Guest_*
  • Guests

Posted 14 April 2010 - 09:00 PM

Wow, nice response!!
I need some time to soak it all in :p
I will search for the topic i saw & link it.
Thanks for the detailed response m8

Pixel Dr

#7 Puzzler33

Puzzler33
  • Members
  • 226 posts

Posted 14 April 2010 - 11:23 PM

Any time. I would quite like to take you up on that offer once you've finished the map...

I'll upload my maps when their done if you want, they're cool :p

Is there anything else you need a little help with?

Edited by Puzzler33, 14 April 2010 - 11:24 PM.

Posted Image

#8 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 15 April 2010 - 05:24 AM

Wouldn't you call up the balrog spawn egg so you get all the effects or am I too old school?

#9 Puzzler33

Puzzler33
  • Members
  • 226 posts

Posted 15 April 2010 - 10:32 AM

Yes. Any idea where you find the egg though?
Posted Image

#10 Ridder Geel

Ridder Geel

    Master Yelloh

  • T3A Staff
  • 10,852 posts
  • Location:The Netherlands (AKA: Holland)
  • Projects:RC Mod + SEE + RTS Engine
  •  The Dangerous T3A Team Chamber Member
  • Division:BFME
  • Job:T3A Staff

Posted 15 April 2010 - 11:24 AM

...objects... or in the ocl ini file...
objectcreationlist.ini :p
look in that ini for the balrog and you should find it...

Edited by Ridder Geel, 15 April 2010 - 11:24 AM.

Ridder Geel

#11 Puzzler33

Puzzler33
  • Members
  • 226 posts

Posted 15 April 2010 - 03:34 PM

Ok I took a look in objectcreationlist.ini and saw that I was trying to find MordorBalrogEgg or MordorBalrogEggPlaceHolder (probably the same thing) and then spent a little more time searching through the object tool on worldbuilder trying to find it.

It is found in Civilian > NONE [ModorBalrogEgg]. You should just be able to spawn it like normal units and it will have the nice effects.
Posted Image

#12 Pixel Dr

Pixel Dr
  • Members
  • 12 posts

Posted 15 April 2010 - 06:51 PM

ok,

Here is the link related to Scripting the Balrog with the spawn FX :

http://forums.revora...p...6&hl=Balrog

Regarding the Balrogs. I did assume that i should place the MordorBalrogEggs near its associated trigger point, then script them to spawn when <LocalPlayer> enters the zone. Am i to understand that the only thing i need to put in the map.ini is the tweaking of their lifespan? What would the code be for it? I can't even get them to appear out of thin air (confused).

Regarding the Spell System. I have tried what you mentioned/suggested; enabling the spell store, setting the FACTION_MEN Science to Available, even routing a specific power, ie the 'healing' power to <LocalPlayer> and Player_1 (tried both, but nothing). Its not essential, but would be nice, considering the enemies on my map are relentless. Mabye it has something to do with where you place it in your starting script/s. I have 3 Scripts that run in sequence from the start, but i need to change it now that i've mastered the camera animations.

Regarding the Removal of the Builders. Since i have a map.ini already, ill just throw the code in there. I'm still a bit shakey with scripting still, scared ill feck up my carefully crafted maps. By the way, I will upload these maps when i'm satisfied that they are both bug free & pro looking. :D

Also, can anyone shed a light on the OCL? and these CINE objects? do they appear when animating & testing a camera animation?
I need to get a general understanding. Thanks for all your help so far :p

Any additional help here would be great :D
Pixel Dr

Edited by Pixel Dr, 15 April 2010 - 06:58 PM.


#13 Puzzler33

Puzzler33
  • Members
  • 226 posts

Posted 15 April 2010 - 09:08 PM

It shouldn't matter where you place it - just put it where you want it. I think what happens is that you spawn both the MordorBalrogEgg and the PlaceHolder and it should create the visual FX and spawn the Balrog itself once that's done. I haven't tested this yet but we'll find out if it works soon enough.

To stop the Balrog(s) from disappearing once their summoning timer is up you need to put in this code:
Object MordorBalrog
RemoveModule ModuleTag_LifetimeUpdate
End

It's possible that you need to add another 'End' in underneath but I doubt it

I'm not sure what else to suggest about the spell system. Try to resign yourself to the growing probability that there is a bug with the spellbook which you won't be able to fix. Hopefully it won't affect your future maps.

I would have thought that scripting was much easier and safer than ini coding because if you get a bit of ini coding wrong then it will crash on you, but anyway...

OCL=Object Creation List. Not too sure about this but I expect it is the sequence of events that enter things like the Balrog onto the map (combining sound, effects and stuff). I think CINE objects are pretty much inaccessible on worldbuilder and you can't really use them...

(((BTW You might alternatively want to use a dragon - you can just make a script saying Spawn unit 'Dragon1' of type 'SummonedDragon' [Found in EvilBeasts>Unit] at waypoint 'DragonSpawn1' or something and it flies down.)))

[Edit]
I have now tested it and I can confirm that spawning a Balrog by spawning both 'MordorBalrogEgg' and 'MordorBalrogEggPlaceHolder' found in Civilian>NONE will create a Balrog rising up through the ground. The only thing is that I'm not convinced whether you can name the Balrog itself by naming the egg or placeholder. I think you will need to reference both the Balrogs in a similar way to the way I described in my second reply about 10 seconds after spawning their eggs.

Edited by Puzzler33, 15 April 2010 - 10:30 PM.

Posted Image

#14 Pixel Dr

Pixel Dr
  • Members
  • 12 posts

Posted 15 April 2010 - 11:42 PM

Ok so, i place both the eggs & placeholders, then script the 2 balrogs to spawn at waypoints near the trigger zone?

Edited by Pixel Dr, 15 April 2010 - 11:45 PM.


#15 Puzzler33

Puzzler33
  • Members
  • 226 posts

Posted 16 April 2010 - 08:29 AM

This is what I think you need to do:

IF
[Conditions - heroes enter area etc.]

THEN
Spawn unit 'Balrog1' of type 'MordorBalrogEgg' on team Team 'PlyrCreeps' at waypoint 'Balrog1SpawnPoint'.
Spawn unit 'Balrog1' of type 'MordorBalrogEggPlaceHolder' on team Team 'PlyrCreeps' at waypoint 'Balrog1SpawnPoint'.
Spawn unit 'Balrog2' of type 'MordorBalrogEgg' on team Team 'PlyrCreeps' at waypoint 'Balrog2SpawnPoint'.
Spawn unit 'Balrog2' of type 'MordorBalrogEggPlaceHolder' on team Team 'PlyrCreeps' at waypoint 'Balrog2SpawnPoint'.
Set timer 'BalrogRef' to expire in '10' seconds.

(No need to spawn the object MordorBalrog at any point as spawning the Egg and PlaceHolder cause a sequence of events which do this for you).

IF
(Timer) 'BalrogRef' has expired

THEN
Set UnitRef 'Balrog1' to unit of type 'MordorBalrog' closest to team Team 'Player_1' belonging to 'PlyrCreeps'.
Set timer 'BalrogRef2' to expire in '1' seconds.

IF
(Timer) 'BalrogRef2' has expired

THEN
Set UnitRef 'Balrog2' to unit of type 'MordorBalrog' closest to team Team 'Player_1' belonging to 'PlyrCreeps'.

Obviously there may be variations on this, such as more specific triggers to make sure the script doesn't fire at the wrong time. Setting unit references will be found in Scripting > Referencing. I'm fairly sure that referencing is necessary because I doubt that the name(s) (Balrog1/Balrog2) will transfer to the actual MordorBalrog object when it is created.

Edited by Puzzler33, 16 April 2010 - 08:31 AM.

Posted Image

#16 Pixel Dr

Pixel Dr
  • Members
  • 12 posts

Posted 16 April 2010 - 06:02 PM

Ah, ok will give it a bash. Thanks for the info. I will get back to you :D

#17 Pixel Dr

Pixel Dr
  • Members
  • 12 posts

Posted 17 April 2010 - 02:28 PM

It worked like a charm dude :p I'm gonna finish off the map and the Testing. Will upload map soon :p
Thks for all your help.

Pixel Dr

#18 Puzzler33

Puzzler33
  • Members
  • 226 posts

Posted 17 April 2010 - 03:11 PM

You're welcome. :p
Posted Image

#19 Pixel Dr

Pixel Dr
  • Members
  • 12 posts

Posted 18 April 2010 - 03:09 PM

Right, Its all going great! Just 2 things now, if any1 wouldn't mind shedding light upon it.

Firstly, when you click on load map, and the screen changes to the load screen, how do I change the top left & right TGA pics? I've figured out how to change the top right one - the map itself - to match the in-game devs ones, but am having trouble with the top left one - an image of area. What do I name the TGA file in my map folder?

And lastly, I want to make my map a .exe installer. Can any1 link to software that'll do this along with some tips?

Thanks again :p

Pixel Dr

#20 Puzzler33

Puzzler33
  • Members
  • 226 posts

Posted 18 April 2010 - 05:18 PM

Both the loading images are 128x128 pixels. The top right one is the minimap which needs to be flipped vertically and called 'Map Name_art'(.tga) the loading picture on the left doesn't need to be flipped or rotated - call it 'Map Name_pic'(.tga)

For example on my most recent map I call the loading picture (on the left)

Hide and Seek KiLL3R by Puzzler33_pic.tga

You don't need to manually put '.tga' because it does it automatically, but it doesn't make a difference anyway.

I hope I haven't got _art and _pic mixed up but if I have then it's the other way round.

Needless to say (hopefully) you should always delete the automatically-created minimap when you have a custom one (_art) because even though it doesn't affect anything it is an obsolete file and you don't want to take longer transferring maps than necessary.

I've never heard of making a map an exe installer... sorry about that. It's not much more trouble just manually copying it from a zipped folder into 'Maps'.

Edited by Puzzler33, 18 April 2010 - 05:19 PM.

Posted Image




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users