SKELETON WARRIORS death/inn script
Moderators: marionline, SDHawk
- Nathan Karr
- Liquid Metal Slime
- Posts: 1215
- Joined: Fri Jan 25, 2008 3:51 am
- Contact:
SKELETON WARRIORS death/inn script
For my hotOHR game, Bonecrush the Demolisher, I want to use a semi-harsh player character death system I've had in mind for a while.
Hero 0 (Find Hero(Hero:Bonecrush)) is the wielder of the blursed sword Dethbane, which prevents him from truly dying. He will always be revived fully at an inn.
Hero 6 is a skeleton (Find Hero(Hero:Skeleton), rising up to continue fighting the good fight through determination. If at 0 HP after battle, this character's equipped items should all be dumped into the party inventory and he be removed from the game.
All other heroes, if dead when the party heals at the inn, should transform into Hero 6, transferring their currently equipped items and customized name.
For simplicity's sake, a full party wipe is a game over as normal - presumably the enemies capture Bonecrush and indefinitely imprison him.
Hero 0 (Find Hero(Hero:Bonecrush)) is the wielder of the blursed sword Dethbane, which prevents him from truly dying. He will always be revived fully at an inn.
Hero 6 is a skeleton (Find Hero(Hero:Skeleton), rising up to continue fighting the good fight through determination. If at 0 HP after battle, this character's equipped items should all be dumped into the party inventory and he be removed from the game.
All other heroes, if dead when the party heals at the inn, should transform into Hero 6, transferring their currently equipped items and customized name.
For simplicity's sake, a full party wipe is a game over as normal - presumably the enemies capture Bonecrush and indefinitely imprison him.
Remeber: God made you special and he loves you very much. Bye!
- Spoonweaver
- Liquid Metal King Slime
- Posts: 6466
- Joined: Mon Dec 08, 2008 7:07 am
- Contact:
- Nathan Karr
- Liquid Metal Slime
- Posts: 1215
- Joined: Fri Jan 25, 2008 3:51 am
- Contact:
Yes. I forgot to include the question, didn't I?Spoonweaver wrote:neat
are you asking for help coding that?
Find Hero and Force Equip are basically the only relevant commands I know here. I know they'll be involved, just not how they'll be involved.
Remeber: God made you special and he loves you very much. Bye!
- Spoonweaver
- Liquid Metal King Slime
- Posts: 6466
- Joined: Mon Dec 08, 2008 7:07 am
- Contact:
Well, you'll need to store what they have on first in some variables you'll need to define
then, you can unequip it
then delete the hero or remove him or bench him, up to you
then add the new guy, or skeleton
and then equip him
no big deal
hope this helps
clearly it's not a finished product as you'll need to add a line for all of the equipment pieces
I assume you want to do something about the hero names and levels too
then, you can unequip it
then delete the hero or remove him or bench him, up to you
then add the new guy, or skeleton
and then equip him
no big deal
Code: Select all
script , skeletonize, iwhichhero, begin
variable(ihead,iarmor,iweapon,ishield)
iweapon:=check equipment (iwhichhero, slot:weapon)
unequip (iwhichhero, slot:weapon)
delete hero (iwhichhero)
add hero (hero:skeleton)
force equip (hero:skeleton, slot:weapon, iweapon)
end
hope this helps
clearly it's not a finished product as you'll need to add a line for all of the equipment pieces
I assume you want to do something about the hero names and levels too
Last edited by Spoonweaver on Wed Jun 17, 2020 7:14 pm, edited 1 time in total.
- SwordPlay
- Chemical Slime
- Posts: 966
- Joined: Sun Jan 22, 2017 9:32 am
- Location: London, England
- Contact:
i tried this, but i made some mistakes, and it doesnt work quite right?
i am not familiar with hero changing commands.
i am not familiar with hero changing commands.
Code: Select all
plotscript, make skelly, begin
variable(who)
for(who,0,40,1)do( # heroes in party
variable(skelly, hero)
hero:= hero by slot(who) # since who is the slot, get the hero name
IF(hero<>-1)THEN( # not an invalid (empty) hero
IF(hero<>6)THEN( # not already a skeleton
# IF HERO IS DEAD. INSERT A CHECK HERE #
skelly := add hero (6) # returns a party slot
variable(slot)
for(slot, 1,5,1)do(
IF(check equipment(hero,slot)<>-1)THEN(
force equip(skelly, slot, check equipment(hero, slot))
) # if valid item in slot
) # for each slot
# you could also carry across other info, like name, exp/lvl etc.,
swap by position (hero, skelly)
delete hero(hero) # bye bye
# IF HERO IS DEAD OR OTHER CHECK #
) # not a skeleton already
) # a valid hero in this slot
) # for active party
end
- Spoonweaver
- Liquid Metal King Slime
- Posts: 6466
- Joined: Mon Dec 08, 2008 7:07 am
- Contact:
Sword's script is close to correct and complete. Tomorrow when I have time I'll post a completed version of it if not beaten to it. "check equipment(hero, slot)" should be "check equipment(who, slot)". You use "get hero stat" to check HP.
Unfortunately, a lot of hero/party plotscripting commands behave badly when you have multiple copies of a hero in the party, they just act on the first copy because they use a hero ID instead of a party slot. "delete hero" is one of them. If you need to act on other copies you need to temporarily change the party ordering, yuck. Is it possible for heroes other than the Skeleton to be duplicated?
There's nothing wrong with giving variables names like "hero" and "item". That's just so common that I wouldn't add any builtin meaning that clashes and breaks scripts (I would actually like to add Hero and Item as 'types').
Unfortunately, a lot of hero/party plotscripting commands behave badly when you have multiple copies of a hero in the party, they just act on the first copy because they use a hero ID instead of a party slot. "delete hero" is one of them. If you need to act on other copies you need to temporarily change the party ordering, yuck. Is it possible for heroes other than the Skeleton to be duplicated?
There's nothing wrong with giving variables names like "hero" and "item". That's just so common that I wouldn't add any builtin meaning that clashes and breaks scripts (I would actually like to add Hero and Item as 'types').
Last edited by TMC on Fri Jun 19, 2020 3:43 pm, edited 3 times in total.
Here you go. Unlike Sword, I didn't test it.
Code: Select all
plotscript, inn revive, begin
variable (slot, skelly, hero)
for (slot, 0, 40) do( # For each party slot
hero := hero by slot(slot) # Get the hero ID
if (hero == -1) then (continue) # Empty party slot? Skip to next 'for' iteration
if (get hero stat(slot, stat:hp) <= 0) then (
# This hero is dead
if (hero == hero:Bonecrush) then(
# Revive
set hero stat(slot, stat:hp, get hero stat(slot, stat:hp, maximum stat))
) else if (hero == hero:Skeleton) then(
# Drop equipment
variable (eqslot, item)
for (eqslot, 1, 5) do(
item := check equipment(slot, eqslot)
if (item <> -1) then(get item(item)) # Not empty?
)
# Delete hero (because of possible duplicates, temporarily swap to slot 0)
swap by position(0, slot)
delete hero(hero)
swap by position(0, slot)
) else (
# Turn into skeleton
skelly := add hero (hero:Skeleton) # Returns a party slot
# Transfer equipment
for (eqslot, 1, 5) do(
item := check equipment(slot, eqslot)
if (item <> -1) then( # Not empty?
add item(item) # Add to inventory
force equip(skelly, eqslot, item) # Removes from inventory again
)
)
# Copy name
get hero name(0, slot)
set hero name(0, skelly)
swap by position (slot, skelly)
# (Assume non-skeleton heroes are never duplicate, otherwise need same trick as before)
delete hero(hero) # bye bye
)
)
)
end
- Spoonweaver
- Liquid Metal King Slime
- Posts: 6466
- Joined: Mon Dec 08, 2008 7:07 am
- Contact: