Jump to content
  • 0

R>@resists


Question

Posted

Hello everyone!

I would like to request a script that could give players the details of resistance through cards/ items equipped by the player, Example: if im wearing ring of flame lord, I type @resist and it shows Fire resistance : 20% and if i have included something like Jakk / Leib Olmai into my equipment, It shows : Fire resistance : 50% or watever. Just a general idea being similar to one server i played a long time ago ( I think 2008 to be exact), was a spanish one so i dont remember the name. Basically once i type @resist, a window popsup saying:

Fire Resistance: 0%

Water Resistance: 0%

Earth Resistance: 0%

Wind Resistance: 0%

Ghost Resistance: 0%

Poison Resistance: 0%

Shadow Resistance: 0%

PLEASE NOTE:

Im not asking for a high end script , all i ask for is an initial script with Bindatcmd for maybe 1 resistance( Example: I type @resists and fire resistance is shown, the script checks itemdb for Jakk/Leib/ROFL ring/Draco card)? and if the script compares the itemdb of the card compounded as mentioned in the brackets, Ill duplicate it for other resists accordingly.

Thanks and Regards,

Santa

Recommended Posts

  • 0
Posted

Ok peoples, here you are. I used item_info_re table in database, but you can change it to item_info according to your own setup.

Also, I just list scripts on items + cards coumpound. If you need the set to be added, you'll have to add it ^^

resistantInfos.txt

ResistList.thumb.jpg.0474a69a8ac2ce43e07a23d34ee9c285.jpg

  • Love 1
  • 0
Posted

Well as far as I can think of it, it's a REALLY big work, cause you can't get the script of an item from it's id (except if there's an info or a command I don't know), except if you're running your server on sql mode. 

So if we're considering this as true, you'll have to list all resistance somewhere, in arrays or something, to retrieve it when you'll run the command (forget it, that's too much work)

On the other hand, if you're on sql mode (or at least if you have the item_db sql table uptodate), you can run an sql command to retrieve the script column of given id and parse it's content to determine the resistance.

Are you fullfilling this pre-requisite?

  • 0
Posted (edited)
22 minutes ago, Alayne said:

Well as far as I can think of it, it's a REALLY big work, cause you can't get the script of an item from it's id (except if there's an info or a command I don't know), except if you're running your server on sql mode. 

So if we're considering this as true, you'll have to list all resistance somewhere, in arrays or something, to retrieve it when you'll run the command (forget it, that's too much work)

On the other hand, if you're on sql mode (or at least if you have the item_db sql table uptodate), you can run an sql command to retrieve the script column of given id and parse it's content to determine the resistance.

Are you fullfilling this pre-requisite?

Hey Alayne, Honestly i dont mind making it an sql mode and since im still in test phase of my server im still flexible and yea I can add the item_db sql table, although Im using the rAmod 2013 item database and in pre-renewal mode, the cards are all pretty much older than that.

Edited by Santafe
  • 0
Posted

Here you are. Can't test it right now, but this should more or less be what you're expecting.

Finally I've made it entirely, as it was easier for me to handle it through array.

resistantInfos.txt

If somebody have better ideas than that, you're to go ^^

You just have to fill pos array, I'm currently only checking Armor and a wrong value of Head. Fill with EQI_ARMOR, EQI_WEAPON...and so on.

  • 0
Posted
35 minutes ago, Alayne said:

Here you are. Can't test it right now, but this should more or less be what you're expecting.

Finally I've made it entirely, as it was easier for me to handle it through array.

resistantInfos.txt

If somebody have better ideas than that, you're to go ^^

You just have to fill pos array, I'm currently only checking Armor and a wrong value of Head. Fill with EQI_ARMOR, EQI_WEAPON...and so on.

Does not work?
 

-	script	Resist Manager::alarm	-1,{
    end;
	
OnAtcommand:	
	setarray .@resistsValues[0], 0, 0, 0, 0, 0, 0, 0, 0, 0;
	setarray .@resistsType$[0], "Fire", "Water", "Wind", "Earth", "Holy", "Dark", "Ghost", "Poison", "Neutral";
	
	//ARMOR
	setarray .@equipPos[0], EQI_ARMOR, EQI_HEAD;
	freeloop 1;
	for( .@r = 0; .@r < getarraysize(.@resistsValues); .@r++ ) {
		for( .@p = 0; .@p < getarraysize(.@equipPos); .@p++ ) {
			.@id = getequipid(.@pos);
			
			//get equip resists
			.@resistsValues[.@r] += callsub("OnGetResist", .@r, .@id);
			
			//now, check cards coumpounded
			for( .@i = 0; .@i < 4; .@i++ ) {
				.@id = getequipcardid(.@pos, .@i);
				if(.@id > 0) {
					.@resistsValues[.@r] += callsub("OnGetResist", .@r, .@id);
				}
			}
		}
	}
	freeloop 0;
	dispbottom "-------------------Resist Values-------------------";
	for( .@r = 0; .@r < getarraysize(.@resistsValues); .@r++ ) {
		dispbottom "	~" + .@resistsType$[.@r] + " --> " + .@resistsValues[.@r];
	}
	end;
	
OnGetResist:
	query_sql("SELECT `script` FROM `item_db` WHERE `id` = " + getarg(1), .@result$);
	if(getarraysize(.@result$) > 0) {
		.@script$ = .@result$[0];
		.@seekStr$ = "bonus2 bSubEle,Ele_";
		switch(getarg(0)) {
			case 0:
				.@seekStr$ += "Fire",
				break;
			case 1:
				.@seekStr$ += "Water",
				break;
			case 2:
				.@seekStr$ += "Wind",
				break;
			case 3:
				.@seekStr$ += "Earth",
				break;
			case 4:
				.@seekStr$ += "Holy",
				break;
			case 5:
				.@seekStr$ += "Dark",
				break;
			case 6:
				.@seekStr$ += "Ghost",
				break;
			case 7:
				.@seekStr$ += "Poison",
				break;
			case 8:
				.@seekStr$ += "Neutral",
				break;
		}
		if(compare(.@script$, .@seekStr$) == 1) {
			explode(.@dest$, .@script$, .@seekStr$);
			if(getarraysize(.@seekStr$) > 1)
			{
				.@valueAfter$ = .@seekStr$[1];
				explode(.@values$, .@valueAfter$, ";");
				if(getarraysize(.@values$) > 1) {
					.@realValue = atoi(.@values$[0]);
				}
			}
		}
	}
	return .@realValue;
	
OnInit:
	bindatcmd "resistlist",strnpcinfo(3) + "::OnAtcommand";
	end;
}


 

Capture.PNG

  • 0
Posted (edited)
14 minutes ago, Elysium said:

Does not work?
 


-	script	Resist Manager::alarm	-1,{
    end;
	
OnAtcommand:	
	setarray .@resistsValues[0], 0, 0, 0, 0, 0, 0, 0, 0, 0;
	setarray .@resistsType$[0], "Fire", "Water", "Wind", "Earth", "Holy", "Dark", "Ghost", "Poison", "Neutral";
	
	//ARMOR
	setarray .@equipPos[0], EQI_ARMOR, EQI_HEAD;
	freeloop 1;
	for( .@r = 0; .@r < getarraysize(.@resistsValues); .@r++ ) {
		for( .@p = 0; .@p < getarraysize(.@equipPos); .@p++ ) {
			.@id = getequipid(.@pos);
			
			//get equip resists
			.@resistsValues[.@r] += callsub("OnGetResist", .@r, .@id);
			
			//now, check cards coumpounded
			for( .@i = 0; .@i < 4; .@i++ ) {
				.@id = getequipcardid(.@pos, .@i);
				if(.@id > 0) {
					.@resistsValues[.@r] += callsub("OnGetResist", .@r, .@id);
				}
			}
		}
	}
	freeloop 0;
	dispbottom "-------------------Resist Values-------------------";
	for( .@r = 0; .@r < getarraysize(.@resistsValues); .@r++ ) {
		dispbottom "	~" + .@resistsType$[.@r] + " --> " + .@resistsValues[.@r];
	}
	end;
	
OnGetResist:
	query_sql("SELECT `script` FROM `item_db` WHERE `id` = " + getarg(1), .@result$);
	if(getarraysize(.@result$) > 0) {
		.@script$ = .@result$[0];
		.@seekStr$ = "bonus2 bSubEle,Ele_";
		switch(getarg(0)) {
			case 0:
				.@seekStr$ += "Fire",
				break;
			case 1:
				.@seekStr$ += "Water",
				break;
			case 2:
				.@seekStr$ += "Wind",
				break;
			case 3:
				.@seekStr$ += "Earth",
				break;
			case 4:
				.@seekStr$ += "Holy",
				break;
			case 5:
				.@seekStr$ += "Dark",
				break;
			case 6:
				.@seekStr$ += "Ghost",
				break;
			case 7:
				.@seekStr$ += "Poison",
				break;
			case 8:
				.@seekStr$ += "Neutral",
				break;
		}
		if(compare(.@script$, .@seekStr$) == 1) {
			explode(.@dest$, .@script$, .@seekStr$);
			if(getarraysize(.@seekStr$) > 1)
			{
				.@valueAfter$ = .@seekStr$[1];
				explode(.@values$, .@valueAfter$, ";");
				if(getarraysize(.@values$) > 1) {
					.@realValue = atoi(.@values$[0]);
				}
			}
		}
	}
	return .@realValue;
	
OnInit:
	bindatcmd "resistlist",strnpcinfo(3) + "::OnAtcommand";
	end;
}

 

Capture.PNG

Try https://pastebin.com/R6rVrfS0

Edited by AdrianoGC
  • 0
Posted

Good suggestion @Santafe .

I'd like to have these kind of atcommands for all status changes in future, for debugging purposes. But that'd need some code refactorizations i think :/

  • Upvote 1
  • 0
Posted (edited)

As I said I can't debug it, so it's just the skeleton. But that's the main idea (and it require item_db to be uptodate on sql table)

Edited by Alayne
  • 0
Posted
32 minutes ago, Alayne said:

As I said I can't debug it, so it's just the skeleton. But that's the main idea (and it require item_db to be uptodate on sql table)

Hey Alayne! I tried to run the script after using the sql table for item_db, i think the problem is with the EQI_ARMOR and EQI_HEAD part? cuz i tested steel chonchon card on cotton shirt but nothing showed, theres no error in console either, it just shows the line " -----resist values----" 

  • 0
Posted
Quote

You just have to fill pos array, I'm currently only checking Armor and a wrong value of Head. Fill with EQI_ARMOR, EQI_WEAPON...and so on.

As said. And as said, can't debug it now, so either you'll have to debug it (logic isn't really hard to figure), otherwise wait for me to debug it ^^

  • 0
Posted
47 minutes ago, Jey said:

Good suggestion @Santafe .

I'd like to have these kind of atcommands for all status changes in future, for debugging purposes. But that'd need some code refactorizations i think :/

I think more efficient is doing source modification I think?

  • 0
Posted
5 minutes ago, Alayne said:

As said. And as said, can't debug it now, so either you'll have to debug it (logic isn't really hard to figure), otherwise wait for me to debug it ^^

Alright xD I tried to see the logic, ill wait for the debug cuz i tried to edit a few things but something is the issue with displaybottom message? after the ----Resist values--- Just a suggestion on where to look xD

  • 0
Posted

Honestly, don't know. I don't understand how that's possible, cause it should at least have written something like

-----Resist-----

~Fire -> 0%

~Water -> 0%

~Wind -> 0%

...

 

  • 0
Posted (edited)
7 hours ago, Alayne said:

Ok peoples, here you are. I used item_info_re table in database, but you can change it to item_info according to your own setup.

Also, I just list scripts on items + cards coumpound. If you need the set to be added, you'll have to add it ^^

resistantInfos.txt

ResistList.thumb.jpg.0474a69a8ac2ce43e07a23d34ee9c285.jpg

Hey Alayne! I tried running it, I guess its something to do with my rA version? cuz all i see is this:

 

Test1.jpg

I even changed item_db_re to item_db, so since im using a 2013 client supporting server, and since i suck at scripting I do have to ask this stupid question, did rA implement support for smthing like freeloop after 2013 servers? O_o cuz it seems to me that the loop area is the one causing this to not show up.

Edit:

Just found this on my server side lol:

 

Untitled.png

Edited by Santafe
  • 0
Posted

Hum...That's strange. You've changed the script right? It's hard to say cause we don't use the same version so, it's difficult to locate the issue...Can you add some debugmes at logic places in the script to see which command cause the issue? I don't think that's the freeloop, cause it says it blocks on a variable attribution (set error), but can't say which one this way :/

  • 0
Posted (edited)

As said earlier, you need to have an uptodate item_info_re on database if you're using the script as I gave it.

Edited by Alayne
  • 0
Posted
12 minutes ago, Alayne said:

As said earlier, you need to have an uptodate item_info_re on database if you're using the script as I gave it.

hmmm as far i can see i check my table but i use item_db_re also XD

Join the conversation

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

Guest
Answer this question...

×   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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...