Aller au contenu

Photo

Error:- Variable Defined Without Type


  • Veuillez vous connecter pour répondre
2 réponses à ce sujet

#1
Willowy

Willowy
  • Members
  • 6 messages
Small problem with the following script, it will not compile.  How and where  should I define the variable (GetIsObjectValid(oItem)).

Thanks:)

1   /*
2   script_01
3   Usage:- OnAction_Conversation Editor
4   */
5
6   #include "nw_i0_tool"
7
8   void main()
9
10  {
11  get player
12  object oPC = GetPCSpeaker();
13
14  //reward
15  RewardPartyXP(2500, oPC, FALSE);
16  RewardPartyGP(10000, oPC, FALSE);
17
18  //remove quest item from PC
19  object oTarget;
20  oTarget = GetItemPossessedBy(oPC, "Quest_Item");
21
22  if (GetIsObjectValid(oItem))
23
24  // destroy "Quest_Item"
25  DestroyObject(oItem);
26  }

/*
Error. 'script_01' did not compile.
script_01.nss(22): ERROR: VARIABLE DEFINED WITHOUT TYPE
*/

#2
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
line 19 and 20

change from
object oTarget;
oTarget = GetItemPossessedBy(oPC, "Quest_Item");

to
object oItem = GetItemPossessedBy(oPC, "Quest_Item");

Modifié par Lightfoot8, 12 septembre 2011 - 12:19 .


#3
Willowy

Willowy
  • Members
  • 6 messages
Thanks you, that did the job.

Talk about not seeing the woods for the trees!:pinched:Too many late nights me thinks.