PDA

View Full Version : Flags on GS2 - Simple question from a simpelton.


Salaisuus
10-09-2006, 03:58 AM
Ok how do I output script that uses flags on gs2?
Like if I want to have npc to react to player if a flag is true.


public function onCreated()
{
if (strtofloat(#s(clientr.flaggy)) >= 2)
{
canbepushed;
}
}


Something like that tho ofcourse that doesnt work. :noob:

Yen
10-09-2006, 04:22 AM
function onCreated() {
if (clientr.flaggy >= 2) {
canbepushed();
}
}

You should read a tutorial, check out the wiki.

Salaisuus
10-09-2006, 06:05 AM
function onCreated() {
if (clientr.flaggy >= 2) {
canbepushed();
}
}


Umm, I tried that, before and after your post.
It didnt work. :confused:

hotrian
10-09-2006, 07:00 AM
//#CLIENTSIDE

or

findplayer(@player.account).clientr.flaggy

or so..?

Salaisuus
10-09-2006, 08:29 AM
Clientside yes.
Tought it didnt need it because first I did it simply like this:

function onCreated() {
canbepushed();
}

without the clientside but still it worked.
(tho it still was clientside since other players could not see the npc move)
Od that it requires to be placed clientside when you ad a few lines or maybe I just dont get something...

Out of curiosity, can canbepushed() be used serverside at all?

Admins
10-09-2006, 11:39 AM
The canbepushed-behaviour can easily be scripted though, then everyone can see it

Salaisuus
10-09-2006, 08:18 PM
The canbepushed-behaviour can easily be scripted though, then everyone can see it
Yup. I did that. Was just wondering.

_Z3phyr_
10-15-2006, 12:27 PM
Pardon this bump, por favor... but

I've spent the past ten minutes trying to do this allgededly easy thing, but for some reason I'm too stupid to make it work.

What's up?

Salaisuus
11-05-2006, 03:56 AM
Ehh?
Well you must have got it by now but just incaise and because I've never
before been able to ansver questions here:


function onActionpulled()
{
if (player.dir = 3)
{
player.x -= 1;
x -= 1;
}
}


Whee.
"This is the first time I've ever used my power to help some one... Its strange,
it feels... Kind of... Nice."

ApothiX
11-30-2006, 04:42 PM
Ehh?
Well you must have got it by now but just incaise and because I've never
before been able to ansver questions here:


function onActionpulled()
{
if (player.dir = 3)
{
player.x -= 1;
x -= 1;
}
}


Whee.
"This is the first time I've ever used my power to help some one... Its strange,
it feels... Kind of... Nice."

function onActionPulled() {
player.x += -vecx(player.dir);
player.y += -vecy(player.dir);
x += -vecx(player.dir);
y += -vecy(player.dir);
}

Would probably accomplish the same thing, without having 4 different if statements.

Skyld
11-30-2006, 04:59 PM
function onActionPulled() {
player.x += -vecx(player.dir);
player.y += -vecy(player.dir);
x += -vecx(player.dir);
y += -vecy(player.dir);
}

Would probably accomplish the same thing, without having 4 different if statements.
Not sure how well this would work?
function onActionpulled()
{
this.x = player.x += -vecx(player.dir);
this.y = player.y += -vecy(player.dir);
}