Skip to content

Posts from Scripts

4.8 (8 ratings)
User Avatar
Auto-translated

BlueHeavenHero, I understand... Then, let's rewrite the function like this:

function TownCaptured( oldowner, newowner )
if ( newowner == PLAYER_1 ) and ( GetObjectiveState("prim6") ~= OBJECTIVE_ACTIVE ) then
DeployReserveHero("Christian", 98, 108, 0)
SetObjectiveState("prim5", OBJECTIVE_COMPLETED, 1)
SetObjectiveState("prim6", OBJECTIVE_ACTIVE, 1)
sleep(3)
MoveHero("Christian", 126, 139, -1)
end
if newowner == PLAYER_2 then
SetObjectiveState("prim5", OBJECTIVE_FAILED, 1)
sleep(10)
Loose()
end
end

Trigger( OBJECT_CAPTURE_TRIGGER, "castle", "TownCaptured" );

Using the same logic, we can attach a trigger to the loss of heroes for the player who owns your hero. When a hero is lost, a function will be triggered that checks if the player lost the correct hero, and then a cutscene or something else will be launched if needed.

BlueHeavenHero
By the way, a similar problem arose with another function - a cutscene is launched, then a battle begins, and AFTER the battle, a text message appears. But - the cutscene is launched, and the text message appears BEFORE the battle. How can this be fixed?

If the battle is launched through StartCombat, there is an argument that allows you to launch a function after the battle is over. Write a function with the text that will be launched after the battle and display the text.

User Avatar
Auto-translated
The game won't wait for the hero to reach the point. Let it go – and it's off. You either need to come up with a clever condition to check if the hero has attacked – while CONDITION do sleep() end and then use if statements with videos. Or – launch the battle with a start combat (immediately after MoveHero) and move the video with all the other if statements to a new function, which you specify as a callback for the start combat.
С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________
In reply to Азгалор
User Avatar
Auto-translated
Azgalor

BlueHeavenHero, I understand... Then, let's rewrite the function like this:

function TownCaptured( oldowner, newowner )
if ( newowner == PLAYER_1 ) and ( IsHeroAlive("Christian") ~= true ) then
StartDialogScene("/DialogScenes/FallenKnight/S3/DialogScene.xdb#xpointer(/DialogScene)")
sleep(1)
DeployReserveHero("Christian", 98, 108, 0)
SetObjectiveState("prim5", OBJECTIVE_COMPLETED, 1)
SetObjectiveState("prim6", OBJECTIVE_ACTIVE, 1)
sleep(3)
MoveHero("Christian", 126, 139, -1)
end
if newowner == PLAYER_2 then
SetObjectiveState("prim5", OBJECTIVE_FAILED, 1)
sleep(10)
Loose()
end
end

Trigger( OBJECT_CAPTURE_TRIGGER, "castle", "TownCaptured" );

Using the same logic, we'll attach a trigger to the loss of heroes for the player who owns your hero. When the hero is lost, a function will be launched that checks if the player lost the correct hero, and then a video will play or something else will happen if needed.

If the battle is launched through StartCombat, there is an argument that allows you to launch a function after the battle is over. Write a function with text that will be launched after the battle and display the text.

I fixed everything in the message, but there are problems with the video... It not only plays BEFORE Vittorio's attack, but also SetObjectiveState doesn't work, and this accursed Vittorio doesn't attack!

Мои карты:
Падший рыцарь
Сердце Хаоса

Мои моды:
Визуальные:
Изменение внешнего вида героев-некромантов
Существа-жители и кое-что по мелочи в городах Ордена Порядка, Некрополиса и Инферно

NCF-существа:
Странствующие рыцари
Наемники

In reply to BlueHeavenHero
User Avatar
Auto-translated
BlueHeavenHero
I've fixed the issue with the message, but there are still problems with the video...
Not only does it play BEFORE Vittorio attacks, but SetObjectiveState also doesn't work, and that darn Vittorio doesn't attack!
Oops, I got confused about the video output - I fixed the function from the previous post, as well as the condition checks for spawning, quest completion, and issuing a new quest. Check it in the game and see what the console outputs if the quests still don't update.
In reply to Азгалор
User Avatar
Auto-translated
Azgalor
Oops, I messed up with the video playback – I fixed the function from the previous post, as well as the checks for spawn conditions, quest completion, and new video playback. Check it in the game and see what the console outputs if the quests still don't update.

My apologies for the rather rude message above.
I won't be able to check it right now. I wrote a script to check if Vittorio is still alive, and if not, the video starts playing. But again, I doubt this script will work... frown

Christian = 0 --I write this at the beginning of the script
function ChristianDeath()
if (heroName == "Christian") and Christian ~= 1 then
StartDialogScene("/DialogScenes/FallenKnight/S3/DialogScene.xdb#xpointer(/DialogScene)")
SetObjectiveState("prim5", OBJECTIVE_COMPLETED, 1)
SetObjectiveState("prim6", OBJECTIVE_ACTIVE, 1)
elseif (heroName == "Christian") and Christian == 1 then
print("Did Vittorio capture the Castle?")
end;
end;

Trigger(PLAYER_REMOVE_HERO_TRIGGER, PLAYER_2, "ChristianDeath")

Мои карты:
Падший рыцарь
Сердце Хаоса

Мои моды:
Визуальные:
Изменение внешнего вида героев-некромантов
Существа-жители и кое-что по мелочи в городах Ордена Порядка, Некрополиса и Инферно

NCF-существа:
Странствующие рыцари
Наемники

In reply to BlueHeavenHero
User Avatar
Auto-translated
BlueHeavenHero

My apologies for the rude message above.
I won't be able to check it right now. I wrote a script to check if Vittorio is alive, and if not, a video will play. But again, I doubt this script will work... frown

Christian = 0 --I write this at the beginning of the script
function ChristianDeath()
if (heroName == "Christian") and Christian ~= 1 then
StartDialogScene("/DialogScenes/FallenKnight/S3/DialogScene.xdb#xpointer(/DialogScene)")
SetObjectiveState("prim5", OBJECTIVE_COMPLETED, 1)
SetObjectiveState("prim6", OBJECTIVE_ACTIVE, 1)
elseif (heroName == "Christian") and Christian == 1 then
print("Did Vittorio capture the Castle?")
end;
end;

Trigger(PLAYER_REMOVE_HERO_TRIGGER, PLAYER_2, "ChristianDeath")

 

Correct these lines:

function ChristianDeath( heroName )

and ( Christian ~= 1 ) then

and (Christian == 1 ) then

And yes, your quest will update and another one will be given after defeating the hero, even though you said you needed the quest operation before the battle with him. However, it's your call 😏

In reply to Азгалор
User Avatar
Auto-translated
Azgalor

And yes, your quest will update and a new one will be issued after defeating the hero, although you wrote before that you needed an operation with quests before the battle with him. However, it's your call 😏

Quests, as expected, should appear after Vittorio's death. And thank you for the correction.

Added 11 hours 56 minutes ago
Azgalor
Oops, I got confused about issuing the video - I fixed the function from the previous post, as well as the check for the conditions for spawning, completing the quest, and issuing a new one. Check in the game and see what the console will output if the quests still don't update.
I tested it, everything works. Thank you for your help!

Мои карты:
Падший рыцарь
Сердце Хаоса

Мои моды:
Визуальные:
Изменение внешнего вида героев-некромантов
Существа-жители и кое-что по мелочи в городах Ордена Порядка, Некрополиса и Инферно

NCF-существа:
Странствующие рыцари
Наемники

In reply to BlueHeavenHero
User Avatar
Auto-translated
Hello everyone! I'm having a problem. When I capture the final town, the Final cutscene is activated, and the town itself is destroyed, BUT – the rest of the script doesn't work! ```lua function Final() RazeTown("FinalHaven") sleep(1) StartDialogScene("/DialogScenes/FallenKnight/Final/DialogScene.xdb#xpointer(/DialogScene)")--- after this function, the script stops working! StartCombat("HafadNecro", "MelhiorFinalCombat", 5, 14, 22, 13, 22, 14, 22, 13, 22, 14, 22, "\Maps\SingleMissions\FallenKnight\FinalCombat.xdb#xpointer(\Script)", nil, "\Scenes\CombatArenas\FinalCombat.(AdventureFlybyScene).xdb#xpointer(\AdventureFlybyScene)", nil) StartDialogScene("/DialogScenes/FallenKnight/Outro/DialogScene.xdb#xpointer(/DialogScene)") sleep(3) Win() end; Trigger(OBJECT_CAPTURE_TRIGGER, "FinalHaven", "Final")

Мои карты:
Падший рыцарь
Сердце Хаоса

Мои моды:
Визуальные:
Изменение внешнего вида героев-некромантов
Существа-жители и кое-что по мелочи в городах Ордена Порядка, Некрополиса и Инферно

NCF-существа:
Странствующие рыцари
Наемники

In reply to BlueHeavenHero
User Avatar
Auto-translated
BlueHeavenHero
Hello everyone! I'm having a problem. When I capture the final town, the Final cutscene is activated, and the town itself is destroyed, BUT – the rest of the script doesn't work!
function Final()
RazeTown("FinalHaven")
sleep(1)
StartDialogScene("/DialogScenes/FallenKnight/Final/DialogScene.xdb#xpointer(/DialogScene)")--- after this function, the script stops working!
StartCombat("HafadNecro", "MelhiorFinalCombat", 5, 14, 22, 13, 22, 14, 22, 13, 22, 14, 22, "\Maps\SingleMissions\FallenKnight\FinalCombat.xdb# xpointer(\Script)", nil, "\Scenes\CombatArenas\FinalCombat.(AdventureFlybySc ene).xdb#xpointer(\AdventureFlybyScene)", nil)
StartDialogScene("/DialogScenes/FallenKnight/Outro/DialogScene.xdb#xpointer(/DialogScene)")
sleep(3)
Win()
end;

Trigger(OBJECT_CAPTURE_TRIGGER, "FinalHaven", "Final")
What does the console report?
In reply to Азгалор
User Avatar
Auto-translated
Azgalor
What is the console complaining about?
The console isn't complaining about anything in the scripts.
Attachments 1
1 file attached • Total size: 6.0 KB

Мои карты:
Падший рыцарь
Сердце Хаоса

Мои моды:
Визуальные:
Изменение внешнего вида героев-некромантов
Существа-жители и кое-что по мелочи в городах Ордена Порядка, Некрополиса и Инферно

NCF-существа:
Странствующие рыцари
Наемники

User Avatar
Auto-translated
I think the problem lies in a poorly designed arena for battles: the game launches it, encounters a critical error, and shuts down. I recommend trying to launch a battle on this arena separately and checking for crashes.
С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________
In reply to }{0TT@6bI4
User Avatar
Auto-translated
}{0TT@6bI4
I think the problem lies in the poorly designed arena for the battle: the game launches it, encounters a critical error, and shuts down. I recommend trying to launch the battle on this arena separately and see if there are any crashes.
Now, thanks to Azgalor's help, everything works.

Added 3 hours 25 minutes ago
Hello everyone! I wrote a battle script, tested it, and everything works. But - the AddCreatures function simply adds creatures without any effect, and I would like to add some kind of visual effect for aesthetics. (Important! The SummonCreature function is NOT suitable!)

Мои карты:
Падший рыцарь
Сердце Хаоса

Мои моды:
Визуальные:
Изменение внешнего вида героев-некромантов
Существа-жители и кое-что по мелочи в городах Ордена Порядка, Некрополиса и Инферно

NCF-существа:
Странствующие рыцари
Наемники

In reply to }{0TT@6bI4
User Avatar
Auto-translated
}{0TT@6bI4
This is not possible.
That's too bad :(

Мои карты:
Падший рыцарь
Сердце Хаоса

Мои моды:
Визуальные:
Изменение внешнего вида героев-некромантов
Существа-жители и кое-что по мелочи в городах Ордена Порядка, Некрополиса и Инферно

NCF-существа:
Странствующие рыцари
Наемники

User Avatar
Auto-translated
Hi! I'm facing some difficulties with the following: I need a certain action to be performed every 2 weeks on the first day of the week. Initially, I wrote the following code:
if (GetDate(WEEK) == 2) and (GetDate(DAY_OF_WEEK) == 1) then
However, this triggers the action on the 2nd week of each month, but I need it to work every 2 weeks on the first day of any month.

Statistics

Welcome our newest member: Emil