Skip to content

Posts from Scripts

4.8 (8 ratings)
In reply to Heroist
User Avatar
13 years ago
Auto-translated
This is getting too complicated. You need to be a programmer, at the very least. The specializations are hardcoded into the program, which, as far as I can tell, isn't even written in Lua.
User Avatar
13 years ago
Auto-translated
too bad...

okay, but how can I determine if a unit stack has been destroyed directly in battle? Using the `exist` function? Or some other method?

Added 15 minutes later
Update: At least, I found a very interesting folder called RPGstats. You can change almost everything there, including, by the way, some of the hero specializations.
In reply to Heroist
User Avatar
13 years ago
Auto-translated
It seems like that's the way to do it. But there's an alternative: the AttackerCreatureDeath (DefenderCreatureDeath) function is called when a creature dies, with the creature's name as an argument. You only need to write the "body" of the function.
function AttackerCreatureDeath(unit)
...
end
User Avatar
13 years ago
Auto-translated
Aha, that’s how you should have dealt with her. I thought she just killed the monster.
In reply to RedHeavenHero
User Avatar
13 years ago
Auto-translated
RedHeavenHero
This is getting too complicated. You need to be a programmer, at the very least. The specializations are hardcoded into the program, which, as far as I know, isn't even written in Lua.
Lua is a scripting language; the program itself is written in another language, like C++.
User Avatar
13 years ago
Auto-translated
No matter what platform it's on, we currently only have access to the machine code... I wish they would release the source code soon!
User Avatar
13 years ago
Auto-translated
Is there a function that allows you to place a hero in a town or at the town gates from any point on the map?
In reply to Dyrman
User Avatar
13 years ago
Конечно. SetObjectPosition.
In reply to RedHeavenHero
User Avatar
13 years ago
Auto-translated
RedHeavenHero
Sure. SetObjectPosition.
It's based on coordinates. How can I use it to target a town?
In reply to Dyrman
User Avatar
13 years ago
Auto-translated
SetObjectPosition('hero', GetObjectPosition('town'))
and the hero ends up in the town's garrison if it is empty.
In reply to RedHeavenHero
User Avatar
13 years ago
Auto-translated
RedHeavenHero
SetObjectPosition('hero', GetObjectPosition('city'))
I tried it this way, but it doesn't work as needed. Is there another way?

Added 1 minute ago
RedHeavenHero

and the hero ends up in the garrison of the city if it's empty.
It is necessary to teleport through the gates of the enemy city, or into the city itself if it's your city, even from the gate's location.
In reply to Dyrman
User Avatar
13 years ago
Auto-translated
Dyrman
So, I tried this method, but it doesn't work as expected. Is there another way?
And how does it work?

"City garrison"
"The city itself"
"Portal point"
Which of these is which?
In reply to RedHeavenHero
User Avatar
13 years ago
Auto-translated
RedHeavenHero
How does it work?
It doesn't work. And the town should never be empty BEFORE the script runs (that's why it's not suitable).
In reply to Dyrman
User Avatar
13 years ago
Auto-translated
Dyrman
You need to jump into the gates of the enemy city, or into the city itself, if it's your city, even from the gate point.
Then, create an array with the "gate points" at the beginning of the game.
gate_points = {}
function GetGatePoints()
for i, town in GetObjectNamesByType('TOWN') do
for j, hero in GetObjectNamesByType('HERO') do
if IsHeroInTown(hero, town, 1, 0) then
local x, y, z = GetObjectPosition(hero)
gate_points[town]={x, y, z}
end;
end;
end;
end;


Added 6 minutes later
Dyrman
No way. And the city should never be empty BEFORE the script runs (that's why it doesn't work).
You can remove the hero from that city using the same function.
User Avatar
13 years ago
Auto-translated
Here's an example of a specific case: 1) The enemy town is disabled, and the hero is also disabled. 2) Conflux, with the desired parameters set. 3) Enable the hero and the town. 4) Now, a battle needs to be initiated. (The "Make" function doesn't work because it clones the hero in the garrison, even though the hero might not enter the town after capturing it, but instead leave the map – this is a bug). Can the parameters be set before the event triggers? For example: During the conflux with the town, but before entering it? How can you enter the gates if someone is already inside the town?

Statistics

Welcome our newest member: recijeb