Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Twilight Bracelet script not working


Kite
 Share

Recommended Posts

Ok,so I have this script but it has a problem.
I need it to be clicked,and equiped it,and then make it where you can not click it again to get the stats over,and over again.

Case 3
        If GetPlayerShieldSlot(Index) Then
        Call SetPlayerShieldSlot(Index, 3)
        call setplayerspell(index, 12, 49)
        call setplayerSTR(Index, GetPlayerSTR(Index) + 5)
        call setplayerMAGI(Index, GetPlayerMAGI(Index) + 10)
        call setplayerDEF(Index, GetPlayerDEF(Index) + 5)
        Call PlayerMsg(Index, "The twilight bracelet is shining", WHITE)
        Else
        If GetPlayerShieldSlot(Index) = 3 Then
        Call PlayerMsg(Index, "You allready have the bracelet on", WHITE)
        End If
        End If
        Exit Sub

So,what could be the problem here?
Thanks in advanced.

Tsukasa,The Chosen one
Link to comment
Share on other sites

This is one mistake.
```
If GetPlayerShieldSlot(Index) Then
```it need to be use like this.
```
If GetPlayerShieldSlot(Index) = 10 Then
```or
```
If GetPlayerShieldSlot(Index) > 10 Then
```
10 would be the number item you are checking if the player have that items in the Shield Slot.

Sincerely,
Rithy
Link to comment
Share on other sites

Well if you were making a Scripted Item. Here is the correct one.
```
Case 3
            If GetPlayerShieldSlot(Index) > 0 Then  'Check if the player have any shield on
            Call PlayerMsg(Index, "Please remove your current shield first", WHITE)  'If they do, tell them to remove it and exit
            Exit Sub
            Else
            Call SetPlayerShieldSlot(Index, 3)    'Set the player's shield to Item Number 3
            Call SetPlayerSpell(Index, 12, 49)    'Set the player's spell slot number 12 to spell number 49
            Call SetPlayerSTR(Index, GetPlayerSTR(Index) + 5)    'Increase player's STR by 5
            Call SetPlayerMAGI(Index, GetPlayerMAGI(Index) + 10)    'Increase player's MAGI by 10
            Call SetPlayerDEF(Index, GetPlayerDEF(Index) + 5)      'Increase player's DEF by 5
            Call PlayerMsg(Index, "The twilight bracelet is shining", WHITE)    'Tell them that they are wearing the item
            ElseIf GetPlayerShieldSlot(Index) = 3 Then        'If they already have the item, tell them they already have it on
            Call PlayerMsg(Index, "You already have the bracelet on", WHITE)
            End If
            End If
            Exit Sub

```
I am not sure if this will work perfectly but there are some problem.
1\. It will not take away the item but instead, you'll have one in the Shield Slot and one your inventory.
2\. The Item will permanently increased the user stats, which mean, they can use the items multiple time to increase their stats.
3\. There might be a problem if the user already have a spell on their spell slot number 12.
4\. The item will be Scripted Item. I don't know if it can be used like an Equipment Items. You probably can.

Sincerely,
Rithy

PS : For problem number 1, you can use the For i = 1 to 24(or w.e) to find which slot the item located then tell the script to remove it when the item is double clicked. If I have time, I'll do it for you if you want.
Link to comment
Share on other sites

lol I didn't offer to help you script your item but instead, I was trying to teach you with the scripting.
It's better if you know how to script because then you won't have to ask questions every time you try to script a simple item.
That is why I put comments next to each line of code to explain what each of them does.

Sincerely,
Rithy
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...