Skip to content

Scoundrel Add Shrapnel Script

I'm having trouble getting this to add shrapnel to all my IEDs. It's triggered off me dropping a specific item, and relies on another reflex to let it know when to change types. Could anyone please point out where I'm going wrong?

display_notice("Starting","red","black"); //here for testing
set_variable('flavor',0)// simple script variable to track which type of IED is being modified
for (to_number(get_variable('flavor'))<=8){
    display_notice(get_variable('flavor'),"red","black");
        switch(to_number(get_variable('flavor'))){  // switch case to set the bomb simple variable to the each ied type
                case 0:
                set_variable('bomb',"handful");
                break;
                case 1:
                set_variable('bomb',"cylinder");
                break;
                case 2:
                set_variable('bomb',"sphere");
                break;
                case 3:
                set_variable('bomb',"grenade");
                break;
                case 4:
                set_variable('bomb',"box");
                break;
                case 5:
                set_variable('bomb',"apparatus");
                break;
                case 6:
                set_variable('bomb',"rod");
                break;
                case 7:
                set_variable('bomb',"canister");
                break;
                case 8:
                set_variable('bomb',"launcher");
                break;
        }
        
        

        
        send_command("add shrapnel to " + get_variable('bomb')); //add shrapnel to current ied type
        
        setTimeout(send_command("put " + get_variable('bomb') + " in " + get_variable('bombcase')), 4500);//wait for balance, then put bomb in a case to let the next one get mod'd
 
    if (get_variable('iedflag') == 1){ //iedflag is set to 1 by a reflex proc'ing off of 'You don't have an explosive of that type', letting it cycle to the next ied flavor
        inc_variable('flavor', 1); //next flavor
        set_variable('iedflag',0); //reset the flag
    }
                       }
    

Comments

  • It might be that the break statement is exiting the entire script/for loop? Perhaps if (flavor == x) {bomb = "type"} elseif ... might be preferable;
    I'd suggest avoiding using get_ and set_ for local variables: Is flavor local to the for loop? if yes, have for (flavor =0; flavor <8; flavor++) as your opening statement for the for loop

    What messages do you get displayed? maybe adding additional for debugging, especially your increment off iedflag, would be useful 
Sign In or Register to comment.