Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
2 registered members (Quad, AndrewAMD), 1,007 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
how can I load two or more levels ? #353662
01/12/11 05:21
01/12/11 05:21
Joined: Jan 2011
Posts: 7
G
gslover Offline OP
Newbie
gslover  Offline OP
Newbie
G

Joined: Jan 2011
Posts: 7
i want to make a turn-based RPG game, how can i let player go from one level to another level? thanks!!! waiting online...

Re: how can I load two or more levels ? [Re: gslover] #353663
01/12/11 05:25
01/12/11 05:25
Joined: Jan 2011
Posts: 120
United States
Logan Offline
Member
Logan  Offline
Member

Joined: Jan 2011
Posts: 120
United States
Look up the "level_load" function within the manual. It's just a normal instruction that loads any map file, so you can use it in any context--after touching that object, after drinking that potion, after falling off that cliff. You can also assign it to an invisible object so the player doesn't know there is a level change coming up, so you can change smoothly.

One thing to keep in mind is no matter what level is loaded, the script running is the same. So even though in WED you can assign different scripts to different levels, they don't change when you do a level change at runtime, so that needs to be taken into consideration.

Re: how can I load two or more levels ? [Re: Logan] #353668
01/12/11 05:43
01/12/11 05:43
Joined: Jan 2011
Posts: 7
G
gslover Offline OP
Newbie
gslover  Offline OP
Newbie
G

Joined: Jan 2011
Posts: 7
thanks! i have a try!

Re: how can I load two or more levels ? [Re: gslover] #353669
01/12/11 05:57
01/12/11 05:57
Joined: Jan 2011
Posts: 7
G
gslover Offline OP
Newbie
gslover  Offline OP
Newbie
G

Joined: Jan 2011
Posts: 7
would you please give me an example for this? my code can not work.

Re: how can I load two or more levels ? [Re: gslover] #353675
01/12/11 06:57
01/12/11 06:57
Joined: Jan 2011
Posts: 120
United States
Logan Offline
Member
Logan  Offline
Member

Joined: Jan 2011
Posts: 120
United States
Code for an entity that changes the level when it is clicked on:

Code:
// this function does the actual level changing
function levelchange_event()
{
     wait(1); // always do this before level_load to give running functions time to end
     freeze_mode = 1; // pause while changing levels
     level_load("level2.wmb"); // change the name to an actual map in your project
     wait(1);
     freeze_mode = 0; // unpause
}

// attach this following action to an object via WED
// this action monitors whether the thing was clicked on, and if so, calls the above function
action level_changer()
{
     my.emask |= ENABLE_CLICK;
     my.event = levelchange_event;
}



Re: how can I load two or more levels ? [Re: Logan] #353829
01/13/11 12:44
01/13/11 12:44
Joined: Jan 2011
Posts: 7
G
gslover Offline OP
Newbie
gslover  Offline OP
Newbie
G

Joined: Jan 2011
Posts: 7
i write the code following you .but there is another problem that the player disappear when the player go from one level to next level.
my code like this:
in the main.c,
#include ...

ENTITY* player;

function main()
{
level_load("level1.mdl");
player=ent_create("player.mdl",nullvector,player_action);
}

in the player.c,the code like this:

Code:// this function does the actual level changing
function levelchange_event()
{
wait(1); // always do this before level_load to give running functions time to end
freeze_mode = 1; // pause while changing levels
level_load("level2.wmb"); // change the name to an actual map in your project
wait(1);
freeze_mode = 0; // unpause
}

// attach this following action to an object via WED
// this action monitors whether the thing was clicked on, and if so, calls the above function
action player_action()
{
my.emask |= ENABLE_CLICK;
my.event = levelchange_event;

.....
}

Re: how can I load two or more levels ? [Re: gslover] #353830
01/13/11 12:54
01/13/11 12:54

C
chris_oat
Unregistered
chris_oat
Unregistered
C



you have to create the player again once the new level is loaded!

Re: how can I load two or more levels ? [Re: ] #353846
01/13/11 15:29
01/13/11 15:29
Joined: Jan 2011
Posts: 7
G
gslover Offline OP
Newbie
gslover  Offline OP
Newbie
G

Joined: Jan 2011
Posts: 7
it's a pity! the video dont let me download. the player is created once only, because i must record or update the data of the player from the first level to the last level.thank you all the same.

Re: how can I load two or more levels ? [Re: gslover] #353869
01/13/11 17:46
01/13/11 17:46
Joined: Jan 2011
Posts: 120
United States
Logan Offline
Member
Logan  Offline
Member

Joined: Jan 2011
Posts: 120
United States
That's fine! Remember, the script file doesn't change even when the level does. BUT, you need to have an entity in your new level with the player action assigned so that A8 knows what in the heck to do. It won't reset anything unless you have some lines like player.awesomeness = 0; at the beginning of the player function--in which case move them to another function, to be called only once at game start, and only include movement, camera, and fighting type code in your actual player function.

Re: how can I load two or more levels ? [Re: Logan] #353870
01/13/11 17:47
01/13/11 17:47
Joined: Jan 2011
Posts: 120
United States
Logan Offline
Member
Logan  Offline
Member

Joined: Jan 2011
Posts: 120
United States
Trust me, plenty of A8 games have both continuously upgrading player characters AND level changes, and they work fine. laugh

Page 1 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1