WW style swimming.
#1
Posted 16 December 2008 - 10:31 AM
Who is talented enough in the ways of the script to take on my amazing challenge?
No, but seriously. It would probably be a really simple edit.
#2
Posted 16 December 2008 - 06:37 PM
I'll script it once I finish my World History Review.
EDIT: I have it. It should work.
It warps you to the last place you were at before swimming.
I designed it for use with global scripts
const int DROWNSFX = 0; //set the drowning sfx here
const int DROWNDMG = 4; //that's a quarter heart
const int WARPSFX = 0; //set the warping out sfx here
//put this before the loop of your global script slot 2
int laststate = Link->Action;
int warpx = Link->X;
int warpy = Link->Y;
int warpdmap = Game->GetCurDMap();
int warpdscreen = Game->GetCurDMapScreen();
int drowncounter = 0;
//put this in the middle of the global script
if(Link->Action == LA_SWIMMING) {
drowncounter ++;
if(drowncounter == DROWNTIME) {
Game->PlaySound(DROWNSFX);
for(int i=0; i<40; i++) {
Waitframe();
Link->Action = LA_DROWNING;
}
Link->Warp(warpdmap, warpdscreen);
Link->X = warpx; Link->Y = warpy;
Link->Action = 0;
Link->HP -= DROWNDMG;
Game->PlaySound(WARPSFX);
}
} else {
warpx = Link->X;
warpy = Link->Y;
warpdmap = Game->GetCurDMap();
warpdscreen = Game->GetCurDMapScreen();
if(laststate == LA_SWIMMING)
drowncounter = 0;
}
//put this right before the waitframe in your global script slot 2
laststate = Link->Action;
It's just a quick fix. It's not really complete yet, but it should work.
PUT IT IN YOUR GLOBAL SCRIPT!!!!
Edited by Beefster, 17 December 2008 - 04:59 PM.
#3
Posted 16 December 2008 - 10:51 PM
$END, ON TOKEN IF
Doesn't seem to be working...and I'm no scripter.
But you said it wasn't really complete, so it's cool.
Edited by Molten Onyx, 16 December 2008 - 10:57 PM.
#4
Posted 16 December 2008 - 11:12 PM
#5
Posted 17 December 2008 - 04:32 AM
You can't just use that code as it is MO, you need to put it inside the global script.
void run(){
while(true){
//code goes here
Waitframe();
}
}
#6
Posted 17 December 2008 - 04:58 AM
#7
Posted 17 December 2008 - 04:59 PM
#8
Posted 19 December 2008 - 08:15 PM
const int DROWNTIME = 900; //that does 15 seconds
const int DROWNSFX = 0; //set the drowning sfx here
const int DROWNDMG = 4; //that's a quarter heart
const int WARPSFX = 0; //set the warping out sfx here
global script slot2{
void run(){
while(true){
int laststate = Link->Action;
int warpx = Link->X;
int warpy = Link->Y;
int warpdmap = Game->GetCurDMap();
int warpdscreen = Game->GetCurDMapScreen();
int drowncounter = 0;
if(Link->Action == LA_SWIMMING) {
drowncounter ++;
if(drowncounter == DROWNTIME) {
Game->PlaySound(DROWNSFX);
for(int i=0; i<40; i++) {
Waitframe();
Link->Action = LA_DROWNING;
}
Link->Warp(warpdmap, warpdscreen);
Link->X = warpx; Link->Y = warpy;
Link->Action = 0;
Link->HP -= DROWNDMG;
Game->PlaySound(WARPSFX);
}
} else {
warpx = Link->X;
warpy = Link->Y;
warpdmap = Game->GetCurDMap();
warpdscreen = Game->GetCurDMapScreen();
if(laststate == LA_SWIMMING)
drowncounter = 0;
}
laststate = Link->Action;
Waitframe();
}
}
I have it set up like that right now, but when I compile it, it tells me there is an error on line 42. There is no line 42.
Also, sorry for not putting it together before, I have a bad habit of quickly looking over things without actually reading them.
EDIT: I gots 200 posts now.
Edited by Molten Onyx, 19 December 2008 - 08:28 PM.
#9
Posted 19 December 2008 - 08:31 PM
Here's what it should look like:
const int DROWNTIME = 900; //that does 15 seconds
const int DROWNSFX = 0; //set the drowning sfx here
const int DROWNDMG = 4; //that's a quarter heart
const int WARPSFX = 0; //set the warping out sfx here
global script slot2{
void run(){
int laststate = Link->Action;
int warpx = Link->X;
int warpy = Link->Y;
int warpdmap = Game->GetCurDMap();
int warpdscreen = Game->GetCurDMapScreen();
int drowncounter = 0;
//Don't put declarations in while loops. THAT'S BAD.
while(true){
if(Link->Action == LA_SWIMMING) {
drowncounter ++;
if(drowncounter == DROWNTIME) {
Game->PlaySound(DROWNSFX);
for(int i=0; i<40; i++) {
Waitframe();
Link->Action = LA_DROWNING;
}
Link->Warp(warpdmap, warpdscreen);
Waitframe();
Link->X = warpx; Link->Y = warpy;
Link->Action = 0;
Link->HP -= DROWNDMG;
Game->PlaySound(WARPSFX);
}
} else {
warpx = Link->X;
warpy = Link->Y;
warpdmap = Game->GetCurDMap();
warpdscreen = Game->GetCurDMapScreen();
if(laststate == LA_SWIMMING)
drowncounter = 0;
}
laststate = Link->Action;
Waitframe();
}
}
}
Edited by Beefster, 10 January 2009 - 05:37 PM.
#10
Posted 19 December 2008 - 08:40 PM
Sorry if I'm just being annoying.
#11
Posted 22 December 2008 - 01:14 PM
If you could fix this it would be great.
#12
Posted 22 December 2008 - 04:29 PM
Edited by Beefster, 22 December 2008 - 04:31 PM.
#13
Posted 10 January 2009 - 01:35 PM
It's okay if you don't, but it would be awesome if you would.
#14
Posted 10 January 2009 - 02:21 PM
Link->X = warpx; Link->Y = warpy;
I think I've run into this before, that if you try to change Link's X and Y positions during the same frame that he warps, it puts him at the blue box at the end of the frame anyway.
#15
Posted 10 January 2009 - 05:36 PM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users