Skip to content

Posts from Scripts

4.8 (8 ratings)
In reply to Gerter
4 years ago
Auto-translated
Nah, it still casts the spell at level 20.
Maybe there's something extra here?
path = '/'..GetMapDataPath()
main_hero = 'Raelag'
print("The main hero is named");

SetHeroCombatScript('Raelag', path.."CombatScript.xdb#xpointer(/Script)");
print("Combat script started");

LevR = GetHeroLevel('Raelag');
print("LevR is set as a level identifier for Raelag");

function HeroLevelSaveF()
SetGameVar("LevR", ceil(GetHeroLevel('Raelag')));
print("We set that LevR is a Set Game Var");
end

SetGameVar("LevR", 1)
Trigger(HERO_LEVELUP_TRIGGER, "Raelag", "HeroLevelSaveF")

function ProbaF()
if LevR < 20 then
print("level is less than 20");
else
print("level is 20 or more");
end;
end;
Trigger(OBJECT_TOUCH_TRIGGER, "Proba", "ProbaF");
User Avatar
4 years ago
Auto-translated
in combat, change the line `
Level_R = GetGameVar("LevR") + 0
` to `
Level_R = ceil(GetGameVar("LevR") + 0)
`.
Нет войне.
In reply to Gerter
4 years ago
Auto-translated
Changed it. Now it casts boulders, like nothing happened, you parasite!))
And the console says, "if the level is less than 20, then..."
User Avatar
4 years ago
Auto-translated
Well, I rechecked this script variant on my own, and at level 20, as it should, it casts the spells. Are you sure you're leveling up the hero to the required level? Show me the complete script in the map editor.
Нет войне.
In reply to Gerter
4 years ago
Auto-translated
Everything that’s written there, down to the last comma, I already posted above. There’s simply nothing else there; I haven’t even made an introductory video yet. As for the combat script, I put in lightning bolts instead of spheres to avoid rewriting it. His level is definitely twenty; I gave him experience and abilities in the editor, and it’s written on him. I’ll go back to my test map, add the same thing there, and check if he will cast lightning bolts.
In reply to Марта
User Avatar
4 years ago
Auto-translated
Martha

His level is definitely 20th, I gave him experience and abilities in the editor, and it's even written on him.
Here lies the problem. The trigger for increasing the level only works if the level increases during the game itself; if it was set in the editor, it won't happen. Therefore, only this line is triggered:
SetGameVar("LevR", 1)
, which is why the combat script always thinks the hero is at level 1.
Нет войне.
In reply to Gerter
4 years ago
Auto-translated
Ah, darn. So, that's probably what's happening – on my test map, rocks are also falling on him.
So, how do I check if the script is working? Do I have to manually give him level 20 every time?
Or maybe I should change the condition from level 20 to level 2 for now, and then adjust it later if everything works fine...
In reply to Марта
User Avatar
4 years ago
Auto-translated
Martha

So, how can I test if the script works? Do I have to manually level up a hero to level 20 every time?
You can enter @WarpHeroExp('Raelag', 97972) in the console at the start of the map. This will level up the hero to the desired level.
Нет войне.
In reply to Марта
4 years ago
Auto-translated
P.S. Yes, that's exactly how it is. I don't know what will happen with it on level 20, but when the number of levels is changed to 2, it casts lightning spells reliably. Thank you very much; I didn't even know about the experience gain and all these subtleties. Hehe) I've used cheats a lot, but the only thing I've never boosted is experience. If the cheat is accepted, that's a solution, for sure – thanks for the idea.
In reply to Gerter
User Avatar
4 years ago
Auto-translated
Gerter
In the trigger, you need to specify the function that will be executed when the level increases. So, the error here is:
Trigger(HERO_LEVELUP_TRIGGER, "Raelag")
and it should be:
Trigger(HERO_LEVELUP_TRIGGER, "Raelag", "HeroLevelSaveF")
It's my fault; I didn't finish writing it and submitted it.
С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________
In reply to Gerter
User Avatar
4 years ago
Auto-translated
Gerter
This is where the problem lies. The trigger for increasing the level only works if the level increases during the game itself; if it was defined in the editor, it won't happen. Therefore, only this line is triggered:
SetGameVar("LevR", 1)
, which is why the combat script always thinks the hero is at level 1.
You can increase the level with
@for i=1, N do LevelUpHero("HeroName") end, where N is the number of additional levels. Then, there is no need to remember a specific amount of experience for each level.
С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________
In reply to }{0TT@6bI4
4 years ago
Auto-translated
Unfortunately, the cheat didn't work – it wasn't registered. And it's not certain that the script would be registered either. But that's not a problem; I've already checked – I planted a whole grove of knowledge trees and used the teleport cheat to jump from one to another.
Everything works. Thank you both very much.
User Avatar
4 years ago
Auto-translated
WarpHeroExp simply sets the hero's experience points, without granting skills/stats, so this function is obviously more convenient for quick testing.
And this isn't a cheat, by the way.
You can use this as a cheat (enter in the console):
enable_cheats
add_exp 97972
Нет войне.
In reply to }{0TT@6bI4
User Avatar
4 years ago
Auto-translated
}{0TT@6bI4
You can increase the level using the following:
@for i=1, N do LevelUpHero("HeroName") end, where N is the number of additional levels. In this case, there is no need to remember the specific amount of experience required for each level.
Have you tried this option?
С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________
User Avatar
4 years ago
Auto-translated
Hello everyone. I've encountered a problem in the script: ``` function fon() local day1; while 1 do if GetObjectiveState("zad5")==OBJECTIVE_ACTIVE then day1=GetDate( ABSOLUTE_DAY ) + 2 while day1 >= GetDate( ABSOLUTE_DAY ) do sleep(10); end; SetObjectiveState("dzad3", OBJECTIVE_ACTIVE); break end; sleep(2); end; while 1 do pfonix = GetHeroCreatures( "Main_Hero", CREATURE_PHOENIX); if pfonix >= 5 then SetObjectiveState("dzad3", OBJECTIVE_COMPLETED); SetObjectiveState("dzad2", OBJECTIVE_FAILED); break; end; end; end ``` The game simply crashes when this script is executed. The script itself was inspired by a similar loop from the campaign for Markel. This entire structure should work. I'm not sure, but the problem might be related to its execution within a thread.
Сценарий: "Наследие прошлого"
Кампании:
"
Новый порядок", "Серый Альянс""Поиски Истины"

Трейлер №2 кампании "Дыхание Пустоты": https://www.youtube.com/watch?v=XkHKXk5BctA&ab_channel=%D0%90ndrei_21

Statistics

Welcome our newest member: recijeb