Need help with trigger actions

ok so i downloaded the graal dvd for my friends server and i found some great weapons to use like the golem i uploaded the golem weapon that lets u spawn golems to help u in battle, any ways i dont know where to put the trigger action that spawns the golem in the rc can anyone help?

golem script

// NPC made by aylad
if (playerenters) {
}
if (playertouchsme) {
toweapons Golem Charm;
}
if (weaponfired || firedonhorse){
if (playermp>49){
putnpc mygolem01.gif,ayladgolem.txt,playerx,playery;
playermp -= 50
}}

trigger action script
if (created) {
  // Initialize the attributes
  showcharacter;
  setcharprop #3,golem-head.gif;
  setcharprop #C0,lightgray;
  setcharprop #C1,gray;
  setcharprop #C2,gray;
  setcharprop #C3,lightgray;
  setcharprop #C4,black;
  dir = 2;
  canbecarried;
  swordpower = 1;
  hurtdx = 0;
  hurtdy = 0;
  hearts = int(playerhearts/3);
}
if (playerenters || wasthrown) {
  // Initialize the this. variables
  followplayer;
  message;
  this.huntspeed = 0.4;
  dirgo = {0,-1,-1,0,0,1,1,0};
  timeout = 0.05;
  if (hearts<=0) {
    this.mode = 5; // RESPAWN
    this.runcounter = 0;
    timeout = 5;
  } else {
    this.mode = 0;
    sprite = 0;
    this.runcounter = int(random(10,40));
  }
}

// Sword attacking stuff
if (timeout && (this.mode==0 || this.mode==2)) {
  // Look for players
  mindist = 1000;
  for (i=0; i<compuscount; i++)
      if (compus[i].power>0) {
    dx = compus[i].x - x;
    dy = compus[i].y - y;
    if (abs(dx)>abs(dy)) {
      if (dx>0) pdir=3; else pdir=1;
    } else {
      if (dy>0) pdir=2; else pdir=0;
    }
    if (pdir==dir) {
      dist = (dx*dx+dy*dy)^0.5;
      if (dist<mindist) {
        cansee = 1;
        if (abs(dx)>abs(dy)) k = int(abs(dx));
        else k = int(abs(dy));
        for (j=0; j<=k-2; j++)
          if (onwall(x+1.5+dx*j/k,y+2+dy*j/k)) cansee = 0;
        if (cansee!=0) {
          mindist = dist;
          aimplayer = i;
          this.aimx = compus[i].x;
          this.aimy = compus[i].y;
        }
      }
    }
  }
  if (mindist<=3) {
    this.runcounter = -1;
    this.mode = 3; // SLAYING
    sprite = 9;
    timeout = 0.05;
  } else if (mindist<20) {
    if (this.mode!=2) message Stop!;
    this.runcounter = 100;
    this.mode = 2; // HUNTING
  } else timeout = 0.05;
}
if (timeout && this.mode==3) { // SLAYING
  this.runcounter++;
  if (this.runcounter>4) {
    this.runcounter = 100;
    this.mode = 2; // HUNTING
    sprite = 0;
  } else {
    sprite = 9+this.runcounter;
  }
  message;
  timeout = 0.05;
}
if (timeout && this.mode==2) { // HUNTING
  sprite = (sprite%8)+1;
  this.runcounter--;
  if (this.runcounter>0 && aimplayer<compuscount && compus[aimplayer].power>0) {
    // Get new direction
    dx = compus[aimplayer].x-x;
    dy = compus[aimplayer].y-y;
    if (abs(dx)>abs(dy)) {
      if (dx>0) dir=3; else dir=1;
    } else {
      if (dy>0) dir=2; else dir=0;
    }

    // Test if we can do a step
    dx = this.aimx-x;
    dy = this.aimy-y;
    if (abs(dx)<=1 && abs(dy)<=1) {
      this.aimx = compus[aimplayer].x;;
      this.aimy = compus[aimplayer].y;
      dx = this.aimx-x;
      dy = this.aimy-y;
    }
    if (abs(dx)>abs(dy)) {
      if (dx>0) testdir=3; else testdir=1;
    } else {
      if (dy>0) testdir=2; else testdir=0;
    }
    len = (dx*dx+dy*dy)^0.5;
    addx = (dx/len)*this.huntspeed;
    addy = (dy/len)*this.huntspeed;
    testx = x + 1.5;
    testy = y + 2;
    if (!onwall(testx+addx,testy+addy)) {
      // Do a step
      x += addx;
      y += addy;
   } else if (!onwall(testx+addx,testy)) x += addx;
   else if (!onwall(testx,testy+addy)) y += addy;
  } else {
    this.mode = 0; // WALKING
    this.walkmode = 1; // RANDOM
    this.runcounter = int(random(10,40));
    sprite = 0;
    dir = (dir+2)%4;
    message;
  }
  timeout = 0.05;
}

// Hurting stuff
if (washit && this.mode!=1 && hearts>0) {
  dx = x-playerx;
  dy = y-playery;
  len = (dx*dx+dy*dy)^0.5;
  hurtdx = dx/len;
  hurtdy = dy/len;
  sprite = 39;
  hideimg 1;
  hearts -= playerswordpower/2;
}
if ((exploded || waspelt || wasshot) &&
    this.mode!=1 && hearts>0 && isleader) {
  hurtdx = -dirgo[dir*2]*0.2;
  hurtdy = -dirgo[dir*2+1]*0.2;
  sprite = 39;
  if (peltwithsign || peltwithvase || peltwithstone || peltwithnpc) hearts -= 1;
  else if (peltwithblackstone) hearts -= 1.5;
  else hearts -= 0.5;
}
if ((hurtdx!=0 || hurtdy!=0) && isleader && this.mode!=4) {
  this.hurtdx = hurtdx;
  this.hurtdy = hurtdy;
  hurtdx = 0;
  hurtdy = 0;
  this.mode = 1; // HURTED
  this.runcounter = 20;
  sprite = 39;
  if (hearts<=0) {
    this.mode = 4; // DYING
    this.runcounter = 24;
    sprite = 0;
  }
  timeout = 0.05;
}
if (timeout && this.mode==1) { // HURTED
  this.runcounter--;
  if (this.runcounter>10) {
    testx = x + 1.5 + this.hurtdx*2;
    testy = y + 2+ this.hurtdy*2;
    if (!onwall(testx,testy)) {
      x += this.hurtdx;
      y += this.hurtdy;
    }
  }
  if (this.runcounter<=0) {
    if (swordpower>0) this.mode = 2; // HUNTING
    else this.mode = 0; // WALKING
    this.runcounter = 100;
    sprite = 0;
  }
  timeout = 0.05;
}
if (timeout && this.mode==4) { // DYING
  if (this.runcounter>0) {
    message;
    if ((this.runcounter%2)==0) dir = (dir+3)%4;
    this.runcounter--;
    if (this.runcounter<=0) {
      sprite = 40;
      play compudead.wav;
      i = random(0,100);
      if (i<10) lay greenrupee;
      else if (i<15) lay bluerupee;
      else if (i<30) lay heart;
    } else timeout = 0.05;
  }
}
if(playertouchesme){
followplayer;
}
if(followsplayer){
sprite = playersprite;
dir = playerdir;
}
if(hearts=0){
putleaps 2,x,y;
destroy;
}

thanks for taking ur time to help me

triggeraction x,y,action,param;

x,y is the target, action is the name of the triggeraction, param is the info you can send as you send the action to x,y.

The flag is if(actionACTIONNAME){}
read NewFeatures2001.txt if you want more, it even includes a handy Mining Tool.

Why can’t you guys use a god damn code tag I swear to fucking god…

that script looks very similar to that I used for the npcs on XPW 2008 which I swiped from the ninja guard script from graal the adventure… it was buggy as hell on the Gserver GR had released at the time (2008-09).

[QUOTE=Arcain;58586]that script looks very similar to that I used for the npcs on XPW 2008 which I swiped from the ninja guard script from graal the adventure… it was buggy as hell on the Gserver GR had released at the time (2008-09).[/QUOTE]

It’s called a PREDEFINED NPC o_o

[QUOTE=Beholder;58600]It’s called a PREDEFINED NPC o_o[/QUOTE]

I think he was being sarcastic :stuck_out_tongue:

[QUOTE=Beholder;58600]It’s called a PREDEFINED NPC o_o[/QUOTE]

hmm it would appear I had a sorry-retarded moment. I get those often. Here is the [buggy as hell] script I was referencing. Edit: the part at the bottom was added to combat a problem the gserver had with updating npc attributes at the time. It failed to do this and somehow was left there.

// Xoria PW ////////////// L/U: 24-March-08
//////////////////////////
// HURTNETWORK: Antaranguard
//
// Ninji Guardsman 1.5 by Lord Izlude
// Modified by Arcain for XPW -10-27-2007
// Modified by Downsider -11-06-2007
// Revised by Arcain -24-March-2008
////////////////////////////////////////////////////////////////

if (playerenters) {this.xx = 16; this.yy = 16;}
if (playerenters && isleader) {

  x = this.xx;
  y = this.yy;
  showcharacter;
  //setcharani idle,;
  Antaranguard = 0;


// You must update these props here at bottom of script...

// ################################################

//                          _NPC Settings_
  dir = 2;                                // Direction
  sprite = 0;                             // NPC Position
  hearts = 9;                             // Health
  shieldpower = 3;                        // Shield Strength
  swordpower = 6;                         // Sword Strength
  this.bowpower = 2;                      // Bow Type (1=Bow 2=Fireball 3=Nuke)
  this.huntspeed = 0.7;                   // Speed
//                          _NPC Appearance_
  setcharprop #3,aero-dark-head.png;
  setcharprop #C0,darkred;
  setcharprop #C1,darkred;
  setcharprop #C2,red;
  setcharprop #C3,red;
  setcharprop #C4,darkred;
  setcharprop #2,hunter-shield6.png;
  setcharprop #1,6blood-sword.png;
  setcharprop #8,darkbeat-body1.png;
// ################################################

  if (this.bowpower == 1) setcharprop #7,wbow1.gif;
  if (this.bowpower == 2) setcharprop #7,wbow2.gif;
  if (this.bowpower == 3) setcharprop #7,wbow4.gif;
  hurtdx = 0;
  hurtdy = 0;
  this.maxheart = hearts;
  this.origdir = dir;
  this.mode = 99;
  timeout = 1;
  //x+=0.5;
  //y+=0.5;
  //        * Uncomment These If You Need The NPC To Show Between Spaces *
}


if (playertouchsme && Antaranguard == 0) {
  say 2;

//////////////////////////////////////////////////////////////////////////////////
// *| DO NOT EDIT BELOW THIS LINE |* /////////////////////////////////////////////



  if (abs(playerx-x) > abs(playery-y)) {
   if (playerx<x) dir = 1;
   else dir = 3;
  }
  else {
   if (playery<y) dir = 0;
   else dir = 2;
  }
}
if (playerendsreading && this.mode == 99) dir = this.origdir;
if (timeout && this.mode == 99) timeout = 0.5;
if (((washit || playeronhorse|| waspelt || exploded || wasshot || hearts != this.maxheart) && this.mode == 99) || (timeout && Antaranguard == 1 && this.mode == 99)) {
  message;
  Antaranguard = 1;
  setarray dirgo,8;
  dirgo[1] = -1;
  dirgo[2] = -1;
  dirgo[5] = 1;
  dirgo[6] = 1;
  timeout = 0.5;
  if (hearts<=0) {
    this.mode = 5; // RESPAWN
    this.runcounter = 0;
    timeout = 5;
  } else {
    this.mode = 0;
    this.runcounter = int(random(10,40));
  }
}

// Sword attacking stuff
if (timeout && (this.mode==0 || this.mode==2)) {
  if (abs(playerx-x) > abs(playery-y)) {
   if (playerx<x) dir = 1;
   else dir = 3;
  }
  else {
   if (playery<y) dir = 0;
   else dir = 2;
  }

  // look for players
  mindist = 1000;
  for (i=0; i<playerscount; i++)
      if (players[i].hearts>0 && players[i].id>=0) {
    dx = players[i].x - x;
    dy = players[i].y - y;
    if (abs(dx)>abs(dy)) {
      if (dx>0) pdir=3; else pdir=1;
    } else {
      if (dy>0) pdir=2; else pdir=0;
    }
    if (pdir==dir) {
      dist = (dx*dx+dy*dy)^0.5;
      if (dist<mindist) {
        cansee = 1;
        if (abs(dx)>abs(dy)) k = int(abs(dx));
        else k = int(abs(dy));
        for (j=0; j<=k-2; j++)
          if (onwall(x+1.5+dx*j/k,y+2+dy*j/k)) cansee = 0;
        if (cansee!=0) {
          mindist = dist;
          aimplayer = i;
        }
      }
    }
  }
  if (mindist<=3) {
    this.runcounter = 0;
    this.mode = 3; // SLAYING
    sprite = 9;
    timeout = 0.05;
  } else if (mindist<30) {
    if (this.mode!=2) message You will die!;
    if (int(random(1,30)) == 1 && this.bowpower != 0) {
      sprite = 33;
      sleep 0.1;
      if (this.bowpower == 1) shootarrow dir;
      else if (this.bowpower == 2) shootfireball dir;
      else if (this.bowpower == 3) shootnuke dir;
      sleep 0.5;
      sprite = 0;
    }
    this.runcounter = 100;
    this.mode = 2; // HUNTING
  } else timeout = 0.05;
}
if (timeout && this.mode==3) { // SLAYING
  this.runcounter++;
  if (this.runcounter>4) {
    this.runcounter = 100;
    this.mode = 2; // HUNTING
    sprite = 0;
  } else {
    sprite = 9+this.runcounter;
  }
  message;
  timeout = 0.05;
}
if (timeout && this.mode==2) { // HUNTING
  sprite = (sprite%8)+1;
  this.runcounter--;
  if (this.runcounter>0 && aimplayer<playerscount) {
    dx = players[aimplayer].x-x;
    dy = players[aimplayer].y-y;
    if (abs(dx)>abs(dy)) {
      if (dx>0) dir=3; else dir=1;
    } else {
      if (dy>0) dir=2; else dir=0;
    }
    len = (dx*dx+dy*dy)^0.5;
    addx = (dx/len)*this.huntspeed;
    addy = (dy/len)*this.huntspeed;
    testx = x + 1.5 + dirgo[dir*2];
    testy = y + 2+ dirgo[dir*2+1];
    if (!onwall(testx+addx,testy+addy)) {
      x += addx;
      y += addy;
   } else if (!onwall(testx+addx,testy)) x += addx;
    else if (!onwall(testx,testy+addy)) y += addy;
  } else {
    this.mode = 0; // WALKING
    this.walkmode = 1; // RANDOM
    this.runcounter = int(random(10,40));
    sprite = 0;
    dir = (dir+2)%4;
    message;
  }
  timeout = 0.05;
}

// Hurting stuff
if (washit && this.mode!=1 && hearts>0) {
  dx = x-playerx;
  dy = y-playery;
  len = (dx*dx+dy*dy)^0.5;
  hurtdx = dx/len;
  hurtdy = dy/len;
  sprite = 39;
  hearts -= playerswordpower/2;
}
if ((exploded || waspelt || wasshot) &&
    this.mode!=1 && hearts>0 && isleader) {
  hurtdx = -dirgo[dir*2]*0.2;
  hurtdy = -dirgo[dir*2+1]*0.2;
  sprite = 39;
  if (peltwithsign || peltwithvase || peltwithstone || peltwithnpc) hearts -= 1;
  else if (peltwithblackstone) hearts -= 1.5;
  else hearts -= 0.5;
}
if ((hurtdx!=0 || hurtdy!=0) && isleader) {
  this.hurtdx = hurtdx;
  this.hurtdy = hurtdy;
  hurtdx = 0;
  hurtdy = 0;
  this.mode = 1; // HURTED
  this.runcounter = 20;
  sprite = 39;
  if (hearts<=0) {
    this.mode = 4; // DYING
    this.runcounter = 24;
    sprite = 0;
  }
  timeout = 0.05;
}
if (timeout && this.mode==1) { // HURTED
  this.runcounter--;
  if (this.runcounter>10) {
    testx = x + 1.5 + this.hurtdx*2;
    testy = y + 2+ this.hurtdy*2;
    if (!onwall(testx,testy)) {
      x += this.hurtdx;
      y += this.hurtdy;
    }
  }
  if (this.runcounter<=0) {
    if (swordpower>0) this.mode = 2; // HUNTING
    else this.mode = 0; // WALKING
    this.runcounter = 100;
    sprite = 0;
  }
  timeout = 0.05;
}
if (timeout && this.mode==4) { // DYING
  if (this.runcounter>0) {
    message;
    if ((this.runcounter%2)==0) dir = (dir+3)%4;
    this.runcounter--;
    if (this.runcounter<=0) {
      sprite = 40;
      dontblock;
      play compudead.wav;
      }else timeout = 0.05;
  }
}
if (Antaranguard = 0){
if (timeout && this.schars > 1) {
  showcharacter;

  setcharprop #3,head13.png;
  setcharprop #3,aero-dark-head.png;
  setcharprop #C0,darkred;
  setcharprop #C1,darkred;
  setcharprop #C2,red;
  setcharprop #C3,red;
  setcharprop #C4,darkred;
  setcharprop #2,hunter-shield6.png;
  setcharprop #1,6blood-sword.png;
  setcharprop #8,darkbeat-body1.png;
this.xx = 16; this.yy = 16;
  x = this.xx;
  y = this.yy;

this.schars = 0;
}
if (timeout) {
  this.schars += 0.1;
}
}

Dude you could’ve saved yourself the shame by saying “Yeah I was being sarcastic.”