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

Need help with a script!


ryandoo
 Share

Recommended Posts

Hello, ive been trying to make a script to make a scripted tile that changes a certain sprite at a certain level. How can i get the following script to work?

If sprite 1 Then
  (Index, If True Then If Level > 19 Change to Sprite 2)
  If False Call PlayerMsg (Index, Your not the right level!" RED)
End If

Thanks for your help.
Link to comment
Share on other sites

I'm going to guess you're new to SadScript, yes?  Anyways, the syntax is trash, so this would never work.  Here's the right way:

```
Sub ChangeSprite(Index)

If GetPlayerLevel(Index) >= # Then
      Call SetPlayerSprite(Index, #)
  ElseIf GetPlayerLevel(Index) <= # Then
      Call PlayerMsg(Index, "You're not the right level!", RED)
      End If
  End Sub
```
The # is the level that you want to put.

Don't worry, we all started out like you at some point.  With a little practice, you'll get better.  ;)
Link to comment
Share on other sites

@Athagekin:

> I'm going to guess you're new to SadScript, yes?  Anyways, the syntax is trash, so this would never work.  Here's the right way:
>
> ```
> Sub ChangeSprite(Index)
>
> If GetPlayerLevel(Index) >= # Then
>       Call SetPlayerSprite(Index, #)
>   ElseIf GetPlayerLevel(Index) <= # Then
>       Call PlayerMsg(Index, "You're not the right level!", RED)
>
>       End If
>   End Sub
> ```
> The # is the level that you want to put.
>
> Don't worry, we all started out like you at some point.  With a little practice, you'll get better.  ;)

this didnt work :(
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...