Skip to content

Posts from Enter the town menu via a script.

No ratings yet — be the first to rate!
User Avatar
Auto-translated

I had a question: is it possible to create a script that allows a hero to access the menu of a specific town? In this case, the town itself wouldn't exist as an object on the map at all; under certain scenario conditions, the hero would be able to enter it through a script, and also attack it through a script, meaning that an arena with a town siege would be launched. I know for sure that it's possible to launch a siege of a town that doesn't exist on the map through a script (the town exists only as a file within the map itself, for example, in the "Hope of Zephyr" mission), but is it possible to access the menu of such a town? And use it like a regular town?

Please share any ideas you might have, or if anyone has tried something similar or encountered this before.

User Avatar
Auto-translated
Hmm, I think it can be implemented using workarounds. You need to hide the town in an inaccessible and unexplored area, and then create a script like this:
MakeHeroInteractWithObject(hero, "Town") -- Use this for interacting with the town

function ResetOwner(hero, obj, old, new)
  SetObjectOwner(obj, 0) -- Set the town's owner to neutral, as MakeHeroInteract will simulate capturing the town
end

Trigger(OBJECT_CAPTURE_TRIGGER, "Town", "ResetOwner")

I haven't tried this implementation, but it would be interesting to see if it works.

С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________
User Avatar
Auto-translated
Author
an unattainable and unexplored area
I wonder if it's possible to assign it some impossible coordinates, like -1000, -1000, so that it's completely impossible to see, even with the map fully revealed...
 

К А
Стикеры GBF в Telegram
In reply to Ment
User Avatar
Auto-translated
Ment
I wonder if it's possible to set some impossible coordinates for him, like -1000, -1000, so that he wouldn't be able to be seen at all, even with the map fully revealed...
Yes, you can 🙂

However, no testing has been done, and it might lead to some crashes. The developers probably didn't pay much attention to extreme cases: for example, when the special cursor mode with terrain recognition tooltip is enabled, moving the cursor outside the map leads to an immediate crash and window closure biggrin
С уважением, }{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
Hmm, I think it can be implemented using workarounds. You need to hide the town in an inaccessible and unexplored area, and then create a script like this:
MakeHeroInteractWithObject(hero, "Town") --Use this for interacting with the town

function ResetOwner(hero, obj, old, new)
SetObjectOwner(obj, 0) --Sets the town's owner to neutral, as MakeHeroInteract will simulate capturing the town
end

Trigger(OBJECT_CAPTURE_TRIGGER, "Town", "ResetOwner")

I haven't tried this implementation, it will be interesting to see if it works.


Interesting idea, I'll try it.

Statistics

Welcome our newest member: Emil