View Single Post
  #4  
Old 04-23-2002, 09:59 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
not to worry

Ok guys, I made a working version that uses strings!

Save this one in graal/levels/npcs folder as defnpcShootWepaonString.txt
and have fun!
Hint: for action, put: putexplosion 1 this.x,this.y
no semicolon
or
putbomb 1,this.x,this.y
and blank out playerdir
and increase repeats!
fun!
NPC Code:

// NPC made by Prozac
//#COMMENTS NPC that shoots something, String based! -By Prozac-
//#EDIT action shootarrow
//#EDIT direction playerdir
//#EDIT How_much_ammo 1
//#EDIT Repeat 1
//#EDIT Weapon_name MyBow
//#EDIT AmmoStringName ammo1
//#EDIT HowMuchGiveToStart 5
//#EDIT SayIfNoAmmoLeft No_Ammo_Left!

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

//#CLIENTSIDE
if (playertouchsme)
{toweapons Weapon_name;
setstring AmmoStringName,HowMuchGiveToStart;
}

if (weaponfired && strtofloat(#s(AmmoStringName))>0)
{
this.distance=Repeat; //how far to throw
this.dir=playerdir;
this.x=playerx+.5+vecx(this.dir)*2;
this.y=playery+1+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;
}
setstring AmmoStringName,#v(strtofloat(#s(AmmoStringName))-How_much_ammo)
}

if (weaponfired && strtofloat(#s(AmmoStringName))<=0)
{setplayerprop #c,SayIfNoAmmoLeft;}


__________________

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