Skip to content

Posts from Help with a map.

No ratings yet — be the first to rate!
User Avatar
8 years ago
Auto-translated
I have a problem with a map.
I need to know how to:
1) Make something happen relative to the player's coordinates.
2) Change the computer player's name (something like this: Red Player > Knight).
3) Create my own spell (not in battle, but during a turn).
4) Make all scripts work in multiplayer.
User Avatar
8 years ago
Auto-translated
1) Make something happen relative to the player's coordinates.
You can get the coordinates of any object using the GetObjectPosition() function and use them as a basis.
2) Change the computer player's name (something like this: Red Player > Knight).
This can only be done through a mod. Look for the words and phrases you need in the game's resources, create similar files within your map with the same relative paths, and edit the names in them. (This task is not trivial in some cases).
3) Create your own spell (not in battle, but during a turn).
There are 4 slots for custom spells that can be used outside of battle; the first 2 are used by some hero specializations in the Campaigns, and 3-4 are completely free (they don't even have icons). As an example, for the 3rd:
ControlHeroCustomAbility(HERO_NAME, CUSTOM_ABILITY_3, CUSTOM_ABILITY_ENABLED);
SetTrigger(CUSTOM_ABILITY_TRIGGER, 'CustomAbilityHandler');

function CustomAbilityHandler(player_hero, id)
if(id == CUSTOM_ABILITY_3) then
YOUR CODE
end
end
User Avatar
8 years ago
Auto-translated
There's a question about why the line `SetAmbient...` isn't working here. Although the line `print("OK2")` works, and everything is visible in the console, the lighting doesn't change. What should I do? function EndRain()
if GetDate(3) ==2 then
print("OK");
SetAmbientLight(GROUND, 'TombYard', nil);
print("OK2");
end
end

Trigger(NEW_DAY_TRIGGER, "EndRain");
However, when I write something nonsensical in the parameters of `SetAmbient...`, it outputs an ERROR
Ideally, I would like an example script
User Avatar
8 years ago
Auto-translated
DarkLordax, the entire script consists of one function, and it seems to be written correctly. Is the 'TombYard' lighting definitely added to Map Properties Tree -> GroundAmbientLight?

I did it as shown in the screenshots, and after that, the function works normally:
SetAmbientLight(GROUND, ‘my_ambient’);
Attachments 2
2 files attached • Total size: 10.2 KB
User Avatar
8 years ago
Auto-translated
As I understand it, I have something different. In my case, even the editor doesn't recognize this lighting. The lighting is there, but the name is completely off the charts (MapProperties). And if you look in the tree, it's there – some kind of phantom file for the lighting.

Statistics

Welcome our newest member: recijeb

Users Online 3 users 1313 guests