LuaAPI.wiki
changeset 380 b9bd613524ca
parent 379 3552b458f1ea
child 381 87b3dcfe11cc
equal deleted inserted replaced
379:3552b458f1ea 380:b9bd613524ca
    65 === <tt>onGameInit()</tt> ===
    65 === <tt>onGameInit()</tt> ===
    66 
    66 
    67 <blockquote>This function is called before the game loads its resources. One can modify various game variables here:
    67 <blockquote>This function is called before the game loads its resources. One can modify various game variables here:
    68 </blockquote>
    68 </blockquote>
    69  * <tt>Seed = 0</tt> - sets the seed of the random number generator
    69  * <tt>Seed = 0</tt> - sets the seed of the random number generator
    70  * <tt>!GameFlags = gfSolidLand + gfArtillery + ...</tt> - sets the gameflags, see above for the available flags
    70  * <tt>!EnableGameFlags(gfSolidLand, gfArtillery)</tt> - sets the GameFlags (just 2 of them in this example), see above for the available flags
    71  * <tt>!TurnTime = 60000</tt> - set the turntime in ms
    71  * <tt>!TurnTime = 60000</tt> - set the turntime in ms
    72  * <tt>!CaseFreq = 0</tt> - frequency of crate drops
    72  * <tt>!CaseFreq = 0</tt> - frequency of crate drops
    73  * <tt>!HealthCaseProb = 35</tt> - chance of receiving a health crate
    73  * <tt>!HealthCaseProb = 35</tt> - chance of receiving a health crate
    74  * <tt>!HealthCaseAmount = 25</tt> - amount of health in a health crate
    74  * <tt>!HealthCaseAmount = 25</tt> - amount of health in a health crate
    75  * <tt>!DamagePercent = 100</tt> - percent of damage to inforce
    75  * <tt>!DamagePercent = 100</tt> - percent of damage to inforce
   133             AddCaption(GetHogName(gear) .. ' took ' .. damage .. ' points of damage')
   133             AddCaption(GetHogName(gear) .. ' took ' .. damage .. ' points of damage')
   134         end
   134         end
   135     end</code>
   135     end</code>
   136 === <tt>onGearResurrect(gearUid) </tt> ===
   136 === <tt>onGearResurrect(gearUid) </tt> ===
   137 
   137 
   138 <blockquote>This function is called when a gear is resurrected. CPU Hogs will resurrect if gfAISurvival is included in !GameFlags. Alternatively, specific gears can have heResurrectable set to true via !SetEffect.
   138 <blockquote>This function is called when a gear is resurrected. CPU Hogs will resurrect if the !GameFlag gfAISurvival is enabled. Alternatively, specific gears can have heResurrectable set to true via !SetEffect.
   139 </blockquote>
   139 </blockquote>
   140 === <tt>onAmmoStoreInit()</tt> ===
   140 === <tt>onAmmoStoreInit()</tt> ===
   141 
   141 
   142 <blockquote>This function is called when the game is initialized to request the available ammo and ammo probabilities. Use !SetAmmo here.
   142 <blockquote>This function is called when the game is initialized to request the available ammo and ammo probabilities. Use !SetAmmo here.
   143 </blockquote>
   143 </blockquote>
   602 === <tt>!SetGearPos(gearUid, value) (0.9.18-dev)</tt> ===
   602 === <tt>!SetGearPos(gearUid, value) (0.9.18-dev)</tt> ===
   603 
   603 
   604 <blockquote>Set pos of specified gear to specified value.</blockquote>
   604 <blockquote>Set pos of specified gear to specified value.</blockquote>
   605 
   605 
   606 == Other Functions ==
   606 == Other Functions ==
       
   607 
       
   608 === <tt>!ClearGameFlags()</tt> ===
       
   609 
       
   610 <blockquote>Disables *all* GameFlags
       
   611 </blockquote>
       
   612 
       
   613 === <tt>!DisableGameFlags(gameflag, ...)</tt> ===
       
   614 
       
   615 <blockquote>Disables the listed GameFlags, without changing the status of other GameFlags
       
   616 </blockquote>
       
   617 
       
   618 === <tt>!EnableGameFlags(gameflag, ...)</tt> ===
       
   619 
       
   620 <blockquote>Enables the listed GameFlags, without changing the status of other GameFlags
       
   621 </blockquote>
       
   622 
       
   623 === <tt>!GetGameFlag(gameflag)</tt> ===
       
   624 
       
   625 <blockquote>Returns true if the specified gameflag is enabled, otherwise false
       
   626 </blockquote>
   607 
   627 
   608 === <tt>!EndGame()</tt> ===
   628 === <tt>!EndGame()</tt> ===
   609 
   629 
   610 <blockquote>Makes the game end.
   630 <blockquote>Makes the game end.
   611 </blockquote>
   631 </blockquote>