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

Question


Skillzalot
 Share

Recommended Posts

I have been working on this script that allows a set of armor if your a warrior to add to your strength and defense if you have it equipped. How would i make it so if you take it off it goes away. Here is the current script script

```
Sub WarriorSet1()
Dim x
Dim Index
X = 0
Index = 1

Do While X = 0
  If GetPlayerClass(Index) = 1 and GetPlayerArmorSlot(Index) = 51 and GetPlayerLegsSlot(Index) = 52  and GetPlayerHelmetSlot(Index) = 53 and GetPlayerNecklaceSlot(Index) = 54 and GetPlayerRingSlot(Index) = 55 and GetPlayerShieldSlot(Index) = 56 and GetPlayerWeaponSlot(Index) = 57 Then
      Call PlayerMsg(Index, "You feel the energy of your equipped items, 13)
      Call SetPlayerSTR(Index, GetPlayerSTR(Index) + 10)
      Call SetPlayerDEF(Index, GetPlayerDEF(Index) + 10)
  End If
  Index = Index + 1
  If Index = 100 Then
      X = 1
  End If
Loop
End Sub
```
I dont know where i would place that script.
Link to comment
Share on other sites

im talking about making it so if you have all those things equipped and your a warrior you get those stats increase. Then when you take one thing off it takes away the stat increase. I also dont know if there is a sub to check equipped items
Link to comment
Share on other sites

```
Sub WarriorSet1()
Dim x
Dim Index
X = 0
Index = 1

Do While X = 0
If GetPlayerClass(Index) = 1 and GetPlayerArmorSlot(Index) = 51 and GetPlayerLegsSlot(Index) = 52  and GetPlayerHelmetSlot(Index) = 53 and GetPlayerNecklaceSlot(Index) = 54 and GetPlayerRingSlot(Index) = 55 and GetPlayerShieldSlot(Index) = 56 and GetPlayerWeaponSlot(Index) = 57 Then
Call PlayerMsg(Index, "You feel the energy of your equipped items, 13)
Call SetPlayerSTR(Index, GetPlayerSTR(Index) + 10)
Call SetPlayerDEF(Index, GetPlayerDEF(Index) + 10)
End If
Index = Index + 1
If Index = 100 Then
X = 1
End If
Loop
End Sub

```
Just tidyed it up.

Ok now in Sub TimedEvent

Add Call WarriorSet1()

It should work.
Link to comment
Share on other sites

```
Sub WarriorSet1()
Dim x
Dim Index
X = 0
Index = 1

Do While X = 0
If GetPlayerClass(Index) = 1 And GetPlayerArmorSlot(Index) = 51 And GetPlayerLegsSlot(Index) = 52  And GetPlayerHelmetSlot(Index) = 53 And GetPlayerNecklaceSlot(Index) = 54 And GetPlayerRingSlot(Index) = 55 And GetPlayerShieldSlot(Index) = 56 And GetPlayerWeaponSlot(Index) = 57 Then
Call PlayerMsg(Index, "You feel the energy of your equipped items", 13)
Call SetPlayerSTR(Index, GetPlayerSTR(Index) + 10)

Call SetPlayerDEF(Index, GetPlayerDEF(Index) + 10)

End If

If Not GetPlayerArmorSlot(Index) = 51 Or Not GetPlayerLegsSlot(Index) = 52  Or Not GetPlayerHelmetSlot(Index) = 53 Or Not GetPlayerNecklaceSlot(Index) = 54 Or Not GetPlayerRingSlot(Index) = 55 Or Not GetPlayerShieldSlot(Index) = 56 Or Not GetPlayerWeaponSlot(Index) = 57 Then
Call PlayerMsg(Index, "You no longer feel the energy of your equipped items", 13)
Call SetPlayerSTR(Index, GetPlayerSTR(Index) - 10)
Call SetPlayerDEF(Index, GetPlayerDEF(Index) - 10)
End If

Index = Index + 1

If Index = 100 Then
X = 1
End If
Loop
End Sub
```
did it for you.
Link to comment
Share on other sites

Still, though, that doesn't do anything but add or subtract stats. If the check runs again, the player will gain more stats or lose more stats. You need to set a variable for whether or not they have the armor set or not. If the expected outcome is not what's in that saved variable, then produce the opposite result, else nothing happens.
Link to comment
Share on other sites

@[NW:

> [CUBE] Sean link=topic=39814.msg389040#msg389040 date=1236268031]
> ```
> Sub WarriorSet1()
> Dim x
> Dim Index
> X = 0
> Index = 1
>
> Do While X = 0
> If GetPlayerClass(Index) = 1 And GetPlayerArmorSlot(Index) = 51 And GetPlayerLegsSlot(Index) = 52  And GetPlayerHelmetSlot(Index) = 53 And GetPlayerNecklaceSlot(Index) = 54 And GetPlayerRingSlot(Index) = 55 And GetPlayerShieldSlot(Index) = 56 And GetPlayerWeaponSlot(Index) = 57 Then
> Call PlayerMsg(Index, "You feel the energy of your equipped items", 13)
> Call SetPlayerSTR(Index, GetPlayerSTR(Index) + 10)
> Call SetPlayerDEF(Index, GetPlayerDEF(Index) + 10)
> Call PutVar("\accounts\" & GetPlayername(index), [Armor Boost], Give, 1)
> End If
>
> if GetVar("\accounts\" & GetPlayername(index), [Armor Boost], Give) = 1
> If Not GetPlayerArmorSlot(Index) = 51 Or Not GetPlayerLegsSlot(Index) = 52  Or Not GetPlayerHelmetSlot(Index) = 53 Or Not GetPlayerNecklaceSlot(Index) = 54 Or Not GetPlayerRingSlot(Index) = 55 Or Not GetPlayerShieldSlot(Index) = 56 Or Not GetPlayerWeaponSlot(Index) = 57 Then
> Call PlayerMsg(Index, "You no longer feel the energy of your equipped items", 13)
> Call SetPlayerSTR(Index, GetPlayerSTR(Index) - 10)
> Call SetPlayerDEF(Index, GetPlayerDEF(Index) - 10)
> End If
> End If
>
> Index = Index + 1
>
> If Index = 100 Then
> X = 1
> End If
> Loop
> End Sub
> ```
> did it for you.

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