Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 06-17-2012, 06:41 PM
E_Man E_Man is offline
E-Man
E_Man's Avatar
Join Date: Jun 2012
Posts: 81
E_Man will become famous soon enough
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",
Reply With Quote
  #2  
Old 06-18-2012, 12:01 AM
Tricxta Tricxta is offline
The Muffin Man
Tricxta's Avatar
Join Date: Oct 2010
Location: Australia
Posts: 563
Tricxta is just really niceTricxta is just really nice
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;

Reply With Quote
  #3  
Old 06-18-2012, 01:18 AM
E_Man E_Man is offline
E-Man
E_Man's Avatar
Join Date: Jun 2012
Posts: 81
E_Man will become famous soon enough
Thank you for the response. I still need help with the carried chicken gani though.
Reply With Quote
  #4  
Old 06-18-2012, 02:18 AM
Tricxta Tricxta is offline
The Muffin Man
Tricxta's Avatar
Join Date: Oct 2010
Location: Australia
Posts: 563
Tricxta is just really niceTricxta is just really nice
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.
Reply With Quote
  #5  
Old 06-18-2012, 02:22 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
PHP Code:
if (created) {
  
setimg chicken.gif;
  
canbecarried;

If you want to go with the bare minimum.
Reply With Quote
  #6  
Old 06-18-2012, 02:44 AM
Devil_Lord2 Devil_Lord2 is offline
David K?
Devil_Lord2's Avatar
Join Date: Apr 2011
Location: PA, MD.
Posts: 643
Devil_Lord2 can only hope to improve
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?
__________________

Digital Media Artist - David K? </3 (UnLoved)
www.davidkrout.com
www.twitch.com/DavidKkz



Reply With Quote
  #7  
Old 06-18-2012, 03:55 AM
E_Man E_Man is offline
E-Man
E_Man's Avatar
Join Date: Jun 2012
Posts: 81
E_Man will become famous soon enough
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.
Reply With Quote
  #8  
Old 06-18-2012, 04:09 AM
Tricxta Tricxta is offline
The Muffin Man
Tricxta's Avatar
Join Date: Oct 2010
Location: Australia
Posts: 563
Tricxta is just really niceTricxta is just really nice
Quote:
Originally Posted by E_Man View Post
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.

Last edited by Tricxta; 06-18-2012 at 07:51 AM.. Reason: Thought I had my point clear enough...
Reply With Quote
  #9  
Old 06-18-2012, 04:53 AM
Devil_Lord2 Devil_Lord2 is offline
David K?
Devil_Lord2's Avatar
Join Date: Apr 2011
Location: PA, MD.
Posts: 643
Devil_Lord2 can only hope to improve
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.
__________________

Digital Media Artist - David K? </3 (UnLoved)
www.davidkrout.com
www.twitch.com/DavidKkz



Reply With Quote
  #10  
Old 06-18-2012, 07:43 AM
Tricxta Tricxta is offline
The Muffin Man
Tricxta's Avatar
Join Date: Oct 2010
Location: Australia
Posts: 563
Tricxta is just really niceTricxta is just really nice
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.
Reply With Quote
  #11  
Old 06-18-2012, 02:17 PM
E_Man E_Man is offline
E-Man
E_Man's Avatar
Join Date: Jun 2012
Posts: 81
E_Man will become famous soon enough
Ok, so I can't change the carry gani of an npc, I can only use an image.
Reply With Quote
  #12  
Old 06-18-2012, 02:50 PM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
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;

__________________
MEEP!
Reply With Quote
  #13  
Old 06-18-2012, 03:31 PM
ff7chocoboknight ff7chocoboknight is offline
Skyzer Zolderon
ff7chocoboknight's Avatar
Join Date: Dec 2006
Location: New Hampshire, United States
Posts: 725
ff7chocoboknight is a name known to allff7chocoboknight is a name known to allff7chocoboknight is a name known to allff7chocoboknight is a name known to all
Send a message via AIM to ff7chocoboknight Send a message via MSN to ff7chocoboknight
But he wants a chicken not a character :|
__________________
Reply With Quote
  #14  
Old 06-18-2012, 04:33 PM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
Quote:
Originally Posted by ff7chocoboknight View Post
But he wants a chicken not a character :|
Quote:
Originally Posted by E_Man View Post
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
__________________
MEEP!
Reply With Quote
  #15  
Old 06-18-2012, 04:37 PM
ff7chocoboknight ff7chocoboknight is offline
Skyzer Zolderon
ff7chocoboknight's Avatar
Join Date: Dec 2006
Location: New Hampshire, United States
Posts: 725
ff7chocoboknight is a name known to allff7chocoboknight is a name known to allff7chocoboknight is a name known to allff7chocoboknight is a name known to all
Send a message via AIM to ff7chocoboknight Send a message via MSN to ff7chocoboknight
Oh.
__________________
Reply With Quote
  #16  
Old 06-18-2012, 09:29 PM
E_Man E_Man is offline
E-Man
E_Man's Avatar
Join Date: Jun 2012
Posts: 81
E_Man will become famous soon enough
Quote:
Originally Posted by callimuc View Post
:|

You don't know how his chicken is made :P if it's a body, head, complete own gani or whatever
It's its own gani.
Reply With Quote
  #17  
Old 06-18-2012, 09:39 PM
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
You can set 'canbecarried' to showcharacters offline. They will inherit the sit gani when picked up. The problem is information is being withheld here.

Does it REALLY need to be a gani? Can you not make it a gif? The problem is when you go down the gani route you're going to complicate things substantially because you end up having to rescript many things/tie up loopholes and such. If you need to, create a copy of the carry gani and insert the chicken gani into that and use replaceani carry,carrychicken; or something.
Reply With Quote
  #18  
Old 06-18-2012, 10:30 PM
E_Man E_Man is offline
E-Man
E_Man's Avatar
Join Date: Jun 2012
Posts: 81
E_Man will become famous soon enough
Quote:
Originally Posted by DustyPorViva View Post
Does it REALLY need to be a gani? Can you not make it a gif?
Is there a way to change an npc that first uses a gani to change into a gif which carried? like an "ifgrabbed" command if that is possible
Reply With Quote
  #19  
Old 06-19-2012, 12:09 AM
Tricxta Tricxta is offline
The Muffin Man
Tricxta's Avatar
Join Date: Oct 2010
Location: Australia
Posts: 563
Tricxta is just really niceTricxta is just really nice
PHP Code:
// Graal2002 NPC by Stefan Knorr
if (created) {
  
// Initialize the attributes
  
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 walk,;
  
this.speed 0.4;
  
canbecarried;
  
timeout 0.05;
}

if (
timeout){
  if (
this.runCount <= 0){
    
dir += int(random(0,3));
    
this.runCount  random(4,10);
  }
  if (
onwall(x+1.5+vecx(dir)*2,y+2+vecy(dir)*2))dir int(random(0,3));
  else {
    
+= vecx(dir)*this.speed;
    
+= vecy(dir)*this.speed;
    
this.runCount -= this.speed;
  }

  
timeout 0.05;
}

if (
wasthrown)setcharani walk,; 
Tested this, works fine offline both using an image or a gani o_0

Last edited by Admins; 06-08-2013 at 04:24 PM..
Reply With Quote
  #20  
Old 06-19-2012, 12:33 AM
E_Man E_Man is offline
E-Man
E_Man's Avatar
Join Date: Jun 2012
Posts: 81
E_Man will become famous soon enough
I tried your script Tricxta but it did not work, I'll show you what happened to me with a gani you probably have because I found it in a server so you can test it.

PHP Code:
// Graal2002 NPC by Stefan Knorr
if (created) {
  
// Initialize the attributes
  
showcharacter;
setcharprop #P1,ce_chicken-white.png;
  
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 ce_chicken_walk,;
  
this.speed 0.4;
  
canbecarried;
  
timeout 0.05;
}

if (
timeout){
  if (
this.runCount <= 0){
    
dir += int(random(0,3));
    
this.runCount  random(4,10);
  }
  if (
onwall(x+1.5+vecx(dir)*2,y+2+vecy(dir)*2))dir int(random(0,3));
  else {
    
+= vecx(dir)*this.speed;
    
+= vecy(dir)*this.speed;
    
this.runCount -= this.speed;
  }

  
timeout 0.05;
}

if (
wasthrown)setcharani ce_chicken_walk,; 
Reply With Quote
  #21  
Old 06-19-2012, 02:31 AM
ff7chocoboknight ff7chocoboknight is offline
Skyzer Zolderon
ff7chocoboknight's Avatar
Join Date: Dec 2006
Location: New Hampshire, United States
Posts: 725
ff7chocoboknight is a name known to allff7chocoboknight is a name known to allff7chocoboknight is a name known to allff7chocoboknight is a name known to all
Send a message via AIM to ff7chocoboknight Send a message via MSN to ff7chocoboknight
What does the chicken gani look like? If it is not a normal character gani it doesn't need showcharacter and all the stuff setting the characters attrs.
__________________
Reply With Quote
  #22  
Old 06-19-2012, 03:00 AM
E_Man E_Man is offline
E-Man
E_Man's Avatar
Join Date: Jun 2012
Posts: 81
E_Man will become famous soon enough
Quote:
Originally Posted by ff7chocoboknight View Post
What does the chicken gani look like? If it is not a normal character gani it doesn't need showcharacter and all the stuff setting the characters attrs.
I looks like it does in the script above, just input it into graal editor to see.
Reply With Quote
  #23  
Old 06-19-2012, 03:17 AM
Tricxta Tricxta is offline
The Muffin Man
Tricxta's Avatar
Join Date: Oct 2010
Location: Australia
Posts: 563
Tricxta is just really niceTricxta is just really nice
I'm confused... do you want this to work offline or online o____0
Reply With Quote
  #24  
Old 06-19-2012, 03:31 AM
ff7chocoboknight ff7chocoboknight is offline
Skyzer Zolderon
ff7chocoboknight's Avatar
Join Date: Dec 2006
Location: New Hampshire, United States
Posts: 725
ff7chocoboknight is a name known to allff7chocoboknight is a name known to allff7chocoboknight is a name known to allff7chocoboknight is a name known to all
Send a message via AIM to ff7chocoboknight Send a message via MSN to ff7chocoboknight
Quote:
Originally Posted by E_Man View Post
I looks like it does in the script above, just input it into graal editor to see.
I don't have the gani. How am I supposed to know what it looks like?
__________________
Reply With Quote
  #25  
Old 06-19-2012, 04:31 AM
E_Man E_Man is offline
E-Man
E_Man's Avatar
Join Date: Jun 2012
Posts: 81
E_Man will become famous soon enough
Quote:
Originally Posted by Tricxta View Post
I'm confused... do you want this to work offline or online o____0
It's offline. Also if you can't find the gani for the chicken I used, just log into classic server, and you should have another gani that should work, just replace the ce_chicken_walk.gani with the new one
Reply With Quote
  #26  
Old 06-19-2012, 06:17 AM
Tricxta Tricxta is offline
The Muffin Man
Tricxta's Avatar
Join Date: Oct 2010
Location: Australia
Posts: 563
Tricxta is just really niceTricxta is just really nice
Make the chicken a body, set the head to nothing and use the code I gave you. It'll take a bit of effort on your part i'm sorry but if you want to achieve, that's how!
Reply With Quote
  #27  
Old 06-19-2012, 06:53 AM
ff7chocoboknight ff7chocoboknight is offline
Skyzer Zolderon
ff7chocoboknight's Avatar
Join Date: Dec 2006
Location: New Hampshire, United States
Posts: 725
ff7chocoboknight is a name known to allff7chocoboknight is a name known to allff7chocoboknight is a name known to allff7chocoboknight is a name known to all
Send a message via AIM to ff7chocoboknight Send a message via MSN to ff7chocoboknight
Quote:
Originally Posted by E_Man View Post
It's offline. Also if you can't find the gani for the chicken I used, just log into classic server, and you should have another gani that should work, just replace the ce_chicken_walk.gani with the new one
Doesn't change the fact that you don't need showcharacter or character attrs for the chicken.
__________________
Reply With Quote
  #28  
Old 06-19-2012, 06:21 PM
E_Man E_Man is offline
E-Man
E_Man's Avatar
Join Date: Jun 2012
Posts: 81
E_Man will become famous soon enough
Quote:
Originally Posted by Tricxta View Post
Make the chicken a body, set the head to nothing and use the code I gave you. It'll take a bit of effort on your part i'm sorry but if you want to achieve, that's how!
Ok, I'll do that, that should work.
Reply With Quote
Reply


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 09:03 AM.


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