PDA

View Full Version : Chicken Carry and Water Maze Script Help


E_Man
06-17-2012, 06:41 PM
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.


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:

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
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
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:
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
function onActionCarry(cmd,pl,plx,ply){
switch(cmd){
case "Grab":
//this.hide();
this.x = 2;
this.y = 2;
break;
case "Throw":
//this.show();
this.x = plx+.5;
this.y = 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.
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
But he wants a chicken not a character :|

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.

E_Man
06-18-2012, 09:29 PM
:|

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.

DustyPorViva
06-18-2012, 09:39 PM
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.

E_Man
06-18-2012, 10:30 PM
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

Tricxta
06-19-2012, 12:09 AM
// 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 {
x += vecx(dir)*this.speed;
y += 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

E_Man
06-19-2012, 12:33 AM
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.

// 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 {
x += vecx(dir)*this.speed;
y += vecy(dir)*this.speed;
this.runCount -= this.speed;
}

timeout = 0.05;
}

if (wasthrown)setcharani ce_chicken_walk,;

ff7chocoboknight
06-19-2012, 02:31 AM
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.

E_Man
06-19-2012, 03:00 AM
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.

Tricxta
06-19-2012, 03:17 AM
I'm confused... do you want this to work offline or online o____0

ff7chocoboknight
06-19-2012, 03:31 AM
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?

E_Man
06-19-2012, 04:31 AM
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

Tricxta
06-19-2012, 06:17 AM
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!

ff7chocoboknight
06-19-2012, 06:53 AM
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.

E_Man
06-19-2012, 06:21 PM
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. :)