Castle Paradox Forum Index Castle Paradox

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Gamelist   Review List   Song List   All Journals   Site Stats   Search Gamelist   IRC Chat Room

plotscripting formula
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
gagekilmer
Ninja... nuff said




Joined: 09 Jan 2013
Posts: 53

PostPosted: Fri Jun 28, 2013 7:37 am    Post subject: plotscripting formula Reply with quote

so I asked about this a couple months ago to write the script and now I am having issues with it. Im trying to give the hero a certain number of stat modifiers per level up. but each level the hero only gets one of the item, and if you go up multiple levels you only get one of the item (not one per level)
this is my script

plotscript, levelup, begin
variable (level)
level := get hero level (me)
get item (138, ((level+2)/4)+1)
end
Back to top
View user's profile Send private message Send e-mail
Bob the Hamster
OHRRPGCE Developer




Joined: 22 Feb 2003
Posts: 2526
Location: Hamster Republic (Southern California Enclave)

PostPosted: Fri Jun 28, 2013 8:46 am    Post subject: Reply with quote

Try this script. I think it should do what you want.

Code:

include, plotscr.hsd

plotscript, instead of battle, formnum, begin
  variable(before, after, difference, i)

  # Before the battle, record the level of the hero
  before := get hero level(find hero(hero:Bob))

  # Fight the battle
  fight formation(formnum)

  # After the battle check to see if the level has increased
  after := get hero level(find hero(hero:Bob))

  # If at least one level up has happened, give the modifier items for each level
  difference := after -- before
  if (difference >= 1) then(
    for(i, before+1, after) do(
      get item (138, ((i+2)/4)+1)
    )
  )

end


This assumes that you only have one hero. A script that will work for multiple heroes is possible, but more complicated.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
gagekilmer
Ninja... nuff said




Joined: 09 Jan 2013
Posts: 53

PostPosted: Fri Jun 28, 2013 10:29 am    Post subject: IDEA Reply with quote

If I used the characters name to define the character, couldnt I copy and paste the script and change the name of the script. since each character uses a different item.

Also, If I give the player the ability to rename the character can the character still be referred to by the name given to them in the editor.
ex. if I name a character Ken, and the player renames them Alex, can I still refer to the character as Ken in plotscripts?
Back to top
View user's profile Send private message Send e-mail
gagekilmer
Ninja... nuff said




Joined: 09 Jan 2013
Posts: 53

PostPosted: Fri Jun 28, 2013 5:52 pm    Post subject: disregard Reply with quote

disregard my last post. could you please try to make me one for three characters. Kenryoku, Suji, and Kokoro?
Back to top
View user's profile Send private message Send e-mail
Bob the Hamster
OHRRPGCE Developer




Joined: 22 Feb 2003
Posts: 2526
Location: Hamster Republic (Southern California Enclave)

PostPosted: Sat Jun 29, 2013 12:45 pm    Post subject: Re: IDEA Reply with quote

gagekilmer wrote:
If I used the characters name to define the character, couldnt I copy and paste the script and change the name of the script. since each character uses a different item.


Yes, this would work just fine.

gagekilmer wrote:
Also, If I give the player the ability to rename the character can the character still be referred to by the name given to them in the editor.
ex. if I name a character Ken, and the player renames them Alex, can I still refer to the character as Ken in plotscripts?


No worries. the hero:Name plotscripting constants are always based on the hero's original name as defined in the hero editor. Even if the player re-names the hero, the hero:Name constant will still point to the correct hero. It is really just an alternate way of writing the hero's ID number.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
gagekilmer
Ninja... nuff said




Joined: 09 Jan 2013
Posts: 53

PostPosted: Mon Jul 01, 2013 6:55 pm    Post subject: issues Reply with quote

So I did as you said, best I could anyways... and set it as the instead of battle script. now I am not getting any of the item when I level up. Did I ruin the Script somehow... All i did was change the name of the variables so that they wouldnt interfere between characters



plotscript, instead of battle, formnum, begin
variable(before1, after1, difference1, a)

# Before the battle, record the level of the hero
before1 := get hero level(find hero(hero:kenryoku))

# Fight the battle
fight formation(formnum)

# After the battle check to see if the level has increased
after1 := get hero level(find hero(hero:kenryoku))

# If at least one level up has happened, give the modifier items for each level
difference1 := after1 -- before1
if (difference1 >= 1) then(
for(a, before1+1, after1) do(
get item (138, ((a+2)/4)+1)
)
)

variable(before2, after2, difference2, b)

# Before the battle, record the level of the hero
before2 := get hero level(find hero(hero:suji))

# Fight the battle
fight formation(formnum)

# After the battle check to see if the level has increased
after2 := get hero level(find hero(hero:suji))

# If at least one level up has happened, give the modifier items for each level
difference2 := after2 -- before2
if (difference2 >= 1) then(
for(b, before2+1, after2) do(
get item (138, ((b+2)/4)+1)
)
)

variable(before3, after3, difference3, c)

# Before the battle, record the level of the hero
before3 := get hero level(find hero(hero:kokoro))

# Fight the battle
fight formation(formnum)

# After the battle check to see if the level has increased
after3 := get hero level(find hero(hero:kokoro))

# If at least one level up has happened, give the modifier items for each level
difference3 := after3 -- before3
if (difference3 >= 1) then(
for(c, before3+1, after3) do(
get item (138, ((c+2)/4)+1)
)
)
end
Back to top
View user's profile Send private message Send e-mail
Bob the Hamster
OHRRPGCE Developer




Joined: 22 Feb 2003
Posts: 2526
Location: Hamster Republic (Southern California Enclave)

PostPosted: Mon Jul 01, 2013 8:32 pm    Post subject: Reply with quote

The problem here is that you will fight the enemy formation 3 times.

Here is the same script re-organized so that there is only one "fight formation" command

Code:

plotscript, instead of battle, formnum, begin
  variable(before1, after1, difference1, a)
  variable(before2, after2, difference2, b)
  variable(before3, after3, difference3, c)
 
  # Before the battle, record the level of each hero
  before1 := get hero level(find hero(hero:kenryoku))
  before2 := get hero level(find hero(hero:suji))
  before3 := get hero level(find hero(hero:kokoro))
 
  # Fight the battle
  fight formation(formnum)
 
  # After the battle check to see if the level has increased
  after1 := get hero level(find hero(hero:kenryoku))
  after2 := get hero level(find hero(hero:suji))
  after3 := get hero level(find hero(hero:kokoro))
 
  # If at least one level up has happened, give the modifier items for each level
  difference1 := after1 -- before1
  if (difference1 >= 1) then(
    for(a, before1+1, after1) do(
      get item (138, ((a+2)/4)+1)
    )
  )
 
  # If at least one level up has happened, give the modifier items for each level
  difference2 := after2 -- before2
  if (difference2 >= 1) then(
    for(b, before2+1, after2) do(
      get item (138, ((b+2)/4)+1)
    )
  )
 
  # If at least one level up has happened, give the modifier items for each level
  difference3 := after3 -- before3
  if (difference3 >= 1) then(
    for(c, before3+1, after3) do(
      get item (138, ((c+2)/4)+1)
    )
  )
end
Back to top
View user's profile Send private message Send e-mail Visit poster's website
gagekilmer
Ninja... nuff said




Joined: 09 Jan 2013
Posts: 53

PostPosted: Mon Jul 01, 2013 8:46 pm    Post subject: thanks Reply with quote

has anyone ever told you that you are both a genius and a lifesaver. Thanks a ton. I have a simewhat related side question. when you start playing you are a floating hand, choosing your character, which we named choice hand. after choosing Kenryoku, and renaming him as you see fit, in the item menu (using items on a character) the hero is still referred to as choice hand. not a major issue, just kind of annoying
Back to top
View user's profile Send private message Send e-mail
gagekilmer
Ninja... nuff said




Joined: 09 Jan 2013
Posts: 53

PostPosted: Mon Jul 01, 2013 8:56 pm    Post subject: Reply with quote

its supposed to be an instead of battle script right? on every map it applies to? im still not getting any of the item
Back to top
View user's profile Send private message Send e-mail
Bob the Hamster
OHRRPGCE Developer




Joined: 22 Feb 2003
Posts: 2526
Location: Hamster Republic (Southern California Enclave)

PostPosted: Tue Jul 02, 2013 9:48 am    Post subject: Re: thanks Reply with quote

Very glad to help :)

gagekilmer wrote:
has anyone ever told you that you are both a genius and a lifesaver. Thanks a ton. I have a simewhat related side question. when you start playing you are a floating hand, choosing your character, which we named choice hand. after choosing Kenryoku, and renaming him as you see fit, in the item menu (using items on a character) the hero is still referred to as choice hand. not a major issue, just kind of annoying


Sounds like the choice hero needs to be removed from the party right after Kenryoku is added to the party.

If you attempt to remove the choice hand before adding Kenryoku, nothing will happen, because you can never have zero heroes in the party.

gagekilmer wrote:
its supposed to be an instead of battle script right? on every map it applies to? im still not getting any of the item


yes, it should be set as the instead-of-battle command on every map. This only applies to random battles. For battles that are triggered from textboxes, you will need to trigger the script instead of fighting the battle directly. You can use another script for that

Code:

plotscript, cave 1 boss battle, begin
  instead of battle(43)
end


In this example above, 43 is the formation id number for the boss.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
gagekilmer
Ninja... nuff said




Joined: 09 Jan 2013
Posts: 53

PostPosted: Tue Jul 02, 2013 8:14 pm    Post subject: Nope Reply with quote

I had already conquered that problem months ago... I made sure to add ken before getting rid of hand. I just double checked. There is only one party member, however (only in the items menu) he is still referred to as choice hand[/i]
Back to top
View user's profile Send private message Send e-mail
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Tue Jul 02, 2013 9:38 pm    Post subject: Reply with quote

Are you saying that the wrong hero name is used in the target picker in the items menu, but not in battle, or in the status, equip, spells or party/order menus?
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
gagekilmer
Ninja... nuff said




Joined: 09 Jan 2013
Posts: 53

PostPosted: Wed Jul 03, 2013 5:49 am    Post subject: Reply with quote

Exactly, and the correct walkabout sprite shows up next to the name "choice hand" and the "kenryoku" (the correct hero) still learns the technique
Back to top
View user's profile Send private message Send e-mail
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Fri Jul 05, 2013 6:23 am    Post subject: Reply with quote

OK, thanks. I found and fixed that bug.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
gagekilmer
Ninja... nuff said




Joined: 09 Jan 2013
Posts: 53

PostPosted: Sun Jul 07, 2013 4:14 pm    Post subject: thanks Reply with quote

so does that mean that I have to re-download beezlebufo to fix it for me?
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP! All times are GMT - 8 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group