Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #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
  #2  
Old 10-08-2002, 08:19 AM
R0bin R0bin is offline
Banned
R0bin's Avatar
Join Date: Oct 2002
Location: Wales, UK
Posts: 828
R0bin is on a distinguished road
Send a message via AIM to R0bin
its ok proz, you can post whole scripts if people didnt ask for it.
Reply With Quote
  #3  
Old 10-08-2002, 08:32 AM
Graal2001_NAT Graal2001_NAT is offline
Registered User
Join Date: Sep 2002
Posts: 241
Graal2001_NAT is on a distinguished road
inefficent, just do
if(weaponfired){
this.on=abs(this.on-1);
if(this.on == 1){
stuff;
}else stuff;
}
__________________
GONE, BAI
Reply With Quote
  #4  
Old 10-08-2002, 09:03 AM
Torankusu Torankusu is offline
Elite Member
Torankusu's Avatar
Join Date: Jun 2001
Posts: 10,065
Torankusu is a jewel in the roughTorankusu is a jewel in the rough
thx!!!!!!
__________________
Quote:
Originally posted by Spark910
Think befreo you type.
Reply With Quote
  #5  
Old 10-09-2002, 05:48 AM
KuJi2002 KuJi2002 is offline
Banned
Join Date: Jul 2002
Location: NYC
Posts: 144
KuJi2002 is on a distinguished road
Send a message via AIM to KuJi2002 Send a message via Yahoo to KuJi2002
I'd just do simple flags
if (weaponfired&&!on) {
set on;
}else unset on;
if (on) {
whatever;
}
Reply With Quote
  #6  
Old 10-09-2002, 05:59 AM
Torankusu Torankusu is offline
Elite Member
Torankusu's Avatar
Join Date: Jun 2001
Posts: 10,065
Torankusu is a jewel in the roughTorankusu is a jewel in the rough
Quote:
Originally posted by KuJi2002
I'd just do simple flags
if (weaponfired&&!on) {
set on;
}else unset on;
if (on) {
whatever;
}
The problem with this is that if another NPC set "on," then it would also trigger this NPC to turn on. Prozac's is for the specific NPC.
__________________
Quote:
Originally posted by Spark910
Think befreo you type.
Reply With Quote
  #7  
Old 10-09-2002, 06:03 AM
KuJi2002 KuJi2002 is offline
Banned
Join Date: Jul 2002
Location: NYC
Posts: 144
KuJi2002 is on a distinguished road
Send a message via AIM to KuJi2002 Send a message via Yahoo to KuJi2002
Is that script even needed?
i made a good one b4
here
NPC Code:

// NPC made by KuJi
//#COMMENTS Clothes Hanger
//#EDIT img cloats2.png
//#EDIT body body.png
//#EDIT sword sword1.png
//#EDIT shield shield1.png
//#EDIT head head1.png
//#EDIT skin black
//#EDIT coat black
//#EDIT sleeves black
//#EDIT shoes black
//#EDIT belt black
if (created) {setimg img;
}
//#CLIENTSIDE
if (playertouchsme) {
setplayerprop#8,body;
setplayerprop#1,sword;
setplayerprop#2,shield;
setplayerprop#3,head;
setplayerprop#C0,skin;
setplayerprop#C1,coat;
setplayerprop#C2,sleeves;
setplayerprop#C3,shoes;
setplayerprop#C3,belt;
}


Put this in your graal folder
levels/npcs
name it as defnpcClothes.txt
Reply With Quote
  #8  
Old 10-09-2002, 06:39 AM
emortylone emortylone is offline
Registered User
Join Date: Apr 2002
Location: Control-NPC
Posts: 834
emortylone is on a distinguished road
I usually do a this.var, or if I'm in the mood, I'll use like a specific flag, not on and !on, but like qmenu and other related items.
---Shifter
__________________
Quote:
*Stefan: it seems sometimes they hire newbie scripters everywhere x-x
*Stefan: scripters are sometimes like people that draw paintings
*Stefan: all that counts is that it looks nice
Reply With Quote
  #9  
Old 10-09-2002, 10:06 AM
Falcor Falcor is offline
Darth Cucumber
Falcor's Avatar
Join Date: Mar 2001
Location: At School
Posts: 2,874
Falcor is on a distinguished road
Send a message via ICQ to Falcor Send a message via AIM to Falcor Send a message via MSN to Falcor Send a message via Yahoo to Falcor
would be nice if we could do bitwise operators like this.on = ~this.on or something. we could just toggle it on and off. But then we'd probably need special binary variables or something. *shrugs*
__________________

subliminal message: 1+1=3
Reply With Quote
  #10  
Old 10-09-2002, 04:35 PM
screen_name screen_name is offline
is watching you
Join Date: Mar 2002
Location: The 3rd Dimension
Posts: 2,160
screen_name is on a distinguished road
Send a message via AIM to screen_name Send a message via MSN to screen_name
Quote:
Originally posted by Kaimetsu


this.on=1-this.on;
Oh my, now I feel kind of silly. I too use this.var = abs(this.var-1);
__________________
[signature]insert here[/signature]
Reply With Quote
  #11  
Old 10-09-2002, 06:42 PM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
this.on = vecx(this.on+1)*(-1);
Reply With Quote
  #12  
Old 10-09-2002, 07:14 PM
screen_name screen_name is offline
is watching you
Join Date: Mar 2002
Location: The 3rd Dimension
Posts: 2,160
screen_name is on a distinguished road
Send a message via AIM to screen_name Send a message via MSN to screen_name
Quote:
Originally posted by Loriel
this.on = vecx(this.on+1)*(-1);
lol


this.on = abs(this.on-.5-.3-.2);
__________________
[signature]insert here[/signature]
Reply With Quote
  #13  
Old 10-10-2002, 05:13 AM
KuJi2002 KuJi2002 is offline
Banned
Join Date: Jul 2002
Location: NYC
Posts: 144
KuJi2002 is on a distinguished road
Send a message via AIM to KuJi2002 Send a message via Yahoo to KuJi2002
i do the following for a clothes changing npc or something
this.clotheson=1;
this.on=1;
set clotheson;
unset clotheson;
etc...
Reply With Quote
  #14  
Old 10-10-2002, 05:29 AM
Graal2001_NAT Graal2001_NAT is offline
Registered User
Join Date: Sep 2002
Posts: 241
Graal2001_NAT is on a distinguished road
why do people use flags =/ I can honestly say I havent use a flag in at least a year, I find them 'outdated' and inefficent, strings are so much better
__________________
GONE, BAI
Reply With Quote
Reply


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 06:31 PM.


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