LuaGuide.wiki
changeset 36 f66efe81d8c0
parent 35 532bb2509f0b
child 37 acd631a56390
equal deleted inserted replaced
35:532bb2509f0b 36:f66efe81d8c0
    43 
    43 
    44 == The initiation events ==
    44 == The initiation events ==
    45 
    45 
    46 The two most important event handlers are onGameInit and onAmmoStoreInit. They are used instead of loading a game scheme and weapon scheme and in Campaign or Missions onGameInit is also used to add teams and hogs.
    46 The two most important event handlers are onGameInit and onAmmoStoreInit. They are used instead of loading a game scheme and weapon scheme and in Campaign or Missions onGameInit is also used to add teams and hogs.
    47 
    47 
    48 === onGameInit ===
       
    49 
       
    50 First we have onGameInit. On this event we should add all game modifiers and team setup. If you are making a Mission you only need to specify the things you want to change on this event, everything not changed will be set to default. The available game modifiers can be found here: http://code.google.com/p/hedgewars/wiki/LuaAPI#onGameInit()
    48 First we have onGameInit. On this event we should add all game modifiers and team setup. If you are making a Mission you only need to specify the things you want to change on this event, everything not changed will be set to default. The available game modifiers can be found here: http://code.google.com/p/hedgewars/wiki/LuaAPI#onGameInit()
    51 
    49 
    52 An example of setting up barrel mayhem in a mission:
    50 An example of setting up barrel mayhem in a mission:
    53 {{{
    51 {{{
    54 function onGameInit()
    52 function onGameInit()
    66 AddTeam("Team", 14483456, "Simple", "Island", "Default")
    64 AddTeam("Team", 14483456, "Simple", "Island", "Default")
    67 AddHog("Hedgehog", 0, 1, "NoHat")
    65 AddHog("Hedgehog", 0, 1, "NoHat")
    68 }}}
    66 }}}
    69 To be able to play you must add another team and hog that should have another team color (this team has 14483456) or if you only want one team add the game flag gfOneClanMode. Look in the LuaAPI to see what the other parameters of !AddTeam and !AddHog is.
    67 To be able to play you must add another team and hog that should have another team color (this team has 14483456) or if you only want one team add the game flag gfOneClanMode. Look in the LuaAPI to see what the other parameters of !AddTeam and !AddHog is.
    70 
    68 
    71 === onAmmoStoreInit ===
    69 In onAmmoStoreInit you set what weapons is available in the game. For every weapon run [http://code.google.com/p/hedgewars/wiki/LuaAPI#SetAmmo_(ammoType,_count,_probability,_delay,_numberInCrate) SetAmmo].
    72 
    70 This is used to set both starting weapons and weapons found in crates.
    73 This is where you set what weapons is available in the game for every weapon run [http://code.google.com/p/hedgewars/wiki/LuaAPI#SetAmmo_(ammoType,_count,_probability,_delay,_numberInCrate) SetAmmo].
       
    74 
    71 
    75 Here is an example of initiation of a Training map:
    72 Here is an example of initiation of a Training map:
    76 {{{
    73 {{{
    77 function onGameInit()
    74 function onGameInit()
    78     Seed = 0
    75     Seed = 0