Jump to content
  • 0
Host32

Create restrictions to equip cards

Question

Hello guys!

 

Im doing some tests with strategic elements and like to create some restrictions to equip cards and dont know if is possible...

 

The first thing is make possible to a card occupy 2 slots, for eg, a specific OP card occupies 2 slots when a common card occupies only 1.

 

The second thing is limit some cards to an specific subtype of item, for eg, a type of card specific for daggers, another type specific for axes and etc.

 

What you guys suggest me? I'll need a plugin or it's possible in a script?

 

Thanks in advance :)

Share this post


Link to post
Share on other sites

12 answers to this question

Recommended Posts

  • 0

@@Host32

 

If the type thing is only for weapons you could check if the equip is a weapon with getiteminfo( .@equipmentId, 2 ), if its 4 its a weapon and to get the weapon type you can use getiteminfo( .@equipmentId, 14 ) that will return the view id of the item, but for weapons it determines what type they are. You can read that up here: http://herc.ws/wiki/Custom_Items

 

Formatting here messes to much with that script, take a look here: http://pastebin.com/QR88u3Ss

Edited by Winterfox

Share this post


Link to post
Share on other sites
  • 0

I experimented with that a bit it is possible to do the first part in a script. Might be buggy though, didn't really test it but it should be able to do what you want. Even though i think performance wise it will be too taxing to be really of use in a live environment. I still think a plugin will do a lot better. The second one would be also possible but i lost the motivation too put in more work atm. It also would add even more layers of performance eaters. But maybe you can use it as prototype to test the idea out or something.

-	script	CARD_CHECK	-1,{	OnInit:		// Card ID		setarray .@cardIds$, 1, 2, 3, 4, 5, 6;		.@cardIdPattern$ = implode( .@cardIds$, ":" );				while( sleep( 5000 ) ) {			.@resCount = query_sql( "SELECT `account_id` FROM `char` WHERE online = 1", .@accountIds );			for( .@i = 0; .@i < .@resCount; .@i++ ) {				if( attachrid( .@accountIds[ .@i ] ) ) {					for( .@y = 1; .@y < 20; .@y++ ) {						if( getequipisequiped( .@y ) ) {							.@equipmentId = getequipid( .@y );							.@eqSlotSpace = getitemslots( .@equipmentId );							.@eqOccupiedSlots = getequipcardcnt( .@y );							.@eqInfoCards$[ 0 ] = getequipcardid( .@y, 0 );							.@eqInfoCards$[ 1 ] = getequipcardid( .@y, 1 );							.@eqInfoCards$[ 2 ] = getequipcardid( .@y, 2 );							.@eqInfoCards$[ 3 ] = getequipcardid( .@y, 3 );						}												for( .@x = 0; .@x < 4; .@x++ ) {							if( compare( .@cardIdPattern$, .@eqInfoCards$[ .@x ] ) )								.@eqOccupiedSlots += 1;						}												if( ( .@eqSlotSpace - .@eqOccupiedSlots ) > 0 ) {							successremovecards .@y;							dispbottom "You tried to add more cards to " + getequipname( .@y ) + " as allowed.";								}					}				}			}		}	end;}

Share this post


Link to post
Share on other sites
  • 0

@@Winterfox you're really awesome :D

 

About the script, it really seems to me a great Hack, in Brazil we call it 'gambiarra' :P But I think good for some initial tests

 

I was trying to use the item script to validate the card, but your idea worked better hehe

 

On the second topic, there is a way to get the subtype of the item or I really need to create some arrays in the script and manually tell what is a sword or a dagger?

 

Thanks

Share this post


Link to post
Share on other sites
  • 0

@@Host32

 

If the type thing is only for weapons you could check if the equip is a weapon with getiteminfo( .@equipmentId, 2 ), if its 4 its a weapon and to get the weapon type you can use getiteminfo( .@equipmentId, 14 ) that will return the view id of the item, but for weapons it determines what type they are. You can read that up here: http://herc.ws/wiki/Custom_Items

 

Formatting here messes to much with that script, take a look here: http://pastebin.com/TqfhE9vn

 

What does the purpose of this creating a restriction? i'm bit confuse of this request.

Share this post


Link to post
Share on other sites
  • 0

@Vlync 

 

experiments :)

 

I am testing some different ideas of gameplay...

Edited by Host32

Share this post


Link to post
Share on other sites
  • 0

@@Winterfox

You forgot to clear .@accountIds array at next iteration.

 

 

 

Also this would not be suitable for large server, attaching and detaching 100's of players would take much processing.

Share this post


Link to post
Share on other sites
  • 0

@@Winterfox

You forgot to clear .@accountIds array at next iteration.

 

 

 

Also this would not be suitable for large server, attaching and detaching 100's of players would take much processing.

 

@@Dastgir

 

Both points might be true, that is why i said in the second post i did:

I experimented with that a bit it is possible to do the first part in a script. Might be buggy though, didn't really test it but it should be able to do what you want. Even though i think performance wise it will be too taxing to be really of use in a live environment.

 

But thanks for reminding me to reset that variable. I tend to forget the weird behaviour of not resetting a array completly but to just update as far as the values go when used in functions.

Edited by Winterfox

Share this post


Link to post
Share on other sites
  • 0
now I see how best is to create a plugin for it, however, it was cheaper to write a script for my tests :P
 
what I'm really testing are some changes in gameplay, a kind of prototype, if it really look good I make a plugin :)
Edited by Host32

Share this post


Link to post
Share on other sites
  • 0

You can check for hook functions pc->can_insert_card and pc->can_insert_card_into.

First check is card can be used by itself, second check if this card can be inserted to this item

Share this post


Link to post
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
Answer this question...

×   Pasted as rich text.   Restore formatting

  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.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.