|
3 registered members (Quad, TipmyPip, Grant),
5,429
guests, and 3
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Simple entity properties crash
#445475
09/10/14 22:19
09/10/14 22:19
|
Joined: Aug 2014
Posts: 57
Yking
OP
Junior Member
|
OP
Junior Member
Joined: Aug 2014
Posts: 57
|
Hello everyone, I seem to have a minor problem with SED, maybe I just sat too long in front of my Screen but I absolutely do not know, why I get a "Crash in Main" Alert Window everytime I run this simple code. #include <acknex.h> #include <default.c>
#define Lifepoints skill1
ENTITY* Player; //Public Entity
function main() { Player.Lifepoints = 10; }
I defined skill1 as Lifepoints so its easier to program with, it does not matter if I use Player.skill1 (that does not work either). I created the Entity* Player before my Main-Code so its accessible from everywhere, placing it in the Main also does not work (Still getting a crash). I must overlook something obvious but I dont know what  , is there someone who can help me? It would be very appreciated  !
|
|
|
Re: Simple entity properties crash
[Re: Yking]
#445476
09/10/14 22:59
09/10/14 22:59
|
Joined: Jun 2009
Posts: 2,210 Bavaria, Germany
Kartoffel
Expert
|
Expert
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
|
1. your entity-pointer is empty (there's no entity it points to). you have to create an entity first. (I guess you'll need some more knowledge about what pointers do, how they work, etc.) 2. there already exists a pointer 'player' (no capital 'p'), you can use that
POTATO-MAN saves the day! - Random
|
|
|
Re: Simple entity properties crash
[Re: Kartoffel]
#445481
09/11/14 06:30
09/11/14 06:30
|
Joined: Jul 2014
Posts: 49 Romania,vaslui
AceX
Newbie
|
Newbie
Joined: Jul 2014
Posts: 49
Romania,vaslui
|
You need to read the whole manual to understand how this engine works,and how to do a game. And this is the code:
#include <acknex.h>
#include <default.c>
#define Lifepoints skill1
function main()
{
player = ent_create("your_player_model.mdl",vector(0,0,0),NULL);
player.Lifepoints = 10;
}
}
|
|
|
Re: Simple entity properties crash
[Re: AceX]
#445486
09/11/14 08:07
09/11/14 08:07
|
Joined: Jun 2009
Posts: 2,210 Bavaria, Germany
Kartoffel
Expert
|
Expert
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
|
@^: you don't have to read the whole manual in order to understand it. The workshops are a better place to start.
also your example won't work because there's no level loaded. Besides that theres also nullvector which you can use instead of vector(0, 0, 0).
POTATO-MAN saves the day! - Random
|
|
|
Re: Simple entity properties crash
[Re: Yking]
#445496
09/11/14 14:01
09/11/14 14:01
|
Joined: Aug 2014
Posts: 57
Yking
OP
Junior Member
|
OP
Junior Member
Joined: Aug 2014
Posts: 57
|
Thanks for all the help  !! I feel like an idiot now ^^
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|