2 questions.

Posted By: Xyro

2 questions. - 09/08/11 19:09

Hello I would like to know on how to get the position of a position object placed in the level editor.

And seccond, I have a model placed in the level editor and I want to use that model in my code so I gave it a action called startup which I defined in my main.c :

ENTITY* mainCharacter;

action startup()
{
mainCharacter = me
}

but that didn't work out so great. So what is the correct way of doing this ?
Posted By: darkinferno

Re: 2 questions. - 09/08/11 19:16

you missed a semi-colong, it should be:

mainCharacter = me;
Posted By: Xyro

Re: 2 questions. - 09/08/11 19:20

Sorry thats just a copy paste error, I had that but whenever I start the game and try to access the mainCharacter it says : Script crash in main SYS but other then that it runs fine
Posted By: Aku_Aku

Re: 2 questions. - 09/08/11 19:25

Maybe a pointer, address problem at a string...
IMHO
Posted By: Xyro

Re: 2 questions. - 09/08/11 19:27

Sorry, is this a solution or are you just thinking out loud xD?
Posted By: Superku

Re: 2 questions. - 09/08/11 19:44

Quote:
try to access the mainCharacter it says : Script crash in main SYS but other then that it runs fine

Show the code where you access that pointer.
Posted By: Aku_Aku

Re: 2 questions. - 09/08/11 19:59

That was a solution based on my telepaty device, because i had to remotely decrypt your code.
Posted By: muffel

Re: 2 questions. - 09/08/11 20:43

I believe the problem is here
Quote:

Functions ending with ..._startup are executed right after the main() function, and LC before the engine and video device is initialized. This way, every script can have its own startup function which initializes its variables or objects. Example:

Found under Script Programming -> Functions

So name the action diffrent

muffel

Posted By: Xyro

Re: 2 questions. - 09/08/11 21:53

Well sorry, I didn't think that it was necessary to provide the other code since I thought it had something to do with me just doing it all wrong but here is the full document : http://pastebin.com/CyNGkFYD

I also changed startup to characterStartup and it still does the same
Posted By: Superku

Re: 2 questions. - 09/08/11 22:19

Place
while(!mainCharacter) wait(1);
in line 28 before the first physX instruction. Even though the entities are loaded already, their actions will be run after your first wait(1) in the main function, thus the pointer is invalid when you try to access it.
Posted By: Xyro

Re: 2 questions. - 09/09/11 09:21

Worked perfectly, thanks laugh
© 2024 lite-C Forums