|
0 registered members (),
6,962
guests, and 2
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
load_leve help :)
#304037
01/04/10 17:09
01/04/10 17:09
|
Joined: Jan 2010
Posts: 3
chuj
OP
Guest
|
OP
Guest
Joined: Jan 2010
Posts: 3
|
Welcome I need help You see I have a map(first_map.wmb, and i try load second map if i press X button
function load_map()
{
if(key_x) // X pressed
{
level_load("second_map.wmb");
}
}
This code does not works, why?
Last edited by chuj; 01/04/10 17:09.
|
|
|
Re: load_leve help :)
[Re: Espér]
#304053
01/04/10 18:12
01/04/10 18:12
|
Joined: Feb 2009
Posts: 3,207 Germany, Magdeburg
Rei_Ayanami
Expert
|
Expert
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
|
short form -> you need a while(1)...wait(1) around your if(key_x)  function load_map() { while(1) { if(key_x) // X pressed { level_load("second_map.wmb"); return; } wait(1); } }
|
|
|
Re: load_leve help :)
[Re: Rei_Ayanami]
#304071
01/04/10 21:25
01/04/10 21:25
|
Joined: Dec 2008
Posts: 1,660 North America
Redeemer
Serious User
|
Serious User
Joined: Dec 2008
Posts: 1,660
North America
|
Or you could use on_x, like this:
function load_map()
{
level_load("second_map.wmb");
}
on_x = load_map();
That's much more efficient than using a while loop, which might cause the map to load multiple times...
|
|
|
Re: load_leve help :)
[Re: Espér]
#304105
01/05/10 00:35
01/05/10 00:35
|
Joined: Dec 2008
Posts: 1,660 North America
Redeemer
Serious User
|
Serious User
Joined: Dec 2008
Posts: 1,660
North America
|
Wait, didn't see the return() call in your code. Nevermind.
BTW: Happy birthday, guy!
Last edited by Redeemer; 01/05/10 00:35.
|
|
|
Re: load_leve help :)
[Re: Redeemer]
#304346
01/06/10 20:22
01/06/10 20:22
|
Joined: May 2006
Posts: 148 Latvia
MTD
Member
|
Member
Joined: May 2006
Posts: 148
Latvia
|
If you load from another level - then put "me=null;" before level_load other wise strange things happening --------Preview me=null; level_load("test.wmb"); wait(1) -------- And it should work.
|
|
|
|