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 04-18-2002, 01:54 PM
G_yoshi G_yoshi is offline
Forbidden
G_yoshi's Avatar
Join Date: Mar 2001
Posts: 7,206
G_yoshi will become famous soon enough
Send a message via AIM to G_yoshi
Weapon won't deactivate :(

For some inane reason, I cannot get my script to disable when I fire the weapon again...
NPC Code:
if (weaponfired && !timeout) {
freezeplayer .05;
//triggeraction playerx+1.5+vecx(playerdir)*2,playery+1.75+vecy(pl ayerdir)*2,chat,;
set client.chat;
timeout = 0.05;
} else if (weaponfired && timeout) {
for (this.i=0; this.i<10000; this.i++) {
hideimg this.i-1;
}
unset client.chat;
}



I've also tried using the flag I have it set, but nothing seems to work :/

I've probably done something wrong, but I can't understand what it coud be
__________________
Reply With Quote
  #2  
Old 04-18-2002, 02:12 PM
Slaktmaster Slaktmaster is offline
man with the mastahplan
Slaktmaster's Avatar
Join Date: Apr 2001
Location: Half-way over the river styx
Posts: 4,422
Slaktmaster is an unknown quantity at this point
Send a message via ICQ to Slaktmaster Send a message via AIM to Slaktmaster
I wouldn't use use weaponfired in a timeout.
I would help you with the script but I have to get to school.
Reply With Quote
  #3  
Old 04-18-2002, 07:19 PM
G_yoshi G_yoshi is offline
Forbidden
G_yoshi's Avatar
Join Date: Mar 2001
Posts: 7,206
G_yoshi will become famous soon enough
Send a message via AIM to G_yoshi
Re: Re: Weapon won't deactivate :(

Quote:
Originally posted by Kaimetsu
Ew, man, that's horrible. Scripts don't run all at once with all the relevant flags for that frame. Every frame, they run once for every event. That means you will never get weaponfired and timeout at the same time. Also, what the heck are you doing by setting/unsetting a flag every 0.05 seconds? Do you have any idea of the extra lag that causes?
I suppose you didn't read it very well, there's more to the script, I'm just not going to show it...instead of it being if (weaponfired && !timeout) {...} I was trying ...&& !client.chat) {...} I've done it before in a few other NPCs so I do not understand what is wrong :/
__________________
Reply With Quote
  #4  
Old 04-18-2002, 08:52 PM
Spanko Spanko is offline
Squeaker of Soles
Spanko's Avatar
Join Date: Nov 2001
Location: The Netherworl...lands
Posts: 1,366
Spanko is on a distinguished road
Send a message via ICQ to Spanko Send a message via AIM to Spanko Send a message via Yahoo to Spanko
It'd probably be more effective if you did:
NPC Code:
if (weaponfired) {
if (client.chat) {
for (this.i=0; this.i<10000; this.i++) {
hideimg this.i-1;
}
unset client.chat;
}
else {
freezeplayer .05;
set client.chat;
timeout=0.05;
}
}

__________________

ICQ: 125283920
MSN: [email protected]
AIM: Squeax0r
Squeaker seems unable to access the forum using this account.. tis a sad day.
Now with occasional Asuka flavour! Ooops a bit too much...
Asuka should be king of Dustari!

"Y'know, some days even my lucky rocketship underpants don't even help."
Reply With Quote
  #5  
Old 04-18-2002, 11:30 PM
Saga2001 Saga2001 is offline
Wishing he had 3 feet
Join Date: Aug 2001
Location: Basement
Posts: 1,565
Saga2001 is on a distinguished road
Send a message via ICQ to Saga2001 Send a message via AIM to Saga2001 Send a message via Yahoo to Saga2001
Quote:
Originally posted by Spanko
It'd probably be more effective if you did:
NPC Code:
if (weaponfired) {
if (client.chat) {
for (this.i=0; this.i<10000; this.i++) {
hideimg this.i-1;
}
unset client.chat;
}
else {
freezeplayer .05;
set client.chat;
timeout=0.05;
}
}

Yay! I was gonna do exactly that you saved me a few minutes!
__________________

!Wan ( 11:27:55 AM):
can i c ur scripts please?
Zorg (RC): If I hear NPC Server call Ne0, Past Austin or Brent sexy one more time im disconnecting it
Reply With Quote
  #6  
Old 04-19-2002, 07:59 AM
G_yoshi G_yoshi is offline
Forbidden
G_yoshi's Avatar
Join Date: Mar 2001
Posts: 7,206
G_yoshi will become famous soon enough
Send a message via AIM to G_yoshi
Quote:
Originally posted by Spanko
It'd probably be more effective if you did:
NPC Code:
if (weaponfired) {
if (client.chat) {
for (this.i=0; this.i<10000; this.i++) {
hideimg this.i-1;
}
unset client.chat;
}
else {
freezeplayer .05;
set client.chat;
timeout=0.05;
}
}

Thanks, but it still doesn't work :/

Here's the entire script so far:
NPC Code:
// NPC made by GregoryYoshi
if (playerenters) {
setshape 1,32,32;
}

if (playertouchsme) {
toweapons InterChat;
}

if (weaponfired) {
if (client.chat) {
for (this.i=0; this.i<10000; this.i++) {
hideimg this.i-1;
}
unset client.chat;
} else {
showimg 500,dk_window.png,(screenwidth/4)-76,(screenheight/2)-120;
changeimgvis 500,4;
wraptext2 imgwidth(dk_window.png)-4,.75,,Waiting for response from other player...;
for (this.i=0; this.i<tokenscount; this.i++) {
showimg this.i,@#t(this.i),(screenwidth/4)-64,(screenheight/2)+(this.i*18)-112;
changeimgzoom this.i,.75;
changeimgvis this.i,5;
sleep .25;
}
freezeplayer .05;
set client.chat;
timeout=0.05;
}
}

if (timeout) {
freezeplayer .05;
timeout = 0.05;
}

/*
wraptext2 imgwidth(dk_window.png)-4,.75,,@#a:#K(160)#c;
for (i=0; i<10000; i++) {
hideimg i-1;
}
*/



This is an NPC I'll be adding to my PW (when it's done) that changes the way players chat on a 1on1 basis...I may just wind up putting in a keydown check routine so that players can exit the chat easily. I'll also have a special chatroom and since I hide the minimap, I may have a small window that displays toalls
__________________
Reply With Quote
  #7  
Old 04-19-2002, 08:27 AM
G_yoshi G_yoshi is offline
Forbidden
G_yoshi's Avatar
Join Date: Mar 2001
Posts: 7,206
G_yoshi will become famous soon enough
Send a message via AIM to G_yoshi
Quote:
Originally posted by Kaimetsu
I should just stamp a full copy of the guidelines onto everybody's foreheads.
Sorry, I've done similar NPCs and never had this problem :/
__________________
Reply With Quote
  #8  
Old 04-19-2002, 08:34 AM
G_yoshi G_yoshi is offline
Forbidden
G_yoshi's Avatar
Join Date: Mar 2001
Posts: 7,206
G_yoshi will become famous soon enough
Send a message via AIM to G_yoshi
Quote:
Originally posted by Kaimetsu


I wouldn't mind if you just posted the part that wasn't working, or at least told us the exact problem :-/
I have already posted it :/

Once I fire the weapon, I can't use 'D' again to turn it off.
__________________
Reply With Quote
  #9  
Old 04-19-2002, 08:48 AM
G_yoshi G_yoshi is offline
Forbidden
G_yoshi's Avatar
Join Date: Mar 2001
Posts: 7,206
G_yoshi will become famous soon enough
Send a message via AIM to G_yoshi
Quote:
Originally posted by Kaimetsu


Wait, this is obvious. You can't fire weapons when frozen.
>.<

I suppose I could then use disabledefmovement instead or, like I said, add in a keydown check :/
__________________
Reply With Quote
  #10  
Old 04-19-2002, 10:23 AM
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
man i miss this place

o well, maybe i shall return in a few months or so, lets just watch
__________________
[signature]insert here[/signature]
Reply With Quote
  #11  
Old 04-19-2002, 03:01 PM
Saga2001 Saga2001 is offline
Wishing he had 3 feet
Join Date: Aug 2001
Location: Basement
Posts: 1,565
Saga2001 is on a distinguished road
Send a message via ICQ to Saga2001 Send a message via AIM to Saga2001 Send a message via Yahoo to Saga2001
Quote:
Originally posted by screen_name
man i miss this place

o well, maybe i shall return in a few months or so, lets just watch
lol. we all miss ya man.

Quote:
Kaimetsu
I should just stamp a full copy of the guidelines onto everybody's foreheads.
*points out guidelines on forehead*
__________________

!Wan ( 11:27:55 AM):
can i c ur scripts please?
Zorg (RC): If I hear NPC Server call Ne0, Past Austin or Brent sexy one more time im disconnecting it
Reply With Quote
  #12  
Old 04-22-2002, 03:11 AM
Saga2001 Saga2001 is offline
Wishing he had 3 feet
Join Date: Aug 2001
Location: Basement
Posts: 1,565
Saga2001 is on a distinguished road
Send a message via ICQ to Saga2001 Send a message via AIM to Saga2001 Send a message via Yahoo to Saga2001
-FooL-

You could do this:

if (weaponfired || timeout && keydown(6))

Or whatever D button is... of course then you'd hafta do a check to make sure it didn't just cancel itself because of the timeout. *shrug*
__________________

!Wan ( 11:27:55 AM):
can i c ur scripts please?
Zorg (RC): If I hear NPC Server call Ne0, Past Austin or Brent sexy one more time im disconnecting it
Reply With Quote
  #13  
Old 04-25-2002, 09:21 PM
emortylone emortylone is offline
Registered User
Join Date: Apr 2002
Location: Control-NPC
Posts: 834
emortylone is on a distinguished road
then put it w/ a second variable. if (this.use==2) so that way have this.use==1 be the action. and like if (this.use==1&&keydown(4)) this.use=2.
---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
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 02:57 PM.


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