Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 04-22-2002, 09:55 AM
prozac424242 prozac424242 is offline
Registered User
prozac424242's Avatar
Join Date: May 2001
Location: Gone crazy: back soon
Posts: 356
prozac424242 is on a distinguished road
Send a message via ICQ to prozac424242 Send a message via AIM to prozac424242
Shooting weapon defnpc!!!

Here is a little NPC that I made to save in your
graall/levels/npcs folder as a text file, defnpcShootWeaopn.txt
TONS of shooting/spell stuff can be done with this.
Anything that starts at the players position and moves out in a line away form the player.
NPC Code:

// NPC made by Prozac
//#COMMENTS NPC that shoots something
//#EDIT action shootarrow
//#EDIT direction playerdir
//#EDIT How_much_ammo 1
//#EDIT Ammo_type playerdarts
//#EDIT Repeat 1
//#EDIT Weapon_name MyBow

if (created)
{setimg wbowi1.png; show;}

//#CLIENTSIDE
if (playertouchsme){toweapons Weapon_name;}

if (weaponfired && Ammo_type>0)
{
this.distance=Repeat; //how far to throw
this.dir=playerdir;
this.x=playerx+vecx(this.dir)*2;
this.y=playery+.5+vecy(this.dir)*2;
for(this.i=0; this.i<this.distance; this.i++)
{
freezeplayer .3; playersprite=33;
this.x+=vecx(this.dir);
this.y+=vecy(this.dir);
action direction;
sleep .05;
}
Ammo_type=Ammo_type-How_much_ammo;
}



Once it saved, go to Predefined NPCs in Graal.
Select the Shootweapon.
action: can be anythign from shootarow, putbomb, lay rupee ....
direction: playerdir if shooting an arrow type, leave blank if not an arrow.
How_much_ammo: what it costs the player to use this item
Repeat: how many times to shoot the arrow/how many bombs to lay/explosions to put, etc. If not an arrow, each succesive repetition will be a bit further out form the player.
Weapon_name: what the weapon is called when player presses Q and selects it.

Have fun! let me know of any errors/comments etc.

-Prozac-
2 and a half years of Graal and still going !!!
__________________

Useful links:
Graal Stats
Client Script Functions-GS1 to GS2
Serverside Script Functions-Gscript page
Particle Engine-Player Attributes
Server Options-Admin rights-Gmaps
Quote:
Originally Posted by Admins
Thanks for developing and improving playerworlds and such
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 12:54 AM.


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