Adding a new hero to the party doesn't work

Ask and answer questions about making games and related topics. Unrelated topics go in that other forum.

Moderators: marionline, SDHawk

Post Reply
User avatar
Seamus Moore
Slime
Posts: 19
Joined: Mon Mar 16, 2020 9:39 pm
Location: Seamus Moore's House

Adding a new hero to the party doesn't work

Post by Seamus Moore »

The active party has only two heroes in it, I want to add a third completely new hero, but when I do with a simple add hero command, A script error pops up, and says that I tried to add it to the party position -38. which doesn't make sense. help.
dQw4w9WgXcQ
User avatar
kylekrack
Liquid Metal Slime
Posts: 1244
Joined: Mon Jun 16, 2014 8:58 am
Location: USA
Contact:

Post by kylekrack »

Can you post your script? I can't help troubleshoot without seeing what arguments you're putting in.
My pronouns are they/them
Ps. I love my wife
User avatar
Seamus Moore
Slime
Posts: 19
Joined: Mon Mar 16, 2020 9:39 pm
Location: Seamus Moore's House

Post by Seamus Moore »

the only code I did related to adding a hero is one command:

add hero(hero:Gan)

Its so basic that I have no Idea how it wont work.
dQw4w9WgXcQ
Eonhetwo
Red Slime
Posts: 48
Joined: Fri Oct 16, 2020 4:56 am
Location: Usa

Post by Eonhetwo »

Try this;

Add hero(find hero:gan)

Or,

Add hero(find hero('whatever number gan is')

I had issue with that too and I think that did the trick for me.
Just a vessel for dank memes
User avatar
kylekrack
Liquid Metal Slime
Posts: 1244
Joined: Mon Jun 16, 2014 8:58 am
Location: USA
Contact:

Post by kylekrack »

The dictionary entry says that add hero takes a hero constant, not a party position. Using find hero shouldn't work correctly. That sounds like a bug.
My pronouns are they/them
Ps. I love my wife
User avatar
Bob the Hamster
Lord of the Slimes
Posts: 7684
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

Yeah, Seamus, you are doing it correctly, this has to be a bug.

Can you e-mail a copy of the rpg file to bob@hamsterrepublic.com ? You could also send an rsav file right before the hero is added
User avatar
Seamus Moore
Slime
Posts: 19
Joined: Mon Mar 16, 2020 9:39 pm
Location: Seamus Moore's House

Post by Seamus Moore »

I sent my game file
dQw4w9WgXcQ
Eonhetwo
Red Slime
Posts: 48
Joined: Fri Oct 16, 2020 4:56 am
Location: Usa

Post by Eonhetwo »

My mistake, I checked my scripts and I actually DONT use what I said above.
Just a vessel for dank memes
User avatar
Bob the Hamster
Lord of the Slimes
Posts: 7684
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

I was able to reproduce the error message, but it is coming from "pathfindheroto" not from "add hero"

If I pick "ignore" on the error message, I can see that the add hero command succeeded, and the new hero is in the party.

So the error is coming from a different part of the script. Can you show us the part of the script where you use "pathfind hero to"?
Attachments
DDD0000.png
DDD0000.png (3.17 KiB) Viewed 6278 times
User avatar
Seamus Moore
Slime
Posts: 19
Joined: Mon Mar 16, 2020 9:39 pm
Location: Seamus Moore's House

Post by Seamus Moore »

Thanks for the help.

Now that I look at it, i see that the error message was caused by me writing "pathfind hero to" instead of "pathfind npc to".

But, I still have an issue, I want the new hero to take up the third slot in the active party instead of replacing the hero in the second slot. But I cant get It to work. How would I do that?
dQw4w9WgXcQ
User avatar
Bird
Slime Knight
Posts: 227
Joined: Thu Jan 26, 2012 2:19 pm
Location: Germany

Post by Bird »

I think you need the command "swap by position".

Code: Select all

add hero (5)
swap by position (find hero (5),2)
This will swap hero #5 with the one in position 2 (meaning third position, as counting starts at 0). If you want to use your hero by name, like

Code: Select all

find hero (hero:James)
, there has to be an entry in the .hsi file, that can be exported in the scripts menu. It translates the name to a constant, that the script would normally use.

If the hero positions in the party should stay fixed in your game, you probably should use "lock hero (5)" so that there can't be any reordering.
Last edited by Bird on Tue Feb 16, 2021 5:51 am, edited 1 time in total.
TMC
Metal King Slime
Posts: 4310
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

Seamus Moore wrote:I want the new hero to take up the third slot in the active party instead of replacing the hero in the second slot.
What Bird wrote is correct... but the question you asked doesn't seem to make sense. "add hero" always puts the new hero into an empty party slot, it doesn't move existing heroes.

I think your question indicates that when you add the hero it appears in the 2nd caterpillar slot, bumping the hero that was in the 2nd to 3rd, because there was an empty party slot in front of the existing hero that the new one got added into. E.g.
slot 0: John
slot 1: (empty) <- "add hero(hero:Joan)" goes here
slot 2: Jim
slot 3: (empty)

If so, what Bird wrote would fix it, unless your party looks like
slot 0: John
slot 1: (empty) <- "add hero(hero:Joan)" goes here
slot 2: (empty) <- and then "swap by position" puts Joan here
slot 3: Jim

Bird wrote:If you want to use your hero by name, like

Code: Select all

find hero &#40;hero&#58;James&#41;
, there has to be an entry in the .hsi file, that can be exported in the scripts menu.
There no need to export the .hsi file or worry about that, as it's exported automatically when compiling.
Post Reply