|
ent_create( ... doesn't load model / lädt das Modell nicht
#280395
07/22/09 14:12
07/22/09 14:12
|
Joined: Jul 2009
Posts: 36
SomebodyNew
OP
Newbie
|
OP
Newbie
Joined: Jul 2009
Posts: 36
|
Hello everyone,
I've started with gamestudio and just completed your tutorials. Well... I just ran into a problem.
I'm trying to learn the basics so i write really short scripts to see if and how they work. So that one day... =) Well, this one didn't work. Honestly, I don't see why.
///////////////////////////// #include <acknex.h> #include <default.c> ///////////////////////////// function main(); function spawn_object(); ///////////////////////////// function main() { level_load("Test1.wmb"); //load the level camera.z = 1000; //move the camera camera.tilt = -90; //look "down" wait(1); }
function spawn_object() { ent_create("kugel.mdl", vector(0,0,0), NULL); wait(1); //Not sure if this one is needed. }
on_u = spawn_object();
Gamestudio does load the level, but pressing the button "u" doesn't create the model. I've put all files (level, script, textures, models) in one directory.
Thank you for taking the time to look at my script.
---------------------------------------------------------
Hallo, bin absoluter Anfänger mit Gamestudio und versuche mit kleinen Scripts c-lite zu erlernen. Mit obenstehendem Script habe ich ein kleines Problem - und weiß wirklich nicht woran es liegt. Hab schon im Handbuch nachgeschlagen, bin leider nicht auf den Fehler gestoßen. Zwar lädt das level, nur passiert nichts, wenn man die Taste "u" drückt. Alle Dateien befinden sich in einem Ordner (level, texturen, model und scripte)
Bin für jeden Tipp dankbar.
Gruß, SombodyNew
|
|
|
Re: ent_create( ... doesn't load model / lädt das Modell nicht
[Re: SomebodyNew]
#280397
07/22/09 14:18
07/22/09 14:18
|
Joined: Aug 2008
Posts: 2,838 take me down to the paradise c...
Cowabanga
Expert
|
Expert
Joined: Aug 2008
Posts: 2,838
take me down to the paradise c...
|
Because you didn't gave the world's gate time to open .Replace function main by this:
function main()
{
level_load("Test1.wmb"); //load the level
wait(4); // CRITICAL MASS =P
camera.z = 1000; //move the camera
camera.tilt = -90; //look "down"
}
EDIT: Gamestudio does load the level, but pressing the button "u" doesn't create the model.
I was totally wrong then, let me take a closer look to your code.
Last edited by Cowabanga; 07/22/09 14:21.
|
|
|
Re: ent_create( ... doesn't load model / lädt das Modell nicht
[Re: SomebodyNew]
#280399
07/22/09 14:19
07/22/09 14:19
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
change on_u = spawn_object(); to on_u = spawn_object; AND put it inside main somewhere.
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: ent_create( ... doesn't load model / lädt das Modell nicht
[Re: SomebodyNew]
#280414
07/22/09 14:55
07/22/09 14:55
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Yes you can. The on_xx commands set the function (as an event) to the xx key. So once the on_xx has been processed, no matter where the code is NOW, if the xx key is pressed, the event(your function) is triggered at the next frame, or the end of this frame, Im not sure of that.
To disable the event, just execute an on_xx=NULL; and the event is released, and the xx key no longer triggers any functions.
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: ent_create( ... doesn't load model / lädt das Modell nicht
[Re: SomebodyNew]
#280418
07/22/09 15:07
07/22/09 15:07
|
Joined: Nov 2007
Posts: 1,143 United Kingdom
DJBMASTER
Serious User
|
Serious User
Joined: Nov 2007
Posts: 1,143
United Kingdom
|
I never understood why you have to omit the () when using a on_xx command.
Is it because with (), the function will be executed and it's return value will be assigned to on_xx. So without the (), you are passing a pointer to the function?
Last edited by DJBMASTER; 07/22/09 15:08.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|