View Single Post
  #1  
Old 10-08-2002, 07:39 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
on-off defnpc for the ****s

Heres one for you newbie scripters who want to make
an npc that you can press D once for "on" mode, and fire again
to set in "off" mode.

IMPORTANT
close graal
Save as: graal/levels/npcs/defnpcOnOffWeapon.txt
then open graal and go to Predefined npcs.

Try putting for npc-action, shootarrow playerdir

NPC Code:

// NPC made by Prozac
//#COMMENTS Weapon with on and off mode
//#EDIT weapon_name item
//#EDIT to-get-this playertouchsme
//#EDIT npc-action

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

//#CLIENTSIDE
if (to-get-this)
{toweapons weapon_name; this.on=0;}

//on and off part when pressing D
if (weaponfired && this.on==0)
{this.on=1; sleep .2; timeout=.05;}
if (weaponfired && this.on==1)
{this.on=0; sleep .2;}

if (timeout && this.on==1)
{
//put your npc actions here

npc-action

timeout=.05;
}




and its OK that this is on this forum becasue
the script provided there does not do anything practical
as it its .. its a form, a mold, for your imagination to pour into!
__________________

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