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 11-04-2001, 05:00 AM
nyghtGT nyghtGT is offline
Banned
nyghtGT's Avatar
Join Date: Jun 2001
Posts: 3,993
nyghtGT is on a distinguished road
Send a message via AIM to nyghtGT
for(...) and i

can someone explain the following code to me please ... i dont understand it .... Explain all parts and what they do please ...
NPC Code:

NPC Code:

if (wasshot) {
for (i=0; i<npcscount; i++)
callnpc i,swimming;
}



Reply With Quote
  #2  
Old 11-04-2001, 05:06 AM
KJS KJS is offline
The one, The only -
KJS's Avatar
Join Date: Apr 2001
Location: USA, Minnesota
Posts: 1,012
KJS is on a distinguished road
Send a message via AIM to KJS
Re: for(...) and i

Quote:
Originally posted by nyghtGT
can someone explain the following code to me please ... i dont understand it .... Explain all parts and what they do please ...
NPC Code:

NPC Code:

if (wasshot) {
for (i=0; i<npcscount; i++)
callnpc i,swimming;
}



basically it calls every npc on that level if the npc was shot and gives it a swimming thing

and inside the other npcs you can say

if(swimming){
//coding
}

so humm lets say the npc calling that code is a person npc

and it gets shot

then the person npc would call all the npcs and set
swimming

then in the other npcs that you want it to effect you say

if(swimming){

}

and do whatever you want in that coding once the person npc gets shot
__________________
Thanks,
-KJL
Reply With Quote
  #3  
Old 11-04-2001, 06:35 AM
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
Re: for(...) and i

NPC Code:

if (wasshot) { Makes the following stuff executed when the NPC is hit by an arrow
for Initializes a for-loop
(i=0; Sets the variable "i" to 0 once
i<npcscount; Defines when to repeat the script after the ) thing: When the variable i is lower than the amount of NPCs in the level
i++) Increasing i each time the script after ) is run
callnpc i,swimming; Setting the flag "swimming" to true for the NPC with the index "i"
}



So what it would be doing in "normal" talk:
1) Wait until the NPC is hit by an arrow.
2) Set "i" to 0
3) Tell the NPC with index "i" that "swimming" is called (makes if (swimming) happen)
4) Increase "i" by one
5) Go back to 3 if "i" is lower than the amount of NPCs in the level
6) Stop executing
Reply With Quote
  #4  
Old 11-06-2001, 08:13 AM
nyghtGT nyghtGT is offline
Banned
nyghtGT's Avatar
Join Date: Jun 2001
Posts: 3,993
nyghtGT is on a distinguished road
Send a message via AIM to nyghtGT
Re: Re: for(...) and i

Quote:
Originally posted by Loriel
NPC Code:

if (wasshot) { Makes the following stuff executed when the NPC is hit by an arrow
for Initializes a for-loop
(i=0; Sets the variable "i" to 0 once
i<npcscount; Defines when to repeat the script after the ) thing: When the variable i is lower than the amount of NPCs in the level
i++) Increasing i each time the script after ) is run
callnpc i,swimming; Setting the flag "swimming" to true for the NPC with the index "i"
}



So what it would be doing in "normal" talk:
1) Wait until the NPC is hit by an arrow.
2) Set "i" to 0
3) Tell the NPC with index "i" that "swimming" is called (makes if (swimming) happen)
4) Increase "i" by one
5) Go back to 3 if "i" is lower than the amount of NPCs in the level
6) Stop executing
thanx to both you peoples ...
Reply With Quote
  #5  
Old 11-06-2001, 11:50 PM
mhermher mhermher is offline
galase galase!
mhermher's Avatar
Join Date: Jun 2001
Location: Sweden, Stockholm.
Posts: 2,012
mhermher is on a distinguished road
Send a message via ICQ to mhermher Send a message via AIM to mhermher Send a message via Yahoo to mhermher
Re: Re: Re: for(...) and i

Quote:
Originally posted by nyghtGT

thanx to both you peoples ...
No problem


__________________
Donate money for my trip to Germany

Adiarde Manager
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 10:14 PM.


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