I'm currently working on a port of Rhidian's Respawning Enemies Mod from the normal edition to the Enhanced Edition while adding some personal lore touch to it. So far it's functioning, the majority of enemies are respawning.
As for the personal touch, I've implemented an NPC in Homestead that takes gold to respawn enemies. The way I had it in mind, every 5 player levels will increase the cost by 2000 Gold.
DISCLAIMER: Still learning Osiris scripting.
In the Story Editor, I added the following code.
[b]IF
CharacterLeveledUp(_Char)
AND
_Char.IsPlayer()
AND
_Char.CharacterGetLevel(_Level)
AND
_Level > 4
THEN
GlobalSetEvent("IsLevel5");
IF
CharacterLeveledUp(_Char)
AND
_Char.IsPlayer()
AND
_Char.CharacterGetLevel(_Level)
AND
_Level > 9
THEN
GlobalSetEvent("IsLevel10");
IF
CharacterLeveledUp(_Char)
AND
_Char.IsPlayer()
AND
_Char.CharacterGetLevel(_Level)
AND
_Level > 14
THEN
GlobalSetEvent("IsLevel15");
IF
CharacterLeveledUp(_Char)
AND
_Char.IsPlayer()
AND
_Char.CharacterGetLevel(_Level)
AND
_Level > 19
THEN
GlobalSetEvent("IsLevel20");[/b]
Coming from C++, this looks horribly inefficient but I'm not sure how to implement things like "else" in Osiris so forgive me. :P
I assume the global events, by default are set as '0' and then when called after a level-up they're toggled to a '1'.
So going to dialogue, I have it set up so if a character passes a level threshold, the previous price option becomes invisible and the current one visible, but for some reason this isn't being triggered.
[b]"I would like to write the names of past adversaries on your pages. (2000 Gold)"
CONDITION IsLocalFlag("CanDone", 1)
CONDITION IsFlag("IsLevel5",0)
CONDITION IsFlag("IsLevel10",0)
CONDITION IsFlag("IsLevel15",0)
CONDITION IsFlag("IsLevel20",0)
CHECK c&c&c&c&c[/b]
This appears standard. Then for Level 5 I have:
[b]"I would like to write the names of past adversaries on your pages. (4000 Gold)"
CONDITION IsLocalFlag("CanDone", 1)
CONDITION IsFlag("IsLevel5",1)
CONDITION IsFlag("IsLevel10",0)
CONDITION IsFlag("IsLevel15",0)
CONDITION IsFlag("IsLevel20",0)
CHECK c&c&c&c&c[/b]
...and so forth for level 10, 15 and 20.
I checked after leveling up multiple times and the dialogue option for 2000 Gold is the only one that's visible.
I know communication between dialogue and story isn't the easiest and after trying a bunch of things I figured it'd be best to ask for help here.
I also want to ask if there's a way to quickly trigger level up events in-game for quicker testing and debugging (as manually getting to level 5 takes a good amount of hours)?
Any help is greatly appreciated.
Cheers!
Emvi.