Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   gani help (https://forums.graalonline.com/forums/showthread.php?t=32003)

davidpsy 06-21-2002 02:33 AM

gani help
 
how do i make it so if the weapon is fired that the player gos in to a gani that i want and how do i make it so if another player thouchs the player that he gets hurt if he touchs the player while he is doing the gani please help

Python523 06-21-2002 03:05 AM

use setani to set the gani and run a sin+cos formula using hitplayer to hit the players around you

Falcor 06-21-2002 03:31 AM

Why use a whole sin-cos forumla? Distance formula would work too, and require far less effort.

just check all the players around you to see if they are in your area, and hit them if they are there. Rather then sending unneccessary actions to the server

NPC Code:

for(i=0;i<playerscount;i++) {
dist = ((players[i].x+1-playerx+1)^2+(players[i].y+1-playery+1)^2)^.5;
if(dist < 5) {
hitobjects power,players[i].x+1,players[i].y+1;
}
}


as long as there arent 100 players on the same level, you should have a problem with lag, and it would be far less error ridden than using something in a circle.

If you would like to only hit players in a certain area away from you, you could also try

if(dist in |3,5|) or so. People close to you wouldnt get hit, however people farther away would.

the blue text you must edit

haunter 06-21-2002 04:02 AM

Quote:

Originally posted by Falcor
Why use a whole sin-cos forumla? Distance formula would work too, and require far less effort.

just check all the players around you to see if they are in your area, and hit them if they are there. Rather then sending unneccessary actions to the server

NPC Code:

for(i=0;i<playerscount;i++) {
dist = ((players[i].x+1-playerx+1)^2+(players[i].y+1-playery+1)^2)^.5;
if(dist < 5) {
hitobjects power,players[i].x+1,players[i].y+1;
}
}


as long as there arent 100 players on the same level, you should have a problem with lag, and it would be far less error ridden than using something in a circle.

If you would like to only hit players in a certain area away from you, you could also try

if(dist in |3,5|) or so. People close to you wouldnt get hit, however people farther away would.

the blue text you must edit

What is "dist" mesured in?

Falcor 06-21-2002 04:47 AM

tiles

davidpsy 06-21-2002 08:42 AM

im not a great scripter i just need some help i dont understand this can you explain how like on the bamboo stick on graal 2001 how did they make it so when you swing the bamboo stick at someone with a gani it hurts the other player?

Python523 06-21-2002 08:52 AM

triggeraction

Falcor 06-21-2002 09:14 AM

trigger action AND a reciever in the weapon itself for the action. triggeraction alone does nothing.

you need if(actionNAME) {dostuff} or so

davidpsy 06-21-2002 09:20 AM

can you explain what each part of the code does?? like a label

Falcor 06-21-2002 09:23 AM

Stop right here, This is beyond your level, as much as I'd like to help, im afraid I cannot. Please learn more about the commands we are discussing first, or atleast concepts behind them.

Hitobjects is for default hitting players.
triggeraction is for triggereing an event (flag) on the person whom it hits.

Read into these two further, but mainly triggeraction.

davidpsy 06-21-2002 09:35 AM

oh lol i know what a triger action is like if (weaponfired)
or if(keydown==1) and i know how to loop like if(playerenters)set moo;
while(moo){

Python523 06-21-2002 09:48 AM

I'm closing this, please study more on how to effectively use these commands that have been posted and you will/should be able to do it


All times are GMT +2. The time now is 08:41 AM.

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