Posted By: Sammy32
[ANET] NPC, ENEMY Pointer - 04/05/13 10:12
hi,
how i can create the globalpointer for an entity was create with WED and this entity has an action with an enemy/npc script.
What is the best way?
have everyone an script?
action enemy(){
......
}
I use A-net Pro
Posted By: rayp
Re: [ANET] NPC, ENEMY Pointer - 04/05/13 10:27
if i understood u right u simply want an global pointer to your enemy ?
if so:
ENTITY* my_ent_pointer;
action enemy(){
my_ent_pointer = me;
..
}
action AnyAction(){
while (!my_ent_pointer) wait(1);
if (my_ent_pointer....
...
}
Posted By: Sammy32
Re: [ANET] NPC, ENEMY Pointer - 04/05/13 10:52
hi,
in my multiplayer game (A-NET) , i have create a map with WED, all Enemys have become an Action for the movement and the ai.
But the Globalpointer cant use for the moment, i have read, i must create an globalpointer with "enet_svent_create(i, &creating_pos);",
but i cant create the entity in livetime, the entity is create at levelstart.
Please help me with an example.
and i hope somebody understand my problem
special thanks
Posted By: MasterQ32
Re: [ANET] NPC, ENEMY Pointer - 04/05/13 10:57
Level entities aren't created with enet_svent_create, enet_clent_create so they have no global pointer.
But you can use a simple workaround:
Create spawnpoints instead of enemies. The spawnpoint action checks if you are a server or a server/client and then spawns your enemies. This allows you to have them as a global pointer. You can also delete the spawnpoints afterwards because you don't need them anymore now...
Posted By: Sammy32
Re: [ANET] NPC, ENEMY Pointer - 04/06/13 11:29
hi,
ok thank you very much,
it works fine.
If i start a Server and a start a client it works fine.
if start a server/client in one application i have some problems,
in this mode start the Action 2 Times , how can make a difference between this actions.
action enemy(){
if(......) // only server
if(....) // all clients and the server/client - client part
}
enet_get_connection() has onyl the information about the applictaion.
thank you for you response and help
best regards
Posted By: Ch40zzC0d3r
Re: [ANET] NPC, ENEMY Pointer - 04/06/13 16:33
enet_get_connection() can return:
CLIENT_MODE
SERVER_MODE
SERVER_CLIENT_MODE
means:
If(enet_get_connection() == SERVER_MODE || enet_get_connection() == SERVER_CLIENT_MODE)
{
...
}
else if(enet_get_connection() == CLIENT_MODE)
{
...
}
Posted By: Sammy32
Re: [ANET] NPC, ENEMY Pointer - 04/12/13 06:58
Hi,
thank you for the help,
the problem is fixed,
I have build some enemys , with spawn points and some aggro management.
Thanks to All
Best regards