Connection ErrorBad RequestSession ExpiredSign in requiredForbiddenNot FoundToo Many RequestsServer ErrorBad GatewayService UnavailableGateway TimeoutHTTP Version Not Supported
Session Expired
Your session has expired. Please log in to continue.
Sign in required
You need an account to do that. Sign in or create one — it only takes a minute.
Request Failed
We encountered an issue while processing your request.
Please check your internet connection and try again.
A question arose: there is a created mob with its own characteristics and abilities. Is it possible to edit it, taking into account the selected difficulty level? When loading a map.
Or is it only possible by creating 4 identical mobs with different settings for each of the 4 difficulty levels?
Good afternoon! This script isn't working; it crashes with the error "Attempt to compare nil with number."
HEAL = {}
HEAL.variant = -1
Healing_arts = {{id=176, heal = 50}, {id=177, heal = 10},}
function HEAL.UseHeal(pl, ans)
if not ans then
HEAL.heal_arts_on = {}
for key, art in Healing_arts do
if HasArtefact(MAIN_HERO, art.id) then
table.insert(HEAL.heal_arts_on, art.id)
end
end
HEAL.len = length(HEAL.heal_arts_on)-1
print(HEAL.len, ' - длина массива') --Outputs minus one - the length of the array
sleep()
if 0 < HEAL.len <= 4 then ---THIS IS WHERE THE SCRIPT CRASHES.
print('Проверка') --IS NOT OUTPUT TO THE CONSOLE
HEAL.variant = 1
local pthheal = "Interface/CustomAbilities/UseFirstAidKit/"
local options = {}
local values = {}
while not values and not options do
sleep()
end
for i=1, HEAL.len do
print (HEAL.len)
print('Проверка 2 ', HEAL.heal_arts_on)
options=pthheal..'Use_'..i..'...'
values= artifacts[HEAL.heal_arts_on].name
--
end
while not options[HEAL.len] do
sleep()
end
options[HEAL.len+1]=Talk.BACK
Talk.mode = 1
Talk.NewDialog(GetIconPath('Heal'), pthheal..'Heal', pthheal..'HealDesc', 'HEAL.UseHeal', options, values)
--
-- elseif HEAL.len > 4 then
elseif HEAL.len <= 0 then
print('Ai?oe') ---THIS IS ALSO NOT OUTPUT TO THE CONSOLE
Talk.mode = 1
Talk.NewDialog("/UI/MessageBox/Warning.xdb#xpointer(/Texture)", pthheal.."WarningNoKit", pthheal.."NoKit", nil)
end
elseif ans then
if HEAL.variant == 1 then
if 0<ans<5 then
STALKER.ChangeHealth(artifacts[HEAL.heal_arts_on[ans]].heal)
RemoveArtefact(MAIN_HERO, HEAL.heal_arts_on[ans])
end
end
end
end
This function is called from the spellbook; the first call works fine, but the second call results in an error in the specified location. I don't even know what the problem is, although it's probably related to the scope. But I don't know how to fix it (and, more importantly, what to fix).
if HEAL.len = -1, then the check 0 < heal.len will return nil, which will then be compared to 4, causing an error. It's simpler to write the condition as if heal.len > 0 and HEAL.len <= 4.
function pabota()
SetObjectEnabled("slava", false);
sleep(10);
SetMonsterSelectionType("slava", 0);
PlayObjectAnimation("slava", "attack00", IDLE);
end;
Trigger(NEW_DAY_TRIGGER, "pabota");
The peasants should constantly attack, but they don't. Can you tell me what's wrong?
}{0TT@6bI4
Auto-translated
What a name for your function! It would be better to call it "Peas_working". Regarding the fact that it's not working: did you pass the turn? The "new day" function starts working from the second day. Also, are there any errors in the console?
I thought about it for a long time and finally understood what needs to be done....
But after thinking some more, I realized...
}{0TT@6bI4, thank you very much!
Andrei_21
Auto-translated
Hello. I'm having a problem with this script:
```
function Win()
while 1 do
sleep(10)
if IsHeroAlive("Quroq") == nil then
StartDialogScene("/Maps/SingleMissions/ne5/St3/DialogScene.xdb#xpointer(/DialogScene)");
sleep(10)
StartDialogScene("/Maps/SingleMissions/ne5/St4/DialogScene.xdb#xpointer(/DialogScene)");
sleep(10)
Win();
break;
end;
sleep(3)
end;
end;
startThread(Win);
```
The dialogs are looping (for some reason I don't understand). The Win command isn't working. Can you tell me where I made a mistake?
}{0TT@6bI4
Auto-translated
Here is that snippet: sleep(10) Win();
It restarts the function because you chose the wrong name. Name the function WinCheckLoop and, accordingly, startThread(WinCheckLoop).
Do you know if there are any commands that check for a specific amount of money and then deduct a certain amount?
}{0TT@6bI4
Auto-translated
pl1gold = GetPlayerResource(PLAYER_number, GOLD) SetPlayerResource(PLAYER_number, GOLD, pl1gold - d), where d is the delta. If the player doesn't have that much money, it will return an error.