LuaGuide.wiki
changeset 37 acd631a56390
parent 36 f66efe81d8c0
child 592 2a5ecd20bf16
equal deleted inserted replaced
36:f66efe81d8c0 37:acd631a56390
    57     MinesTime = 0
    57     MinesTime = 0
    58     Explosives = 40
    58     Explosives = 40
    59 end
    59 end
    60 }}}
    60 }}}
    61 
    61 
    62 If you are doing a Training or Campaign you should also set Seed, Map and Theme. But you must also add teams and hogs on this event. This is done by using !AddTeam and !AddHog. An example of adding one team with one hog:
    62 If you are doing a Training or Campaign you should also set Seed, Map and Theme. But you must also add teams and hogs on this event. This is done by using !AddTeam and !AddHog. An example of adding one team with one hog (these functions may only be used here):
    63 {{{
    63 {{{
    64 AddTeam("Team", 14483456, "Simple", "Island", "Default")
    64 AddTeam("Team", 14483456, "Simple", "Island", "Default")
    65 AddHog("Hedgehog", 0, 1, "NoHat")
    65 AddHog("Hedgehog", 0, 1, "NoHat")
    66 }}}
    66 }}}
    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.
    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.
    88 
    88 
    89 function onAmmoStoreInit()
    89 function onAmmoStoreInit()
    90     SetAmmo(amShotgun, 9, 0, 0, 0)
    90     SetAmmo(amShotgun, 9, 0, 0, 0)
    91 end
    91 end
    92 }}}
    92 }}}
       
    93 
       
    94 == Gears everywhere ==
       
    95 
       
    96 Mostly everything in Hedgewars are made op of gears: grenades, bazooka shells, and cake just to name a few. But these are just the visible gears, the whip's affect and wind change are also gears. But for now we will focus on the more concrete ones.
       
    97 
       
    98 The hogs are gears too and when you shoot with bazooka the bazooka shell will be created and explode when it hits the ground. When the shell is created the onGearAdd event is called and the gear parameter will be the bazooka. And when it hits the ground, before the gear has been deleted onGearDelete is invoked with the shell as parameter, after that it is removed.
       
    99 
       
   100 The last event handler onGameTick is called every game tick, that is every millisecond which is a thousand times a second. These three event handlers are the core in the script and where most of the code goes.