Flameswit44 Posted November 20, 2010 Author Share Posted November 20, 2010 Hey this is really important in this point of my game.I need a script that changes you into a peticular sprite when you go into an area but when you leave the area you change back into your original sprite.Is this possible?Im using Eclipse StableThanks in advance! Link to comment Share on other sites More sharing options...
DrNova Posted November 20, 2010 Share Posted November 20, 2010 One way to do it, find the ONMAPLOAD sub, and add a check.If getplayermap = #map, then set player sprite to #spriteTo 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 More sharing options...
Flameswit44 Posted November 20, 2010 Author Share Posted November 20, 2010 im almost a 3rd grader at scripting but i think i can figure it out :)ty Link to comment Share on other sites More sharing options...
DrNova Posted November 20, 2010 Share Posted November 20, 2010 > 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 SubThat is the most brief example of what your script will need to look like,if playermap = 4 (whatever number they switch) Thenchange 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 More sharing options...
Flameswit44 Posted November 20, 2010 Author Share Posted November 20, 2010 kk ill try them.but what do you mean"switchmap = # (the number they switch to the sprite)"then number they switch to the sprite? Link to comment Share on other sites More sharing options...
DrNova Posted November 20, 2010 Share Posted November 20, 2010 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 switchmapthen, 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 Thenit checks like-if players map = this stored map number (via switchmap) Thendo scriptPersonally, 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 SubThat 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 More sharing options...
Flameswit44 Posted November 20, 2010 Author Share Posted November 20, 2010 oooOOOOOOooo! i get it now :Dthx for your help now i can finish my game :) Link to comment Share on other sites More sharing options...
DrNova Posted November 20, 2010 Share Posted November 20, 2010 See? Its not so hard once you start getting it :)Glad I could help Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now