| 1 | == trigger(func) == |
| 2 | This is the constructor. It defines the function(s) that will be called iteratively and registers them. |
| 3 | == priority(int=1) == |
| 4 | This method defines the priority the trigger has. |
| 5 | == enable() == |
| 6 | This method activates the trigger. |
| 7 | == disable() == |
| 8 | This method deactivates the trigger. |
| 9 | |
| 10 | Every trigger starts with a preceding function that contains the code we want "triggered". To make it a trigger, you would create a new Trigger object specifying the function(s) you want to work with: |
| 11 | |
| 12 | {{{ |
| 13 | function trigName() |
| 14 | { |
| 15 | if(accumulated("food") >= 500) |
| 16 | { |
| 17 | sendchat("this player has 500+ food!"); |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | trigger = new trigger(trigName()); |
| 22 | }}} |
| 23 | |
| 24 | Now, The trigger is registered and recognized by the engine. You, then, have to activate it to make it work. To activate/deactivate triggers, you use the enable and disable methods. For optimization, you can also set a priority for triggers within 4 different levels (1 being default). Priority must be called before enabling it: |
| 25 | |
| 26 | {{{ |
| 27 | trigger.priority(4); |
| 28 | trigger.enable; |
| 29 | trigger.disable; |
| 30 | }}} |
| 31 | |
| 32 | Additionally, you may want to group functions for easy modification and work with them as you would with one. So, you can create a trigger group like this: |
| 33 | |
| 34 | {{{ |
| 35 | trigger = new trigger(trigName(), trigFoo(), trigBar()); |
| 36 | }}} |
| 37 | |
| 38 | == Trigger Reference == |
| 39 | |
| 40 | === Conditions: === |
| 41 | |
| 42 | {{{ |
| 43 | trigAISignal(ai, signal); |
| 44 | trigCinematicAbort(); |
| 45 | trigAccumulated(player, attr); |
| 46 | trigUnitsAllDead(); |
| 47 | trigBuildingsAllDead(); |
| 48 | trigBringObjectToArea(); // Waiting for Bobby to define this |
| 49 | trigBringObjectToObject(); // Waiting for Bobby to define this |
| 50 | trigCheatEntered(string); |
| 51 | trigChatContains(string); |
| 52 | trigChatChoiceAnswer(string); |
| 53 | trigChance(int); |
| 54 | trigObjectDestroyed(object); |
| 55 | trigDifficulty(); |
| 56 | trigDiplomacyChange(source, target, type = all); |
| 57 | trigDistanceToPoint(object, point, radius); |
| 58 | trigDistanceToObject(source, target, radius); |
| 59 | trigPercentComplete(object); |
| 60 | trigPercentDamaged(object); |
| 61 | trigLogCompare(); // what is this? |
| 62 | trigLogCheck(); // what is this? |
| 63 | trigVarCompare(); // what is this? |
| 64 | trigVarCheck(); // what is this? |
| 65 | trigObjectInteracted(); // how is this used? |
| 66 | trigObjectActive(object); |
| 67 | trigObjectDead(object); |
| 68 | trigObjectChanged(object); |
| 69 | trigObjectVisible(player, object, amount); |
| 70 | trigObjectsInArea(object, area); |
| 71 | trigObjectOwned(player, object); |
| 72 | trigObjectCaptured(player, object); |
| 73 | trigObjectSelected(player, object); |
| 74 | trigObjectTypeSelected(player, type); |
| 75 | trigObjectGarrisoned(object, type, amount); |
| 76 | trigPlayerActive(player); |
| 77 | trigPlayerAtPop(player); |
| 78 | trigPlayerDefeated(player); |
| 79 | trigPlayerDistanceToPoint(player, point, radius); |
| 80 | trigPlayerDistanceToObject(player, target, radius); |
| 81 | trigPlayerIsBuilding(player, type); |
| 82 | trigPlayerResigned(player); |
| 83 | trigPlayerUnitCount(player, type); |
| 84 | trigTechResearch(player, tech); |
| 85 | trigTechResearched(player, tech); |
| 86 | trigTechResearching(player, tech); |
| 87 | trigTimer(ms); |
| 88 | }}} |
| 89 | |
| 90 | === Effects: === |
| 91 | |
| 92 | {{{ |
| 93 | trigAIScriptGoal(); // details here |
| 94 | trigCampaignAdvance(); |
| 95 | trigCampaignNext(); |
| 96 | trigAreaStringChange(); |
| 97 | trigHeroChange(); |
| 98 | trigBlockAllAmbient(); |
| 99 | trigBlockAllMusic(); |
| 100 | trigBlockAllSounds(); |
| 101 | trigCameraCut(); |
| 102 | trigCameraTrack(); |
| 103 | trigChangeDiplomacy(); |
| 104 | trigChangeElevation(); |
| 105 | trigChangeOwnership(); |
| 106 | trigChangeTerrain(); |
| 107 | trigChangeView(); |
| 108 | trigCheats(); |
| 109 | trigChat(); |
| 110 | trigCinematicMode(); |
| 111 | trigChatClear(); |
| 112 | trigUIClear(); |
| 113 | trigCounterValueAdd(); |
| 114 | trigCounterStop(); |
| 115 | trigCounter(); //isn't this a condition just like timer? |
| 116 | trigCounterClear(); |
| 117 | trigWaterCreate(); |
| 118 | trigDeclareVictory(); |
| 119 | trigDisplayInstructions(); |
| 120 | trigEndGame(); |
| 121 | trigUnitEnable(); |
| 122 | trigFadeToColor(); |
| 123 | trigFadeOutSounds(); |
| 124 | trigFadeOutMusic(); |
| 125 | trigMinimapFlare(); |
| 126 | trigUIFlash(); |
| 127 | trigUIFlashCategory(); |
| 128 | trigUIFlashTech(); |
| 129 | trigUIFlashTrain(); |
| 130 | trigFlashObjects(); |
| 131 | trigMinimapFlashObjects(); |
| 132 | trigGameSpeed(); |
| 133 | trigMainMenu(); |
| 134 | trigGroupChange(); |
| 135 | trigGrantResources(); |
| 136 | trigHealUnit(); |
| 137 | trigHideScore(); |
| 138 | trigHighlightUnits(); |
| 139 | trigKillObject(); |
| 140 | trigKillObjectsInArea(); |
| 141 | trigLockAllGates(); |
| 142 | trigLockGate(); |
| 143 | trigLog(); |
| 144 | trigLogChange(); |
| 145 | trigModifyObject(); |
| 146 | trigModifyObjectAbility(); |
| 147 | trigModifyObjectIcon(); |
| 148 | trigModifyObjectName(); |
| 149 | trigModifyResourceValue(); |
| 150 | trigMoveObjectToArea(); |
| 151 | trigMusicFilename(); |
| 152 | trigMusicMood(); |
| 153 | trigMusicPlay(); |
| 154 | trigMusicStop(); |
| 155 | trigObjectAnimation(); |
| 156 | trigObjectChangeType(); |
| 157 | trigObjectCreate(); |
| 158 | trigObjectDamage(); |
| 159 | trigObjectDamageInArea(); |
| 160 | // cheezy's did you check with them to see if this was possible? maybe load them at start |
| 161 | // and do a switch type thing? |
| 162 | trigObjectFileLoad(); |
| 163 | trigObjectFreeze(); |
| 164 | trigObjectHeading(); |
| 165 | trigObjectInAreaMove(); |
| 166 | trigObjectScale(); |
| 167 | trigObjectStop(); |
| 168 | trigObjectTask(); |
| 169 | trigPatrol(); |
| 170 | trigGamePause(); |
| 171 | trigObjectiveWindowPause(); |
| 172 | // kinda redundant, why not just make conditions to check if they are open, then do game pause? |
| 173 | trigPhaseUpgradePause(); |
| 174 | trigPlaceFoundation(); |
| 175 | trigPlayDialogue(); |
| 176 | trigPlayDialogueChoice(); |
| 177 | trigPlayRPGDialogue(); |
| 178 | trigPlayMovie(); |
| 179 | trigPlaySound(); |
| 180 | trigPlayerDestroyAllBuildings(); |
| 181 | trigPlayerDestroyAllUnits(); |
| 182 | trigPlayerLOSChange(); |
| 183 | trigPlayerSetActive(); |
| 184 | trigPlayNextMusicTrack(); |
| 185 | trigRateConstruction(); |
| 186 | trigRateResearch(); |
| 187 | trigRateTraining(); |
| 188 | trigRateReset(); |
| 189 | trigDataLog(); |
| 190 | trigRemoveMiniMap(); |
| 191 | trigRemoveObject(); |
| 192 | trigRemoveObjectsInArea(); |
| 193 | trigRenderFog(); |
| 194 | trigRenderRain(); |
| 195 | trigRenderSky(); |
| 196 | trigRenderSnow(); |
| 197 | trigReshroud(); |
| 198 | trigRevealMap(); |
| 199 | trigChatSend(); |
| 200 | trigChatSendChoice(); |
| 201 | trigSetPlaylist(); |
| 202 | trigSetLighting(); |
| 203 | trigSetObjective(); |
| 204 | trigSetHint(); |
| 205 | trigDefeatPlayer(); |
| 206 | trigPlayerWon(); |
| 207 | trigUnitOutlines(); |
| 208 | trigUnitScramble(); |
| 209 | trigShakeCamera(); |
| 210 | trigSoundFilename(); |
| 211 | trigSoundPause(); |
| 212 | trigScrambleStop(); |
| 213 | trigTechStatus(); |
| 214 | trigTeleportUnits(); |
| 215 | trigToggleView(); |
| 216 | trigToggleTerritories(); |
| 217 | trigTransferResources(); |
| 218 | trigTributeResources(); |
| 219 | trigUnblockAllAmbient(); |
| 220 | trigUnblockAllSounds(); |
| 221 | trigUnblockMusic(); |
| 222 | trigUnfreezeUnit(); |
| 223 | trigUnload(); |
| 224 | trigUnlockGate(); |
| 225 | trigUnitBuildBuilding(); |
| 226 | trigUnitGarrison(); |
| 227 | trigUnitWork(); |
| 228 | trigUserControls(); |
| 229 | trigWinMessageSet(); |
| 230 | trigLossMessageSet(); |
| 231 | trigWriteToLog(); |
| 232 | trigYouLose(); |
| 233 | trigYouWin(); |
| 234 | }}} |