Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Old Scripting Engine (GS1)
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #16  
Old 08-02-2017, 12:51 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Quote:
Originally Posted by cbk1994 View Post
This is a really neat trick, but I'm curious why you'd prefer this over a serverside onPlayerEnters?
Mostly picked it up from using it on gmaps, since I can throw it in a class and put it in levels on an overworld, snap it with x = int(this.x/64)*64; and it will still warp players out of specific levels on the gmap, since onPlayerEnters() doesn't work. I also just find it more reliable since it will persist even after the initial entering the level.
Reply With Quote
  #17  
Old 08-02-2017, 09:10 PM
Kamaeru Kamaeru is offline
G2k1
Kamaeru's Avatar
Join Date: Dec 2001
Posts: 1,040
Kamaeru has much to be proud ofKamaeru has much to be proud ofKamaeru has much to be proud ofKamaeru has much to be proud ofKamaeru has much to be proud ofKamaeru has much to be proud of
Quote:
Originally Posted by DustyPorViva View Post
Mostly picked it up from using it on gmaps, since I can throw it in a class and put it in levels on an overworld, snap it with x = int(this.x/64)*64; and it will still warp players out of specific levels on the gmap, since onPlayerEnters() doesn't work. I also just find it more reliable since it will persist even after the initial entering the level.
That's how zones are handled on 2k1 like event zones (survivor, CNR, etc), kingdoms zones, nopk zones, quest zones, etc.
__________________
3DS friendcode: 1118-0226-7975
Reply With Quote
  #18  
Old 08-03-2017, 04:52 AM
maximus_asinus maximus_asinus is offline
RIP DarkCloud_PK
Join Date: Oct 2001
Location: Canada
Posts: 3,745
maximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond repute
Without having a weapon added to another player, is it possible to manipulate another player who is not in the same level as me?
__________________
Save Classic!
Reply With Quote
  #19  
Old 08-08-2017, 03:16 AM
maximus_asinus maximus_asinus is offline
RIP DarkCloud_PK
Join Date: Oct 2001
Location: Canada
Posts: 3,745
maximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond repute
I'm trying to use attachplayertoobj.
PHP Code:
if (created) {
  
setshape 1,256,128;
}
if (
playertouchsme) {
  
attachplayertoobj 0,id;

Offline that works flawlessly, but online if I touch the NPC my coordinates get set to 0 and I'm warped to the corner of the level. What am I doing wrong?
__________________
Save Classic!
Reply With Quote
  #20  
Old 03-17-2018, 08:26 PM
MysticalDragon MysticalDragon is offline
Global Administration
MysticalDragon's Avatar
Join Date: Oct 2002
Location: Lynn Ma
Posts: 883
MysticalDragon is a jewel in the roughMysticalDragon is a jewel in the rough
Send a message via AIM to MysticalDragon Send a message via MSN to MysticalDragon
this is a bit late try doing it clientside online
__________________
~Delteria Support
~Playerworld Support
~PWA Chief
http://support.toonslab.com
[email protected]



Reply With Quote
  #21  
Old 03-18-2018, 05:24 AM
Kamaeru Kamaeru is offline
G2k1
Kamaeru's Avatar
Join Date: Dec 2001
Posts: 1,040
Kamaeru has much to be proud ofKamaeru has much to be proud ofKamaeru has much to be proud ofKamaeru has much to be proud ofKamaeru has much to be proud ofKamaeru has much to be proud of
Quote:
Originally Posted by maximus_asinus View Post
I'm trying to use attachplayertoobj.
Ok I actually figured that out recently. You have to set the positions for entering/exiting as a square area. Something like this in the case of a bridge I scripted for Dustari:

NPC Code:

function onCreated() {
this.isbridge = true;
dontBlock();
drawoverplayer();

}

//#CLIENTSIDE
function onCreated() {
this.bridgeWidth = 12;
this.bridgeHeight = 9;
this.bindPositions = {
{3, {-1,3.5}, {1,4.5}}, // {dirToBindOn, {x1,y1}, {x2, y2}}
{1, {11,3.5}, {13,4.5}}
};

this.tilesOver = {
22,22,22,22,22,22,22,22,22,22,22,22,
22,22,22,22,22,22,22,22,22,22,22,22,
22,22,22,22,22,22,22,22,22,22,22,22,
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
22,22,22,22,22,22,22,22,22,22,22,22,
22,22,22,22,22,22,22,22,22,22,22,22,
22,22,22,22,22,22,22,22,22,22,22,22,
22,22,22,22,22,22,22,22,22,22,22,22,
};
this.tilesUnder = {
22,22,22,22,0 ,0 ,0 ,0 ,22,22,22,22,
22,22,22,22,0 ,0 ,0 ,0 ,22,22,22,22,
22,22,22,22,0 ,0 ,0 ,0 ,22,22,22,22,
22,22,22,22,0 ,0 ,0 ,0 ,22,22,22,22,
22,22,22,22,0 ,0 ,0 ,0 ,22,22,22,22,
22,22,22,22,0 ,0 ,0 ,0 ,22,22,22,22,
22,22,22,22,0 ,0 ,0 ,0 ,22,22,22,22,
22,22,22,22,0 ,0 ,0 ,0 ,22,22,22,22,
22,22,22,22,0 ,0 ,0 ,0 ,22,22,22,22,
};
setShape2(this.bridgeWidth, this.bridgeHeight, this.tilesUnder);
setImg("g2k1_dustari_castlebridge.png");
}

function onPlayerEnters() { this.setTimer(0.05); }
function onTimeout() {
temp.pcx = player.x + 1.5;
temp.pcy = player.y + 2;
temp.inzone = 0;
for (temp.i: this.bindPositions) {
temp.cdir = temp.i[0];
temp.cx1 = this.x + temp.i[1][0];
temp.cx2 = this.x + temp.i[2][0];
temp.cy1 = this.y + temp.i[1][1];
temp.cy2 = this.y + temp.i[2][1];
if (temp.pcx in |temp.cx1, temp.cx2| && temp.pcy in |temp.cy1, temp.cy2|) {
if (player.attached && player.dir != temp.cdir)
leaveBridge();
else if (!player.attached && player.dir == temp.cdir)
enterBridge();
temp.inzone = 1;
}
}

this.setTimer(0.05);
}
function leaveBridge() {
drawunderplayer();
setShape2(this.bridgeWidth, this.bridgeHeight, this.tilesUnder);
detachPlayer();
sleep(.2);
drawoverplayer();

}
function enterBridge() {

setShape2(this.bridgeWidth, this.bridgeHeight, this.tilesOver);
attachPlayerToObj(0, id);
}



The important thing to look at being this.bindpositions because it is what tells the timeout function where to check. It took me a while to figure this out, but this script can be modified to create a nice illusion of layering in many situations.
__________________
3DS friendcode: 1118-0226-7975
Reply With Quote
  #22  
Old 03-18-2018, 08:12 PM
MysticalDragon MysticalDragon is offline
Global Administration
MysticalDragon's Avatar
Join Date: Oct 2002
Location: Lynn Ma
Posts: 883
MysticalDragon is a jewel in the roughMysticalDragon is a jewel in the rough
Send a message via AIM to MysticalDragon Send a message via MSN to MysticalDragon
We did the same thing on delteria but I like your method you did with the array regarding setShape2 I did that aswell. Also use [PHP] tags instead of code tags looks much cleaner.


PHP Code:
//#CLIENTSIDE
function onCreated() {
  
with (findimg(200)) {
    
this.image thiso.bridgeImage;
    
this.layer  1;
    
this.thiso.x;
    
this.thiso.y;
    
this.mode  1;
    
this.alpha 0.75;

    if (
thiso.direction == "vertical")
      
this.+= 2;
    else
      
this.+= 2;
  }

  
this.bridgeWidth  getImgWidth(this.bridgeImage) / 16;
  
this.bridgeHeight getImgHeight(this.bridgeImage) / 16;
  
this.this.bridgeWidth  + (this.direction == "horizontal" 0);
  
this.this.bridgeHeight + (this.direction == "vertical" 0);

  
// 10 16
  // 10 21

  
this.dontBlock();

  
onTimeOut();
}

function 
onBridge(temp.py) {
  if (
player.x in |this.xthis.this.w|) {
    if (
temp.py in |this.ythis.this.h|)
      return 
true
  }

  return 
false;
}

function 
isPlayerEntering(temp.py) {
  if (
player.x in |this.xthis.this.w|) {
    if (
temp.py in |this.ythis.2|)
      return 
true;

    if (
temp.py in |this.this.2this.this.h|)
      return 
true;    
  }

  return 
false;
}

function 
onTimeOut() {
  
temp.py player.vecy(player.dir) * 1.05;

  
temp.entered isPlayerEntering(temp.py);

  if (
temp.entered) {
    if (
player.attached == false) {
      
attachPlayerToObj(0this.id);
      
setshape2(this.wthis.hthis.shape);
    }
  } else if (
player.attached == true && player.attachid == this.id) {
    if (
onBridge(temp.py)) {
    } else {
      
detachplayer();  
    }
    
this.chat "attached";
  } else {
    
this.chat "na";
  }

  
setTimer(0.05);

__________________
~Delteria Support
~Playerworld Support
~PWA Chief
http://support.toonslab.com
[email protected]



Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 01:02 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.