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

Scripted item need help…


Fatmidget
 Share

Recommended Posts

Alrighty this should be a fairly basic thing you can help me with… So i set up an item that switches my character to sprite number 5, sprite number 5 is my character with a car, i was wondering what script i would implement on the end to make me turn back from the car to my normal sprite by clicking the item again, thanks!

Sub ScriptedItem(index, Script)
Select Case Script
    Case 0
Call SetPlayerSprite(Index, 5)
Call PlayerMsg(Index, "You Hop in the car.", WHITE)
SendPlayerData
End Select
End Sub

(Also i was wondering if there was a feature where i could change my sprites speed, if not thanks anyways)
Link to comment
Share on other sites

Sub ScriptedItem(index, Script)
```
  Select Case Script
    Case 0
  Call putvar("carform.ini", Sprites, GetPlayerName(index), Getplayersprite(index))
  call setplayerspeed(index, GetPlayerSpeed(index)+4)
  Call SetPlayerSprite(Index, 5)
  Call PlayerMsg(Index, "You Hop in the car.", WHITE)
  SendPlayerData
End Select
End Sub
```
To switch back just do

```
Call SetPlayerSprite(Index, putvar("carform.ini", Sprites, GetPlayerName(index)))
  Call PlayerMsg(Index, "You get out of the car", WHITE)
  SendPlayerData
```

something like this. I didn't test it or even read it through. Any problems tell me.
Link to comment
Share on other sites

@Munro:

> Sub ScriptedItem(index, Script)
>
> > Select Case Script
> >     Case 0
> >   Call putvar("carform.ini", Sprites, GetPlayerName(index), Getplayersprite(index))
> >   call setplayerspeed(index, GetPlayerSpeed(index)*2)
> >   Call SetPlayerSprite(Index, 5)
> >   Call PlayerMsg(Index, "You Hop in the car.", WHITE)
> >   SendPlayerData
> > End Select
> > End Sub
>
> To switch back just do
>
> > Call SetPlayerSprite(Index, getvar("carform.ini", Sprites, GetPlayerName(index)))
> >   Call PlayerMsg(Index, "You get out of the car", WHITE)
> >   call setplayerspeed(index, GetPlayerSpeed(index)/2)
> >   SendPlayerData
>
> something like this. I didn't test it or even read it through. Any problems tell me.

I see a few problems, but I fixed them above.  The changes are underlined.
Link to comment
Share on other sites

@DarkMazer:

> To switch back just do
>
> something like this. I didn't test it or even read it through. Any problems tell me.
>
> I see a few problems, but I fixed them above.  The changes are underlined.

No problems you just multiplied the speed instead of adding which I did. And you divided the speed afterwards which I admit I forgot to add.

But don't call them mistakes if all you did was add your own spin.
Link to comment
Share on other sites

I only called that a problem because, if the player's speed is already higher than 4, it won't work, since SetSpeed only takes in powers of 2. 
Oh, I just noticed that you used SetPlayerSpeed and not SetSpeed.  XP

The main thing I was correcting was using putvar in a place where getvar should have been.
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...