TRACK TO PROBLEM with linked object

I need to track my player (Cube.081) but I don´t know how to proceed with python (I would prefer logic bricks if there was an option).

I´m using this enemy with library linking.
I have my blend file here
http://www.megaupload.com/?d=AFFZUQSE

I will appreciate a answer for dummies… (I do not know a damn thing about python)
Thanks!!!

Assuming that you want the enemy to track to the player:
add an always sensor (not true pulse) to a python controller (on the enemy)
connect a trackto actuator to the controller called “track”

in the python script write:

import bge
cont = bge.logic.getCurrentController()
own = cont.owner

track = cont.actuators[“track”]
track.object = “Cube.081”
cont.activate(track)

Thanks for your help! I loaded the script in bge. Here is a screenshot of this.
Do I need to fill the track to field too?
Because my enemy isn`t trackin the cube.
Maybe is a stupid question, but I never used python before.

Thanks man!!


I hadn’t realised that you were using 2.4!
Therefore you’ll have to change the code to 2.4x;

cont = GameLogic.getCurrentController()
own = cont.owner

track = cont.actuators["track"]
track.object = "Cube.081"
cont.activate(track)

Thanks a lot!!
I will test it
:smiley:

Hi @agoose77 how are you man?
I imported the script and I have this…
[ATTACH=CONFIG]147964[/ATTACH]

And my track doesn`t work in my main file. (I tried many times, deleting the OB:Cube.081 from track to in the enemy)
What could I be doing wrong???

Thank you sooo much!

Hi there! According to your logic bricks/ code the movement actuator wouldn’t be firing, is your character still moving forward? Try jsut using straight forward logicbricks like this (Stand back, ASCII artist at work here, lol):

always ___> AND __> TrackTo (Cube.081 in OB field)
``````_
>AND ____> Movement

If hat doesn’t work then something else is wrong, let me know!

Hi Matt how are you?
The character does move, the problem is that the “track to” isnt working... Im using linked assets to a main file.

Cheers!

Heeeeeeeeeeeeeeelp

Pleaseeeeeeeeeeeeee