if(created)

Alright prior to using the latest gserver release, this wasnt a problem.

NPC’s such as light effects, that use if(created) and not if(playerenters), they dont work right if you reconnect in the level that they are in.

for example:

if (created) { drawaslight; dontblock; setcoloreffect 1,0,0,0.5; }

does not show the light effect, just the image of the light, it works after you update the level though. if you reconnect in a level with an npc like this in it, it messes up.


if (created||playerenters) { drawaslight; dontblock; setcoloreffect 1,0,0,0.5; }

now, a code like this one works perfectly, even if you reconnect in the level.

i dunno if this adhering to how official graal had worked but it seems weird


if (created) { dontblock; x=14; y=40; } if (playerenters) { setcoloreffect 1,0.4,0,0.79; drawaslight; this.light = 1; timeout = 0.05; } if (timeout) { this.light += random(-0.1,0.1); if (!(this.light in |1,3|)) this.light = 1; setzoomeffect this.light; timeout = 0.05; }

This code also works perfectly, so it seems that as long as ‘playerenters’ is in there, there are no problems.

i think its good practice to always use if (created || playerenters).
gscript is crazzzzzzyyyyyy!

i think the created flag is set when its the first time the player sees the npc.

Therefor using playerenters would be a more efficient way as it’s always called?
Oh, and Skoopa, your problem is that created is only called by the leader of the level. If you use any timeouts or sleeps, don’t forget to add a timereverywhere.

Guess what you don’t need for sleeps.

no point in using if (created || playerenters)

if you want to recreate if (created)

just use if (playerenters && isleader) else just use if (playerenters)

all good :slight_smile:

You do need timereverywhere for sleeps, I’ve tested it.

^^^^^^^ he be right :smugbert:

???

I think that fixed it, mine was set to true for some reason

i was fucking right! booyeah

I thought (created) flag was semi-broken…?

Also, playerenters && isleader would do something slightly different than created dude.