View Single Post
  #4  
Old 08-27-2014, 05:49 PM
samich samich is offline
Registered User
samich's Avatar
Join Date: Jan 2007
Posts: 59
samich will become famous soon enough
Send a message via MSN to samich
The reason they are NPC's is because they are copyLevel generated floors. It is an automated playerhouse-esque system, and I needed to dynamically set the level to go to next, as regular level links wouldn't work dynamically like that.

NPC Code:

function onCreated() {
setimg("vivitron_hotel-halfdoor.png");
// Get the next level up's floor number
this.floor = int(this.level.name.substring(12, -1).tokenize(".")[0]) + 1;
setshape(1, 32, 16);
dontblock();
drawunderplayer();
}

function onPlayerTouchsMe() {
if(!levelexists("hotel_floor_" @ this.floor @ ".nw")) return;
setlevel2("hotel_floor_" @ this.floor @ ".nw", player.x, 33.5);
}



Here is a video (disregard floors 1,2 and possibly 3, as they are made in a way that works, but is not the way I want the levels to look like): http://youtu.be/w6vKyZ8Pa_I

At around 18-20 seconds I demonstrate how moving slowly, the setlevel2 transition works just fine, but anytime before that, weird things happen, such as some images not loading (due to such immediate level switching, I'm assuming).
__________________
[Graal Related Business]
Reply With Quote