Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   setting hat on a character in GS2 (https://forums.graalonline.com/forums/showthread.php?t=75901)

Cherrykao 07-28-2007 02:50 AM

setting hat on a character in GS2
 
i know the GS1 command is "setcharprop #P1" for setting a hat on an NPC, but is there a GS2 command for setting a hat on a character or NPC like "headimg" for head, "bodyimg" for body, etc...

i also have another question. how or what function determines whether or not players are able to walk through another player and players cannot walk through other players? do people just script their own functions for this or is there a command that can be used?? thanks.

coreys 07-28-2007 02:58 AM

player.attr[0] = "imagename";
I believe.

DustyPorViva 07-28-2007 03:14 AM

Only way to make players walk through each other is to make the area a nopk zone. Though, someone recently posted a script in the code gallery that did that exact thing.

Cherrykao 07-28-2007 05:12 AM

thanks. i ran into another problem. here's what i did:

PHP Code:

function onPlayerEnters() {
  
datalog.loadvars("levels/datastuff.txt");

  
stat datalog.info;
}

//#CLIENTSIDE
function onCreated() {
  
this.chat format("This info: %s",stat);


when i run this script, the output is: "This info: 0". there's already stuff saved into this text file. datalog.info should contain a string: "test" and not the number 0. i can't seem to correctly copy variables from serverside to clientside (or vice versa).

i don't want to get rid of the CLIENTSIDE comment since i have additional functions below this that are clientside functions only.

DustyPorViva 07-28-2007 05:21 AM

You can't just read a serverside variable from the clientside. You should use attr's.

Cherrykao 07-28-2007 05:27 AM

thanks. it works using attr's.

Twinny 07-28-2007 11:27 AM

Here's what I do

PHP Code:

if (player.chat.starts("sethat"))
  
player.attr[1] = player.chat.substring(7,-1); 


cbk1994 07-28-2007 04:24 PM

Quote:

Originally Posted by Twinny (Post 1335005)
Here's what I do

PHP Code:

if (player.chat.starts("sethat"))
  
player.attr[1] = player.chat.substring(7,-1); 


pshaw. Thats noob code.

PHP Code:

tokens player.chat.tokenize();
if ( 
tokens[0] == "/sethat" )
{
  
player.attr[1] = tokens[1];


^-- That's where it's at.

Rapidwolve 07-28-2007 04:42 PM

Quote:

Originally Posted by cbkbud (Post 1335031)
PHP Code:

tokens player.chat.tokenize();
if ( 
tokens[0] == "/sethat" )
{
  
player.attr[1] = tokens[1];



ew o-o

Twinny 07-28-2007 05:26 PM

Quote:

Originally Posted by cbkbud (Post 1335031)
pshaw. Thats noob code.

PHP Code:

tokens player.chat.tokenize();
if ( 
tokens[0] == "/sethat" )
{
  
player.attr[1] = tokens[1];


^-- That's where it's at.

That tokenize was seriously unnecessary... I didn't create a var (you also forgot to temp it) and I didn't need to tokenize it then access an index...

coreys 07-28-2007 05:34 PM

I think that was the point...I think he was joking. lol

Inverness 08-12-2007 09:09 PM

Quote:

Originally Posted by coreys (Post 1335038)
I think that was the point...I think he was joking. lol

This forum has too many retards to try to guess which ones are actually average people making a joke, so I just lump them all in the retard box if they say crap like that.

PHP Code:

if (player.chat.starts("sethat "))
  
player.attr[1] = player.chat.substring(7,-1); 

Better like that, with the space at the end of sethat :D

So if I say "sethatfrootloopston" it wont do anything.

zokemon 08-13-2007 06:13 PM

Quote:

Originally Posted by cbkbud (Post 1335031)
pshaw. Thats noob code.

PHP Code:

tokens player.chat.tokenize();
if ( 
tokens[0] == "/sethat" )
{
  
player.attr[1] = tokens[1];


^-- That's where it's at.

Using tokenize without parameters is real noob code.


All times are GMT +2. The time now is 03:49 PM.

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