|
0 registered members (),
1,089
guests, and 10
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Local Pointer !
#343711
10/09/10 12:45
10/09/10 12:45
|
Joined: Jul 2009
Posts: 96
mEnTaL
OP
Junior Member
|
OP
Junior Member
Joined: Jul 2009
Posts: 96
|
How can I create an ENTITY pointer which must be LOCAL for a certain entity. I need this for my AI - every NPC has a target1 ponter which must lead to a detected enemy. Here is the code:
action ally()
{
ENTITY*target1;
if (my.status==attacking)
{................}
........
my.event=detect_target;
}
function detect_target ()
{
if (event_type == EVENT_DETECT)
{
if (you.skill2==1) // enemy detected
{
my.status=attacking; target1=you; }
}
}
But the functions just can't recognize the pointer because it is local. Any ideas how to make this little pointer local BUT recognized by the other functions?
|
|
|
Re: Local Pointer !
[Re: mEnTaL]
#343714
10/09/10 14:04
10/09/10 14:04
|
Joined: Nov 2008
Posts: 216
jane
Member
|
Member
Joined: Nov 2008
Posts: 216
|
define the "ENTITY*target1;" outside of the action,
in the enemy-action put in "target1=my;"
Last edited by jane; 10/09/10 14:09.
|
|
|
|
|
|