Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
oncreatetriggers [2016/10/18 23:22]
benw11
oncreatetriggers [2017/05/24 14:27] (current)
Line 67: Line 67:
 end; end;
 </​code>​ </​code>​
 +
 +I will now start explaining the function that are important to this tut
 +<​code>​
 +function triggerBase.onCreate(id)
 +    local instance = triggerBase:​new(g_server ~= nil, g_client ~= nil);
 + if instance:​load(id) then
 + g_currentMission:​addOnCreateLoadedObject(instance);​
 + instance:​register(true);​
 + else
 + instance:​delete();​
 + end;
 +end;
 +g_onCreateUtil.addOnCreateFunction("​customCallScript",​ triggerBase.onCreate);​
 +</​code>​
 +
 +This part is the most important part in the whole script, why you ask? how far would you get without any gas in your car? that is how important it is.
 +The part that makes the callback you need for your map is this line
 +
 +<​code>​
 +g_onCreateUtil.addOnCreateFunction("​customCallScript",​ triggerBase.onCreate);​
 +</​code>​
 +
 +this is the full scriptCallBack that you need to write in the trigger
 +modOnCreate.customCallScript
 +
 +"​customCallScript"​ can/must be changed when you make your script as it could conflict if there are other callbacks with the same name, same for triggerBase class.
 +
 +Thats it for the basic scriptCallback.
  
  
 ---- ----
  
-Original Author:  ​XX | Date:  XX+Original Author:  ​Xentro ​| Date:   May 12, 2013
         ​         ​
 [[modding_tutorials|Modding Index]] | [[miscellaneous_modding|Misc. Modding Tutorials]] [[modding_tutorials|Modding Index]] | [[miscellaneous_modding|Misc. Modding Tutorials]]