Post new topic    
Page 1, 2  »
Metal Slime
Send private message
Odd plotscripting question (multiple copies of heroes) 
 PostThu Apr 08, 2010 3:36 am
Send private message Reply with quote
Working on my RGC entry and ran into a possible problem... Is there any way for plotscripting to distinguish between multiple copies of the same hero when there's no way to tell which party slot that hero might be in?

For example... you start with one copy of Monster A. You can get infinitely more Monster A's by stealing from the matching random-encounter enemy, which gives you an item that triggers a script to add another copy to your party.

But the copy of Monster A you start with is level 5, and the ones you can get in battle start at either level 2 or 3. So the plotscript that adds new Monster A's to your party needs to be able to pick out the one that you just added, rather than accidentally de-leveling your level 5 Monster A, with a "set hero level" command.

Having multiple copies of each hero for different starting levels isn't an option, by the way, since I've already used up 56 of the 60 available slots for heroes.

===========

So, is there any way for a plotscript to pick out the most recent copy of a hero when multiple copies exist? And if not, would it be quick and easy enough to make it into a nightly version before April 30th?

Now that I think about it, a "set hero's starting level" plotscript command would work just as well for this... but unfortunately there doesn't seem to be one of those either. Seems like that one might be easier to add in (we already have "set damage cap" and "set default weapon"... it can't be much more complicated than those, right?)
Liquid Metal Slime
Send private message
 
 PostThu Apr 08, 2010 1:45 pm
Send private message Reply with quote
This solution will work if the maximum allowed number of party members is four and there is no 'bank' of heroes:

1. Edit the Menu so that the Order command does not exist.
2. Script all the Add Member sequences so that a global variable is assigned to each new hero.
3. Use global variables to distinguish hero slots.

I can't think of another way to do it, but there might be an undocumented command already. That happens to me a lot.
My website, the home of Motrya:
http://www.jshgaming.com
Metal Slime
Send private message
 
 PostThu Apr 08, 2010 3:30 pm
Send private message Reply with quote
Why not have custom set the default level at 2 or 3, and then the script that starts you off with the level 5 monster is responsible for changing that one? So custom has the level for 'recruits' and you only need scripts to set the levels of your starting heroes?

Other than that, I think this could be accomplished with a script that does the following:

[pseudocode]
swap out hero in slot 0
add hero (monster A)
set hero level using slot 0, since monster A must have gone there
swap original hero back into slot 0
[/pseudocode]
I am Srime
Liquid Metal King Slime
Send private message
Re: Odd plotscripting question (multiple copies of heroes) 
 PostThu Apr 08, 2010 6:07 pm
Send private message Reply with quote
FnrrfYgmSchnish wrote:

So, is there any way for a plotscript to pick out the most recent copy of a hero when multiple copies exist? And if not, would it be quick and easy enough to make it into a nightly version before April 30th?


I just updated the "add hero" command so that it returns the party slot number of the hero that was added (or -1 if the party is full)
Metal Slime
Send private message
 
 PostThu Apr 08, 2010 8:15 pm
Send private message Reply with quote
Quote:
This solution will work if the maximum allowed number of party members is four and there is no 'bank' of heroes:

1. Edit the Menu so that the Order command does not exist.
2. Script all the Add Member sequences so that a global variable is assigned to each new hero.
3. Use global variables to distinguish hero slots.


Unfortunately, the way I've got the game set up definitely does let you have a lot of room for reserve heroes... so I guess I'll have to figure out some other way around it.

Quote:
Why not have custom set the default level at 2 or 3, and then the script that starts you off with the level 5 monster is responsible for changing that one? So custom has the level for 'recruits' and you only need scripts to set the levels of your starting heroes?


That's pretty much what I'm doing right now, except the default level is 0 (and so the level 5 monster you start with and the lower ones all have "set hero level" in their add-hero scripts.)

The problem is that there's also a way to get higher-leveled copies of the same monster later on... so however I get around this will have to account for a whole range of different starting levels instead of just two or three.

Quote:
[pseudocode]
swap out hero in slot 0
add hero (monster A)
set hero level using slot 0, since monster A must have gone there
swap original hero back into slot 0
[/pseudocode]


Yeah, this looks like it would probably work.

Quote:
I just updated the "add hero" command so that it returns the party slot number of the hero that was added (or -1 if the party is full)


Wow, that sounds like pretty much exactly what I needed. I'm guessing this will show up in today's nightly version?
Liquid Metal King Slime
Send private message
 
 PostThu Apr 08, 2010 8:29 pm
Send private message Reply with quote
I forced an early nightly, so it is there now
Metal Slime
Send private message
 
 PostSat Apr 10, 2010 7:52 pm
Send private message Reply with quote
Er... how exactly do I use this?

I've tried a few different ways, but none of them seem to work...

Code:
   set hero level(add hero(hero:SLIME),2)


Code:
   set hero level(hero by slot(add hero(hero:SLIME)),2)


Code:
   variable(pucka)
   set variable(pucka,add hero(hero:SLIME))
   set hero level(hero by slot(pucka),2)


None of them gave me any errors while compiling... but they also didn't work. The hero is added to the party without any problems, but they're always at their default level (0) instead of the level the script was supposed to set them at.

What am I doing wrong?
Liquid Metal Slime
Send private message
 
 PostSat Apr 10, 2010 8:04 pm
Send private message Reply with quote
FnrrfYgmSchnish wrote:
Er... how exactly do I use this?

I've tried a few different ways, but none of them seem to work...

Code:
   set hero level(add hero(hero:SLIME),2)


Code:
   set hero level(hero by slot(add hero(hero:SLIME)),2)


Code:
   variable(pucka)
   set variable(pucka,add hero(hero:SLIME))
   set hero level(hero by slot(pucka),2)


None of them gave me any errors while compiling... but they also didn't work. The hero is added to the party without any problems, but they're always at their default level (0) instead of the level the script was supposed to set them at.

What am I doing wrong?


Third method looks correct to me.
The last line is the problem. Just use:

Code:
set hero level(pucka,2)

My website, the home of Motrya:
http://www.jshgaming.com
Metal Slime
Send private message
 
 PostSat Apr 10, 2010 10:05 pm
Send private message Reply with quote
Tried it just now, and... still doesn't work. For some reason it's setting the level of the first hero (hero #55, who was in the party before the script starts) rather than the one that was just added (hero #1.)

I'm not sure how it's happening that way, unless the "add hero returns the slot where the newly-added hero went" thing just isn't working yet... or there's some extra thing I need to do that I haven't thought of yet.
Liquid Metal King Slime
Send private message
 
 PostSun Apr 11, 2010 2:41 am
Send private message Reply with quote
Try it this way:

Code:

variable(slot)
slot := add hero(hero:SLIME)
show value(slot)
set hero level(slot ,2)


The value shown should be the number of the slot that the slime is added to.

If you get a 0 (and the slime was not actually added to the 0 slot) then the command is not working.
Metal Slime
Send private message
 
 PostSun Apr 11, 2010 4:08 am
Send private message Reply with quote
Just added your version of the script in and tested it, and...



Yep, it gives me a zero right in the lower-left corner of the screen.
Liquid Metal Slime
Send private message
 
 PostSun Apr 11, 2010 5:26 am
Send private message Reply with quote
FnrrfYgmSchnish wrote:

Liquid Metal King Slime
Send private message
 
 PostSun Apr 11, 2010 5:15 pm
Send private message Reply with quote
Okay, there has got to be a problem with the return value for the command. I am away from my computer right now (posting from my phone) but I'll check it out as soon as I get a chance
Liquid Metal King Slime
Send private message
 
 PostWed Apr 14, 2010 11:15 pm
Send private message Reply with quote
I checked this command out carefully, and for me, "add hero" is definitely returning the slot number that it added to, or -1 if it failed.

Is it possible that you are still running the stable version of game.exe instead of the latest nightly?
Metal Slime
Send private message
 
 PostWed Apr 14, 2010 11:54 pm
Send private message Reply with quote
I don't see how it could be an older version of game.exe, since when I downloaded the first nightly with the change to "add hero," I saved it in the same folder as the old one and overwrote everything.

I guess there's a chance that I accidentally clicked "don't overwrite" on one of the files or downloaded the nightly before the new one went up, though.
I'll try the most recent nightly when I get home from my class later tonight; maybe delete my old game.exe/custom.exe files beforehand just in case they somehow aren't being overwritten like they should be.

Glad to hear that "add hero" is working now, though. Hopefully I can get it working on my end before April is over... I'd rather not have to take a ton of time figuring out some weird, complicated plotscripty workaround just to get Puckamon working in time for the RGC.

EDIT: Just tested this, and... yep, it works now. Not sure why it didn't before... I'm guessing I downloaded the last nightly too soon and didn't get the one with the new version of "add hero."
Display posts from previous:
Page 1, 2  »