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!