You need to assign the pointer:

Code:

entity* nonmovingentity; // a global entity pointer

// insert this code at the very top of your action before the while loop

nonmovingentity = me; // assigns the pointer to the entity
while (!nonmovingentity)
{
wait(1); // read note for reason for this
}

// other code you have goes here



The reason why you need that extra bit is, if the entity is not present, the pointer becomes invalid and an error will occur. This makes the engine wait until the entity pointer is valid (or is present in the case of using ent_create) and when it is valid (or present), the loop becomes false and the second while loop initiates.

Also, the text cannot be places in an action or inside a function. It needs to be kept outside of a function (and above the action that uses it).

I, too, was one very confused with scripting. Through the use of two side projects (my 2D game is the main one) and reading replies from others to similar issues, I've learned a lot.


"You level up the fastest and easiest if you do things at your own level and no higher or lower" - useful tip My 2D game - release on Jun 13th; My tutorials