Название не придумал
Выполнено 5%
New here? I'm Roha — want a quick tour?
Okay, fine (I'm just too lazy to write everything out, and I'm having some issues with the script on the map).
2) Create a region and change the Priority to something suitable (I haven't tested this!), and you can also set the priority to -1 for other objects.
The result is roughly this:
- Hmm... something in the region, hey you helmet-heads, we have guests.
- OK! Whatever, there's an enemy!
So, what's wrong here!
function pobor1()
if GetObjectiveState("SQ1", 1) ==OBJECTIVE_UNKNOWN then
SetObjectiveState("SQ1", OBJECTIVE_ACTIVE, 1);
MessageBox("Maps/SingleMissions/C1W1/poborQ1.txt", "nothing");
if IsObjectExists("pobornik1") ==false then
if IsObjectExists("pobornik2") ==false then
if IsObjectExists("pobornik3") ==false then
SetObjectiveState("SQ1", OBJECTIVE_COMPLETED, 1);
SetObjectEnabled("dwellquest1", true);
SetObjectOwner("dwellquest1", 1);
Trigger(OBJECT_TOUCH_TRIGGER, "dwellquest1", nil)
end;
end;
end;
elseif GetObjectiveState("SQ1", 1) ==OBJECTIVE_ACTIVE then
if IsObjectExists("pobornik1") ==false then
if IsObjectExists("pobornik2") ==false then
if IsObjectExists("pobornik3") ==false then
MesageBox("Maps/SingleMissions/C1W1/poborEND.txt", "nothing");
SetObjectEnabled("dwellquest1", true);
SetObjectOwner("dwellquest", 1);
SetObjectiveState("SQ1", OBJECTIVE_COMPLETED, 1);
Trigger(OBJECT_TOUCH_TRIGGER, "dwellquest1", nil)
end;
end;
end;
end
end
Trigger(OBJECT_TOUCH_TRIGGER, "dwellquest1", "pobor1")
The almighty console writes ERROR attempt to call a nil value. But where is this nil value!
In short, everything works only if all three enemies (pobornik) are killed before taking the quest; then it will be completed! If you take the quest first, then some nil value pops up!
How can I give a hero the Perfect Necromancy skill?
I mean, give it as a reward for completing a quest, using a script.
Does GiveHeroSkill increase the skill level?
I wouldn't recommend ever using the word "false"! It's unlikely that the issue is related to it, although who knows, but besides the errors in the console, "false" and "true" haven't caused me any other problems.
Added 1 minute ago
Using these two words is fundamentally incorrect. There are "nil," 0, 1, etc. It depends on the scripting command.
Added 52 minutes ago
How can I give a hero the "Perfect Necromancy" skill?
I had this problem: MesageBox(One s)!
function portal(hero)
if GetObjectOwner(hero) == 1 then
if GetObjectiveState("tom") == OBJECTIVE_UNKNOWN then
MessageBox(path.."tom1.txt")
end
if GetObjectiveState("tom") == OBJECTIVE_ACTIVE then
QuestionBox(path.."tom2.txt",'Dragon("'..hero..'")')
end
end
end
Trigger(OBJECT_TOUCH_TRIGGER, "portal","portal")
function Dragon(hero)
local week = ceil(GetDate(DAY) / 7)
sleep(3)
--
StartCombat(hero,nil,3,84, diff * week, 84, diff * week, 84, diff * week,nil,'BattleResult',nil,nil)
end
Everything works fine, but... (see the screenshot)
What could be causing this? I just want the console to be clean and not display an error.
There is a problem: here is the codeEverything works fine, but... (see screenshot)function portal(hero)
if GetObjectOwner(hero) == 1 then
if GetObjectiveState("tom") == OBJECTIVE_UNKNOWN then
MessageBox(path.."tom1.txt")
end
if GetObjectiveState("tom") == OBJECTIVE_ACTIVE then
QuestionBox(path.."tom2.txt",'Dragon("'..hero..'")')
end
end
end
Trigger(OBJECT_TOUCH_TRIGGER, "portal","portal")
function Dragon(hero)
local week = ceil(GetDate(DAY) / 7)
sleep(3)
--
StartCombat(hero,nil,3,84, diff * week, 84, diff * week, 84, diff * week,nil,'BattleResult',nil,nil)
end
What could be causing this? I just want the console to be clean and not display an error.
'Dragon("'..hero..'")()' that is, after calling the Dragon function, the result returned from it will be called, and since the function does not return anything, an error occurs when trying to call nil.QuestionBox(path.."tom2.txt",'Dragon("'..hero..'")--') then the executable code will look like this: 'Dragon("'..hero..'")--()' that is, the extra parentheses will be commented out.
This is due to the callback being called with a parameter. By default, the scripting engine simply adds two parentheses (and parameters, in some cases) to the name and executes the resulting code. If you call the callback with custom parameters, the code to be executed will be something like this:that is, after calling the Dragon function, the result returned from it will be called, and since the function returns nothing, an error occurs when trying to call nil.'Dragon("'..hero..'")()'
It can be fixed by adding two minus signs:then the code to be executed will look like this:QuestionBox(path.."tom2.txt",'Dragon("'..hero..'")--')that is, the extra parentheses will be commented out.'Dragon("'..hero..'")--()'