Jump to content


Photo

Map Scripting


  • Please log in to reply
48 replies to this topic

#1 Gumby22don

Gumby22don
  • Project Team
  • 144 posts
  •  AWD Development Team
  • Division:BFME
  • Job:Co-Designer: RoR 1 and 2

Posted 21 March 2006 - 05:16 AM

Any code snippets that will be useful to all for custom map designs can go here.

This is what I've come up with as a script for a hero-based map setup.

*** IF ***
	 Player '<This Player>' has Greater Than  0  unit or structure of type 'ElvenPorter'
*** THEN ***
  Find 'ElvenPorter' Owned by Player '<This Player>' nearest team Team 'PlyrCivilian/teamPlyrCivilian' and reference as UnitRef 'PorterForDeletion'
   Unit 'PorterForDeletion' is removed from the world.
  Show debug string and pause: String: 'AI_DEL_PORTERS'
*** ELSE ***
  Disable Script 'Destroy Porters - Elves'.

For anyone who needs a custom map where you're going to disable the annoying little porters that come hardcoded to bfme2. If you want to disable building more, you can disable each type of porter, and worker in a script as well. You probably also need to make this script for each type of porter. (I just disabled factions for each player on the map)

Don
have a great day

Edited by Gumby22don, 21 March 2006 - 05:17 AM.

Posted Image

#2 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 21 March 2006 - 08:01 AM

Interesting... I just disabled the Porter (As in building new ones) and created a quick-Fix map.ini.

PlayerTemplate FactionDwarves
	StartingUnit1 = NONE
	StartingUnitOffset1 = X:30 Y:215 Z:0
	
	StartingUnit0 = NONE
	StartingUnitOffset0 = X:1 Y:120 Z:0
End


I can do Scripting just fine, but I dont like looking around for unnescesary ones that can easily be solved in map.ini!

Edited by Fingulfin, 21 March 2006 - 08:02 AM.

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

#3 ched

ched

    .

  • Undead
  • 4,431 posts
  • Location:Angers (France)
  • Projects:Rhovanion Alliance
  •  T3A Team Chamber Member
  • Division:BFME
  • Job:Previous Division Leader

Posted 21 March 2006 - 02:05 PM

pinned

just a question, why would you want to disable porters ? aren't they what allows you to actually build your base ? :blink:
Software is like sex; it's better when it's free ~Linus Torvald

#4 Mathijs

Mathijs

    Post-modern Shaman

  • Network Leaders
  • 13,756 posts
  • Projects:Age of the Ring
  • Division:Revora
  • Job:Leader

Posted 21 March 2006 - 02:12 PM

For hero based maps :blink:

No fuel left for the pilgrims


#5 Bart

Bart

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

Posted 21 March 2006 - 02:30 PM

ok, another one. these scripts can be used to do certain things, like playing sounds and showing texts only for 1 player (in a MP map)

1. for each player, put down a RohanBaseDefenseFoundation (or another object of that sort) and name it PLAYER_ID_X (x being the player)
2. for each player, make a script folder. for example: 'player x events'. make this folders unactive
3. script example:
*** If ***
Unit 'PLAYER_1_ID' is owned by player '<local player>'
*** Then ***
Enable script 'player 1 events'
4. then you can put scripts in the folder like:
*** If ***
Something
*** Then ***
Play a sound
Show a message
Flash a command button
and it won't cause out-of-syncs

i invented this for my Helms Deep map

Edited by 2playgames, 26 June 2006 - 04:54 PM.

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."

#6 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 21 March 2006 - 06:37 PM

Cool!!!!! This could be VERY useful! OOS are the main reason people dont like my maps... LOL

Edited by Fingulfin, 21 March 2006 - 06:37 PM.

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

#7 Bart

Bart

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

Posted 21 March 2006 - 08:24 PM

well, it's not like this script solves any other OOS problems. it's mainly for very cinematic/scripted maps like minas tirith, helms deep, 'the movie' etc..
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."

#8 Gumby22don

Gumby22don
  • Project Team
  • 144 posts
  •  AWD Development Team
  • Division:BFME
  • Job:Co-Designer: RoR 1 and 2

Posted 22 March 2006 - 02:04 AM

That's very cool 2playgames. I'll put it into mine immediately - I want a plot-based hero map, which will trigger events based on your faction, and hero choice, level etc.

Also, fingulfin: Thanks, now I feel very silly. Is there some list of what can be put into a map.ini? - I tried copying the whole fortress definition and modifying to enable archers to be built but couldn't get it working, which was why i used map scripting for almost everything.

Don
have a great day
Posted Image

#9 Bart

Bart

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

Posted 22 March 2006 - 04:58 PM

you only have to add the Comman_ConstructGondorArcherHorde button to the fortress CommandSet
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."

#10 Mullers_11

Mullers_11

    Onlooker

  • Project Team
  • 806 posts
  • Location:England
  • Projects:Visions, The Four Ages
  •  Not active

Posted 22 March 2006 - 08:20 PM

Command_ConstructGondorArcherHorde

:lol:

Retired


#11 Bart

Bart

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

Posted 22 March 2006 - 08:38 PM

if i would make a direct translation from dutch to english i would call you 'antf***er' :lol: it actually means 'someone who's picking on really small things'

you're right though :)
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."

#12 Gumby22don

Gumby22don
  • Project Team
  • 144 posts
  •  AWD Development Team
  • Division:BFME
  • Job:Co-Designer: RoR 1 and 2

Posted 23 March 2006 - 01:07 AM

That's what I expected - I must have ini files all over the place stuffing me up.

So does adding things to a previously defined CommandSet require the full CommandSet rewritten, or can you just add that one line to say:CommandSet ElvenFortress
yada yada buttons definitions ...Command_ConstructGondorArcherHorde
end
?
Posted Image

#13 Bart

Bart

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

Posted 23 March 2006 - 02:37 PM

normally you can just add it, but the fortress thing is different
you have to put it somewhere in the middle, and also edit the commandbutons that make you go to the 'sub-commandsets'
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."

#14 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 24 March 2006 - 11:26 PM

Ive found CommandSets terribly annoying... In my map INI I had to test the map a couple hundred times before I got everything in the correct order... Its TERRIBLY annoying!
Posted Image
--------------------------------------
"You look like a ghost of your former self..."

#15 Kelso

Kelso

    BFME Admin

  • Project Team
  • 1,467 posts
  • Projects:Rise of Rome, Rise of Rome 2
  •  AWD and T3A Team Chamber Leader
  • Division:BFME
  • Job:Designer: Rise of Rome 1 and 2

Posted 25 March 2006 - 05:54 AM

Doing it via scripts allows you to only distribute the map instead of having to distribute a "mod". Makes it a bit easier and more accessible.
Posted Image
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 25 March 2006 - 06:12 AM

Ummm... No! It is all in the file so it is as easily transferrable. Not to mention for some reason people flip when they see stupid stuff, like Saruman having Word 'o' Power... Only problem is if you edit it too far, you make it so they have to restart the program before they can play a different map.
Posted Image
--------------------------------------
"You look like a ghost of your former self..."

#17 Bart

Bart

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

Posted 25 March 2006 - 06:22 PM

kelso, don't tell us you don't know about map.ini after 1050 posts here :)
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."

#18 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 25 March 2006 - 10:25 PM

When I started modding (not very long ago) Kelso had no Idea about map.ini... This is what happens when you guys dont actually play the game!!! I have played several maps with a map.ini without even knowing it had one...
Posted Image
--------------------------------------
"You look like a ghost of your former self..."

#19 ched

ched

    .

  • Undead
  • 4,431 posts
  • Location:Angers (France)
  • Projects:Rhovanion Alliance
  •  T3A Team Chamber Member
  • Division:BFME
  • Job:Previous Division Leader

Posted 25 March 2006 - 11:31 PM

kelso, don't tell us you don't know about map.ini after 1050 posts here :w00t:


and 3 CnC games :)



anyway, map.inis are special INI files in which you can override settings defined in INI.big

If I wanted, say, Legolas to inflict more damage JUST on my map, I would replace his WeaponSet.

Map.big contains example of such map.inis, especially in Single Player Maps
Software is like sex; it's better when it's free ~Linus Torvald

#20 Kelso

Kelso

    BFME Admin

  • Project Team
  • 1,467 posts
  • Projects:Rise of Rome, Rise of Rome 2
  •  AWD and T3A Team Chamber Leader
  • Division:BFME
  • Job:Designer: Rise of Rome 1 and 2

Posted 26 March 2006 - 10:31 PM

When I started modding (not very long ago) Kelso had no Idea about map.ini... This is what happens when you guys dont actually play the game!!!


Excuse me? Fin, think before you post please lest I'll be forced to make you look like an idiot.

And I misread what you wrote, didn't see the map.ini reference. Furthermore, I am and have been for some time, fully aware of map.ini, I'm not a complete moron. However, I have never coded anything using it as a foundation and therefore I know nothing about it. This is not my first rodeo guys. :D
Posted Image
Posted Image




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users