Post new topic    
Liquid Metal Slime
Send private message
SKELETON WARRIORS death/inn script 
 PostWed Jun 17, 2020 4:56 pm
Send private message Reply with quote
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.
NO EAT
Liquid Metal King Slime
Send private message
 
 PostWed Jun 17, 2020 5:45 pm
Send private message Reply with quote
neat

are you asking for help coding that?
Liquid Metal Slime
Send private message
 
 PostWed Jun 17, 2020 5:56 pm
Send private message Reply with quote
Spoonweaver wrote:
neat

are you asking for help coding that?


Yes. I forgot to include the question, didn't I?

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.
NO EAT
Liquid Metal King Slime
Send private message
 
 PostWed Jun 17, 2020 7:13 pm
Send private message Reply with quote
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


Code:
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
Chemical Slime
Send private message
 
 PostWed Jun 17, 2020 9:56 pm
Send private message Reply with quote
i tried this, but i made some mistakes, and it doesnt work quite right?
i am not familiar with hero changing commands.

Code:

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
Liquid Metal King Slime
Send private message
 
 PostWed Jun 17, 2020 11:40 pm
Send private message Reply with quote
that script is a little messy
and you should avoid keyterms like hero for variables
but what exactly happens with your script that you dont want to happen and what doesnt it do right
Metal King Slime
Send private message
 
 PostFri Jun 19, 2020 3:39 pm
Send private message Reply with quote
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').
Chemical Slime
Send private message
 
 PostFri Jun 19, 2020 3:54 pm
Send private message Reply with quote
right. multiple heroes of the same definition are kinda a pain to manage.
oh! excuse me.

(screams internally)

All of the transient, Is parable, only: The insufficient, Here, grows to reality:
The indescribable, Here, is done: Woman, eternal, Beckons us on. (Goethe)
Metal King Slime
Send private message
 
 PostSat Jun 20, 2020 4:15 am
Send private message Reply with quote
Here you go. Unlike Sword, I didn't test it.

Code:
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
Chemical Slime
Send private message
 
 PostSat Jun 20, 2020 4:19 am
Send private message Reply with quote
TMC wrote:
Here you go. Unlike Sword, I didn't test it.


Kamina
All of the transient, Is parable, only: The insufficient, Here, grows to reality:
The indescribable, Here, is done: Woman, eternal, Beckons us on. (Goethe)
Liquid Metal King Slime
Send private message
 
 PostSat Jul 04, 2020 1:43 am
Send private message Reply with quote
Nate... did it work for you?
Display posts from previous: