Buff management function

Banana Lord

Member
I want to make a function that will make sure a character can fit in at least one more AT buff. So if they have 2 AT songs active and they can hold a maximum number of 3 in their head then the function will do nothing. However, if they have 3 active then it will shrug 1. It won't do this at random, rather it will try to shrug a buff that the user has the skill for (so that they can easily replace it later). If the user has the skill to cast a number of their active AT buffs then the script will shrug the one that costs the least MP.

The main application for this is to make a slot available for eatdrink to run ode, and then ditch ode so that the user has access to all of their song slots again.

I haven't got very far xD
PHP:
void make_room_for_at_buff()
	{
	boolean four_songs = boolean_modifier("four songs");
	boolean extra_song = boolean_modifier("additional song");
	int max_songs = 3 + to_int(four_songs) + to_int(extra_song);
	
	if(num_songs == max_songs)
		{
		remove one
		}
	}
 

Banana Lord

Member
That script would have been handy when I was trying to write a get_buffbot_buffs function for NCF.ash >_> What do you think of this code? I haven't tested it yet, so it could be completely broken for all I know.
PHP:
void get_buffbot_buffs()
	{
	print("Getting buffs from buffbots", "blue");	
	###implement later    load_current_map("NCF_Buffbot_Data", buffbot_data);
	file_to_map("NCF_Buffbot_Data.txt", buffbot_data);
	file_to_map("NCF_Buffbot_Buffs.txt", buffbot_buffs);
	string message;
	int meat;
	int time_waited;
	int pause = 5;
	int max_time = 60;
	
	foreach effect in buffbot_buffs
		{
		foreach buffbot in buffbot_data
			{
			if(buffbot_online(buffbot) && have_effect(effect.to_effect()) < my_adventures())
				{
				meat = buffbot_data [buffbot, effect];
				message = "";
				if(buffbot == "buffy")
					message = my_adventures()+" "+effect;
				
				kmail(buffbot, message, meat);
				time_waited = 0;
				while(have_effect(effect.to_effect()) < my_adventures() && time_waited < max_time)
					{
					waitq(pause);
					time_waited += pause;
					refresh_status();
					}
				}
			}
		}
	}
 

Banana Lord

Member
I'm about to sign off for the day so I haven't gone into to it too far, but is it possible to request a certain number of turns of a buff with acquireBuff.ash? The only parameter for calling it is (effect e), so how does it know how many turns of an effect to get? If I've only got 5 turns of empathy and I execute acquireBuff(empathy); it won't do anything will it?
 
Top