Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Raelyn's Big Book of Scripting Questions. (https://forums.graalonline.com/forums/showthread.php?t=85091)

[email protected] 04-11-2009 01:23 PM

Quote:

Originally Posted by Raelyn (Post 1482943)
Question #7
I have several NPCs with the following script.

PHP Code:

if (created) {
  
setshape 1,32,16;
}

if (
playertouchsme){
  
say2 Says_stuff_here;


What is the GS2 equivalent for the say2 command? And is there something wrong about the functionality of this script (bad formatting aside)? Because I have 4 of them on the gmap, and two work, and two don't. All identical, the only difference is the sign text. :confused:

The GS2 way, have you read the wiki? (http://wiki.graal.net/index.php/Creation)
HTML Code:

player.say2("Stuff in here");

Raelyn 04-11-2009 01:40 PM

Quote:

Originally Posted by [email protected] (Post 1482947)
HTML Code:

player.say2("Stuff in here");

So I need player.say2? Or just say2 like Ziro posted?

Inverness 04-11-2009 01:51 PM

Quote:

Originally Posted by Raelyn (Post 1482949)
So I need player.say2? Or just say2 like Ziro posted?

Just say2.

After looking at the wiki it doesn't show that say2 is part of the player object, it is a global function.

[email protected] 04-11-2009 01:53 PM

It's serverside too... I'm using it as we speak
HTML Code:

function onActionDisplayStats() {
  temp.i = "#i(classic_bowlingpin_2.png)";
  temp.txt = "\n        " @ i SPC "Lane" SPC this.alleynum SPC "Scores" SPC i @ "\n\n";
 
  temp.players = this.onGetList();
  for (temp.p: temp.players) {
    temp.p = findPlayer(p);
    if (p.level.name != this.level.name) continue;
   
    temp.score = this.("score_" @ p.account);
    temp.txt @= "#i(" @ p.headimg @ ", 0, 64, 32, 32)" SPC p.nick.substring(0, 25) @ "\n";
   
    temp.c = temp.score.tokenize();
    for (temp.i: temp.c) {
      temp.ind = c.index(i);
     
      temp.txt @= " " @ i @ ",";
      if (ind == 5) temp.txt @= "\n";
    }
    temp.txt = txt.substring(0, txt.length() - 1) @ "\n";
  }
  player.say2(temp.txt);
}


cbk1994 04-11-2009 02:46 PM

Indeed, I am fairly certain it can be used serverside.

Raelyn 04-23-2009 11:33 AM

Question #8
 
If I am going to be replacing the default tileset, how would I apply it online? Not really sure how to use addtiledef online.

The tiles has to be in levels\images\ also, right?

TSAdmin 04-23-2009 12:21 PM

Quote:

Originally Posted by Raelyn (Post 1486208)
If I am going to be replacing the default tileset, how would I apply it online? Not really sure how to use addtiledef online.

The tiles has to be in levels\images\ also, right?

If I'm not mistaken about your request, you want to make it a Weapon-NPC that adds to people as they log in. Within the Weapon-NPC, the following lines would be necessary to achieve the same output as if you were doing it offline in the Level Editor:

PHP Code:

//#CLIENTSIDE
function onCreated() {
  
removeTileDefs("");

  
addTileDef("tileImageFile.ext""prefix"type);


Yes, "tileImageFile.ext" must be in a valid image directory as defined in your Folder Options, generally in the folder you specified, or any custom sub-folder.

cbk1994 04-23-2009 09:50 PM

Adding a bit to what TSA said, you can also do stuff like

PHP Code:

addtiledef("tileset.png""server_"1);
addtiledef("cavetileset.png""servercave_"1); // or...
addtiledef("cavetileset.png""server_cave-"1); 

for adding custom tiles for certain levels, rather than putting it in the actual level.

Raelyn 04-24-2009 12:04 AM

Quote:

Originally Posted by cbk1994 (Post 1486276)
Adding a bit to what TSA said, you can also do stuff like

PHP Code:

addtiledef("tileset.png""server_"1);
addtiledef("cavetileset.png""servercave_"1); // or...
addtiledef("cavetileset.png""server_cave-"1); 

for adding custom tiles for certain levels, rather than putting it in the actual level.

Would I put this in a weapon and add to all players? Or would I put this in a global script, like NPC server?

Raelyn 04-24-2009 12:31 AM

Question #9
 
When adding gmaps online, if I am going to be placing additional gmaps, such as a 2 level gmap to make a larger room, etc, do I have to add a loadmap function for that? Or does the server automatically detect all the new gmaps?

Tigairius 04-24-2009 12:34 AM

You need to use gmaps= in server options. It will automatically load the gmap if it is in that list. After you add it, type "/updatelevel whatever.gmap" in RC.

If the NPC-Server has rights to the gmap, you can also use the scripting function:
PHP Code:

addgmap(str) - adds dynamicly a gmap to the options and loads it 


Raelyn 04-24-2009 01:10 AM

Quote:

Originally Posted by Tigairius (Post 1486321)
You need to use gmaps= in server options. It will automatically load the gmap if it is in that list. After you add it, type "/updatelevel whatever.gmap" in RC.

If the NPC-Server has rights to the gmap, you can also use the scripting function:
PHP Code:

addgmap(str) - adds dynamicly a gmap to the options and loads it 


Would that be:


PHP Code:

gmaps=aetherforge_main.gmap

or

PHP Code:

gmaps=aetherfoge_main

?

cbk1994 04-24-2009 01:17 AM

Quote:

Originally Posted by Raelyn (Post 1486349)
Would that be:


PHP Code:

gmaps=aetherforge_main.gmap

or

PHP Code:

gmaps=aetherfoge_main

?

The second one.

Raelyn 04-24-2009 01:31 AM

Quote:

Originally Posted by cbk1994 (Post 1486352)
The second one.

Alright, thanks.

cbk1994 04-24-2009 01:55 AM

Quote:

Originally Posted by Raelyn (Post 1486308)
Would I put this in a weapon and add to all players? Or would I put this in a global script, like NPC server?

[sorry, didn't see this earlier]

It has to be in a weapon that all players have; addtiledef only works clientside. TSA provided a code example that you can pretty much copy and paste in.


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

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