Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Old Scripting Engine (GS1) (https://forums.graalonline.com/forums/forumdisplay.php?f=154)
-   -   Chicken Carry and Water Maze Script Help (https://forums.graalonline.com/forums/showthread.php?t=134266663)

E_Man 06-17-2012 06:41 PM

Chicken Carry and Water Maze Script Help
 
I was to make levels in offline editor but I can't do a water maze right, this is what I have:

// NPC made by E-Man
if (playerswimming) {
playerx=31;
playery=42;
}

It only works if I start in the water. Also I want to know how to how to change the carry gani of an npc so I can carry a chicken because when I try to carry a chicken, it looks like a person, and I can't use "replaceani" or "replacecharani",

Tricxta 06-18-2012 12:01 AM

Playerswimming is a passive flag, you'll need to continuously keep on checking the flag,
this can be either through a while or timeout loop.

PHP Code:

if (playerenters || timeout){
  if (
playerswimming){
    
playerx 31;
    
playery 42;
  }
  
timeout 0.05;



E_Man 06-18-2012 01:18 AM

Thank you for the response. I still need help with the carried chicken gani though.

Tricxta 06-18-2012 02:18 AM

Sorry, I didn't pay attention to your other quest. You can achieve this in a variety of ways.
Although I think the carry function is broken(online).

You can do this though:
PHP Code:

setplayerprop #P3,chickenImage.png;
replaceani idle,carrystill;
replaceani walk,carry

Requires a bit more working though. However if it's just offline you're using this for
canbecarried; should work fine. Which will be inserted into the npc you want to be able to carry.
You should take the time to look at commands.rtf in closer detail, GS1 is a really easy language which shouldn't really need assistance with.

DustyPorViva 06-18-2012 02:22 AM

PHP Code:

if (created) {
  
setimg chicken.gif;
  
canbecarried;


If you want to go with the bare minimum.

Devil_Lord2 06-18-2012 02:44 AM

I'm just wondering, how might the online version be fixed?
What I would do is an ongoing timeout checking the direction of the player, which location from the npc he is at, and then if he is doing the grab gani.

Then I guess you'd make the carrying gani the image that it is carrying?
But is there a more efficient way of making onplayergrabs?

E_Man 06-18-2012 03:55 AM

Quoting is not working right now for me, but I can't use
"setplayerprop #P3,chickenImage.png;
replaceani idle,carrystill;
replaceani walk,carry;"
that Tricxta said because it is for the player and not the npc itself. I also can't use
"if (created) {
setimg chicken.gif;
canbecarried;
} "
that DustyPorViva said because it is using an image and not a gani. I need to make it a gani for an npc character that replaces the original carry gani.

Tricxta 06-18-2012 04:09 AM

Quote:

Originally Posted by E_Man (Post 1697580)
Quoting is not working right now for me, but I can't use
"setplayerprop #P3,chickenImage.png;
replaceani idle,carrystill;
replaceani walk,carry;"
that Tricxta said because it is for the player and not the npc itself. I also can't use
"if (created) {
setimg chicken.gif;
canbecarried;
} "
that DustyPorViva said because it is using an image and not a gani. I need to make it a gani for an npc character that replaces the original carry gani.

What dusty said will work and also is most preferable, it's also what I hoped I'd be inferring... I just gave solutions for both online and offline in GS1.

Devil_Lord2 06-18-2012 04:53 AM

Well this is my solution for online which still doesn't work...

Level NPC:
PHP Code:

this.join("cancarry");
function 
onCreated(){
  
this.size = {2,2};
  
setshape(1,16*this.size[0],16*this.size[1]);
}
//#CLIENTSIDE
function onCreated(){
  
this.carry "block.png";
  
this.size = {2,2};
  
settimer(.1);


Class: cancarry
PHP Code:

function onActionCarry(cmd,pl,plx,ply){
  switch(
cmd){
    case 
"Grab":
      
//this.hide();
      
this.2;
      
this.2;
      break;
    case 
"Throw":
      
//this.show();
      
this.plx+.5;
      
this.ply-1;
      
findPlayer(pl).chat "true";
      break;
  }
  
sleep(1);
  
this.chat " ";
}
//#CLIENTSIDE
function onTimeout(){
  
//this.chat = "X:" SPC this.x-3 SPC this.x+this.size[0] SPC "Y:" SPC this.y-3.5 SPC this.y+this.size[1]-.5;
  
if (player.ani == "grab" && player.x in |this.x-3,this.x+this.size[0]| && player.y in |this.y-3.5,this.y+this.size[1]-.5| && this.newplayer == null){
    
setani("carrystill",null);
    
replaceani("idle","carrystill");
    
replaceani("walk","carry");
    
player.attr[3] = this.carry;
    
triggeraction(this.x,this.y,"Carry","Grab",player.account);
    
//this.hide();
    
sleep(.5);
    
this.newplayer player.account;
  }  
  
settimer(.1);
}

function 
onKeyPressed(a,b,c){
    if (
b=="a" && player.account == this.newplayer){
      
throwcarry();
      
setani("grab",null);
      
replaceani("idle","idle");
      
replaceani("walk","walk");
      
//this.show();
      
player.attr[3] = "";
      
triggeraction(this.x,this.y,"Carry","Throw",player.account,player.x,player.y);
      
freezeplayer(.2);
      
this.newplayer null;
    }
  } 

I was going to have it change Z and X depending on the player.dir...
but I still feel there is an easier way then how I'd do it..

Even if I got it to work, serverside, it would still be pretty slow...
Doesn't want to react after hidden it seems, and I don't want to change its alpha...
Then at -2 -2 it doesn't want to react... X = 2 and Y = 2 was my best bet. :/

Also, E_Man, you can also 'fake quote' by putting QUOTE and /QUOTE with the brackets.

Tricxta 06-18-2012 07:43 AM

Stop confusing people david, he wants an offline script and he's been given it. That means it can only be GS1. If you want to show case your poor script take it to the code gallery.

E_Man 06-18-2012 02:17 PM

Ok, so I can't change the carry gani of an npc, I can only use an image. :(

callimuc 06-18-2012 02:50 PM

There you go for the gani version.
PHP Code:

if (created) {
  
showcharacter;
  
setcharprop #3,head0.png;
  
setcharprop #C0,orange;
  
setcharprop #C1,white;
  
setcharprop #C2,blue;
  
setcharprop #C3,red;
  
setcharprop #C4,black;
  
setcharprop #2,shield1.gif;
  
shieldpower 1;
  
dir 2;
  
setcharani idle,;
  
canbecarried;



ff7chocoboknight 06-18-2012 03:31 PM

But he wants a chicken not a character :|

callimuc 06-18-2012 04:33 PM

Quote:

Originally Posted by ff7chocoboknight (Post 1697623)
But he wants a chicken not a character :|

Quote:

Originally Posted by E_Man (Post 1697580)
that DustyPorViva said because it is using an image and not a gani. I need to make it a gani for an npc character that replaces the original carry gani.

:|

You don't know how his chicken is made :P if it's a body, head, complete own gani or whatever ^^

ff7chocoboknight 06-18-2012 04:37 PM

Oh.


All times are GMT +2. The time now is 03:37 AM.

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