Page 1 of 1

Conditional events

Posted: Wed Dec 30, 2020 11:41 pm
by beatusille
Hello!

I resumed the work in my little proyect and would like to know if there is some easy way to create conditional events, like if some squad reach some tile in the scenario, a message appears, or if somebody get killed, reinforcements appear.

If it needs some prgramming, I fear, I will not be able to do it myself.

I am happy about any answers!

Re: Conditional events

Posted: Thu Dec 31, 2020 5:57 pm
by A_Wal_
You can get reinforcements to spawn in on a set turn just using the editor but I think calling them with a trigger square needs to be scripted. Just look at how the game does it and then try to adapt it to what you want to do. I just looked and it would be something like...

Code: Select all

include "Functions.BSF"
include "tools.BSF"
include "ScenarioTools.BSF"

int hasSpawned;

FUNCTION Tick(side)
{
int i;
int id;
int unit;

	for(i=0; i<GetUnitCount(0); i++)
	{
		id = GetUnitID(0, i);
		if (GetUnitActive(id) == 1 && hasSpawned != 1)
		{
			if (GetUnitX(id) == GetAIPointX(??) && GetUnitY(id) == GetAIPointY(??))
			{
				unit = TeleportOrkSquad(??, ??, 0, 0, 0, "DEFFDRED");
				unit = TeleportOrkSquad(??, ??, 0, 0, 0, "KRUMPA");	
				unit = TeleportOrkSquad(??, ??, 0, 0, 0, "NOBZ_SKORCHA");	
				unit = TeleportOrkSquad(??, ??, 0, 0, 0, "MORKANAUT");	
				unit = TeleportOrkSquad(??, ??, 0, 0, 0, "NOBZ_SLUGGA");	
				unit = TeleportOrkSquad(??, ??, 0, 0, 0, "BATTLEWAGONKANNON");	
				unit = TeleportOrkSquad(??, ??, 0, 0, 0, "FLASH_GITZ");	
				AddVizCamCenter(GetUnitX(unit), GetUnitY(unit));
				hasSpawned = 1;
			}
		}
	}
}
The first two ??s will be the victory point that actives the spawn and the others would be the x and y grid positions you want that unit to spawn in on.
Go into C:\Program Files (x86)\Steam\steamapps\common\Warhammer 40000 Sanctus Reach\Data\scripts and copy any file into C:\Users\user\Documents\My Games\SANCTUS\MULTIPLAYER\your campaign folder name\SCENARIOS and rename the new file to the exact same name as your map file that's in this folder, then delete everything in the file and replace it with this script. Not sure it will work but it will get you started if you want to experiment, just keep checking back to how the game's scripts do it.

This would be if Mogrok dies.

Code: Select all

include "Functions.BSF"
include "tools.BSF"
include "ScenarioTools.BSF"

int hasSpawned;

FUNCTION Tick(side)
{
int i;
int id;
int unit;

	for(i=0; i<GetUnitCount(0); i++)
	{
		id = GetUnitID(0, i);
		if (IsUnitType(id, "Mogrok") == 1)
		{
			if (GetUnitDead(id) == 1 && hasSpawned != 1)
			{
				unit = TeleportOrkSquad(??, ??, 0, 0, 0, "DEFFDRED");
				unit = TeleportOrkSquad(??, ??, 0, 0, 0, "KRUMPA");	
				unit = TeleportOrkSquad(??, ??, 0, 0, 0, "NOBZ_SKORCHA");	
				unit = TeleportOrkSquad(??, ??, 0, 0, 0, "MORKANAUT");	
				unit = TeleportOrkSquad(??, ??, 0, 0, 0, "NOBZ_SLUGGA");	
				unit = TeleportOrkSquad(??, ??, 0, 0, 0, "BATTLEWAGONKANNON");	
				unit = TeleportOrkSquad(??, ??, 0, 0, 0, "FLASH_GITZ");	
				AddVizCamCenter(GetUnitX(unit), GetUnitY(unit));
				hasSpawned = 1;
			}
		}
	}
}

Re: Conditional events

Posted: Thu Dec 31, 2020 5:58 pm
by pipfromslitherine
You can do anything like this fairly simply, though it does require you to script the events in the scripting language. Unfortunately Sanctus was not set up to be as mod friendly as it might have been - the best initial approach might be to copy an existing campaign and tinker with the scripts in that.

Here is some very basic info on how to set that up.

http://gamewiki.slitherine.com/doku.php?id=stub_engine

Cheers

Pip

Re: Conditional events

Posted: Fri Jan 01, 2021 11:11 pm
by beatusille
Thak you to both of you for your answers!

Re: Conditional events

Posted: Thu Jan 07, 2021 3:40 pm
by beatusille
Hi again!

With your help, I think I am really getting it, but I am still trying to understand some things. After exploring the script commands list, I could not indentify wich one can I use to make appear a pop up text. What I would like to get is the same structure of the reinforcements texts: a big text appears, and the battle is interrupted until the player clicks the confirmation sign. Is is possible?

Thank you for your patience...

:oops:

Re: Conditional events

Posted: Thu Jan 07, 2021 5:19 pm
by pipfromslitherine
You would use the ShowUIScreen command - all the script commands are documented in the Documents/My Games/SANCTUS/Autodocs/BattleScript.txt file. You can also use Notepad++ to search on (e.g.) ShowUIScreen to see how the game itself uses it. This can show any UI screen (including ones you create yourself in your campaign).

You can also use ShowConfirm if you are OK with a simpler popup.

Cheers

Pip