| Infiltrator Member # 5566 | written Tuesday, March 8 2005 11:32
Profile
#0 what do i do to make this code work i know almost nothing about scripting i want and am working on a scenario which will include illegal drugs and if you would be so kind i need help on what to do with this script i tried replacing my scenario script with this one but i also need the code for the herb can anyone help me ?
 
 EDIT:i want to make skribbane Herb if anyone has the code for that please give it to me
 
 
 quote:That was the old version. This is the updated version.
 Main difference: Comments, cleaned up.
 
 //This script IS the SCENARIO script.
 //This can be changed and redistributed as you feel necessary.
 
 beginscenarioscript;
 
 variables;
 short WantSDF, NeedSDF, DrugTimer, DrugTimer2, DeadTimer, CleanTimer, Char, Choice;
 DrugTimer = 0;
 DrugTimer2 = 0;
 DeadTimer = 10;
 CleanTimer = 0;
 WantSDF = 0;
 NeedSDF = 0;
 char = get_selected_char();
 
 body;
 
 // This is the state that is called every time the scenario is loaded,
 // even when a save file in the scenario is loaded. Some things that should go here:
 // Names and descriptions of special items.
 // Names and effects of custom special abilities.
 beginstate LOAD_SCEN_STATE;
 break;
 
 // This is the state that is called only once at the very beginning of
 // the scenario. Some things that should go here:
 // The stuff in shops.
 // Creating horses and boats.
 beginstate START_SCEN_STATE;
 // Initialize a few shops.
 
 // Shop 0 - armor
 add_item_to_shop(0,25,25);
 add_item_to_shop(0,26,20);
 add_item_to_shop(0,30,20);
 add_item_to_shop(0,31,10);
 add_item_to_shop(0,35,10);
 add_item_to_shop(0,121,15);
 add_item_to_shop(0,122,15);
 add_item_to_shop(0,126,3);
 add_item_to_shop(0,131,2);
 add_item_to_shop(0,111,15);
 add_item_to_shop(0,16,10);
 add_item_to_shop(0,136,10);
 add_item_to_shop(0,137,10);
 add_item_to_shop(0,141,5);
 
 // Shop 1 - weapons
 add_item_to_shop(1,45,25);
 add_item_to_shop(1,46,20);
 add_item_to_shop(1,50,15);
 add_item_to_shop(1,51,10);
 add_item_to_shop(1,55,5);
 add_item_to_shop(1,65,20);
 add_item_to_shop(1,66,10);
 add_item_to_shop(1,70,5);
 
 // Shop 2 - tools
 add_item_to_shop(2,170,500);
 add_item_to_shop(2,171,500);
 add_item_to_shop(2,172,30);
 add_item_to_shop(2,174,500);
 add_item_to_shop(2,177,500);
 
 // Shop 3 - missiles
 add_item_to_shop(3,85,500);
 add_item_to_shop(3,86,10);
 add_item_to_shop(3,90,10);
 add_item_to_shop(3,95,3);
 add_item_to_shop(3,100,20);
 add_item_to_shop(3,101,10);
 add_item_to_shop(3,105,10);
 
 // Shop 4 - potions
 add_item_to_shop(4,220,4);
 add_item_to_shop(4,221,3);
 add_item_to_shop(4,222,3);
 add_item_to_shop(4,223,2);
 
 // Shop 5 - food
 add_item_to_shop(5,4,500);
 add_item_to_shop(5,6,500);
 add_item_to_shop(5,7,500);
 break;
 
 // This state is called every tick wherever the party is in the scenario.
 // You can use the set_state
 beginstate START_STATE;
 
 //All of this has to do with the timer of the drug and the effects
 //of not using it after being addicted.
 
 //This is here so you can cure them by setting an SDF, which
 //would probably be a good idea.
 if(get_flag(299,29) == 1)
 {
 NeedSDF = 0;
 }
 
 if(CleanTimer > 0)
 {
 DrugTimer = (DrugTimer + 1);
 //This is how many turns pass before a check if you have the
 //drug or not appears. Feel free to set this to whatever you
 //want.
 if (DrugTimer >= 250)
 {
 if(has_item(445))
 {
 reset_dialog();
 add_dialog_str(0, "You feel a craving to consume a drug. Do you?", 0);
 add_dialog_choice(0, "Consume the drug.");
 add_dialog_choice(1, "Don't consume the drug.");
 Choice = run_dialog(0);
 if (Choice == 1)
 {
 print_str("You consume some drugs. You aren't getting high anymore.");
 take_item(445);
 DrugTimer = 0;
 DrugTimer2 = 0;
 }
 if(Choice == 2)
 {
 print_str("You decide to try and get clean");
 CleanTimer = (CleanTimer - 1);
 if(NeedSDF >= 1)
 {
 DrugTimer2 = (DrugTimer2 + 1);
 }
 }
 }
 if((has_item(445) == false) || (Choice == 2))
 {
 if((has_item(445) == false) && (NeedSDF == 0))
 {
 CleanTimer = (CleanTimer - 1);
 }
 //This is checking whether or not the PC is addicted. If so, it
 //will affect the person by random types of damage. These are
 //either a stat decrease or just plain old unblockable damage.
 if(NeedSDF >= 1)
 {
 print_str("You're addicted. You're body can't handle itself!!!");
 DamageType = get_ran(1,1,3);
 StatType = get_ran(1,0,3);
 if(DamageType == 1)
 {
 damage_char(Char,50,4);
 DrugTimer = 0;
 DrugTimer2 = (DrugTimer2 + 1);
 }
 if(DamageType == 2)
 {
 alter_stat(Char,StatType,-3);
 DrugTimer = 0;
 DrugTimer2 = (DrugTimer2 + 1);
 }
 if(DamageType == 3){
 alter_stat(Char,StatType,-1);
 DrugTimer = 0;
 DrugTimer2 = (DrugTimer2 + 1);
 }
 }
 if(DrugTimer2 == (DeadTimer - 1))
 {
 print_str("YOU ARE NEAR DEATH. YOU NEED THE DRUG WHICH YOU HAVE BECOME ADDICTED TO!");
 }
 }
 }
 }
 break;
 
 // Place your own states below. Give each a number at least 10.
 beginstate 10;
 
 Char = who_used_custom_item;
 
 reset_dialog();
 add_dialog_str(0, "This is obviously a type of drug. You are not sure what the effects will be. Do you want to take it anyways?" ,0);
 add_dialog_choice(0, "Yes.");
 add_dialog_choice(1, "No.");
 Choice = run_dialog(0);
 
 if(Choice == 1)
 {
 set_char_status(Char,1,10,1,0);
 set_char_status(Char,2,10,1,0);
 set_char_status(Char,5,10,1,0);
 set_char_status(Char,17,10,1,0);
 set_char_status(Char,22,10,1,0);
 DrugTimer = 0;
 DrugTimer2 = 0;
 
 if(CleanTimer == 0)
 {
 WantSDF = 0;
 }
 
 if(WantSDF >= 12)
 {
 NeedSDF = 1;
 CleanTimer = 1000;
 message_dialog("You feel the drug settle in, it seeps into every part of your body. You feel your body change and become akin to the drug. You are now addicted.","");
 }
 
 if(NeedSDF == 0)
 {
 WantSDF = (WantSDF + 2);
 CleanTimer = (CleanTimer +2);
 }
 }
 
 if(choice == 2)
 {
 
 }
 break;
 
 
 [ Wednesday, March 09, 2005 14:34: Message edited by: hawk king ]
 Posts: 507 |
Registered: Tuesday, March 1 2005 08:00
 |