Jump to content

Changing PC's action points in battle


Xaiya

Recommended Posts

I'm not entirely sure that you mean a PC, but deduct_ap() both works on NPCs when called form inside their creature scripts and on PCs when called from the code of a custom item ability. As far as I know, there's no way to deduct AP from a PC during combat when it, say, steps in a certain location, or something like that.

Link to comment
Share on other sites

Well, I decided to do something different.

Unfortunately, it is acting funky.

It keeps asking me if I want to use it, and only one of the control panels did something.

 

Click to reveal..
Code:
beginstate 11; reset_dialog(); add_dialog_str(0,"There is a control panel here, would you like to use it?",0); add_dialog_choice(0,"No."); add_dialog_choice(1,"Use control panel."); if ((get_flag(4,11) == 0) && (run_dialog(1) == 2)){ print_str_color("The northwest control panel glows.",3); play_sound(45); set_height(11,9,8); set_flag(4,11,1); } if ((get_flag(4,11) == 1) && (run_dialog(1) == 2)){ print_str("Nothing happens."); } if ((get_flag(4,11) == 2) && (run_dialog(1) == 2)){ print_str_color("The northwest control panel glows.",3); play_sound(45); set_height(11,9,7); set_flag(4,11,3); } if ((get_flag(4,11) == 3) && (run_dialog(1) == 2)){ print_str("Nothing happens."); } if ((get_flag(4,11) == 4) && (run_dialog(1) == 2)){ print_str_color("The northwest control panel glows.",3); play_sound(45); set_height(11,9,6); set_flag(4,11,5); } if ((get_flag(4,11) == 5) && (run_dialog(1) == 2)){ print_str("Nothing happens."); } else block_entry(1); break; beginstate 12; reset_dialog(); add_dialog_str(0,"There is a control panel here, would you like to use it?",0); add_dialog_choice(0,"No."); add_dialog_choice(1,"Use control panel."); if ((get_flag(4,11) == 0) && (run_dialog(1) == 2)){ print_str("Nothing happens."); } if ((get_flag(4,11) == 1) && (run_dialog(1) == 2)) { print_str_color("The southwest control panel glows.",3); set_flag(4,11,2); } if ((get_flag(4,11) == 2) && (run_dialog(1) == 2)){ print_str("Nothing happens."); } if ((get_flag(4,11) == 3) && (run_dialog(1) == 2)){ print_str_color("The southwest control panel glows.",3); set_flag(4,11,4); } if ((get_flag(4,11) == 4) && (run_dialog(1) == 2)){ print_str("Nothing happens."); } if ((get_flag(4,11) == 5) && (run_dialog(1) == 2)){ print_str("Nothing happens."); } else block_entry(1);   break; 

(The two control panels are in separate locations.)

Link to comment
Share on other sites

Um, run_dialog() is a call that performs an action (running the parameters of whatever dialog you have set up), not a static call that returns a number. If you want to get what a player did with a dialog choice, have a variable get the value like so:

 

Code:
choice = run_dialog(1);

Note that choice can be replaced with any variable. Then, instead of:

Code:
if ((get_flag(4,11) == 1) && (run_dialog(1) == 2)){ 

You'd use:

Code:
if ((get_flag(4,11) == 1) && (choice == 2)){ 

 

If there proves to be something else wrong with the code, I couldn't find it. No offense, but when your coding style was mangled by UBB, it was like trying to read hieroglyphics.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...