Skip to content

Posts from Scripts

4.8 (8 ratings)
User Avatar
14 years ago
Auto-translated
function func()
a=a+1;
if a==4 then
MessageBox(message path);
end;
end;
Trigger(HERO_LEVELUP_TRIGGER, hero name, func);
User Avatar
14 years ago
Auto-translated
Yes, it seems that you need to know the name of the hero for whom the quest is intended. Is it possible to modify this script so that it works for a random hero in the player's army?
User Avatar
14 years ago
Auto-translated
function func()
a=a+1;
if a==4 then
MessageBox(path to message);
end;
end;
function adding(hero)
Trigger(HERO_LEVELUP_TRIGGER,hero,"func");
end;
function removing(hero)
Trigger(HERO_LEVELUP_TRIGGER,hero,nil);
end;
Trigger(PLAYER_ADD_HERO_TRIGGER,1,"adding");
Trigger(PLAYER_REMOVE_HERO_TRIGGER,1,"removing");
User Avatar
14 years ago
Auto-translated
Ment, thank you for your help, but your script doesn't work for me; I'll try to adjust it a bit.
User Avatar
14 years ago
Auto-translated
Ment, in multiplayer, how can you force a player to lose if a condition is not met (i.e., ~=true)? ``` function town3exist(townname) while 1 do if IsObjectExists(townname)~=true then Loose(GetPlayerFilter(PLAYER_3)); end; sleep(10); end; end; startThread(town3exist("town3")) ``` Something like this, but it doesn't seem to work.
In reply to Vulpes93
User Avatar
14 years ago
Auto-translated
Oligarch
There is a command called RegionToPoint, but it creates a point region. And I'm not sure if this is what you're looking for.
RegionToPoint returns the coordinates of a region consisting of a single cell.
Out of all six creation functions (CreateArtifact, CreateCaravan, CreateDwelling, CreateMonster, CreateStatic, CreateTreasure), none of them create regions. Unfortunately...:(
User Avatar
14 years ago
Auto-translated
:smile45: Guys, take him on. He's been harassing me in the game :D
Loose(GetPlayerFilter(PLAYER_3));
- this is just a nonsensical jumble of letters...
User Avatar
14 years ago
Auto-translated
Confirmed. Just 3 or PLAYER_3.
User Avatar
14 years ago
Auto-translated
If the town town1 is captured, then the hero Brem must die. Which function would be suitable to remove the hero from the game? Multiplayer map.
In reply to Vulpes93
User Avatar
14 years ago
function killBrem()
Trigger(5,'town1',nil)
RemoveObject('Brem')
end
Trigger(5,'town1','killBrem')
In reply to RedHeavenHero
User Avatar
14 years ago
Auto-translated
RedHeavenHero
function killBrem()
Trigger(5,'town1',nil)
RemoveObject('Brem')
end
Trigger(5,'town1','killBrem')
I thought RemoveObject doesn't work on heroes.
In reply to Vulpes93
User Avatar
14 years ago
Auto-translated
If they are in the town, yes, but in general, it should work.
function killBrem()
    Trigger(5,'town1',nil)
    if GetHeroTown('Brem') then
        SetObjectPosition('Brem',1,1,0)
    end
    RemoveObject('Brem')
end
Trigger(5,'town1','killBrem')
It will work 100%.
In reply to RedHeavenHero
User Avatar
14 years ago
Auto-translated
RedHeavenHero
If they are in the town, then yes, but in general, it should work.
function killBrem()
Trigger(5,'town1',nil)
if GetHeroTown('Brem') then
SetObjectPosition('Brem',1,1,0)
end
RemoveObject('Brem')
end
Trigger(5,'town1','kilBrem')
It will work 100%.

Does the hero's name in quotes need to be written with " or ' – does it matter?
By the way, it won't work)) you forgot the semicolon.
You don't need to worry about whether he is in the town or not.
In reply to Vulpes93
User Avatar
14 years ago
Auto-translated
Doesn't matter.
Sorry, I wrote "kill" with one "l" in the trigger.
It seems like they just put it there anyway. I didn't notice any difference with or without the semicolon. It works the same.
you don't need to worry about whether it's in the city or not
then the first option will work too.
In reply to Vulpes93
User Avatar
14 years ago
Auto-translated
Vulpes93
Does it matter whether you use " or ' for the hero's name in quotes?
It doesn't matter, but you should open and close with the same type of quote. So, something like "Hero'" should not be used.

The RedHeavenHero script should work. (with the subsequent correction, which is described in the post above)

And the ";" is just a tribute to the traditions of another language, or a habit... They are optional here.

Statistics

Welcome our newest member: recijeb