Jump to content
Sign in to follow this  
soloooy0

script

Recommended Posts

  "TriggerScripts": [
    "scripts/TriggerHelper.js",
    "skirmishes/YourTrigger.js", <-- this includes script to your map, path is relative to public/maps
  ],

In the script file, for example "YourTrigger.js" there need to be following section

{
	let cmpTrigger = Engine.QueryInterface(SYSTEM_ENTITY, IID_Trigger);
	cmpTrigger.DoAfterDelay(time, "nameOfFunction", {/*parameters*/}); <- if you want to trigger function with time delay
	cmpTrigger.RegisterTrigger("OnInitGame", "InitFunction", { "enabled": true }) <- I would prefer this one
}

In InitFunction you can bind more triggers

You define any function in your trigger file with Trigger.prototype.nameOfFunction

Trigger.prototype.InitFunction = function()
{
	this.RegisterTrigger("OnOwnershipChanged", "MyOwnershipChange", { "enabled": true }); <- bind to whatever On event
	// or call any custom function in Trigger
}

To give commands to entities use ProcessCommand function

ProcessCommand(playerID, anyCommandInJsonForm);

It is good to look into TriggerHelper file to see defined functions you can already use.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...