Post new topic    
Adding a new hero to the party doesn't work 
 PostSat Feb 06, 2021 1:51 am
Send private message Reply with quote
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
Liquid Metal Slime
Send private message
 
 PostSat Feb 06, 2021 3:08 am
Send private message Reply with quote
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
 
 PostSat Feb 06, 2021 7:03 pm
Send private message Reply with quote
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
Red Slime
Send private message
 
 PostSat Feb 06, 2021 8:11 pm
Send private message Reply with quote
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
Liquid Metal Slime
Send private message
 
 PostSat Feb 06, 2021 9:26 pm
Send private message Reply with quote
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
Liquid Metal King Slime
Send private message
 
 PostSat Feb 06, 2021 9:46 pm
Send private message Reply with quote
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
 
 PostSun Feb 07, 2021 1:20 am
Send private message Reply with quote
I sent my game file
dQw4w9WgXcQ
Red Slime
Send private message
 
 PostSun Feb 07, 2021 3:52 pm
Send private message Reply with quote
My mistake, I checked my scripts and I actually DONT use what I said above.
Just a vessel for dank memes
Liquid Metal King Slime
Send private message
 
 PostSun Feb 07, 2021 4:58 pm
Send private message Reply with quote
DDD0000.png
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"?
 
 PostSun Feb 07, 2021 9:29 pm
Send private message Reply with quote
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
Slime Knight
Send private message
 
 PostTue Feb 09, 2021 11:16 am
Send private message Reply with quote
I think you need the command "swap by position".

Code:
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:
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.
Metal King Slime
Send private message
 
 PostMon Feb 15, 2021 9:36 am
Send private message Reply with quote
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:
find hero (hero:James)
, 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.
Display posts from previous: