|
NPC Dialog Error
#182574
02/07/08 17:10
02/07/08 17:10
|
Joined: Feb 2008
Posts: 27 Germany, Hessen
Crackdown90
OP
Newbie
|
OP
Newbie
Joined: Feb 2008
Posts: 27
Germany, Hessen
|
Hi, i cant find the error in this! this is my start screen: Code:
// don't forget to include npc1.wdl // attach action npc1 to your non playing character
function npc_talks(); // function prototype
string npc1_str = "Yeah, a good day to you too"; string npc2_str = "No, I'm not interested in buying used 286 computers"; string npc3_str = "I can't talk to you - I have to clean my helmet"; string npc4_str = "I'm not talking to you from now on"; string npc5_str = "Hm hm hm...";
text npc_txt { layer = 22; pos_x = 0; pos_y = 0; font = standard_font; strings = 5; // 5 "lines" for this npc string = null; flags = d3d; }
action npc1 { clip_size = 0; // show all the triangles for all the models while (1) { temp.x = player.x - my.x; temp.y = player.y - my.y; temp.z = 0; vec_to_angle(my.pan, temp); // rotate towards the player
ent_cycle("stand",my.skill9); my.skill9 += 1.5 * time; if (my.skill9 >= 100) {my.skill9 = 0;} // play "stand" animation
my.skill10 = vec_dist(my.x, player.x); if (my.skill10 < 200) // player comes closer than 200 quants to the npc { if (my.skill11 == 0) { my.skill11 = 1; // the npc says a single "line" (fake exclusive_global) npc_talks(); } } else { my.skill11 = 0; } wait (1); } }
function npc_talks() { if (my.skill12 < 5) {my.skill12 += 1;} // strings from 0..4 = 5 strings are allowed
if (my.skill12 == 1) {npc_txt.string = npc1_str;} if (my.skill12 == 2) {npc_txt.string = npc2_str;} if (my.skill12 == 3) {npc_txt.string = npc3_str;} if (my.skill12 == 4) {npc_txt.string = npc4_str;} if (my.skill12 == 5) {npc_txt.string = npc5_str;}
npc_txt.visible = on; waitt (48); npc_txt.visible = off; }
Its a tut from AUM! Thanks
|
|
|
Re: NPC Dialog Error
[Re: Crackdown90]
#182575
02/07/08 17:31
02/07/08 17:31
|
Joined: Feb 2008
Posts: 337
Vadim647
Senior Member
|
Senior Member
Joined: Feb 2008
Posts: 337
|
1. Try using something other than standart font, it sometimes lags without any visible reason 2. Try changing 'string = null;' to 'string = "","","","","";'.
I switched to other account since marth 2010. Guess which.
|
|
|
|