Conditional events

Post Reply
beatusille
Lance Corporal - Panzer IA
Lance Corporal - Panzer IA
Posts: 11
Joined: Thu Oct 15, 2020 8:06 am

Conditional events

Post by beatusille » Wed Dec 30, 2020 11:41 pm

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!

A_Wal_
Corporal - 5 cm Pak 38
Corporal - 5 cm Pak 38
Posts: 38
Joined: Tue Jul 30, 2019 5:22 pm

Re: Conditional events

Post by A_Wal_ » Thu Dec 31, 2020 5:57 pm

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;
			}
		}
	}
}

pipfromslitherine
Site Admin
Site Admin
Posts: 9299
Joined: Wed Mar 23, 2005 10:35 pm

Re: Conditional events

Post by pipfromslitherine » Thu Dec 31, 2020 5:58 pm

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
follow me on Twitter here

beatusille
Lance Corporal - Panzer IA
Lance Corporal - Panzer IA
Posts: 11
Joined: Thu Oct 15, 2020 8:06 am

Re: Conditional events

Post by beatusille » Fri Jan 01, 2021 11:11 pm

Thak you to both of you for your answers!

beatusille
Lance Corporal - Panzer IA
Lance Corporal - Panzer IA
Posts: 11
Joined: Thu Oct 15, 2020 8:06 am

Re: Conditional events

Post by beatusille » Thu Jan 07, 2021 3:40 pm

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:

pipfromslitherine
Site Admin
Site Admin
Posts: 9299
Joined: Wed Mar 23, 2005 10:35 pm

Re: Conditional events

Post by pipfromslitherine » Thu Jan 07, 2021 5:19 pm

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
follow me on Twitter here

Post Reply

Return to “Sanctus Reach Mods and Scenario Design”