Jump to content
  • 0

help[SQL] Removing Armors while simultaneously giving back a new armor plus whatever card was socketed


archilles89

Question


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  72
  • Reputation:   0
  • Joined:  10/28/12
  • Last Seen:  

Hello, I don't know whether this is the correct place to place to post this.
I am new at SQL and am trying to learn, but the concept of inserting commands into SQL Machine seems easy enough.

 

I am trying to remove a specific type of armor from all players in inventory, and storage while simultaneously giving back to them a new armor plus whatever card that was socketed into their previous armor. Is this possbile? If so, can you guide me step by step?

Thanks for taking the time to read this. I really need this guys. Appreciate any help I can get. :(

Link to comment
Share on other sites

15 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  72
  • Reputation:   0
  • Joined:  10/28/12
  • Last Seen:  

Hello, I don't know whether this is the correct place to place to post this.

I am new at SQL and am trying to learn, but the concept of inserting commands into SQL Machine seems easy enough.


 


I am trying to remove a specific type of armor from all players in
inventory, and storage while simultaneously giving back to them a new
armor plus whatever card that was socketed into their previous armor. Is
this possbile? If so, can you guide me step by step?


Thanks for taking the time to read this. I really need this guys. Appreciate any help I can get. :(

Edited by Emistry
topic merged.
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  

Try this one, I'm at school so please bear with me if i commit mistake ( inventory or equipment only ) :

-    script    Sample    -1,{
OnPCLoginEvent:
    set .@armor, 2302;
    getinventorylist;
    for ( set .@i, 0; .@i < @inventorylist_count; set .@i, .@i + 1 ) {
        if ( @inventorylist_id[.@i] == .@armor ) {
            set .@count, .@count + 1;
            if ( .@count > 1 ) end;
            if ( getequipid(2) == .@armor ) {
                if ( !getequipcardcnt(2) ) end;
                    successremovecards 2;
                    mes "Success";
            } else {
                set .@cards, @inventorylist_card1[.@i];
                if ( !.@cards ) end;
                delitem @inventorylist_id[.@i], 1;
                getitem .@armor, 1;
                getitem .@cards, 1;
                mes "Success!";
            }
        }
    }
    end;
}
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  72
  • Reputation:   0
  • Joined:  10/28/12
  • Last Seen:  

Thank you! I will try it out and let you know the result!


Try this one, I'm at school so please bear with me if i commit mistake ( inventory or equipment only ) :

-    script    Sample    -1,{
OnPCLoginEvent:
    set .@armor, 2302;
    getinventorylist;
    for ( set .@i, 0; .@i < @inventorylist_count; set .@i, .@i + 1 ) {
        if ( @inventorylist_id[.@i] == .@armor ) {
            set .@count, .@count + 1;
            if ( .@count > 1 ) end;
            if ( getequipid(2) == .@armor ) {
                if ( !getequipcardcnt(2) ) end;
                    successremovecards 2;
                    mes "Success";
            } else {
                set .@cards, @inventorylist_card1[.@i];
                if ( !.@cards ) end;
                delitem @inventorylist_id[.@i], 1;
                getitem .@armor, 1;
                getitem .@cards, 1;
                mes "Success!";
            }
        }
    }
    end;
}

The script is showing line 1 error. I don't understand the script, how do I delete 2305 Jacket[1] and replace it with 2302 Cotton Shirt[1] plus whatever card the player was using? Thanks for the help I really appreciate this.
 

Edited by archilles89
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  

The script is showing line 1 error.

Show the error

 

how do I delete 2302 Cotton Shirt[1] and replace it with 2305 Jacket[1] plus whatever card the player was using?

Change 2302 to 2305

set .@armor, 2302;
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  72
  • Reputation:   0
  • Joined:  10/28/12
  • Last Seen:  

Change 2302 to 2305

set .@armor, 2302;

 

But then won't I still get the same armor back? since

getitem .@armor, 1;

Error:

post-9514-0-75839500-1378551869_thumb.png

Edited by archilles89
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  

Try :

-    script    Sample    -1,{
OnPCLoginEvent:
    set .@armor, 2305;
    if ( countitem(.@armor) > 1 ) end;
    getinventorylist;
    for ( set .@i, 0; .@i < @inventorylist_count; set .@i, .@i + 1 ) {
        if ( @inventorylist_id[.@i] == .@armor ) {
            if ( getequipid(2) == .@armor ) {
                if ( !getequipcardcnt(2) ) end;
                    successremovecards 2;
                    mes "Success";
            } else {
                set .@cards, @inventorylist_card1[.@i];
                if ( !.@cards ) end;
                delitem @inventorylist_id[.@i], 1;
                getitem 2302, 1;
                getitem .@cards, 1;
                mes "Success!";
            }
        }
    }
    end;
}
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  72
  • Reputation:   0
  • Joined:  10/28/12
  • Last Seen:  

Okay, what about a 4 slotted weapons?

Error screenshot is posted.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  

post-9514-0-75839500-1378551869_thumb.pn
 
This :
-<TAB>script<TAB>Sample<TAB>-1,{
Okay, what about a 4 slotted weapons?

That is a different story

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  72
  • Reputation:   0
  • Joined:  10/28/12
  • Last Seen:  

 

post-9514-0-75839500-1378551869_thumb.pn
 
This :
-<TAB>script<TAB>Sample<TAB>-1,{

Okay, what about a 4 slotted weapons?

That is a different story

 

So it's not possible? What about doing this through SQL?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  

It's possible. but will re-script for that purpose. It can be done trough SQL however i think you need to relog your character before you see update that your item is deleted.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  72
  • Reputation:   0
  • Joined:  10/28/12
  • Last Seen:  

Uhm, I can wait for your script :)
Here's the full story, I have a [2] Armors, Shoes, Manteau, which I am going to remove but too many players have them already. So I need some way to remove all those items, and replace them with a new one, plus with all the cards they've socketed.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  

Try :

-    script    Sample    -1,{
OnPCLoginEvent:
    set .to_remove, 2305;
    set .to_give, 2302;
    if ( countitem( .to_remove ) > 1 ) end;
    getinventorylist;
    for ( set .@i, 0; .@i < @inventorylist_count; set .@i, .@i + 1 ) {
        if ( @inventorylist_id[.@i] == .to_remove ) {
            if ( getequipid(2) == .to_remove ) {
                if ( !getequipcardcnt(2) ) end;
                    successremovecards 2;
                    mes "Success";
            } else {
                set .@card1, @inventorylist_card1[.@i];
                set .@card2, @inventorylist_card2[.@i];
                set .@card3, @inventorylist_card3[.@i];
                set .@card4, @inventorylist_card4[.@i];
                delitem @inventorylist_id[.@i], 1;
                getitem .to_give, 1;
                if ( .@card1 )
                    getitem .@card1, 1;
                if ( .@card2 )
                    getitem .@card2, 1;
                if ( .@card3 )
                    getitem .@card3, 1;
                if ( .@card4 )
                    getitem .@card4, 1;
                mes "Success!";
            }
        }
    }
    end;
}
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  72
  • Reputation:   0
  • Joined:  10/28/12
  • Last Seen:  

Try :

-    script    Sample    -1,{
OnPCLoginEvent:
    set .to_remove, 2305;
    set .to_give, 2302;
    if ( countitem( .to_remove ) > 1 ) end;
    getinventorylist;
    for ( set .@i, 0; .@i < @inventorylist_count; set .@i, .@i + 1 ) {
        if ( @inventorylist_id[.@i] == .to_remove ) {
            if ( getequipid(2) == .to_remove ) {
                if ( !getequipcardcnt(2) ) end;
                    successremovecards 2;
                    mes "Success";
            } else {
                set .@card1, @inventorylist_card1[.@i];
                set .@card2, @inventorylist_card2[.@i];
                set .@card3, @inventorylist_card3[.@i];
                set .@card4, @inventorylist_card4[.@i];
                delitem @inventorylist_id[.@i], 1;
                getitem .to_give, 1;
                if ( .@card1 )
                    getitem .@card1, 1;
                if ( .@card2 )
                    getitem .@card2, 1;
                if ( .@card3 )
                    getitem .@card3, 1;
                if ( .@card4 )
                    getitem .@card4, 1;
                mes "Success!";
            }
        }
    }
    end;
}

It works fine now Thanks!!

So if I wanted to remove multiple items and give out multiple new items and cards back I just re-use the script?

Edited by archilles89
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  

Hmm :

set .to_remove, 2305; // to be deleted
set .to_give, 2302; // to be get


So if I wanted to remove multiple items and give out multiple new items and cards back I just re-use the script?

Use an array if you want it that way.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  72
  • Reputation:   0
  • Joined:  10/28/12
  • Last Seen:  

Use an array if you want it that way.

 

/omg

Sorry but I'm not that good in scripting. Can you help me?

Okay so this works while in inventory or as equipment, how can I make it work for storage?

Link to comment
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.   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.

×
×
  • Create New...