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

Sorry

 
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: Mon Jul 08, 2013 8:54 pm    Post subject: Sorry Reply with quote

I'm sure Bob the Hamster and TMC probably hate me by now but Ive got another plotscripting problem, though hopefully my last for a while. I tried to write another script, for a focus system (you can choose balanced, attack, defense, or weapons. all stats being used in your focus are bumped up to 150% all those not being used are brougt down to 50%)

here is my script:

Plotscript, ninattackfocus, begin
variable (who)
who := find hero (hero: kenryoku)
variable (old fire base, new fire max)
old fire base := get hero stat (who, stat:fire, base stat)
new fire max := get hero stat (who, stat:fire, maximum stat)
variable (old water base, new water max)
old water base := get hero stat (who, stat:water, base stat)
new water max := get hero stat (who, stat:water, maximum stat)
variable (old lightning base, new lightning max)
old lightning base := get hero stat (who, stat:lightning, base stat)
new lightning max := get hero stat (who, stat:lightning, maximum stat)
variable (old earth base, new earth max)
old earth base := get hero stat (who, stat:earth, base stat)
new earth max := get hero stat (who, stat:earth, maximum stat)
variable (old wind base, new wind max)
old wind base := get hero stat (who, stat:wind, base stat)
new wind max := get hero stat (who, stat:wind, maximum stat)
variable (old strength base, new strength max)
old strength base := get hero stat (who, stat:strength, base stat)
new strength max := get hero stat (who, stat:strength, maximum stat)
variable (old defense base, new defense max)
old defense base := get hero stat (who, stat:defense, base stat)
new defense max := get hero stat (who, stat:defense, maximum stat)
if (check tag (75)) then
begin
set hero stat (who, stat:fire, ((3 * old fire base) / 2), base stat)
set hero stat (who, stat:water, ((3 * old water base) / 2), base stat)
set hero stat (who, stat:lightning, ((3 * old lightning base) / 2), base stat)
set hero stat (who, stat:earth, ((3 * old earth base) / 2), base stat)
set hero stat (who, stat:wind, ((3 * old wind base) / 2), base stat)
set hero stat (who, stat:strength ((1 * old strength base) / 2), base stat)
set hero stat (who, stat:defense ((1 * old defense base) / 2), base stat)
set hero stat (who, stat:fire, new fire max, current stat)
set hero stat (who, stat:water, new water max, current stat)
set hero stat (who, stat:lightning, new lightning max, current stat)
set hero stat (who, stat:earth, new earth max, current stat)
set hero stat (who, stat:wind, new wind max, current stat)
set hero stat (who, stat:strength, new strength max, current stat)
set hero stat (who, stat:defense, new defense max, current stat)
show text box (137)
wait for text box
set tag (76, on)
set tag (75, off)
end
if (check tag (76)) then
begin
show text box (138)
wait for text box
end
if (check tag (77)) then
begin
set hero stat (who, stat:fire, (2 * old fire base), base stat)
set hero stat (who, stat:water, (2 * old water base), base stat)
set hero stat (who, stat:lightning, (2 * old lightning base), base stat)
set hero stat (who, stat:earth, (2 * old earth base), base stat)
set hero stat (who, stat:wind, (2 * old wind base), base stat)
set hero stat (who, stat:strength, (2 * old strength base), base stat)
set hero stat (who, stat:defense, ((2 * old defense base) / 3), base stat)
set hero stat (who, stat:fire, new fire max, current stat)
set hero stat (who, stat:water, new water max, current stat)
set hero stat (who, stat:lightning, new lightning max, current stat)
set hero stat (who, stat:earth, new earth max, current stat)
set hero stat (who, stat:wind, new wind max, current stat)
set hero stat (who, stat:strength, new strength max, current stat)
set hero stat (who, stat:defense, new defense max, current stat)
set hero stat (who, stat:fire, ((3 * old fire base) / 2), base stat)
set hero stat (who, stat:water, ((3 * old water base) / 2), base stat)
set hero stat (who, stat:lightning, ((3 * old lightning base) / 2), base stat)
set hero stat (who, stat:earth, ((3 * old earth base) / 2), base stat)
set hero stat (who, stat:wind, ((3 * old wind base) / 2), base stat)
set hero stat (who, stat:strength ((1 * old strength base) / 2), base stat)
set hero stat (who, stat:defense ((1 * old defense base) / 2), base stat)
set hero stat (who, stat:fire, new fire max, current stat)
set hero stat (who, stat:water, new water max, current stat)
set hero stat (who, stat:lightning, new lightning max, current stat)
set hero stat (who, stat:earth, new earth max, current stat)
set hero stat (who, stat:wind, new wind max, current stat)
set hero stat (who, stat:strength, new strength max, current stat)
set hero stat (who, stat:defense, new defense max, current stat)
show text box (137)
wait for text box
set tag (76, on)
set tag (77, off)
end
if (check tag (7Cool) then
begin
set hero stat (who, stat:fire, (2 * old fire base), base stat)
set hero stat (who, stat:water, (2 * old water base), base stat)
set hero stat (who, stat:lightning, (2 * old lightning base), base stat)
set hero stat (who, stat:earth, (2 * old earth base), base stat)
set hero stat (who, stat:wind, (2 * old wind base), base stat)
set hero stat (who, stat:strength, ((2 * old strength base) / 3), base stat)
set hero stat (who, stat:defense, (2 * old defense base), base stat)
set hero stat (who, stat:fire, new fire max, current stat)
set hero stat (who, stat:water, new water max, current stat)
set hero stat (who, stat:lightning, new lightning max, current stat)
set hero stat (who, stat:earth, new earth max, current stat)
set hero stat (who, stat:wind, new wind max, current stat)
set hero stat (who, stat:strength, new strength max, current stat)
set hero stat (who, stat:defense, new defense max, current stat)
set hero stat (who, stat:fire, ((3 * old fire base) / 2), base stat)
set hero stat (who, stat:water, ((3 * old water base) / 2), base stat)
set hero stat (who, stat:lightning, ((3 * old lightning base) / 2), base stat)
set hero stat (who, stat:earth, ((3 * old earth base) / 2), base stat)
set hero stat (who, stat:wind, ((3 * old wind base) / 2), base stat)
set hero stat (who, stat:strength ((1 * old strength base) / 2), base stat)
set hero stat (who, stat:defense ((1 * old defense base) / 2), base stat)
set hero stat (who, stat:fire, new fire max, current stat)
set hero stat (who, stat:water, new water max, current stat)
set hero stat (who, stat:lightning, new lightning max, current stat)
set hero stat (who, stat:earth, new earth max, current stat)
set hero stat (who, stat:wind, new wind max, current stat)
set hero stat (who, stat:strength, new strength max, current stat)
set hero stat (who, stat:defense, new defense max, current stat)
show text box (137)
wait for text box
set tag (76, on)
set tag (78, off)
end
end

two issues
1. you start with tag 75 (balanced) on, and when you switch to using attack (tag 76 on) the stats in the status menu dont change.
2. after turning tag 76 on, i made it so trying to turn it on again will show you text box 138, instead of 137. 137 is still showing

any ideas?
Back to top
View user's profile Send private message Send e-mail
GozerGomez
Guest






PostPosted: Mon Jul 08, 2013 10:09 pm    Post subject: Reply with quote

I notice you're changing the base stat instead of the maximum stat. Maybe that's causing #1. According to the plotscripting dictionary,
http://hamsterrepublic.com/ohrrpgce/docs/plotdict.xml#about-basestat , changes to the base stat *don't* appear on the menus by default.

It's hard to guess what the problem is. Hit F4 to open the Tag Debug menu, and use the PageDown button to go down to 75, 76, 77 and 78. Are they all the same color? If I read this script correctly, and I think I do, you're going to have to get 75, 77 and 78 turned off before it'll show something that isn't 137. Look at the flow of the script.

You ask at the start.. "Is Tag 75 on? If so, turn Tag 76 on and turn Tag 75 off."

But then you immediately ask "Is Tag 76 on? If so, do this" so any time Tag 75 was on and the script is called, you're going to do the 76 part, because 75 turned on 76.

Later on, you ask "Is 77 on? If so, turn 77 off and then turn on 76", but you don't do anything to 75. Likewise, for 78, you don't do anything about 77. You might want to and some ands to this thing, for instance...

Code:
if ( checktag (75) == on , and , checktag (76) == off )
then
begin


To make sure that once Tag 76 is on, which I presume means "The player has chosen a style", it will ignore that section of the code and only do the part for 76. You would add the same and 76 off to 77 and 78.

It's hard to tell exactly waht you're trying to do, but maybe this will help
Back to top
GozerGomez
Guest






PostPosted: Mon Jul 08, 2013 10:17 pm    Post subject: Reply with quote

Oh! and my programmer suggests you might want to move the "If checktag (76)" bit to as close to the end as possible, so the 77 and 78 blocks could trigger it in the same breath, and not just the 75. You might also want to make say, turning 75 on automatically turn off 77 and 78, and turning 77 on makes turn 75 and 78, and turning 78 on makes 77 and 75 go out, so that the styles are somewhat exclusive. Again, it's hard to tell what you're trying to do, I'm sorry. Some screenshots or a diagram or something might make it clearer.
Back to top
gagekilmer
Ninja... nuff said




Joined: 09 Jan 2013
Posts: 53

PostPosted: Tue Jul 09, 2013 7:51 am    Post subject: SO CONFUSED Reply with quote

I think I realized what I did wrong, I however do not know how to fix it.
the "if (check tag(**)) commands are supposed to check what "mode" you are in. so if it returns false (not meeting the criteria) then its supposed to move on to the next check tag and see if it fits the criteria... and i fixed the issue with the stat not changing, I think. is there and else command to continue the script, and skip the "begin" to the "end" I dont know if that made any sense at all...
Back to top
View user's profile Send private message Send e-mail
gagekilmer
Ninja... nuff said




Joined: 09 Jan 2013
Posts: 53

PostPosted: Tue Jul 09, 2013 7:59 am    Post subject: dammit Reply with quote

disregard my last post.

this is the edited script:

Plotscript, ninattackfocus, begin
variable (who)
who := find hero (hero: kenryoku)
variable (new fire max)
new fire max := get hero stat (who, stat:fire, maximum stat)
variable (new water max)
new water max := get hero stat (who, stat:water, maximum stat)
variable (new lightning max)
new lightning max := get hero stat (who, stat:lightning, maximum stat)
variable (new earth max)
new earth max := get hero stat (who, stat:earth, maximum stat)
variable (new wind max)
new wind max := get hero stat (who, stat:wind, maximum stat)
variable (new strength max)
new strength max := get hero stat (who, stat:strength, maximum stat)
variable (new defense max)
new defense max := get hero stat (who, stat:defense, maximum stat)
if (check tag (75) == on, and, check tag(76) == off, and, check tag (77) == off, and, check tag (7Cool ==off) then
begin
set hero stat (who, stat:fire, ((3 * new fire max) / 2), maximum stat)
set hero stat (who, stat:water, ((3 * new water max) / 2), maximum stat)
set hero stat (who, stat:lightning, ((3 * new lightning max) / 2), maximum stat)
set hero stat (who, stat:earth, ((3 * new earth max) / 2), maximum stat)
set hero stat (who, stat:wind, ((3 * new wind max) / 2), maximum stat)
set hero stat (who, stat:strength ((1 * new strength max) / 2), maximum stat)
set hero stat (who, stat:defense ((1 * new defense max) / 2), maximum stat)
set hero stat (who, stat:fire, maximum stat, current stat)
set hero stat (who, stat:water, maximum stat, current stat)
set hero stat (who, stat:lightning, maximum stat, current stat)
set hero stat (who, stat:earth, maximum stat, current stat)
set hero stat (who, stat:wind, maximum stat, current stat)
set hero stat (who, stat:strength, maximum stat, current stat)
set hero stat (who, stat:defense, maximum stat, current stat)
show text box (137)
wait for text box
set tag (76, on)
set tag (75, off)
end
if (check tag (76)) then
begin
show text box (138)
wait for text box
end
if (check tag (77)) then
begin
set hero stat (who, stat:fire, (2 * new fire max), maximum stat)
set hero stat (who, stat:water, (2 * new water max), maximum stat)
set hero stat (who, stat:lightning, (2 * new lightning max), maximum stat)
set hero stat (who, stat:earth, (2 * new earth max), maximum stat)
set hero stat (who, stat:wind, (2 * new wind max), maximum stat)
set hero stat (who, stat:strength, (2 * new strength max), maximum stat)
set hero stat (who, stat:defense, ((2 * new defense max) / 3), maximum stat)
set hero stat (who, stat:fire, maximum stat, current stat)
set hero stat (who, stat:water, maximum stat, current stat)
set hero stat (who, stat:lightning, maximum stat, current stat)
set hero stat (who, stat:earth, maximum stat, current stat)
set hero stat (who, stat:wind, maximum stat, current stat)
set hero stat (who, stat:strength, maximum stat, current stat)
set hero stat (who, stat:defense, maximum stat, current stat)
set hero stat (who, stat:fire, ((3 * new fire max) / 2), maximum stat)
set hero stat (who, stat:water, ((3 * new water max) / 2), maximum stat)
set hero stat (who, stat:lightning, ((3 * new lightning max) / 2), maximum stat)
set hero stat (who, stat:earth, ((3 * new earth max) / 2), maximum stat)
set hero stat (who, stat:wind, ((3 * new wind max) / 2), maximum stat)
set hero stat (who, stat:strength ((1 * new strength max) / 2), maximum stat)
set hero stat (who, stat:defense ((1 * new defense max) / 2), maximum stat)
set hero stat (who, stat:fire, maximum stat, current stat)
set hero stat (who, stat:water, maximum stat, current stat)
set hero stat (who, stat:lightning, maximum stat, current stat)
set hero stat (who, stat:earth, maximum stat, current stat)
set hero stat (who, stat:wind, maximum stat, current stat)
set hero stat (who, stat:strength, maximum stat, current stat)
set hero stat (who, stat:defense, maximum stat, current stat)
show text box (137)
wait for text box
set tag (76, on)
set tag (77, off)
end
if (check tag (7Cool) then
begin
set hero stat (who, stat:fire, (2 * new fire max), maximum stat)
set hero stat (who, stat:water, (2 * new water max), maximum stat)
set hero stat (who, stat:lightning, (2 * new lightning max), maximum stat)
set hero stat (who, stat:earth, (2 * new earth max), maximum stat)
set hero stat (who, stat:wind, (2 * new wind max), maximum stat)
set hero stat (who, stat:strength, ((2 * new strength max) / 3), maximum stat)
set hero stat (who, stat:defense, (2 * new defense max), maximum stat)
set hero stat (who, stat:fire, maximum stat, current stat)
set hero stat (who, stat:water, maximum stat, current stat)
set hero stat (who, stat:lightning, maximum stat, current stat)
set hero stat (who, stat:earth, maximum stat, current stat)
set hero stat (who, stat:wind, maximum stat, current stat)
set hero stat (who, stat:strength, maximum stat, current stat)
set hero stat (who, stat:defense, maximum stat, current stat)
set hero stat (who, stat:fire, ((3 * new fire max) / 2), maximum stat)
set hero stat (who, stat:water, ((3 * new water max) / 2), maximum stat)
set hero stat (who, stat:lightning, ((3 * new lightning max) / 2), maximum stat)
set hero stat (who, stat:earth, ((3 * new earth max) / 2), maximum stat)
set hero stat (who, stat:wind, ((3 * new wind max) / 2), maximum stat)
set hero stat (who, stat:strength ((1 * new strength max) / 2), maximum stat)
set hero stat (who, stat:defense ((1 * new defense max) / 2), maximum stat)
set hero stat (who, stat:fire, maximum stat, current stat)
set hero stat (who, stat:water, maximum stat, current stat)
set hero stat (who, stat:lightning, maximum stat, current stat)
set hero stat (who, stat:earth, maximum stat, current stat)
set hero stat (who, stat:wind, maximum stat, current stat)
set hero stat (who, stat:strength, maximum stat, current stat)
set hero stat (who, stat:defense, maximum stat, current stat)
show text box (137)
wait for text box
set tag (76, on)
set tag (78, off)
end
end


if it meets the check tag criteria, it will go through the smaller scripts (begin to end) which end with turning tags on and off. if these tags are changed the script needs to end, it can only continue if it doesnt meet the check tag criteria, in which case it moves down to the next check tag, same situation there, if it runs the smaller script it needs to end there
Back to top
View user's profile Send private message Send e-mail
G. Gomez
Guest






PostPosted: Tue Jul 09, 2013 1:17 pm    Post subject: Reply with quote

I don't believe that's the case. Even if the conditional answers false, it will still continue to the next conditional and so on, until it reaches the end of the script. If you want it to end when one of the settings has changed, you should probably break this down into smaller scripts and take a look at the ExitScript command.
Back to top
sotrain515




Joined: 17 May 2010
Posts: 39
Location: Connecticut

PostPosted: Wed Jul 10, 2013 7:16 am    Post subject: Reply with quote

Hello, I have some advice. First, please use the "Code" tags to post your plotscripting samples onto the forums, it makes it so much easier to read. I think you lose tab-indentation out of hand (at least I seem to on Firefox), but spaces will stay. Which brings me to my next advice: please indent your code so that the blocks are more visible. I went ahead and applied these to your second code snippet:

Code:

Plotscript, ninattackfocus, begin
   variable (who)
   who := find hero (hero: kenryoku)
   variable (new fire max)
   new fire max := get hero stat (who, stat:fire, maximum stat)
   variable (new water max)
   new water max := get hero stat (who, stat:water, maximum stat)
   variable (new lightning max)
   new lightning max := get hero stat (who, stat:lightning, maximum stat)
   variable (new earth max)
   new earth max := get hero stat (who, stat:earth, maximum stat)
   variable (new wind max)
   new wind max := get hero stat (who, stat:wind, maximum stat)
   variable (new strength max)
   new strength max := get hero stat (who, stat:strength, maximum stat)
   variable (new defense max)
   new defense max := get hero stat (who, stat:defense, maximum stat)
   if (check tag (75) == on, and, check tag(76) == off, and, check tag (77) == off, and, check tag (78) ==off) then
   begin
      set hero stat (who, stat:fire, ((3 * new fire max) / 2), maximum stat)
      set hero stat (who, stat:water, ((3 * new water max) / 2), maximum stat)
      set hero stat (who, stat:lightning, ((3 * new lightning max) / 2), maximum stat)
      set hero stat (who, stat:earth, ((3 * new earth max) / 2), maximum stat)
      set hero stat (who, stat:wind, ((3 * new wind max) / 2), maximum stat)
      set hero stat (who, stat:strength ((1 * new strength max) / 2), maximum stat)
      set hero stat (who, stat:defense ((1 * new defense max) / 2), maximum stat)
      set hero stat (who, stat:fire, maximum stat, current stat)
      set hero stat (who, stat:water, maximum stat, current stat)
      set hero stat (who, stat:lightning, maximum stat, current stat)
      set hero stat (who, stat:earth, maximum stat, current stat)
      set hero stat (who, stat:wind, maximum stat, current stat)
      set hero stat (who, stat:strength, maximum stat, current stat)
      set hero stat (who, stat:defense, maximum stat, current stat)
      show text box (137)
      wait for text box
      set tag (76, on)
      set tag (75, off)
   end
   if (check tag (76)) then
   begin
      show text box (138)
      wait for text box
   end
   if (check tag (77)) then
   begin
      set hero stat (who, stat:fire, (2 * new fire max), maximum stat)
      set hero stat (who, stat:water, (2 * new water max), maximum stat)
      set hero stat (who, stat:lightning, (2 * new lightning max), maximum stat)
      set hero stat (who, stat:earth, (2 * new earth max), maximum stat)
      set hero stat (who, stat:wind, (2 * new wind max), maximum stat)
      set hero stat (who, stat:strength, (2 * new strength max), maximum stat)
      set hero stat (who, stat:defense, ((2 * new defense max) / 3), maximum stat)
      set hero stat (who, stat:fire, maximum stat, current stat)
      set hero stat (who, stat:water, maximum stat, current stat)
      set hero stat (who, stat:lightning, maximum stat, current stat)
      set hero stat (who, stat:earth, maximum stat, current stat)
      set hero stat (who, stat:wind, maximum stat, current stat)
      set hero stat (who, stat:strength, maximum stat, current stat)
      set hero stat (who, stat:defense, maximum stat, current stat)
      set hero stat (who, stat:fire, ((3 * new fire max) / 2), maximum stat)
      set hero stat (who, stat:water, ((3 * new water max) / 2), maximum stat)
      set hero stat (who, stat:lightning, ((3 * new lightning max) / 2), maximum stat)
      set hero stat (who, stat:earth, ((3 * new earth max) / 2), maximum stat)
      set hero stat (who, stat:wind, ((3 * new wind max) / 2), maximum stat)
      set hero stat (who, stat:strength ((1 * new strength max) / 2), maximum stat)
      set hero stat (who, stat:defense ((1 * new defense max) / 2), maximum stat)
      set hero stat (who, stat:fire, maximum stat, current stat)
      set hero stat (who, stat:water, maximum stat, current stat)
      set hero stat (who, stat:lightning, maximum stat, current stat)
      set hero stat (who, stat:earth, maximum stat, current stat)
      set hero stat (who, stat:wind, maximum stat, current stat)
      set hero stat (who, stat:strength, maximum stat, current stat)
      set hero stat (who, stat:defense, maximum stat, current stat)
      show text box (137)
      wait for text box
      set tag (76, on)
      set tag (77, off)
   end
   if (check tag (78)) then
   begin
      set hero stat (who, stat:fire, (2 * new fire max), maximum stat)
      set hero stat (who, stat:water, (2 * new water max), maximum stat)
      set hero stat (who, stat:lightning, (2 * new lightning max), maximum stat)
      set hero stat (who, stat:earth, (2 * new earth max), maximum stat)
      set hero stat (who, stat:wind, (2 * new wind max), maximum stat)
      set hero stat (who, stat:strength, ((2 * new strength max) / 3), maximum stat)
      set hero stat (who, stat:defense, (2 * new defense max), maximum stat)
      set hero stat (who, stat:fire, maximum stat, current stat)
      set hero stat (who, stat:water, maximum stat, current stat)
      set hero stat (who, stat:lightning, maximum stat, current stat)
      set hero stat (who, stat:earth, maximum stat, current stat)
      set hero stat (who, stat:wind, maximum stat, current stat)
      set hero stat (who, stat:strength, maximum stat, current stat)
      set hero stat (who, stat:defense, maximum stat, current stat)
      set hero stat (who, stat:fire, ((3 * new fire max) / 2), maximum stat)
      set hero stat (who, stat:water, ((3 * new water max) / 2), maximum stat)
      set hero stat (who, stat:lightning, ((3 * new lightning max) / 2), maximum stat)
      set hero stat (who, stat:earth, ((3 * new earth max) / 2), maximum stat)
      set hero stat (who, stat:wind, ((3 * new wind max) / 2), maximum stat)
      set hero stat (who, stat:strength ((1 * new strength max) / 2), maximum stat)
      set hero stat (who, stat:defense ((1 * new defense max) / 2), maximum stat)
      set hero stat (who, stat:fire, maximum stat, current stat)
      set hero stat (who, stat:water, maximum stat, current stat)
      set hero stat (who, stat:lightning, maximum stat, current stat)
      set hero stat (who, stat:earth, maximum stat, current stat)
      set hero stat (who, stat:wind, maximum stat, current stat)
      set hero stat (who, stat:strength, maximum stat, current stat)
      set hero stat (who, stat:defense, maximum stat, current stat)
      show text box (137)
      wait for text box
      set tag (76, on)
      set tag (78, off)
   end
end


Next, some sprucing up and simplification; you have a lot of redundancy that makes it a lot longer than it has to be. For example, you can just set all the stats at the very end and have the different variables be what you want within the if-blocks. Also, variable definition can all be done in a single line at the very top:

Code:

Plotscript, ninattackfocus, begin
   variable (who, new fire max, new water max, new lightning max, new earth max, new wind max, new strength max, new defense max)

   who := find hero (hero: kenryoku)

   new fire max := get hero stat (who, stat:fire, maximum stat)
   new water max := get hero stat (who, stat:water, maximum stat)
   new lightning max := get hero stat (who, stat:lightning, maximum stat)
   new earth max := get hero stat (who, stat:earth, maximum stat)
   new wind max := get hero stat (who, stat:wind, maximum stat)
   new strength max := get hero stat (who, stat:strength, maximum stat)
   new defense max := get hero stat (who, stat:defense, maximum stat)

   if (check tag (75) == on, and, check tag(76) == off, and, check tag (77) == off, and, check tag (78) ==off) then
   begin
      #fire, water, lightning, earth and wind are 150%; strength and defense are 50%
      new fire max := ((3 * new fire max) / 2)
      new water max := ((3 * new water max) / 2)
      new lightning max : = ((3 * new lightning max) / 2)
      new earth max := ((3 * new earth max) / 2)
      new wind max := ((3 * new wind max) / 2)
      new strength max := ((1 * new strength max) / 2)
      new defense max := ((1 * new defense max) / 2)

      show text box (137)
      wait for text box
      set tag (76, on)
      set tag (75, off)
   end
   if (check tag (76)) then
   begin
      show text box (138)
      wait for text box
   end
   if (check tag (77)) then
   begin
      #?????
      new fire max := ((3 * new fire max) / 2)
      new water max := ((3 * new water max) / 2)
      new lightning max : = ((3 * new lightning max) / 2)
      new earth max := ((3 * new earth max) / 2)
      new wind max := ((3 * new wind max) / 2)
      new strength max := ((1 * new strength max) / 2)
      new defense max := ((1 * new defense max) / 2)

      show text box (137)
      wait for text box
      set tag (76, on)
      set tag (77, off)
   end
   if (check tag (78)) then
   begin
      #?????
      new fire max := ((3 * new fire max) / 2)
      new water max := ((3 * new water max) / 2)
      new lightning max : = ((3 * new lightning max) / 2)
      new earth max := ((3 * new earth max) / 2)
      new wind max := ((3 * new wind max) / 2)
      new strength max := ((1 * new strength max) / 2)
      new defense max := ((1 * new defense max) / 2)

      show text box (137)
      wait for text box
      set tag (76, on)
      set tag (78, off)
   end

   #update all the max stats of the hero
   set hero stat (who, stat:fire, new fire max, maximum stat)
   set hero stat (who, stat:water, new water max, maximum stat)
   set hero stat (who, stat:lightning, new lightning max, maximum stat)
   set hero stat (who, stat:earth, new earth max, maximum stat)
   set hero stat (who, stat:wind, new wind max, maximum stat)
   set hero stat (who, stat:strength, new strength max, maximum stat)
   set hero stat (who, stat:defense, new defense max, maximum stat)

   #update all the curr stats of the hero
   set hero stat (who, stat:fire, new fire max, current stat)
   set hero stat (who, stat:water, new water max, current stat)
   set hero stat (who, stat:lightning, new lightning max, current stat)
   set hero stat (who, stat:earth, new earth max, current stat)
   set hero stat (who, stat:wind, new wind max, current stat)
   set hero stat (who, stat:strength, new strength max, current stat)
   set hero stat (who, stat:defense, new defense max, current stat)
end


Now that this post is super-huge, some flaws become obvious. In your original code, you had, in several places, a line such as:

Code:
set hero stat (who, stat:fire, maximum stat, current stat)


I'm guessing what you mean for this to do is to set the current stat equal to the maximum stat. HOWEVER, and this may be confusing, "maximum stat" is itself a constant (similar to "stat:fire") and probably has a value of 0, 1, or 2. What you probably meant to write is:

Code:
set hero stat (who, stat:fire, get hero stat(who, stat:fire, maximum stat), current stat)


Which is kind of cumbersome and ugly, so I spruced it up and just set it to the "new fire stat" variable itself, since that accomplishes the same thing.

The other odd thing about your original code is that.. well, let me illustrate, it's hard to explain. In your second code block, if we just isolate the "fire:stat" stuff, we have the following statements:

Code:

set hero stat (who, stat:fire, (2 * new fire max), maximum stat)
set hero stat (who, stat:fire, maximum stat, current stat)
set hero stat (who, stat:fire, ((3 * new fire max) / 2), maximum stat)
set hero stat (who, stat:fire, maximum stat, current stat)


What this seems to do is to double the fire:stat, set the curr to the max, then 3/2 the fire:stat and set the curr to the max. Ultimately, this is exactly the same as just 3/2 the fire:stat. I'm not sure what you are trying to do here... Maybe you can shed some light and then I can edit my code snippet above, but for now I just left if-blocks #2 and #3 the same as #1.


Finally, as G. Gomez noted, you are setting tag 76 to on after 75 is on and 76 is off in the first block... Definitely look into that. I also have some further tips:

Name your tags! It makes it a lot easier to know what each one supposedly does if you go by their in-game tag names (also exported in your .hsi file) as opposed to "76" and "77". In fact, I usually name all my constants (e.g. textboxes, etc.) so that it's easy(er) to tell at a glance what's going on in the code with fewer comments.

Another thing is that you are not keeping track of the original values anywhere; so if somebody selects the 150% attack twice in a row their stats would boost up twice. Although, that may be me just not understanding how hero stats work, I confess I never deal with them myself.

If I'm understanding right, your tags should also probably be consolidated into a single global variable that has multiple enum options as opposed to various tags. I'm guessing tag 75 is "strong attack", 76 is "normal attack" or somesuch; this would be better served by having a global variable called "attack strength" or something and then checking if it is set to one of three variables. In its current state, you seem to be accounting for cases where a "strong attack" and a "weak attack" are both set to "on", which doesn't really make sense, right? I could be misunderstanding, though.

Phew, sorry for the mega-post. Hope you found it helpful...
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 10, 2013 9:08 am    Post subject: Reply with quote

The mega post was helpful, however this is why nobody understood what I was trying to do. there are four scripts like this one. there is a menu called "Ninja Focus" with four menu items. Jutsu - fire, water, wind, earth, lightning boosted defense and strength lowered. Defense - Defense augmented everything else diminished. Strength - Strength is augmented everything else is diminished. and Balanced. all at normal values. This script runs whenyou choose the Jutsu focus. that is why all of the mini scripts turn tag 76 on, that is the tag saying that that is the mode you are in. tag 75 - in balanced mode
tag 77 - defense. tag 78 - strength.
I moved the already in tag 76 script near the top so a small problem was fixed. you pointing out to use find hero stat (who, stat:x, maximum stat) instead of just maximum stat solved my problem.
in code snippet 2, you are in defensive mode, meaning that the other script already halved the fire stat. so we are doubling it to return it to normal value and then multiplying by 3/2 to bring it up to 150%. thats what confused everyone
Back to top
View user's profile Send private message Send e-mail
sotrain515




Joined: 17 May 2010
Posts: 39
Location: Connecticut

PostPosted: Wed Jul 10, 2013 9:30 am    Post subject: Reply with quote

Quote:
in code snippet 2, you are in defensive mode, meaning that the other script already halved the fire stat. so we are doubling it to return it to normal value and then multiplying by 3/2 to bring it up to 150%. thats what confused everyone


Ah, of course. Okay then, it still has a slight flaw in it, that I can now illustrate for you. To take the "stat:fire" example again (your original code):

Code:
set hero stat (who, stat:fire, (2 * new fire max), maximum stat)
set hero stat (who, stat:fire, maximum stat, current stat)
set hero stat (who, stat:fire, ((3 * new fire max) / 2), maximum stat)
set hero stat (who, stat:fire, maximum stat, current stat)


Now, I already explained about the maximum stat part, so let's just fix that up first:

Code:
set hero stat (who, stat:fire, (2 * new fire max), maximum stat)
set hero stat (who, stat:fire, get hero stat(who, stat:fire, maximum stat), current stat)
set hero stat (who, stat:fire, ((3 * new fire max) / 2), maximum stat)
set hero stat (who, stat:fire, get hero stat(who, stat:fire, maximum stat), current stat)


Okay, now what you are trying to do is to set the stat:fire to double itself and then to 3/2 of its doubled-self. This is not quite what you are doing. What you are doing is setting it to double the "new fire max" variable and then to 3/2 the "new fire max" variable. Effectively just setting it to 3/2 of the "new fire max" variable, which is not what you want to accomplish.

You can fix this by simply combining all of it into one statement; after all, doubling something and then 3/2'ing it is the same as tripling it. For example, if stat:fire was 1, doubling it yields 2 and 3/2'ing that yields 3. I.e.:

Code:
set hero stat (who, stat:fire, (3 * new fire max), maximum stat)
set hero stat (who, stat:fire, get hero stat(who, stat:fire, maximum stat), current stat)


Or, to put it into my "spruced-up" code style:

Code:
new fire max := (3 * new fire max)


With the sets themselves down at the bottom.
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 10, 2013 9:40 am    Post subject: Reply with quote

thanks a ton, now all I have to do is write this 11 more times
Back to top
View user's profile Send private message Send e-mail
sotrain515




Joined: 17 May 2010
Posts: 39
Location: Connecticut

PostPosted: Wed Jul 10, 2013 10:20 am    Post subject: Reply with quote

You're welcome. May I ask why you have to write it 11 more times?
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 10, 2013 11:26 am    Post subject: Reply with quote

because there are 3 characters, each with 4 modes. for a total of 12 scripts. I completed one of them, well at this point 4 of them, and they all work now that I know what I did wrong
Back to top
View user's profile Send private message Send e-mail
BMR
Aspiring Megalomaniac




Joined: 27 Dec 2008
Posts: 21
Location: The Philippines

PostPosted: Wed Jul 10, 2013 5:43 pm    Post subject: Reply with quote

Spreadsheet it. Easy way to make multiple sets of code.

Alternatively, rewrite this to be able to accept different characters/modes. You could then pass the hero number to this, and it'll set everything depending on the hero number passed. That way you won't have to have multiple sets of code that all do the same thing.
_________________
Being from the third world, I reserve the right to speak in the third person.
Back to top
View user's profile Send private message Visit poster's website
sotrain515




Joined: 17 May 2010
Posts: 39
Location: Connecticut

PostPosted: Thu Jul 11, 2013 6:05 am    Post subject: Reply with quote

Yes, and please allow me to elaborate on BMR's alternative suggestion to have your existing code apply to multiple characters...

Let's take your original script's beginning couple of lines (this is based on my revision):

Code:
Plotscript, ninattackfocus, begin
   variable (who, new fire max, new water max, new lightning max, new earth max, new wind max, new strength max, new defense max)

   who := find hero (hero: kenryoku)


If you instead passed in the hero variable, you wouldn't have to have your current one be unique to "hero:kenryoku", it could apply to all of them:

Code:
Plotscript, ninattackfocus, who, begin
   variable (new fire max, new water max, new lightning max, new earth max, new wind max, new strength max, new defense max)


(I removed the "who" variable declaration and initial value and added it as an argument to the script). Then your call of ninattackfocus would just change from:

Code:
ninattackfocus


to

Code:
ninattackfocus(findhero(hero:kenryoku))


and you can just put whatever hero name you want in as an argument when calling the function.

This has the benefit of simplifying your code and making revisions later on much more manageable. Imagine if you decide to add another stat; this way you only have to update one function as opposed to 12 or however many.

As for the modes, I'm guessing that could be simplified, too, but I don't know enough about how your code currently works to be able to tell.

e: VVV Damn, I always do stuff like that... Thanks, fixed it.


Last edited by sotrain515 on Tue Jul 16, 2013 7:09 am; edited 1 time in total
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: Sun Jul 14, 2013 8:34 am    Post subject: Reply with quote

I haven't read through this thread, but I'd just like to point out that "ninattackfocus(hero:kenryoku)" should be "ninattackfocus(findhero(hero:kenryoku))"
_________________
"It is so great it is insanely great."
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
Page 1 of 1

 
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