Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 11-04-2003, 03:08 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
triggeraction/callnpc barrier

Why am I unable to do a triggeraction with params to one NPC that will do a triggeraction back with params? I've tried the combination of doing triggeraction and responding with callnpc but nothing happens. The purpose of this is to create something of a pathnode system which I can send NPCs to run along. I'm sure there are better ways of having an NPC get from point A to point B. This is just the way I chose.

*note
This is a crude script at the moment. All I'm doing is testing my idea without too much success .

<sending NPC>
NPC Code:

...

if (timeout) {

for (lag=0; lag<10; lag++) {
if (dir==3) {
//showimg lag,brick.png,x+lag+vecx(dir)*2,y+1+vecy(dir)*2;
triggeraction x+lag+vecx(dir)*2,y+1+vecy(dir)*2,path,#v(id),#v(l ag);
}
sleep .1;
}
timeout = 0.45;
}

if (node) {
setcharprop #c,PING!;
distx = strtofloat(#p(0));
disty = strtofloat(#p(1));
disttime = strtofloat(#s(path.latency));
}



<recieving NPC>
NPC Code:
if (playerenters) {
setshape 1,48,48;
dontblock;
}

if (actionpath) {
setstring path.npcindex,#p(0);
setstring path.latency,#p(1);
setcharprop #c,FOUND!;
//play quickbm.wav;
callnpc strtofloat(#s(path.npcindex)),node,#v(x),#(y);
}



'lag' is used to determine the actual time distance (in tiles). The 'recieving NPC' works. I just can't get the sender to respond to the callnpc sent to it. showimg is so I know where its triggering :]
__________________
Reply With Quote
  #2  
Old 11-04-2003, 06:20 AM
slimchance11 slimchance11 is offline
Registered User
Join Date: Mar 2003
Posts: 31
slimchance11 is on a distinguished road
Is the level in the levels list? I've been having trouble using triggeraction on servers too, your script looks fine, i've been trying things like that too and they never seem to work, I think something with triggeraction on servers has changed o0
__________________
I came... I saw... I PWNED!!!
Reply With Quote
  #3  
Old 11-04-2003, 06:28 AM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
Ew, don't put sleeps in loops. And non-prefixed vars are volatile. It's not guaranteed that their values will be preserved between frames.
__________________
Reply With Quote
  #4  
Old 11-04-2003, 07:01 AM
ZeLpH_MyStiK ZeLpH_MyStiK is offline
Scripter
ZeLpH_MyStiK's Avatar
Join Date: May 2003
Location: NYC
Posts: 553
ZeLpH_MyStiK is on a distinguished road
Send a message via MSN to ZeLpH_MyStiK Send a message via Yahoo to ZeLpH_MyStiK
I'm not 100% sure, but, I believe triggeraction cannot be done from inside a timeout loop. Anyone care to verify?
__________________
Reply With Quote
  #5  
Old 11-04-2003, 07:11 AM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
Quote:
Originally posted by ZeLpH_MyStiK
I'm not 100% sure, but, I believe triggeraction cannot be done from inside a timeout loop.
Why not?
__________________
Reply With Quote
  #6  
Old 11-04-2003, 07:18 AM
ZeLpH_MyStiK ZeLpH_MyStiK is offline
Scripter
ZeLpH_MyStiK's Avatar
Join Date: May 2003
Location: NYC
Posts: 553
ZeLpH_MyStiK is on a distinguished road
Send a message via MSN to ZeLpH_MyStiK Send a message via Yahoo to ZeLpH_MyStiK
I believe it's because the timeout loop is too fast for triggeractions. Its the same reason why I was told that a timeout or sleep of 0.05 is necessary in a while loop, otherwise it may crash the npcserver.
__________________
Reply With Quote
  #7  
Old 11-04-2003, 07:33 AM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
Quote:
Originally posted by ZeLpH_MyStiK
I believe it's because the timeout loop is too fast for triggeractions. Its the same reason why I was told that a timeout or sleep of 0.05 is necessary in a while loop, otherwise it may crash the npcserver.
Um... okay. You can send triggeractions whenever you want, dude. Might not be advisable, but it's possible.
__________________
Reply With Quote
  #8  
Old 11-04-2003, 07:46 AM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
yea, triggeraction is common with the NC system, its wats used for practically anything you may need it for. Its faster, easier, and works perfectly. (unless u cant script)
Reply With Quote
  #9  
Old 11-04-2003, 07:57 AM
ZeLpH_MyStiK ZeLpH_MyStiK is offline
Scripter
ZeLpH_MyStiK's Avatar
Join Date: May 2003
Location: NYC
Posts: 553
ZeLpH_MyStiK is on a distinguished road
Send a message via MSN to ZeLpH_MyStiK Send a message via Yahoo to ZeLpH_MyStiK
Hmm, interesting, I was taught that it would crash the NPC-Server. ::TAKES A CLOSER LOOK AT SCRIPT ABOVE:: =)
__________________
Reply With Quote
  #10  
Old 11-04-2003, 09:20 PM
GoZelda GoZelda is offline
Mister 1,000,000
GoZelda's Avatar
Join Date: Jan 2003
Location: Brussels, capital of Europe.
Posts: 5,396
GoZelda will become famous soon enough
Send a message via AIM to GoZelda Send a message via MSN to GoZelda
Quote:
Originally posted by ZeLpH_MyStiK
Hmm, interesting, I was taught that it would crash the NPC-Server. ::TAKES A CLOSER LOOK AT SCRIPT ABOVE:: =)
Erm, serverside it wouldn't work i s'ppose, because you have a minimum of 0.1 in a timeout.
__________________

Quote:
Originally Posted by Lance
stefan is satan
I am the best.
[URL removed]Music or aural pollution?
Reply With Quote
  #11  
Old 11-05-2003, 04:30 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 slimchance11
Is the level in the levels list? I've been having trouble using triggeraction on servers too, your script looks fine, i've been trying things like that too and they never seem to work, I think something with triggeraction on servers has changed o0
This is only to test offline at the moment. I had this same problem a long time ago when I tried to setup player damage since I use my own health system. I can send the triggers, but I can't send two triggers consecutively with parameters in each :/



Quote:
Originally posted by Kaimetsu
Ew, don't put sleeps in loops. And non-prefixed vars are volatile. It's not guaranteed that their values will be preserved between frames.
As already noted its just a crude script, but you're probably right. I put the sleep in there in case there was a problem in that it couldn't break from the for loop. I'm guessing that when an NPC is called or triggered while in any kind of loop it will automattically break to jump to where it has been called or triggered?

I could probably set a string in the loop that contains the ID, but I'm not sure if

NPC Code:

for (this.i=0; this.i<npcscount; this.i++) {
callnpc this.i,<flag>,;
}



will actually use that NPC's ID since what is usually set is somewhere in the thousands range. I haven't tried that yet.
__________________
Reply With Quote
  #12  
Old 11-05-2003, 05:29 AM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
Quote:
Originally posted by G_yoshi
As already noted its just a crude script, but you're probably right. I put the sleep in there in case there was a problem in that it couldn't break from the for loop. I'm guessing that when an NPC is called or triggered while in any kind of loop it will automattically break to jump to where it has been called or triggered?
Well, technically NPCs can't be triggered while in loops - the events are accumulated and triggered in sequence. If you're talking about events occuring when the sleep pointer is set then you might be right, I've never been foolhardy enough to experiment with it.
__________________
Reply With Quote
  #13  
Old 11-05-2003, 05:54 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


Well, technically NPCs can't be triggered while in loops - the events are accumulated and triggered in sequence. If you're talking about events occuring when the sleep pointer is set then you might be right, I've never been foolhardy enough to experiment with it.
I see. Hmm. Well, I tried my idea of setting the character NPC's id to a string and doing the callnpc loop and it resonded. Now if I can get it to stop running the for loop :x

*edit*
Its sort of working. Biggest issue right now is finding a way to make it ignore the last node it walked to when searching for a node that is not in the same direction.
__________________

Last edited by G_yoshi; 11-05-2003 at 07:16 AM..
Reply With Quote
  #14  
Old 11-05-2003, 07:17 AM
ZeLpH_MyStiK ZeLpH_MyStiK is offline
Scripter
ZeLpH_MyStiK's Avatar
Join Date: May 2003
Location: NYC
Posts: 553
ZeLpH_MyStiK is on a distinguished road
Send a message via MSN to ZeLpH_MyStiK Send a message via Yahoo to ZeLpH_MyStiK
Ok, I guess someone *cough*Kai*cough* deleted my script. If you want it, just IM me on AIM. My SN is DarkBlade7788.
__________________
Reply With Quote
  #15  
Old 11-05-2003, 07:20 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 ZeLpH_MyStiK
Ok, I guess someone *cough*Kai*cough* deleted my script. If you want it, just IM me on AIM. My SN is DarkBlade7788.
What script? I wasn't exactly asking for a script. I was looking for input on what I was doing that could help me solve my problem. I wound up trying something else that I didn't try last night and it worked. Now I have new problems to deal with o.O
__________________
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 11:12 PM.


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