Author Topic: Loading a new scenario from an existing one (Story mode?)  (Read 1032 times)

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
I added (in svn) a new lua function that allows you to load another scenario from inside an existing scenario:

Code: [Select]
loadScenario('capture_the_flag2')
Currently there are a number of things incomplete so i need feedback. I have a restriction that the new scenario must have hte same techtree and factions, but map, tileset can change. How should we make this progress, what kinds of things would we want to see? Carry over untis or start iwth new units and new factions? Bring over builds and upgrades or not etc?

Update: Added a way to call the next scenario with exisitng factions or with only newly defined factions in the new scenario:

Code: [Select]
-- keep existing factions
loadScenario('capture_the_flag2',1)
-- drop existing factions
loadScenario('capture_the_flag2',0)

Playing around with this shows a lot of promise for doing things like missions! Using the current svn code I made two scenarios. The first scenario i setup a cell trigger (to find out cell co-ordinates, svn's debug view shows mouse xy cell coords):

Code: [Select]
cell_event_newscenario = registerCellTriggerEventForFactionToLocation(0,{12,20})
print( 'cell_event_newscenario = ' .. cell_event_newscenario )

When any unit from faction 0 touches the cell at 12,20, my cell trigger event is called:

Code: [Select]
<cellTriggerEvent>
                       if triggeredCellEventId() == cell_event_newscenario then
clearDisplayText()
DisplayFormattedText('warping to new scenario!')

createUnit('blacksmith', 0, startLocation(0))
createUnit('technodrome', 0, startLocation(0))
technodrome= lastCreatedUnit()

giveResource('gold', 0, 400);
giveResource('wood', 0, 400);

giveUpgradeCommand(technodrome, 'robotics')

loadScenario('capture_the_flag2',1)
end
</cellTriggerEvent>

In this case i add a few new units, start an upgrade and then load all of my factions into scenario: capture_the_flag2

This should make for some great new scenarios :)
« Last Edit: 7 October 2011, 03:57:12 by softcoder »

titi_son

  • Draco Rider
  • *****
  • Posts: 283
  • titi_son
    • View Profile
Re: Loading a new scenario from an existing one (Story mode?)
« Reply #1 on: 7 October 2011, 19:49:45 »
 :thumbup:
My first Tilseset: SPRING :) (included in Megaglest )

Secret Hint: To play online join the IRC #megaglest-lobby on freenode which is the lobby chat ingame. So you can chat with or wait for people in the lobby without running megaglest all the time.

 

anything