Need a little help with something

I’ve been messing around in GS1 lately just so I can get familiarized with it again, but I have came across a problem. Perhaps someone could help.

NPC1 the first trigger thing.

// NPC made by Chicken_l33t
if (playerenters || created){
  setshape 1,32,32;
  save[1] = 5;
}
if (playertouchsme) {
  for (i = 0; i < npcscount; i++){
    if (npcs[i].save[0] == 5){
      triggeraction npcs[i].x,npcs[i].y,test,#v(npcs[0].id),#c;
    }
  }
}

if (actiontest2){
  message Response from: #p(0);
}

secoond NPC receiver with rebuttal lol

// NPC made by Chicken_l33t
if (created || playerenters) {
  setshape 1,32,32;
  save[0] = 5;
}

if (actiontest){
  message Recieved shit from: #p(0) said: #p(1);
  for (i = 0; i < npcscount; i++){
    if (npcs[i].save[1] == 5){
      triggeraction npcs[i].x,npcs[i].y,test2,#v(npcs[0].id);
    }
  }
}

Anyways basically I found a work around so this thing works fine, but
I wanted to do something like triggeraction npcs[#p(0)].x etc
along those lines, but it doesn’t work. Also I tried setting a variable like so
testid = #p(0);
npcs[testid].x

There is no real purpose to this NPC i’m just fucking about with stuff.

Doesn’t that stuff require a NPC-server?

No. It works offline in the editor.

Too many things don’t work online.

#p(0) is a string.
testid = strtofloat(#p(0));

I tried that already :X

 testid = strtofloat(#p(0));
 triggeraction npcs[testid].x,npcs[testid].y,test2,#v(npcs[0].id);

I also tryed [#v(testid)] which just gives me a debug error. :confused:

Aye, I noticed I had some bitchy problems with NPC IDs.
So I cheated, made it scan for NPCs with specific traits, which would give me their index by their position in the forloop

Yeh, basically what my workaround was up there ^^.
Just set a save[] and checked it in the for loop.

This might help more people that’s scripting, could you find some better name for this thread? :stuck_out_tongue:

Can’t use paramaters inside of npcs[]? work around. lol I dunno.