Auto-translated
What I mean is, should this SetObjective be implemented as a separate function, or can it be included in this one?
New here? I'm Roha — want a quick tour?
What I mean is, should this SetObjective be implemented as a separate function, or can it be included in this one?
str = 'function(parameter)'
...
Trigger(OBJECT_TOUCH_TRIGGER, 'object name', 'parse(str)')
Trigger(OBJECT_TOUCH_TRIGGER, "monum1", "monumtext");
Trigger(OBJECT_TOUCH_TRIGGER, "monum2", "monumtext");
Trigger(OBJECT_TOUCH_TRIGGER, "monum3", "monumtext");
Trigger(OBJECT_TOUCH_TRIGGER, "monum4", "monumtext");
function monumtext (hero, obj)
if obj == 'monum1' then
MessageBox(mpath.. 'monum1.txt');
elseif obj == 'monum2' then
MessageBox(mpath.. 'monum2.txt');
elseif obj == 'monum3' then
MessageBox(mpath.. 'monum3.txt');
elseif obj == 'monum4' then
MessageBox(mpath.. 'monum4.txt');
end;
end;
The object_touch trigger always passes 2 parameters to the function (it doesn't matter if you use them or not): the name of the hero who touched the object and the name of the object that was touched. Therefore, you should write Trigger(OBJECT_TOUCH_TRIGGER, 'object name', 'function'), without any parameters in the parentheses.
function SuppGlutt()
SetObjectiveState("Qnecro", OBJECTIVE_COMPLETED);
RemoveObject("Isher");
SetObjectOwner("gorodZemlya", 1);
ChangeHeroStat("RedHeavenHero04", STAT_EXPERIENCE, 15000);
ChangeHeroStat("RedHeavenHero04", STAT_MORALE, 1);
ChangeHeroStat("RedHeavenHero04", STAT_LUCK, 1);
Trigger(PLAYER_REMOVE_HERO_TRIGGER, "Straker", nil);
end;
Trigger(PLAYER_REMOVE_HERO_TRIGGER, "Straker", "SuppGlutt");
Trigger(PLAYER_REMOVE_HERO_TRIGGER, player number, 'function to which the names of the lost hero and its victor (or nil) will be passed')function SuppGlutt (looser, winner)
if(looser == "Straker") then
SetObjectiveState("Qnecro", OBJECTIVE_COMPLETED);
RemoveObject("Isher");
SetObjectOwner("gorodZemlya", 1);
ChangeHeroStat("RedHeavenHero04", STAT_EXPERIENCE, 15000);
ChangeHeroStat("RedHeavenHero04", STAT_MORALE, 1);
ChangeHeroStat("RedHeavenHero04", STAT_LUCK, 1);
Trigger (PLAYER_REMOVE_HERO_TRIGGER, number, nil);
end;
end;
Trigger (PLAYER_REMOVE_HERO_TRIGGER, player number to which the desired hero belongs, "SuppGlutt")
Question about threads. I don't know much about them, but I think I need them here, so I'm asking for help.
There are several special neutral creatures. After they are destroyed, a trigger should activate (probably), and a reserve hero should appear.
How is this implemented?
function fun()
while (1) do
sleep(2);
if (Exists('neutral1') == nil) and (Exists('neutral2') == nil) then
fun2();
break
end;
end;
end;
startThread(fun);
And a second question, not about threads: can one trigger activate multiple functions? How do I write this?
For example, will a trigger like this work - Trigger(REGION_ENTER_AND_STOP_TRIGGER , "dialog", "Dialog1", "function2", "function3", "function228"); ?
Trigger(REGION_ENTER_AND_STOP_TRIGGER , "dialog", "Dialog1")
function Dialog1 ()
...
function2();
end;
function function2 ()
...
function3();
end;
and so on.
Perhaps there is a way to do it; I would launch them in a chain:
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "dialog", "Dialog1")
function Dialog1()
function1();
function2();
function3();
end
If anyone knows, could you please tell me how to transfer the hero's level to a combat script:confused: :
function start()
if the attacker's hero level >=1
cast one spell
if the attacker's hero level >=10
cast one spell
if the attacker's hero level >=20
cast one spell
end:rolleyes:
x = GetHeroLevel('name of the hero')
SetGameVar('Level', x)function Start()
HeroLevel = GetGameVar('Level') + 0
if(HeroLevel >= 1) then
... and so on.
function cherti ()
while (1) do
sleep(2);
if (Exists('chert1') == nil) and (Exists('chert2') == nil) and (Exists('chert3') == nil) and (Exists('chert4') == nil) and (Exists('chert5') == nil) and (Exists('chert6') == nil) and (Exists('chert7') == nil) and (Exists('chert8') == nil) then
Quelaag ();
break
end;
end;
end;
startThread("cherti");
function Quelaag ()
DeployReserveHero( "Oddrema", 60, 36, GROUND );
end;
But after all the "cherti" are destroyed, nothing happens. Can you tell me where the error is?
Added 23 minutes later
And another question. Is it possible to create a hidden connection between quests? I'll try to come up with a simple example:
Quest - destroy an enemy hero.
Secondary quest - destroy a neutral creature.
When you approach the enemy hero, dialogue #1 plays, but if you have destroyed the neutral creatures, dialogue #2 will play.
Also, if you simply fight the enemy hero, his army will have 5 phoenixes.
But if you defeat the neutral creatures, he will have 250 wolves and some artifact will be found.
Is it possible to implement something like this?