Dark Souls style "Bonfire"
Moderators: marionline, SDHawk
Dark Souls style "Bonfire"
Aloha.
In Dark Souls, when you rest at a Bonfire you can save your game and restore your health + estus flasks, but all the enemies you have slain are respawned (with the exception of some boss characters). In my game, as you may have read in a previous thread, there are wandering NPCs that trigger a script - the script calls a battle then uses "delete npc (npcref)" to remove that particular NPC copy, so that I may reuse the same NPC for multiple enemies.
[s]Now my question is, if I wanted the player to use an "Inn" that also reset these enemies, how would I go about doing so? I understand that using "delete npc (npcref)" is not permanent in the sense that when the player reloads a saved game the deleted NPCs will be restored. Is there a form of trickery I could use whereby a script saves game, then immediately reloads that save game to restore these NPCs? It would fit well with my intention, as I only want to have one save slot anyway - a consequence of playing so many roguelikes. [/s]
[s]Other than that, is there another way I could achieve the same effect? [/s]
Regards.
Edit: Ok, it works great! I run it as a script used when sleeping at a particular Inn. I have another quandry, however. I want the "inn" to be free, and not display the "inn costs $x, pay $x?". Is there a script command to "use an inn"? I couldn't find anything like that anywhere. I would use plotscripting, but as I am running FF1 style mp it could be quite tricky to restore that accurately.
More regards!
In Dark Souls, when you rest at a Bonfire you can save your game and restore your health + estus flasks, but all the enemies you have slain are respawned (with the exception of some boss characters). In my game, as you may have read in a previous thread, there are wandering NPCs that trigger a script - the script calls a battle then uses "delete npc (npcref)" to remove that particular NPC copy, so that I may reuse the same NPC for multiple enemies.
[s]Now my question is, if I wanted the player to use an "Inn" that also reset these enemies, how would I go about doing so? I understand that using "delete npc (npcref)" is not permanent in the sense that when the player reloads a saved game the deleted NPCs will be restored. Is there a form of trickery I could use whereby a script saves game, then immediately reloads that save game to restore these NPCs? It would fit well with my intention, as I only want to have one save slot anyway - a consequence of playing so many roguelikes. [/s]
[s]Other than that, is there another way I could achieve the same effect? [/s]
Regards.
Edit: Ok, it works great! I run it as a script used when sleeping at a particular Inn. I have another quandry, however. I want the "inn" to be free, and not display the "inn costs $x, pay $x?". Is there a script command to "use an inn"? I couldn't find anything like that anywhere. I would use plotscripting, but as I am running FF1 style mp it could be quite tricky to restore that accurately.
More regards!
Last edited by guo on Tue Apr 26, 2016 5:21 am, edited 1 time in total.
vvight.wordpress.com
My caveman scripting instincts say that you should give each NPC an appearance tag (e.g. tag 5 = blue goblin defeated) and set it to an OFF condition on each NPC that triggers the fight. Make a bunch of sequential tags, say 20 of them from tags 5 to 25, then do something like this for the bonfire:
I did the above line in Hollowkeep's script to reset all the tags that determine if a specific verb command box is highlighted, and basically reset the HUD to a normal state.
Code: Select all
for (x,5,25) do (set tag (x, off))
- Bob the Hamster
- Lord of the Slimes
- Posts: 7660
- Joined: Tue Oct 16, 2007 2:34 pm
- Location: Hamster Republic (Ontario Enclave)
- Contact:
If I remember correctly, (can't check now, posting from my phone) you can restore all HP and MP like an inn using one of the text box conditionals
Last edited by Bob the Hamster on Tue Apr 26, 2016 12:10 pm, edited 1 time in total.
Of course if you are using tags instead of "delete npc" then you can flip the tag.
Aside from saving and loading the game, which is certainly a good trick and the way to go, the mundane way to reload all deleted NPCs is to use "reset map state" and "delete map state". They only works for the current map, so you would have to call them in the map autorun script the first time you enter the map after when the NPCs are meant to be restored. It's quite a messy solution.
Anyway, I didn't realise there wasn't a command to get the inn effect. But you can set it as a textbox conditional, and just advance the textbox automatically with a script.
But it's easy to script a restore of level mp. You can pass 'maximum stat' as the 'type' to the "get level mp" command:
Aside from saving and loading the game, which is certainly a good trick and the way to go, the mundane way to reload all deleted NPCs is to use "reset map state" and "delete map state". They only works for the current map, so you would have to call them in the map autorun script the first time you enter the map after when the NPCs are meant to be restored. It's quite a messy solution.
Anyway, I didn't realise there wasn't a command to get the inn effect. But you can set it as a textbox conditional, and just advance the textbox automatically with a script.
But it's easy to script a restore of level mp. You can pass 'maximum stat' as the 'type' to the "get level mp" command:
Code: Select all
script, restore level mp, who, begin
variable(slot)
for (slot, 0, 7) do (
set level mp(who, slot, get level mp(who, slot, maximumstat))
)
end
Thanks! Brilliant. While I have you here, may I ask for an efficient way to restore levelled mp (all slots, regardless of how many spells have been used in each) by "1" spell without going over maximum ?
Last edited by guo on Tue Apr 26, 2016 10:47 pm, edited 1 time in total.
vvight.wordpress.com
It's nearly the same, but use a "min" function (which mysteriously isn't builtin) to cap the mp.
Code: Select all
script, min, a, b, begin
if (a < b) then (return (a)) else (return (b))
end
script, restore level mp, who, begin
variable(slot, mp)
for (slot, 0, 7) do (
mp := get level mp(who, slot, current stat) + 1
mp := min(mp, get level mp(who, slot, maximum stat))
set level mp(who, slot, mp)
)
end
Last edited by TMC on Wed Apr 27, 2016 9:16 am, edited 1 time in total.
That's so elegant, I wouldn't have thought of that. I have never naturally been a coder, so I always tend to think more "obtusely" when approaching these sorts of things. My thinking was along the lines of:
I will also have to ensure the script removes the NPC copy similar to the health pickups, and also to not remove the pickup if you are at full levelled MP.
Thankyou once again, I always find that I have learned something valuable when I ask these questions. Appreciate the patience and the help as always.
Code: Select all
script, level mp +1, begin
variable (slot)
for (slot, 0, 7) do (
if ( (level mp (0, slot, currentstat) < level mp (0, slot, maximumstat) ) then (
set level mp (0, slot, current stat) +1
else ()
end
Thankyou once again, I always find that I have learned something valuable when I ask these questions. Appreciate the patience and the help as always.
Last edited by guo on Wed Apr 27, 2016 1:16 pm, edited 3 times in total.
vvight.wordpress.com
I was very confused as well, because I didn't realise that it was guo, not kylekrack, who posted the original question. I don't see how that would help.
Fake arrays
Fake arrays