Scripts: Difference between revisions
Knightlord07 (talk | contribs) No edit summary |
Knightlord07 (talk | contribs) No edit summary |
||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
This tutorial how to make scripts | |||
This | == Introduction == | ||
This is just an introduction part how script work in your custom campaign & scenario work. | |||
Since it's fairly easy to do it, you can go to in-game map editor & you will see an tab called edit script. | |||
There is bunch of options how do you want to make your scripts to turn out. | |||
== Scripts editing == | |||
Now let's start with the stuff in-game script editor have. | |||
* Immediate Start, that will instant start the map | |||
* Start of turns, that will start certain turns | |||
* Victory, that will let the player or opponent win | |||
* Each Days, that will repeat itself per days | |||
* Unit Destroyed, that will target an either player or opponent unit | |||
* Building Destroyed, same as unit destroyed but it's only target building e.g mini cannon & ects | |||
* Terrain Destroyed, same with unit & building that will target terrain only | |||
* Building Capture, capture certain prop | |||
* Player defeated, player or opponent defeated | |||
* Units destroyed, that will count how many unit if the player or opponent defeat | |||
* Building owned, that will count how many building that the player or opponent owned | |||
* Player in area, that will make the player reach a certain location | |||
* Unit in area, same as the player in area but this will target your unit & move toward the certain location | |||
* Check variable, I dunno what that supposed to do? | |||
* Is Selected CO, that will check a certain co you play as | |||
* Gathered Funds, that will check how much funds you hold | |||
Next is the events | |||
* Dialog, create your own dialogues | |||
* Spawn unit, allow you spawn unit | |||
* Defeat Player, that allow you let player defeat how to change the victory condition | |||
* Change Buildlist, allow you to edit the player buildlist | |||
* Add funds, adding more funds to current player, if you want take funds away you have to do it manually | |||
* Change Weather, change certain weather | |||
* Change CO bar, same as funds, if you want take power meter away you have to do it manually | |||
* Modify Terrain, change the layout of the map | |||
* Modify Unit, edit certain unit either with fuel, ammo or HP | |||
* Animation, I dunno what that does? | |||
* Victory Info, allow you to make victory info, there is an easier way to make it by do it manually | |||
* Modify Variable, I dunno what that does either? | |||
* Change unit AI, change unit AI behavior | |||
* Change building owned, change players building ownership, by targeting certain prop (X & Y) | |||
* Change unit owner, same with building own but this is target only unit | |||
* Change player team, swap player team | |||
* Spawn building, spawn prop on the map | |||
* Center map, target location of the map | |||
* Play Sound, play random sfx it only used wav file only | |||
* Building counter fire, I dunno what that does? | |||
* Volcano Fire, allow the volcano target certain location of the map | |||
* Extend Map, expand the battlefield map itself | |||
== Custom NPCs dialogue == | |||
The Custom NPCs is pretty easy once you install them in your mod, but they won't appear in-game script editor so you have to do it manually (by using any program that is accepted JS codes e.g VScode) | |||
Here is an example if you made any custom NPC<syntaxhighlight lang="javascript"> | |||
var dialog13 = GameAnimationFactory.createGameAnimationDialog(map, qsTr("Tuutturu! here is your grand prize Professor Knightlord!"), "CO_MAYURI_NPC", GameEnums.COMood_Happy, "#ff0000"); dialog9.loadBackground(""); // 1 ScriptEventDialogItem //That how you insert custom NPC in your dialogue also DO NOT COPY IT READER! | |||
</syntaxhighlight>If you having trouble putting Custom NPC in your dialogue please visit COW Discord to ask about it. | |||
Also you need to have face & info just in case | |||
== Custom Music == | |||
The Custom music is another feature if you feel like if you want to change the in-game music up with completely new soundtrack up | |||
Here is an example you want to install custom music in<syntaxhighlight lang="javascript"> | |||
audio.clearPlayList(); | |||
audio.addMusic("maps/your map name folder/music/insert your custom music here.mp3"); | |||
audio.playMusic(0); | |||
//That allow you play custom music in during your gameplay | |||
</syntaxhighlight>But you have to do it manually, can't do it in-game script | |||
== Manually edit version == | |||
This is the manually version there will be some stuff, might be easy or hard depend what type you going for | |||
I recommend use any JS program to do this manually. | |||
Victory info<syntaxhighlight lang="javascript"> | |||
this.getVictoryInfo = function(map) // victoryInfo | |||
{ | |||
return qsTr("It's you vs my waifu Sion but this time she enter her vampire form, good luck try to avoid getting bit by her!") | |||
}; // victoryInfo | |||
//This is an example way to make your victory info an easier way, also DO NOT COPY IT READER! | |||
this.getVictoryInfo = function(map) // victoryInfo | |||
{ | |||
return qsTr("") | |||
}; // victoryInfo | |||
//This one is free to use | |||
</syntaxhighlight>Play Sound<syntaxhighlight lang="javascript"> | |||
dialog13.setSound("tutturuu", 1, 0); | |||
//That an example how to use the custom sound, you can do it in-game script | |||
</syntaxhighlight>Alt victory<syntaxhighlight lang="javascript"> | |||
this.victory = function(team, map) | |||
{ | |||
if (team == 0) | |||
{ | |||
campaignScript.changeMusic("maps/your map name folder/music/insert your custom music here.mp3"); | |||
gameScript.victoryDialog(map); | |||
} | |||
if (team == 1) | |||
{ | |||
campaignScript.changeMusic("maps/your map name folder/music/insert your custom music here.mp3"); | |||
gameScript.EnemyvictoryDialog(map); | |||
} | |||
}; | |||
//This an alt victory if you going to add custom achievement or unlockable cos from the shop | |||
</syntaxhighlight> | |||
[[Category:Modding tutorials]] | [[Category:Modding tutorials]] | ||
Latest revision as of 04:43, 21 August 2024
This tutorial how to make scripts
Introduction
This is just an introduction part how script work in your custom campaign & scenario work.
Since it's fairly easy to do it, you can go to in-game map editor & you will see an tab called edit script.
There is bunch of options how do you want to make your scripts to turn out.
Scripts editing
Now let's start with the stuff in-game script editor have.
- Immediate Start, that will instant start the map
- Start of turns, that will start certain turns
- Victory, that will let the player or opponent win
- Each Days, that will repeat itself per days
- Unit Destroyed, that will target an either player or opponent unit
- Building Destroyed, same as unit destroyed but it's only target building e.g mini cannon & ects
- Terrain Destroyed, same with unit & building that will target terrain only
- Building Capture, capture certain prop
- Player defeated, player or opponent defeated
- Units destroyed, that will count how many unit if the player or opponent defeat
- Building owned, that will count how many building that the player or opponent owned
- Player in area, that will make the player reach a certain location
- Unit in area, same as the player in area but this will target your unit & move toward the certain location
- Check variable, I dunno what that supposed to do?
- Is Selected CO, that will check a certain co you play as
- Gathered Funds, that will check how much funds you hold
Next is the events
- Dialog, create your own dialogues
- Spawn unit, allow you spawn unit
- Defeat Player, that allow you let player defeat how to change the victory condition
- Change Buildlist, allow you to edit the player buildlist
- Add funds, adding more funds to current player, if you want take funds away you have to do it manually
- Change Weather, change certain weather
- Change CO bar, same as funds, if you want take power meter away you have to do it manually
- Modify Terrain, change the layout of the map
- Modify Unit, edit certain unit either with fuel, ammo or HP
- Animation, I dunno what that does?
- Victory Info, allow you to make victory info, there is an easier way to make it by do it manually
- Modify Variable, I dunno what that does either?
- Change unit AI, change unit AI behavior
- Change building owned, change players building ownership, by targeting certain prop (X & Y)
- Change unit owner, same with building own but this is target only unit
- Change player team, swap player team
- Spawn building, spawn prop on the map
- Center map, target location of the map
- Play Sound, play random sfx it only used wav file only
- Building counter fire, I dunno what that does?
- Volcano Fire, allow the volcano target certain location of the map
- Extend Map, expand the battlefield map itself
Custom NPCs dialogue
The Custom NPCs is pretty easy once you install them in your mod, but they won't appear in-game script editor so you have to do it manually (by using any program that is accepted JS codes e.g VScode)
Here is an example if you made any custom NPC
var dialog13 = GameAnimationFactory.createGameAnimationDialog(map, qsTr("Tuutturu! here is your grand prize Professor Knightlord!"), "CO_MAYURI_NPC", GameEnums.COMood_Happy, "#ff0000"); dialog9.loadBackground(""); // 1 ScriptEventDialogItem //That how you insert custom NPC in your dialogue also DO NOT COPY IT READER!
If you having trouble putting Custom NPC in your dialogue please visit COW Discord to ask about it.
Also you need to have face & info just in case
Custom Music
The Custom music is another feature if you feel like if you want to change the in-game music up with completely new soundtrack up
Here is an example you want to install custom music in
audio.clearPlayList();
audio.addMusic("maps/your map name folder/music/insert your custom music here.mp3");
audio.playMusic(0);
//That allow you play custom music in during your gameplay
But you have to do it manually, can't do it in-game script
Manually edit version
This is the manually version there will be some stuff, might be easy or hard depend what type you going for
I recommend use any JS program to do this manually.
Victory info
this.getVictoryInfo = function(map) // victoryInfo
{
return qsTr("It's you vs my waifu Sion but this time she enter her vampire form, good luck try to avoid getting bit by her!")
}; // victoryInfo
//This is an example way to make your victory info an easier way, also DO NOT COPY IT READER!
this.getVictoryInfo = function(map) // victoryInfo
{
return qsTr("")
}; // victoryInfo
//This one is free to use
Play Sound
dialog13.setSound("tutturuu", 1, 0);
//That an example how to use the custom sound, you can do it in-game script
Alt victory
this.victory = function(team, map)
{
if (team == 0)
{
campaignScript.changeMusic("maps/your map name folder/music/insert your custom music here.mp3");
gameScript.victoryDialog(map);
}
if (team == 1)
{
campaignScript.changeMusic("maps/your map name folder/music/insert your custom music here.mp3");
gameScript.EnemyvictoryDialog(map);
}
};
//This an alt victory if you going to add custom achievement or unlockable cos from the shop