Thread: getnpc
View Single Post
  #7  
Old 04-24-2003, 09:38 PM
Falados Falados is offline
Cucumber NPC
Falados's Avatar
Join Date: Jan 2003
Posts: 141
Falados is on a distinguished road
Send a message via ICQ to Falados Send a message via AIM to Falados
Quote:
Originally posted by Loriel
Perhaps not, but he is trying hard

NPC Code:
for (i = 0; i < npcscount; i++) {
with (npcs[i]) message I worship Loriel!;
}


^ makes all NPCs in the level express their feelings about me.
That kind of loop is very common
That isnt getnpc
NPC Code:

with(getnpc(npcname)) {
//Code directed at npcsname
}


get npc in a with statement will direct all code to the npc you choose. all actions like setstring and this.value=# will be done inside the npc.. the name of the npc comes from its name in the database, when you create an npc on NC you do this.

Example:
NPC Code:

with(getnpc(Control-NPC)) {
setstring this.happy,Smile;
this.smiles = 1000;
}



This will set this.happy string in the Control-NPC to Smile, and the variable this.smiles to 1000.
__________________

subliminal message: 1+1=3
Reply With Quote