Graalians

Graalians (https://www.graalians.com/forums/index.php)
-   GraalOnline Era (https://www.graalians.com/forums/forumdisplay.php?f=13)
-   -   Small Script Help! Can't get Statue working (https://www.graalians.com/forums/showthread.php?t=7791)

Johnaudi 06-23-2012 04:42 PM

Small Script Help! Can't get Statue working
 
Hey,
bin trying to script for the past days, my gold gonna expire in 1 day so i gotta find a quick way to fix it up... so what shall I do? It used to work but I messed and added the /reset command, not working anymore :/ Thanks
Quote:

// Created by Graal804226
function onMouseDown(mode) {
if (mode == "left") {
Temp.pl = findnearestplayer(mousex, mousey);
Player.chat = format("%s was clicked", temp.pl.communityname);

this.head=player.head;
this.chat=player.chat;
this.body=player.body;
this.nick=player.nick;
this.ap=player.ap;
setcharprop #P1,#P1;
this.ani = player.ani;
this.dir = player.dir;
}
}
if (created) {
showcharacter();
this.head = "head0.png";
this.nick = "Statue";
this.colors[0] = "orange";
this.colors[1] = "white";
this.colors[2] = "blue";
this.colors[3] = "red";
this.colors[4] = "black";
this.shield = "no-shield.png";
this.dir = 2;
setcharani("idle",NULL);
message click on me!;
function onPlayerChats() {
if (player.chat == "/reset") {
this.chat ="reset";
}
if (player.chat !="/reset"){
return;
}
}
}
also somehow, function onCreate() doesn't work here...

DanTheMan 06-23-2012 05:03 PM

- Didn't even use 'temp.pl' in defining the NPC's looks (example: temp.pl.head)
- Mixing GS1 and GS2
- Nesting another function inside of 'onCreated' for no apparent reason
- What exactly are you trying to do?

Johnaudi 06-23-2012 05:06 PM

Quote:

Posted by DanTheMan (Post 146887)
- Didn't even use 'temp.pl' in defining the NPC's looks (example: temp.pl.head)
- Mixing GS1 and GS2
- Nesting another function inside of 'onCreated' for no apparent reason
- What exactly are you trying to do?

Oh thanks about the temp.pl =] completely forgot it...
-I get that alot
-I'll try
-making it once clicked, the attributes will load as the player's

Emera 06-23-2012 05:14 PM

Are you using this online or offline? If you're using it online I'll help you with a GS2 version.

Johnaudi 06-23-2012 05:15 PM

Quote:

Posted by Emera (Post 146889)
Are you using this online or offline? If you're using it online I'll help you with a GS2 version.

Online =] yeah sorry for the gs1

Emera 06-23-2012 05:26 PM

PHP Code:

function onCreated() {
  
//Makes sure it's a character NPC
  
showCharacter();
  
  
//Set look before it clones a player
  
this.head "head.png";
  
this.body "body.png";
  
this.nick "unknown";
  
this.dir 2;
}

function 
onMouseDown(mode) {
  
//Only sets if the left mouse button is pressed
  
if (mode != "left") return;
  
  
//Check if the mouse is over the NPC
  
if (mousex in this.xthis.1.5 | && mousey in this.ythis.|) {
    
//Copy the player's features to the NPC
    
this.head player.head;
    
this.body player.body;
    
this.shield player.shield;
    
this.colors[0] = player.colors[0];
    
this.colors[1] = player.colors[1];
    
this.colors[2] = player.colors[2];
    
this.colors[3] = player.colors[3];
    
this.colors[4] = player.colors[4];
    
this.attr[1] = player.attr[1]
    
this.nick player.nick;
    
this.ap player.ap;
  }


That should work. I've commented parts of the code to help you understand it.

callimuc 06-23-2012 05:28 PM

PHP Code:

//#CLIENTSIDE
function onCreated() {
  
showcharacter();
  
this.head "head0.png";
  
this.body "body.png";
  
this.nick "Statue";
  
this.colors[0] = "orange";
  
this.colors[1] = "white";
  
this.colors[2] = "blue";
  
this.colors[3] = "red";
  
this.colors[4] = "black";
  
this.shield "no-shield.png";
  
this.dir 2;
  
setcharani("idle",NULL);
  
this.attr[1] = "";
  
this.chat "Click me!";
}

function 
onMouseDown(mode) {
  if (
mode != "left") return;
  
temp.pl findnearestplayer(mousexmousey);
  
player.chat format("%s was the nearest target"temp.pl.communityname);

  
this.head player.head;
  
this.chat player.chat;
  
this.body player.body;
  
this.nick player.nick;
  
this.ap player.ap;
  
this.attr[1] = player.attr[1//hat
  
this.ani player.ani;
  
this.dir player.dir;
}
function 
onPlayerChats() {
  if (
player.chat == "/reset"this.chat "reset";


Keep in mind, this will reset whenever the level is updated. To prevent that you could do something like this (very simple and just viewable for you);

PHP Code:

//#CLIENTSIDE
function onPlayerEnters() {
  
showcharacter();
  if (
client.statue_first == NULL) {
    
this.head "head0.png";
    
this.body "body.png";
    
this.nick "Statue";
    
this.colors[0] = "orange";
    
this.colors[1] = "white";
    
this.colors[2] = "blue";
    
this.colors[3] = "red";
    
this.colors[4] = "black";
    
this.shield "no-shield.png";
    
this.dir 2;
    
setcharani("idle",NULL);
    
this.attr[1] = "";
    
this.chat "Click me!";
  }
  else {
    
this.head client.statue_first[0];
    
this.body client.statue_first[1];
    
this.nick client.statue_first[2];
    
this.colors[0] = client.statue_first[3][0];
    
this.colors[1] = client.statue_first[3][1];
    
this.colors[2] = client.statue_first[3][2];
    
this.colors[3] = client.statue_first[3][3];
    
this.colors[4] = client.statue_first[3][4];
    
this.shield client.statue_first[4];
    
this.dir client.statue_first[5];
    
setcharani(client.statue_first[6], NULL);
    
this.attr[1] = client.statue_first[7];
  }
}

function 
onMouseDown(mode) {
  if (
mode != "left") return;
  
client.statue_first = {
    
player.head//head
    
player.body//body
    
player.nick//nickname
    
{player.colors[0], player.colors[1], player.colors[2], player.colors[3], player.colors[4]}, //colors
    
player.shield//shield
    
player.dir//direction
    
player.ani//gani
    
player.attr[1//hat
  
};
  
onPlayerEnters();
}

function 
onPlayerChats() {
  if (
player.chat != "reset") return;
  
this.chat "reset";
  
client.statue_first NULL;
  
onPlayerEnters();
  
setTimer(2);
}

function 
onTimeOut() {
  
this.chat "";


Wasnt sure if you want to have your look setted or the other players look. If you want the other players look setted, you could do something like this for the onActionMouseDown()

PHP Code:

function onMouseDown(mode) {
  if (
mode != "left") return;
  
temp.pl findNearestPlayer(mousexmousey);
  if (
mousex in |temp.pl.xtemp.pl.x+3| && mousey in |temp.pl.ytemp.pl.y+3|) {
    
client.statue_first = {
      
temp.pl.head//head
      
temp.pl.body//body
      
temp.pl.nick//nickname
      
{temp.pl.colors[0], temp.pl.colors[1], temp.pl.colors[2], temp.pl.colors[3], temp.pl.colors[4]}, //colors
      
temp.pl.shield//shield
      
temp.pl.dir//direction
      
temp.pl.ani//gani
      
temp.pl.attr[1//hat
    
};
    
onPlayerEnters();
  }




Yah no clue what I wrote there so ask me if you didnt understand something


Damn Emera was faster but anyway it might help

Emera 06-23-2012 05:30 PM

Wouldn't you want to be saving them in serverr. variables instead of client variables so they don't change for each player?

callimuc 06-23-2012 05:34 PM

Quote:

Posted by Emera (Post 146896)
Wouldn't you want to be saving them in serverr. variables instead of client variables so they don't change for each player?

Depending on if the statue should be shown clientside or not. Yah maybe the serverr.flags if everyone should see it.

EDIT for John:
To have it viewable for everyone you could simply change the client.statue_first to server.statue_first. That should work aswell and would be viewable for everyone. But probably I'd change it to something serverside than and use serverr.flags since they are more secure and not changeable with memory editors.

Johnaudi 06-23-2012 06:05 PM

Quote:

Posted by callimuc (Post 146895)
PHP Code:

//#CLIENTSIDE
function onCreated() {
  
showcharacter();
  
this.head "head0.png";
  
this.body "body.png";
  
this.nick "Statue";
  
this.colors[0] = "orange";
  
this.colors[1] = "white";
  
this.colors[2] = "blue";
  
this.colors[3] = "red";
  
this.colors[4] = "black";
  
this.shield "no-shield.png";
  
this.dir 2;
  
setcharani("idle",NULL);
  
this.attr[1] = "";
  
this.chat "Click me!";
}

function 
onMouseDown(mode) {
  if (
mode != "left") return;
  
temp.pl findnearestplayer(mousexmousey);
  
player.chat format("%s was the nearest target"temp.pl.communityname);

  
this.head player.head;
  
this.chat player.chat;
  
this.body player.body;
  
this.nick player.nick;
  
this.ap player.ap;
  
this.attr[1] = player.attr[1//hat
  
this.ani player.ani;
  
this.dir player.dir;
}
function 
onPlayerChats() {
  if (
player.chat == "/reset"this.chat "reset";


Keep in mind, this will reset whenever the level is updated. To prevent that you could do something like this (very simple and just viewable for you);

PHP Code:

//#CLIENTSIDE
function onPlayerEnters() {
  
showcharacter();
  if (
client.statue_first == NULL) {
    
this.head "head0.png";
    
this.body "body.png";
    
this.nick "Statue";
    
this.colors[0] = "orange";
    
this.colors[1] = "white";
    
this.colors[2] = "blue";
    
this.colors[3] = "red";
    
this.colors[4] = "black";
    
this.shield "no-shield.png";
    
this.dir 2;
    
setcharani("idle",NULL);
    
this.attr[1] = "";
    
this.chat "Click me!";
  }
  else {
    
this.head client.statue_first[0];
    
this.body client.statue_first[1];
    
this.nick client.statue_first[2];
    
this.colors[0] = client.statue_first[3][0];
    
this.colors[1] = client.statue_first[3][1];
    
this.colors[2] = client.statue_first[3][2];
    
this.colors[3] = client.statue_first[3][3];
    
this.colors[4] = client.statue_first[3][4];
    
this.shield client.statue_first[4];
    
this.dir client.statue_first[5];
    
setcharani(client.statue_first[6], NULL);
    
this.attr[1] = client.statue_first[7];
  }
}

function 
onMouseDown(mode) {
  if (
mode != "left") return;
  
client.statue_first = {
    
player.head//head
    
player.body//body
    
player.nick//nickname
    
{player.colors[0], player.colors[1], player.colors[2], player.colors[3], player.colors[4]}, //colors
    
player.shield//shield
    
player.dir//direction
    
player.ani//gani
    
player.attr[1//hat
  
};
  
onPlayerEnters();
}

function 
onPlayerChats() {
  if (
player.chat != "reset") return;
  
this.chat "reset";
  
client.statue_first NULL;
  
onPlayerEnters();
  
setTimer(2);
}

function 
onTimeOut() {
  
this.chat "";


Wasnt sure if you want to have your look setted or the other players look. If you want the other players look setted, you could do something like this for the onActionMouseDown()

PHP Code:

function onMouseDown(mode) {
  if (
mode != "left") return;
  
temp.pl findNearestPlayer(mousexmousey);
  if (
mousex in |temp.pl.xtemp.pl.x+3| && mousey in |temp.pl.ytemp.pl.y+3|) {
    
client.statue_first = {
      
temp.pl.head//head
      
temp.pl.body//body
      
temp.pl.nick//nickname
      
{temp.pl.colors[0], temp.pl.colors[1], temp.pl.colors[2], temp.pl.colors[3], temp.pl.colors[4]}, //colors
      
temp.pl.shield//shield
      
temp.pl.dir//direction
      
temp.pl.ani//gani
      
temp.pl.attr[1//hat
    
};
    
onPlayerEnters();
  }




Yah no clue what I wrote there so ask me if you didnt understand something


Damn Emera was faster but anyway it might help

This works, but once level updated it changes...

Edit : oh nvm got it fixed!

Twinny 06-26-2012 01:21 AM

If you save statue settings to serverr flags, Skyld will cleanse your server with flame. Server flags are not appropriate for statues at all... What if 1000 statues were added? >: (

If statues absolutely NEED to keep their outfit even when the level is updated/server is restarted, use files.

e.g.

this.statuename = "myhouse_statue1" and then when the outfit is set serverside, save all the variables into a file e.g. statues/myhouse_states1.txt

In the oncreated event, check if the file exists and if it does, load the values from it. Keep it all serverside and then the server won't have to sync Statue outfits for statues in every single damn level with the player :)

Higbey 06-26-2012 05:25 AM

Quote:

Posted by Twinny
If you save statue settings to serverr flags, Skyld will cleanse your server with flame. Server flags are not appropriate for statues at all... What if 1000 statues were added? >: (

Skyld: he kills it with fire.

Johnaudi 06-26-2012 10:11 AM

Since its a scripting thread, I need help with the variable commands, for example the ec system, I wanted to make it add on each time I want.
Quote:

function onCreate() {
this.level.ecteller = this;
}
function onPlayerTouchsMe() {
if (player.account =="Graal804226") {
this.ec=10;
this.chat ="You have"SPC this.ec SPC"EC's";
}
}
function onTest() {
this.ec +=1;
}
I added this on another NPC :
Quote:

function onPlayerChats() {
if (player.chat=="addec") {
this.level.ecteller.trigger("Test","");
}
}
Thanks...

Twinny 06-26-2012 11:00 PM

Quote:

Posted by Johnaudi (Post 148574)
Since its a scripting thread, I need help with the variable commands, for example the ec system, I wanted to make it add on each time I want.

I added this on another NPC :

Thanks...

I will say straight off the bat that you need onCreated and not onCreate. I also don't see why you are using level references and seperate NPCs for that.

But, you should take it to the OGCC and not here at this point.

Emera 06-30-2012 07:44 PM

Quote:

Posted by Johnaudi (Post 148574)
Since its a scripting thread, I need help with the variable commands, for example the ec system, I wanted to make it add on each time I want.

I added this on another NPC :

Thanks...

Are you trying to give players EC? You'll find it won't work if you're giving NPCs the EC using this.ec instead of player.clientr.ec. This is because this. refers to the NPC, and player.clientr. refers to the player's clientr flags. Save the EC to the player's flags to give the player EC.

PHP Code:

player.clientr.ec ++;
//OR
player.clientr.ec += 10

Just a note, clientr flags can only be changed on the serverside, but can be read from both the clientside and the serverside, so you'll have to add the EC on the serverside. Also, use php tags to show coding instead of quotes ;)

I doubt you'll be able to understand how to load/save from text files this early on in learning GS2, so here's an example of how to save and load your NPC's configuration to/from a text file. Firstly, you'll have to give your NPC-Server the following right.

HTML Code:

rw objects/statues/*.txt
After that, simply add this code to a class and join it to the NPC you wish to make a statue. After that, simply call the loadStatueConfig(); function to load the statue and the saveStatueConfig(); function to save the statue.

PHP Code:

function onCreated() {
  
showCharacter();
  
loadStatueConfig();
}

function 
loadStatueConfig() {
  
this.loadfrom "objects/statues/statue_" this.id ".txt";
  
temp.config.loadlines(this.loadfrom); 
  
  for (
lines temp.config) {
    
this.head lines[0];
    
this.body lines[1];
    
this.shield lines[2];
    
this.sword lines[3];
    
this.colors[0] = lines[4];
    
this.colors[1] = lines[5];
    
this.colors[2] = lines[6];
    
this.colors[3] = lines[7];
    
this.colors[4] = lines[8];
  }
}

function 
saveStatueConfig() {
  
this.saveto "objects/statues/statue_" this.id ".txt";
  
temp.config = {
    
this.head,
    
this.body,
    
this.shield,
    
this.sword,
    
this.colors[0],
    
this.colors[1],
    
this.colors[2],
    
this.colors[3],
    
this.colors[4]
  };
  
  
temp.config.savelines(this.savetofalse);


I hope that helped!

Johnaudi 07-13-2012 09:03 AM

Okay Thanks Emera...
am currently working on an Event, but is there a way to find (in the level) the guy with the most ... lets say clientr.ec
anyway I can warp him and find the command? like is there something like player.most.clientr.ec.setlevel2?

Emera 07-13-2012 12:27 PM

Use for (temp.pl : players) { to scan through all of the players in the level. You can then use temp.pl.clientr.ec to check their ec clientr flag.

Johnaudi 07-13-2012 02:14 PM

Quote:

Posted by Emera (Post 160646)
Use for (temp.pl : players) { to scan through all of the players in the level. You can then use temp.pl.clientr.ec to check their ec clientr flag.

I know that, I just wanted to know, how can I created something to make the one with the MOST EC's be warped or uses chat for a certain thing...
something like for (winner: playerwithmostclientr.ec) {
isnt there something like this similar? like I will use winner.setlevel2() if it worked etc..

callimuc 07-14-2012 08:59 PM

You could do something like this:
PHP Code:

this.mostec NULL;
for (
temp.plplayers) {
  
temp.track findPlayer(this.mostec);
  if (
temp.pl.clientr.event_ec temp.track.clientr.event_ecthis.mostec temp.pl;
}
findPlayer(this.mostec).setLevel2(levelnamexy); 


Emera 07-14-2012 11:02 PM

Quote:

Posted by callimuc (Post 161529)
You could do something like this:
PHP Code:

this.mostec NULL;
for (
temp.plplayers) {
  
temp.track findPlayer(this.mostec);
  if (
temp.pl.clientr.event_ec temp.track.clientr.event_ecthis.mostec temp.pl;
}
findPlayer(this.mostec).setLevel2(levelnamexy); 


Beat me to it :(

Johnaudi 07-15-2012 06:42 AM

Quote:

Posted by callimuc (Post 161529)
You could do something like this:
PHP Code:

this.mostec NULL;
for (
temp.plplayers) {
  
temp.track findPlayer(this.mostec);
  if (
temp.pl.clientr.event_ec temp.track.clientr.event_ecthis.mostec temp.pl;
}
findPlayer(this.mostec).setLevel2(levelnamexy); 


Thank you, but I still don't see the usage of temp.pl and not plys. Like I use, what's the difference?

callimuc 07-15-2012 08:24 PM

You can call it however you want to. You can also call it temp.stefan, temp.john, ... . On Graal it's mostly called temp.pl for one player and temp.plyrs/temp.plys for more players. It's just easier for others to see what you want to do with it. Kinda like organisation but there are no rules for that.
The 2nd "param", in this case players, is always an array. In this case players is an array, just like allplayers, serveroptions.staff, ... . You could also do something like
PHP Code:

temp.testarray = {"hello""my""name""is""calli"};
for (
temp.whatevertemp.testarray) {
  echo(
temp.whatever);


Basicly its the same (in this case) as
PHP Code:

temp.testarray = {"hello""my""name""is""calli"};
for (
temp.i=0temp.i<temp.testarray.size(); temp.i++) {
  echo(
temp.testarray[temp.i]);


in my opinion.

I just prefer the for() loop in this case

Emera 07-15-2012 08:39 PM

Quote:

Posted by callimuc (Post 162284)
PHP Code:

temp.testarray = {"hello""my""name""is""calli"};
for (
temp.i=0temp.i<temp.testarray.size(); temp.i++) {
  echo(
temp.testarray[temp.i]);



Sorry, but it was my understanding that coders styled their code. I must be mistaken? DO IT AGAIN!

callimuc 07-15-2012 09:01 PM

Quote:

Posted by Emera (Post 162289)
Sorry, but it was my understanding that coders styled their code. I must be mistaken? DO IT AGAIN!

What?

Johnaudi 07-16-2012 09:07 AM

Quote:

Posted by callimuc (Post 162284)
You can call it however you want to. You can also call it temp.stefan, temp.john, ... . On Graal it's mostly called temp.pl for one player and temp.plyrs/temp.plys for more players. It's just easier for others to see what you want to do with it. Kinda like organisation but there are no rules for that.
The 2nd "param", in this case players, is always an array. In this case players is an array, just like allplayers, serveroptions.staff, ... . You could also do something like
PHP Code:

temp.testarray = {"hello""my""name""is""calli"};
for (
temp.whatevertemp.testarray) {
  echo(
temp.whatever);


Basicly its the same (in this case) as
PHP Code:

temp.testarray = {"hello""my""name""is""calli"};
for (
temp.i=0temp.i<temp.testarray.size(); temp.i++) {
  echo(
temp.testarray[temp.i]);


in my opinion.

I just prefer the for() loop in this case

I know about the type of calling, but why temp. not this.? I'm still getting confused as this point

IPAD* 07-16-2012 11:43 AM

Quote:

Posted by callimuc (Post 162295)
What?

What the **** cant you read he said you cant style

callimuc 07-16-2012 11:46 AM

Quote:

Posted by IPAD* (Post 162480)
What the **** cant you read he said you cant style

So captain obvious tell me what is not styled on that.

Quote:

Posted by Johnaudi (Post 162468)
I know about the type of calling, but why temp. not this.? I'm still getting confused as this point

temp.flags only stay in the function. Using this.flags will be usable in the whole script and can be changed external through other scripts (thats why i made it this.mostec since you might need it later on). There is no need in using this.flags in that case but its up to you.

IPAD* 07-16-2012 12:52 PM

Quote:

Posted by callimuc (Post 162481)
So captain obvious tell me what is not styled on that.



temp.flags only stay in the function. Using this.flags will be usable in the whole script and can be changed external through other scripts (thats why i made it this.mostec since you might need it later on). There is no need in using this.flags in that case but its up to you.

I just answered chapter 1 I didn't prepare for chapter 2 man!

Johnaudi 07-16-2012 01:48 PM

Quote:

Posted by callimuc (Post 162481)
So captain obvious tell me what is not styled on that.



temp.flags only stay in the function. Using this.flags will be usable in the whole script and can be changed external through other scripts (thats why i made it this.mostec since you might need it later on). There is no need in using this.flags in that case but its up to you.

Oh alright!! Got that!! Thanks.
Quote:

function onCreated() {
this.number=0;
}
function onPlayerTouchsMe() {
if (this.number==0) {
this.chat="you touched me! I feel so special!";
this.number=1;
} else {
this.chat="Stop touching me! You already did!";
}
}
So exactly what I'm asking is : so temp.number can't replace this.number in this case?
And second : is there any other way without using this.number?
Thanks a lot!
P.S @iPad : his script style is readable and nice to the eye.

Emera 07-16-2012 02:53 PM

Quote:

Posted by callimuc (Post 162481)
So captain obvious tell me what is not styled on that.

Spaces between symbols like + and =
Nothing big mango, just pointing it out ;)

Quote:

Posted by Johnaudi (Post 162499)
Oh alright!! Got that!! Thanks.

So exactly what I'm asking is : so temp.number can't replace this.number in this case?
And second : is there any other way without using this.number?
Thanks a lot!
P.S @iPad : his script style is readable and nice to the eye.

Speaking of styling, there's an absence of it in your code. You'll have to get acquanited with styling your code so others can read it. It's hard to read when there's no styling.

Here's some links to help get you started:
http://forums.graalonline.com/forums...ad.php?t=61805
http://fp4.ca/gs2beautifier/

Also, I don't get what you're trying to say about this.number and temp.number.

Johnaudi 07-16-2012 03:14 PM

Quote:

Posted by Emera (Post 162514)
Spaces between symbols like + and =
Nothing big mango, just pointing it out ;)



Speaking of styling, there's an absence of it in your code. You'll have to get acquanited with styling your code so others can read it. It's hard to read when there's no styling.

Here's some links to help get you started:
http://forums.graalonline.com/forums...ad.php?t=61805
http://fp4.ca/gs2beautifier/

Also, I don't get what you're trying to say about this.number and temp.number.

does changing the styling affect the script?

Emera 07-16-2012 03:20 PM

Quote:

Posted by Johnaudi (Post 162534)
does changing the styling affect the script?

No, but it makes it look a damn sight better, and it's easier for other scripters to read it.

callimuc 07-16-2012 04:30 PM

Quote:

Posted by Emera (Post 162514)
Spaces between symbols like + and =
Nothing big mango, just pointing it out ;)

Oh well, in this case it doesn't really matter since I saw lots of scripts not spacing that one though ;) I think in that case it's just better after the semicolon since you will recall it very quickly when you see it (maybe not as a beginner, lol)

Striker 11-23-2012 12:46 PM

Quote:

Posted by callimuc (Post 146895)
PHP Code:

//#CLIENTSIDE
function onCreated() {
  
showcharacter();
  
this.head "head0.png";
  
this.body "body.png";
  
this.nick "Statue";
  
this.colors[0] = "orange";
  
this.colors[1] = "white";
  
this.colors[2] = "blue";
  
this.colors[3] = "red";
  
this.colors[4] = "black";
  
this.shield "no-shield.png";
  
this.dir 2;
  
setcharani("idle",NULL);
  
this.attr[1] = "";
  
this.chat "Click me!";
}

function 
onMouseDown(mode) {
  if (
mode != "left") return;
  
temp.pl findnearestplayer(mousexmousey);
  
player.chat format("%s was the nearest target"temp.pl.communityname);

  
this.head player.head;
  
this.chat player.chat;
  
this.body player.body;
  
this.nick player.nick;
  
this.ap player.ap;
  
this.attr[1] = player.attr[1//hat
  
this.ani player.ani;
  
this.dir player.dir;
}
function 
onPlayerChats() {
  if (
player.chat == "/reset"this.chat "reset";


Keep in mind, this will reset whenever the level is updated. To prevent that you could do something like this (very simple and just viewable for you);

PHP Code:

//#CLIENTSIDE
function onPlayerEnters() {
  
showcharacter();
  if (
client.statue_first == NULL) {
    
this.head "head0.png";
    
this.body "body.png";
    
this.nick "Statue";
    
this.colors[0] = "orange";
    
this.colors[1] = "white";
    
this.colors[2] = "blue";
    
this.colors[3] = "red";
    
this.colors[4] = "black";
    
this.shield "no-shield.png";
    
this.dir 2;
    
setcharani("idle",NULL);
    
this.attr[1] = "";
    
this.chat "Click me!";
  }
  else {
    
this.head client.statue_first[0];
    
this.body client.statue_first[1];
    
this.nick client.statue_first[2];
    
this.colors[0] = client.statue_first[3][0];
    
this.colors[1] = client.statue_first[3][1];
    
this.colors[2] = client.statue_first[3][2];
    
this.colors[3] = client.statue_first[3][3];
    
this.colors[4] = client.statue_first[3][4];
    
this.shield client.statue_first[4];
    
this.dir client.statue_first[5];
    
setcharani(client.statue_first[6], NULL);
    
this.attr[1] = client.statue_first[7];
  }
}

function 
onMouseDown(mode) {
  if (
mode != "left") return;
  
client.statue_first = {
    
player.head//head
    
player.body//body
    
player.nick//nickname
    
{player.colors[0], player.colors[1], player.colors[2], player.colors[3], player.colors[4]}, //colors
    
player.shield//shield
    
player.dir//direction
    
player.ani//gani
    
player.attr[1//hat
  
};
  
onPlayerEnters();
}

function 
onPlayerChats() {
  if (
player.chat != "reset") return;
  
this.chat "reset";
  
client.statue_first NULL;
  
onPlayerEnters();
  
setTimer(2);
}

function 
onTimeOut() {
  
this.chat "";


Wasnt sure if you want to have your look setted or the other players look. If you want the other players look setted, you could do something like this for the onActionMouseDown()

PHP Code:

function onMouseDown(mode) {
  if (
mode != "left") return;
  
temp.pl findNearestPlayer(mousexmousey);
  if (
mousex in |temp.pl.xtemp.pl.x+3| && mousey in |temp.pl.ytemp.pl.y+3|) {
    
client.statue_first = {
      
temp.pl.head//head
      
temp.pl.body//body
      
temp.pl.nick//nickname
      
{temp.pl.colors[0], temp.pl.colors[1], temp.pl.colors[2], temp.pl.colors[3], temp.pl.colors[4]}, //colors
      
temp.pl.shield//shield
      
temp.pl.dir//direction
      
temp.pl.ani//gani
      
temp.pl.attr[1//hat
    
};
    
onPlayerEnters();
  }




Yah no clue what I wrote there so ask me if you didnt understand something


Damn Emera was faster but anyway it might help

wowwowoowwowoowoow i was looking at how john learnt scripting but i am still not at that level :[

RedBoy786* 11-23-2012 02:50 PM

cool story bro

Striker 11-23-2012 03:07 PM

-_-

-_- hmm

callimuc 11-23-2012 03:52 PM

because you are supposed to restart everything and you still dont seem to get the if-statements (maybe you did already, didnt check your thread yet)

Striker 12-02-2012 07:15 AM

Quote:

Posted by callimuc (Post 238776)
because you are supposed to restart everything and you still dont seem to get the if-statements (maybe you did already, didnt check your thread yet)

please do! i understand if() and for() these i can use really good...

Rockstar 12-02-2012 08:15 AM

y u bump?!!?


All times are GMT. The time now is 01:14 PM.

Powered by vBulletin/Copyright ©2000 - 2025, vBulletin Solutions Inc.