Little help please
Can i use the IF statement on a door warp to change where im warped to? EG I go to a house and warp to one room then when the story value changes i warp to a different room from the same door. Any help would be greatly appreciated and an example script would be fantastic.
Thanks guys.
Thanks guys.
void main(void) { //first we make sprite touchable sp_touch_damage(¤t_sprite, -1); } void touch(void) { if(&story == 1) { freeze(1); //fade down the screen after freezeing dink fade_down(); script_attach(1000); //&player map is the screen number &player_map = 120; //loads map load_screen(); //draws map draw_screen(); //we have to freeze dink again after wrap freeze(1); //where should dink appear? sp_x(1, 180); sp_y(1, 250); //let's fade up screen fade_up(); unfreeze(1); } else { //on the other condition do the same thing but //change loacation and screen number } }
I haven't tested the script so there may be typos
EDIT: Oh and you have to remove the wrap from editor...and the sprite must be hard
You forgot to kill the script. You always need to kill the script manually after you've done a script_attach(1000)! Just put this line after unfreeze(1);
kill_this_task();
Also, it might be a good idea to disable touch damage when warping, just to make sure the script isn't run multiple times. Here is the edited version:
And I don't see any reason why it would need to be hard. Sure Dink can walk straight through the door when it isn't hard, but there would not be any fundamental reason why it wouldn't work...
kill_this_task();
Also, it might be a good idea to disable touch damage when warping, just to make sure the script isn't run multiple times. Here is the edited version:
void main(void) { //first we make sprite touchable sp_touch_damage(¤t_sprite, -1); } void touch(void) { if(&story == 1) { sp_touch_damage(¤t_sprite, 0); freeze(1); //fade down the screen after freezeing dink fade_down(); script_attach(1000); //&player map is the screen number &player_map = 120; //loads map load_screen(); //draws map draw_screen(); //we have to freeze dink again after wrap freeze(1); //where should dink appear? sp_x(1, 180); sp_y(1, 250); //let's fade up screen fade_up(); unfreeze(1); kill_this_task(); } else { //on the other condition do the same thing but //change loacation and screen number } }
And I don't see any reason why it would need to be hard. Sure Dink can walk straight through the door when it isn't hard, but there would not be any fundamental reason why it wouldn't work...
YE I'm sorry I haven't scripted dinkC for a long time, I was thinking about normal wrapping, not touch damage