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

Sprite Switchback Script


Flameswit44
 Share

Recommended Posts

One way to do it, find the ONMAPLOAD sub, and add a check.
If getplayermap = #map, then set player sprite to #sprite

To switch back, could do Onmapload, if getplayermap <> #map with diff sprite, then switch player sprite.

Very basic idea, but you should be able to figure it out from there, there are several ways you can do it.

Easy script to figure out, perfect place to begin learning scripting if you dont know how yet.

Tinker around, ask questions when you mess up, and let people guide you in LEARNING how. You will be happy you did it, opens alot of doors.
Link to comment
Share on other sites

> call setplayersprite(index, #)

This is one command you will need.
The 2 is where you put the number of the sprite you want to change them to.

> Sub onmapload(index)
> Dim switchmap
>
> switchmap = #  (the number they switch to the sprite)
>
> If getplayermap(index) = switchmap Then
> Call setplayersprite(index, #)
> Else
> Exit Sub

That is the most brief example of what your script will need to look like,if playermap = 4 (whatever number they switch) Then
change sprite to (index, 4)  (whatever number you want them to change to)

thats the general idea.
You will also need to change back after they leave.
If its only 1 map, then it will be much easier. If they must have the new sprite and go through a couple maps, will be a little longer.

But as I said, expiriment, and ask when you get stuck.

P.S. I havent actually scripted for a while, so some of the exact names of those commands may be off, but if it doesnt work post your script for other to look over, I'm pretty sure they are the correct lines in my example
Link to comment
Share on other sites

The

    Dim switchmap

    switchmap = #

is a way of storing a variable, something you will call later in your script.

You must designate the name that will be called like this

    Dim switchmap

then, below it, specify what switchmap means

    switchmap = getplayermap(index)

now, switchmap is set to be the number of the map the player is in, or in the case of the onmapload sub, the map being loaded.
Now, when you use this command

    If getplayermap(index) = switchmap Then

it checks like-if players map = this stored map number (via switchmap) Then
do script

Personally, when I store a variable, I call it with the INT(switchmap), INT means interger, or a number, I find less chance for error when you specify your called varianle as a number. Maybe not neccesary usually, but I have had scripts that didnt work till I did that.
So it would look like this

    Sub onmapload(index)
    Dim switchmap

    switchmap = #  (the map number they switch to the sprite)

    If getplayermap(index) = INT(switchmap) Then
    Call setplayersprite(index, #)
    Else
    Exit Sub

That sets the variable  SWITCHMAP to the map number you want, (this can be called whatever you want to use as the name to call later) then it checks if the map the player is on, or the getplayermap(index) =.  is the same as INT(switchmap), and if so runs the script below it.

Anymore questions just ask
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...