Home » FULL CONTROL GAMES » #JAFDEV Story/Level Design » LUA Scripting Reference
LUA Scripting Reference[message #338430] Fri, 19 December 2014 01:00 Go to next message
Shanga

 
Messages:3549
Registered:January 2000
Location: Danubia
Full Lua scripting reference here:
https://dl.dropboxusercontent.com/u/2994227/JAFTXLuaScriptingReference.pdf

Quote:
Strategic Layer

void strategic.UnlockSector(string sectorID)
Example: strategic.UnlockSector(

[Updated on: Fri, 19 December 2014 01:18] by Moderator



Re: LUA Scripting Reference[message #338431] Fri, 19 December 2014 01:01 Go to previous messageGo to next message
Shanga

 
Messages:3549
Registered:January 2000
Location: Danubia
Ingame Quest Functions

A compendium of all the quest functions we have in JAF
(because seeing them in action makes them easier to understand)

Remove item from inventory?
"UserScript": "tactical.RemoveAsset('door_security_keypad_635484673627415808')",


Check quests state
"ConditionsString": "quest.GetQuestState('Q_helicoptercrash') == 'Active'",


Check NPC interaction
 "UserScript": "memory.Set('FreddyB', 'Talked')",


"ConditionsString": "memory.Get('TioUrban') == 'Clear' and memory.Get('FreddyB') ~= 'Talked'",


Check quest state
"ConditionsString": "quest.GetQuestState('Q_EveryDayImSmuggling') == 'New'",


Add item to inventory
"UserScript": "inventory.AddItem('', 'Barret_m82A1_B')",


Check quest specific goal
"ConditionsString": "quest.GetGoalState('Q_WhoGaveMyGirlHerpes', 'G1') == 'Active'",


Start NPC dialogue
"UserScript": "dialog.Start('C_WhoGaveMyGirlHerpes', 'Npc_FredBearpit')",


Check inventory for quest item
"ConditionsString": "inventory.HasItem('','Barret_m82A1_B')",


Set quest as failed
"UserScript": "quest.UpdateQuest('Q_EveryDayImSmuggling', 'Failed')",


Remove quest item, set quest goal as completed, set quest as completed, set Steam achievement as completed
Quote:
"UserScript": "inventory.RemoveItem('', 'Barret_m82A1_B')\r quest.UpdateGoal('Q_EveryDayImSmuggling', 'G1', 'Completed')\r quest.UpdateQuest('Q_EveryDayImSmuggling', 'Completed')\r achievement.TriggerEvent(\"SideDishCompleted\")",


Add money to player
"UserScript": "strategic.AddMoney(7000)",


Spawn quest enemy in the sector
Quote:
"UserScript": "tactical.SpawnNamedEnemy(1722, 'Enemy_Smugglers1', 'East')\r tactical.SpawnNamedEnemy(2351, 'Enemy_Smugglers', 'East')\r tactical.SpawnNamedEnemy(3632, 'Enemy_Smugglers1', 'East')\r tactical.SpawnNamedEnemy(4768, 'Enemy_Smugglers', 'North')\r tactical.SpawnNamedEnemy(1334, 'Enemy_Smugglers1', 'South')",


Check if a sector is clear
"ConditionsString": "memory.Get('Gazorro') ~= 'Clear'",


Remove a rock map asset to reveal a trap-door
Quote:

"ConditionsString": "memory.Get('Trapdoor') ~= 'Found'",
"UserScript": "tactical.RemoveAsset('rock_swamp_10_81_635501920538277046')",


Set an NPC status as "hireable"
"UserScript": "strategic.SetMercHireable('Nadette_Amina')",


Remove and NPC from the sector map
"UserScript": "tactical.RemoveUnit('Npc_Spirit')",


Check if the player's active squad is full
"ConditionsString": "tactical.IsSquadFull() == false\r
",


Check if player has required sum and substract amount
Quote:
"ConditionsString": "strategic.GetMoneyTotal()>838",
"UserScript": "strategic.AddMoney(-839)",


Remove unit as NPC from the map, set unit as hireable, put unit in player's squad
Quote:
"UserScript": "tactical.RemoveUnit('Npc_Spirit')\r tactical.SpawnMerc(6919, 'Nadette_Amina', 'West')\r strategic.SetMercHireable('Nadette_Amina')\r strategic.SetUnitHired(\"Nadette_Amina\", 1)",


Check NPC ID as condition
"ConditionsString": "npcID == 'Npc_PapaRalf'",


Check player's inventory for specific item (beer_01), set a quest goal G1 as complete, open as active goal G2
Quote:
"ConditionsString": "inventory.HasItem('', 'Beer_01')",
"UserScript": "quest.UpdateGoal('Q_ThrowingOutTrash', 'G1', 'Completed')\r quest.UpdateGoal('Q_ThrowingOutTrash', 'G2', 'Active')",


Check if player's unit has specific level of skill, set quest goal G2 complete, open goal G3 as active
Quote:
"ConditionsString": "tactical.GetUnitStat('', 'Intelligence') > 79",
"UserScript": "memory.Set('Chess', 'Won')\r quest.UpdateGoal('Q_ThrowingOutTrash', 'G2', 'Completed')\r quest.UpdateGoal('Q_ThrowingOutTrash', 'G3', 'Active')",


Check player's unit specific skill level
"ConditionsString": "tactical.GetUnitStat('', 'Intelligence') < 80",


Check player's inventory for 2 items, unlock OSIM sectors, set quest status
Quote:
"ConditionsString": "inventory.HasItem('', 'Top_Secret_Folder') and inventory.HasItem('', 'OSIM_Note')",
"UserScript": "strategic.UnlockSector('K12')\r strategic.UnlockSector('K13')\r memory.Set('Tunnel', 'Opened')",


Set NPC status as "spoken", set TestSubject variable as "release" and if sector status is "Free"
Quote:
"ConditionsString": "memory.Get('TheBaronLanshof') ~= 'Spoken' and memory.Get('TestSubject') ~= 'Released' and memory.Get('Osim') == 'Clear'",


Pre-check if squad is full, release TestSubject, set as hireable and add into squad The Baron
Quote:
"ConditionsString": "tactical.IsSquadFull() == false",
"UserScript": "memory.Set('TestSubject', 'Released')\r tactical.RemoveUnit('Npc_RudgarLanshof')\r tactical.SpawnMerc(2339, 'Rudgar_Lanshof', 'North')\r memory.Set('Baron', 'Out')\r strategic.SetMercHireable('Rudgar_Lanshof')\r strategic.SetUnitHired(\"Rudgar_Lanshof\", 14)",



Re: LUA Scripting Reference[message #338432] Fri, 19 December 2014 01:01 Go to previous message
Shanga

 
Messages:3549
Registered:January 2000
Location: Danubia
Notes:

  • You can do checks on items, stats, quest goals
  • You can add money, items, NPC to squad
  • You can change the status of an NPC to hireable
  • You can trigger a story panel or an info text
  • You can enable/disable game objects
  • You can spawn enemy units (named or not) in specific tiles
  • You can teleport squads to a given sector
  • You can lock/unlock sectors
  • You can trigger a dialogue either by entering a zone (area defined in the editor) or by clicking on an NPC

Not clear/not used in game:

tactical.RewardSkillXP(

[Updated on: Fri, 19 December 2014 01:28] by Moderator



Previous Topic: Rebuilding Omerta in JA:F editor
Goto Forum:
  


Current Time: Tue Feb 20 21:20:39 EET 2018

Total time taken to generate the page: 0.00804 seconds