Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-20-2015, 07:26 PM
Alpho Alpho is offline
Registered User
Alpho's Avatar
Join Date: Dec 2011
Location: California, USA
Posts: 80
Alpho will become famous soon enough
Exclamation Dexterity Rope & Posts Question

Hello! I have another scripting question.

I'm trying to make 2 wooden posts, with a rope connecting them, which a player can grab to walk across. This would be for a Dexterity skill later on. Right now, the only problem I'm having is that the rope which connects the posts shows incorrectly. When a player grabs a post and walks across the rope, I changed the layer of the rope to 0 so that it shows under my player. Though, doing so resulted in any other player that walks "underneath" the rope (not walking on it) now shows on top of it.

There's probably another better way all together to show the rope..or even a better way to do this all together? I posted the code and an image of the code's result below.

Each post is joined to the class "dexterity_post".
Each post has the direction in which the player should be walking set to this.attr[2];

I plan to add left and right directions to this later as well. I suppose the best way to do it would be to add all directions (diagonal too) with one detection script?

PHP Code:
//#CLIENTSIDE
function onCreated() {
  
this.setshape2(12, {
    
0,
    
22
  
});
  
  
temp.radius 64;
  
  
temp.npcs this.level.findareanpcs(
    
this.- (temp.radius 2),
    
this.- (temp.radius 2),
    
temp.radius,
    
temp.radius
  
);
  
  for (
temp.npc temp.npcs) {
    if (
temp.npc != this) {
      if (
temp.npc.isinclass("dexterity_post")) {
        
this.link = {temp.npc.1temp.npc.1};
      }
    }
  }
  
  switch (
this.attr[2]) {
    case 
"down":
      
with (findimg(1)) {
        
this.0.4;
        
this.+ (thiso.link[1] - thiso.5);
        
image "olwest_lassorope.png";
        
layer 2;
        
stretchy = (thiso.link[1] - thiso.y) / 1.5;
      }
    break;
  }
}

function 
onActionGrab() {
  
player.this.1;
  
player.this.1;
  
  
temp.ani_walk "walk";
  
player.pauseani(10);
  
movement.onFreeze(10);
  
  
findimg(1).layer 0;
  
  switch (
this.attr[2]) {
    case 
"up":
      
player.dir 0;
      
      while (
player.!= this.link[1] - 1) {
        
player.-= 0.5;
        
player.ani temp.ani_walk;
        
sleep(0.05);
      }
    break;
    case 
"down":
      
player.dir 2;
      
      while (
player.!= this.link[1] + 2) {
        
player.+= 0.5;
        
player.ani temp.ani_walk;
        
sleep(0.05);
      }
    break;
  }
  
  
findimg(1).layer 2;
  
player.pauseani(0);
  
movement.onFreeze(0);
  
player.ani player.idleani;


Note: The post graphics are not final and are just placeholders
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 10:22 PM.


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