Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Distributing weapons. (https://forums.graalonline.com/forums/showthread.php?t=85087)

Raelyn 04-11-2009 03:41 AM

Distributing weapons.
 
Ok, I have a weapon NPC on the server that has alot of chat commands etc, but currently I have to add it to people for them to have it, what is the easiest method to have the NPC server check and add it to anyone who doesn't have it when they log on?

Tigairius 04-11-2009 04:03 AM

Quote:

Originally Posted by Raelyn (Post 1482858)
Ok, I have a weapon NPC on the server that has alot of chat commands etc, but currently I have to add it to people for them to have it, what is the easiest method to have the NPC server check and add it to anyone who doesn't have it when they log on?

-Click on your NPCs button (the button on the far left of your NPC-Control).
-Right click Control-NPC and edit the script.
-If the script is blank, add this:
PHP Code:

function onActionPlayerOnline() {
  
player.addWeapon("weapon name");


-If the script is not blank, just add player.addWeapon("weapon name"); in your actionplayeronline function.

Raelyn 04-11-2009 05:01 AM

Quote:

Originally Posted by Tigairius (Post 1482863)
-Click on your NPCs button (the button on the far left of your NPC-Control).
-Right click Control-NPC and edit the script.
-If the script is blank, add this:
PHP Code:

function onActionPlayerOnline() {
  
player.addWeapon("weapon name");


-If the script is not blank, just add player.addWeapon("weapon name"); in your actionplayeronline function.

Thanks!

Oi, I should start another thread titled "Raelyn's Big List of Questions" since I have about a million more. Such as, what is the GS2 equivalent of the lay and lay2 commands? And why does firing arrows and placing bombs on the gmap seem to not work properly? :P

Also, I have a script for setani is GS1, how would I setani in GS2? And the GS1 version doesn't work in the gmap, only indoor levels, what would cause this?

Thank you.

Schetti 04-11-2009 08:09 AM

Simple ani scripts:
PHP Code:

(this.)setcharani("sch_ctfblueidle","null"); //changes the ani of the NPC
//(dont know about null(Serverside only)), this. isnt needed, but I got told to use

replaceani("walk""another_walk"); //to replace the players first gani 
//with a second(Clientside only)

setani("burninair","null"); //changes the ani of the Player
//(dont know about null(Clientside only)) 

Go make that thread, I'll try to help you(1 newb helps the other)

Tigairius 04-11-2009 08:21 AM

Quote:

Originally Posted by Raelyn (Post 1482871)
Thanks!

Oi, I should start another thread titled "Raelyn's Big List of Questions" since I have about a million more. Such as, what is the GS2 equivalent of the lay and lay2 commands? And why does firing arrows and placing bombs on the gmap seem to not work properly? :P

Also, I have a script for setani is GS1, how would I setani in GS2? And the GS1 version doesn't work in the gmap, only indoor levels, what would cause this?

Thank you.

"lay", "lay2", "shootarrow", etc. commands are all deprecated commands that were only left for compatibility and are not actually recommended to use.

An example of laying a green rupee could be replicated (depending on your 'gralats' class) with something as simple as:
PHP Code:

with (putnpc2(xy"join gralats;")) {
  
this.type 1// 0 = green, 1 = blue, 2 = red, 3 = gold


Other commands, like shootarrow() can be replicated using a shoot() command.

PHP Code:

//#CLIENTSIDE
function onWeaponFired() {
  
// TServerLevel.shoot(x,y,z,angle,zangle,strength,ani,aniparams)
  
shoot(player.1.5 vecx(player.dir), player.vecy(player.dir), player.zgetangle(vecx(player.dir), vecy(player.dir)), NULLNULL"arrow"NULL);


You would have to make a gani called 'arrow' with an arrow facing all four directions, of course. It's my recommendation that you don't use any of those older commands, and re-script most of that kind of stuff.

Simple animation changes are:
PHP Code:

setCharAni("idle"NULL); // This will set the NPC's ani to idle, replace "NULL" with an additional PARAM1 if necessary.

setAni("idle"NULL); // This will set the player's ani to idle, replace "NULL" with an additional PARAM1 if necessary.

replaceAni("walk""newwalk"); // Replaces 'walk' with 'newwalk'. 

The top two commands for ganis work both clientside and serverside.


If you really need to place bombs on a gmap, I recommend doing something like this:

PHP Code:

temp.mapx player.gmap.name == NULL getmapx(player.level.name) * 64;
temp.mapy player.gmap.name == NULL getmapy(player.level.name) * 64;
putbomb(1temp.mapx xtemp.mapy y); 

Quote:

Originally Posted by Schetti (Post 1482908)
Simple ani scripts:
PHP Code:

(this.)setcharani("sch_ctfblueidle","null"); //changes the ani of the NPC
//(dont know about null(Serverside only)), this. isnt needed, but I got told to use

setani("burninair","null"); //changes the ani of the Player
//(dont know about null(Clientside only)) 

Go make that thread, I'll try to help you(1 newb helps the other)

Let's not teach bad habits, probably better to leave the teaching to the teachers :)

Schetti 04-11-2009 08:37 AM

Quote:

Originally Posted by Tigairius (Post 1482911)
Let's not teach bad habits, probably better to leave the teaching to the teachers :)

ok

fragman85 04-11-2009 11:18 AM

Ah c'mon Schetti just wanted to help him, rofl


All times are GMT +2. The time now is 10:54 PM.

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