» TeamX (Àðõèâ Ôîðóìà)«


Ôîðóì TeamX » English Forum » new question (about  MVAR)

Ïåðåõîä ïî òåìàì
<< Ïðåä. Ñëåä. >>
Åäèíñòâåííàÿ ñòðàíèöà ýòîé òåìû

 
xisailuo
Ïîëüçîâàòåëü

Ðåãèñòðàöèÿ: Àâã. 2004

Âñåãî: 19 ñîîáùåíèé

In my script , there is charactor A and B.A talked to the dude_obj and then dude_obj can talk to the B.There are two results after the talking to the B,and there are differences between the lator talking of the A.

So I make an .h file: modbase.h
Öèòàòà:

/*
Copyright 1998-2003 Interplay Entertainment Corp.  All rights reserved.
*/

#ifndef MODBASE_H
#define MODBASE_H

// Map vars for Arroyo Village Map

// Comments

//MAP_GLOBAL_VARS:

//GLOBAL                                        NUMBER

// All Map Vars need to start w/ MVAR_

#define MVAR_Talk               (0)


#endif // MODBASE_H



and my script file
Öèòàòà:
#define NAME                    SCRIPT_BASEMM
#include "..\headers\define.h"
#include "..\headers\ModReact.h"
#include "..\headers\command.h"
#include "..\headers\ModBase.h"


procedure start;
procedure talk_p_proc;  
procedure old_pickup_p_proc;
procedure Node001;
procedure Node002;
procedure Node003;
procedure Node004;

procedure Node006;

procedure Node008;
procedure Node009;
procedure node010;
procedure node011;
procedure node012;
procedure node013;
procedure node014;
procedure Node015;
/* Script Specific Procedure Calls */
procedure Node998;
procedure Node999;                                      // This Node is Always Ending


procedure start begin
set_map_var(MVAR_Talk , 0);
end

procedure old_pickup_p_proc begin
end

procedure talk_p_proc begin

start_gdialog (NAME,self_obj,4,-1,-1);
      gSay_Start;
    if (map_var(MVAR_Talk == 0)) then begin
          call Node001;
    set_map_var(MVAR_Talk , 1);
    END
  if (map_var(MVAR_Talk == 3)) then begin  
     call Node011;
       end
  if (map_var(MVAR_Talk == 4)) then begin
          call Node014;
      gSay_End;
      gSay_End;
      end_dialogue;
      END

 
 if (map_var(MVAR_Talk == 1)) then begin
float_msg(self_obj, mstr(117), FLOAT_MSG_NORMAL);
end
end

procedure Node001 begin
  Reply(100);
  NOption(101,Node002,004);
  NOption(102,Node002,004);
end

procedure Node002 begin
  Reply(103);
  NOption(104,Node003,004);
  NOption(mstr(105) + " " + dude_name + mstr(106), Node004, 4);
end

procedure Node003 begin
  Reply(107);
  NOption(109,Node006,004);
end

procedure Node004 begin
  Reply(108);
  NOption(110,Node006,004);  
end

procedure Node006 begin
variable obj;
  obj := obj_carrying_pid_obj(self_obj, PID_MEAT_JERKY  );
add_obj_to_inven(dude_obj,obj);
 Reply(111);
  NOption(113,Node008,004);
  NOption(114,Node009,004);
end



procedure Node008 begin
  Reply(115);

end

procedure Node009 begin
  Reply(116);

end



procedure Node010 begin
  Reply(118);

  NOption(119,Node011,004);
  NOption(120,Node012,004);
end

procedure Node011 begin
  Reply(121);

  NOption(123,Node013,004);
  NOption(124,Node013,006);
end


procedure Node012 begin
  Reply(122);

  NOption(123,Node013,004);
  NOption(124,Node013,006);
end


procedure Node013 begin
  Reply(125);

end

procedure Node014 begin
  Reply(126);
NOption(127,Node015,004);
end

procedure Node015 begin
  Reply(128);

end

procedure Node999 begin
end

procedure Node998 begin
end
 


when dude_obj have finished talking to the B ,MVAR_Talk==2
I can start dialog, but there is empty ,it seems not use my .msg file or MVAR_talk is error .Can you tell me why?Thank you

http://www.zzezz.com/bbs/discuz!/attachments/c5pJ_scr00000.gif

(Edited by xisailuo at 20:22 - 19 Sep., 2004)

Îòïðàâëåíî: 20:20 - 19 Ñåíò., 2004
Raven
Ïîëüçîâàòåëü

Îòêóäà: Âëàäèê
Ðåãèñòðàöèÿ: Ôåâð. 2004

Âñåãî: 408 ñîîáùåíèé

>Can you tell me why?
Yes.

Ah, a LOTS of bugs.

So, we have MVAR_Talk==2. Look at your talk_p_proc. There is no if-check for MVAR_Talk==2, both no default "else begin"-block. So script don`t call any node - it simply ends talk_p_proc procedure without any action. Why then dialog screen don`t close autmaticaly? Because you place gsay_end and end_dialogue in the
if (map_var(MVAR_Talk == 4))
block and script simply ignore them.

Second, map_var(MVAR_Talk==x) wouldn`t work at all cause after preprocessor this would be map_var((0)==x) and this don`t make sense. This should be map_var(MVAR_Talk)==x.

Third.
--------------------------
procedure start begin
set_map_var(MVAR_Talk , 0);
end
--------------------------

This is potential bug. Procedure start called not on the script creation, but before any other procedure in the script (inluding critter_p_proc :-). So in most cases this procedure shouldn`t contain any code. Anyway MVARs always initialize with null.

Fourth.
----------------------
if [smthng] then begin
call Node00x;
[some_code]
end
----------------------
It`s a good idea to put [some code] before call operation, because script may be interrupted in some way (i.e. player can press "0" while at that node) and [some code] don`t be executed at all.

Fifth.
---------------------------------------------------
if (map_var(MVAR_Talk) == 0) then begin
 set_map_var(MVAR_Talk , 1);
 call Node001;
end
[some code]
if (map_var(MVAR_Talk) == 1) then begin
 float_msg(self_obj, mstr(117), FLOAT_MSG_NORMAL);
end
---------------------------------------------------
MVAR_Talk==0. Script uses first if-block. MVAR_Talk set to 1 and Node001 called. After Node end script returns back to the "end" string. Execute [some code]. And then execute another if-block (because MVAR_Talk is already set to 1 at the first if-block). It seems to me, that this is not what you want. You should use "else" to fix this.

Sixth.
-------------------
 gSay_End;
 gSay_End;
-------------------
In much cases this will crash Fallout. Try to use gSay_end/gSay_start and start_gdialog/end_dialogue only once per script cause this wery bugy commands. Not by itself, but they oftenly lead to crashes and locks.

Well, finaly your script should be look like this:
------------------------------------------------
<...>
procedure start begin end

procedure talk_p_proc begin
start_gdialog (NAME,self_obj,4,-1,-1);
gSay_Start;

 if map_var(MVAR_Talk)==0 then begin
  set_map_var(MVAR_Talk,1);
  call Node001;
 end else if map_var(MVAR_Talk)==1 then float_msg(self_obj, mstr(117), FLOAT_MSG_NORMAL);
 else if map_var(MVAR_Talk)==2 then begin
  [some node-call :-)]
 end else if map_var(MVAR_Talk)==3 then call Node011;
 else if map_var(MVAR_Talk)==4 then call Node014;
 else set_map_var(MVAR_Talk,0); //this should never happen. Just for safe
 
gSay_End;
end_dialogue;
end
<...>
------------------------------------------------

This, hopefuly, should work :-) If there no other errors :-)  

I don`t now that Fallout are somewhat popular at China (or Korea?).

========================================
Addition.

Another bug at talk_p_proc :-)

You can`t use float_msg while in dialog mode. So if want to show a floater for map_var(MVAR_Talk)==1 , then code for it must be placed before start_gdialog:
Êîä:
 
procedure talk_p_proc begin

if map_var(MVAR_Talk)==1 then float_msg(self_obj, mstr(117), FLOAT_MSG_NORMAL);
else begin
 start_gdialog (NAME,self_obj,4,-1,-1);
 gSay_Start;

 if map_var(MVAR_Talk)==0 then begin
  set_map_var(MVAR_Talk,1);
  call Node001;
 end else if map_var(MVAR_Talk)==2 then begin
  [some node-call :-)]
 end else if map_var(MVAR_Talk)==3 then call Node011;
 else if map_var(MVAR_Talk)==4 then call Node014;
 else set_map_var(MVAR_Talk,0); //this should never happen. Just for safe
 
 gSay_End;
 end_dialogue;
end
end




(Îòðåäàêòèðîâàë(à) Raven - 11:22 - 21 Ñåíò., 2004)

Îòïðàâëåíî: 4:12 - 21 Ñåíò., 2004
xisailuo
Ïîëüçîâàòåëü

Ðåãèñòðàöèÿ: Àâã. 2004

Âñåãî: 19 ñîîáùåíèé

In China, most people do not play fallout , they like RTS ,Online game & Japanese RPG,but Fallout is also popular in some BBS,they think it is great

Îòïðàâëåíî: 5:21 - 8 Îêò., 2004
 

Ïåðåõîä ïî òåìàì
<< Ïðåä. Ñëåä. >>
Åäèíñòâåííàÿ ñòðàíèöà ýòîé òåìû


Powered by Ikonboard 2.1.9 RUS
Modified by RU.Board Team
© 2000 Ikonboard.com