Player "Grabs" Me?

I felt this thread is long overdue. Is there a hidden event flag that fires when it is grabbed, or should I do a combination of “playertouchsme” and check if they A key is down?

Here, i’m in a generous mood so i’ll give you a semi working implementation of if (playergrabsme).

if (keypressed && strtofloat(#p(0)) == 65){
  this.tArea = {playerx + 1.5 + vecx(playerdir)*2,playery + 2+ vecy(playerdir)*2};
  for (this.n = 0; this.n <npcscount;this.n++){
    if (this.tArea[0] in |npcs[this.n].x,npcs[this.n].x+npcs[this.n].width| &&
      this.tArea[1] in |npcs[this.n].y,npcs[this.n].y+npcs[this.n].height|){
      callnpc this.n,playergrabsme,;
    }
  }
}

I don’t like the method Tricxta uses.

if (keypressed && keydown(6)) {
  triggeraction playerx+1.5+vecx(playerdir)*2,playery+2+vecy(playerdir)*2,grab,;
}

And the NPC you grab would have if (actiongrab) {

Simple.

and if you make that an invisible weapon all you need to do is put (actiongrab) on any NPC. Assuming the character still has the weapon at any given time it should work.

This is much better than the triggeractions version xd By far.

It looks fancy, but it does the same thing. Why over complicate it?

I would have just checked the proximity and sprite of player

and it’s a waste of characters.

That won’t work and I’ll let you figure out why.

Worked last time I did it

You can be more precise xp “Does the same thing” Somewhat, but not exactly.

I don’t give a fuck. Why give someone that can’t script an over-complicated code? triggeractions are easy.

I like tricxta’s because it utilizes a bounding box on NPC’s without setshape or a rectangular sprite, so it’s more reliable, whereas the normal triggeraction approach will choke if you miss a non-transparent pixel on the sprite.

setshape setshape2 showcharacter