2 NPC conversation
Well i have question.How to make one guard talk to second guard while Dink asked one of them about the second one?
I may have the wrong idea, but anyway, you could make one guard say something then the other guard say something that seems like he's talking to that other guard. Make them kinda facing eachother too if you can.
I need a script.When i do this the one guard will say what the second will say!
Ahh! I know what you mean. Go to your Main.C where it says Add you own globals here blah blah Put something like
make_global_int("&guard1", 0);
make_global_int("&guard2", 0);
Then in your script for the first guard in a void main(void) put something like &guard = ¤t_sprite;
Then in other script do same thing put with &guard2. Then in any script put say_stop("blah", &guard2); Then guard2 should say it. Then change &guard2 to &guard1 and guard1 will say it. Does this help?
make_global_int("&guard1", 0);
make_global_int("&guard2", 0);
Then in your script for the first guard in a void main(void) put something like &guard = ¤t_sprite;
Then in other script do same thing put with &guard2. Then in any script put say_stop("blah", &guard2); Then guard2 should say it. Then change &guard2 to &guard1 and guard1 will say it. Does this help?
Thanx.It helped!
This method costs you two globals, if you want to save two use this script and attach it to the guard you're speaking (guard1) to: (and remove the other guard(guard2) from the map)
void main(void)
{
int &guard2 = create_sprite(x,y,brain,seq,frame);
sp_script(&guard2,"guard2");
}
void talk(void)
{
say("BlaBla",1);
say("`7I agree",¤t_sprite);
say("`8So do I",&guard2);
}
Put the talk and hit information for the second guard in the guard2.c script.
I used this trick numerous times in the scourger, in my current work I choose to use two globals but continuously re-use them which is a good choice too...
void main(void)
{
int &guard2 = create_sprite(x,y,brain,seq,frame);
sp_script(&guard2,"guard2");
}
void talk(void)
{
say("BlaBla",1);
say("`7I agree",¤t_sprite);
say("`8So do I",&guard2);
}
Put the talk and hit information for the second guard in the guard2.c script.
I used this trick numerous times in the scourger, in my current work I choose to use two globals but continuously re-use them which is a good choice too...
A quick way is to use sp(); to get the other sprite (check sprite number in editor, do int &guard = sp(x); in script) though Windinkedit can sometimes spontaneously change these numbers, screwing your scripts up. Never had any problems with Dinkedit myself.
I've been using get_sprite_with_this_brain() for one sprite to find another's number. Works pretty well if there's only a couple of sprites, anymore and you'll have to use different brain types.
:This method costs you two globals:
So what! You've got 200! Only someone that makes HUGE Dmods would have to worry about that. IE: SimonK. (Even though he's over Dink Smallwood)
So what! You've got 200! Only someone that makes HUGE Dmods would have to worry about that. IE: SimonK. (Even though he's over Dink Smallwood)
Still... I can't say it's a -great- idea to use up your globals when you could do the exact same thing with a local variable.
It may not be a good idea to just go handing out globals everywhere, but you may find it necessary to have a couple global variables for things. Keep in mind you could still use the variables for other purposes.
Let's say you did use a variable for one of the two knights. It would only be for that screen, so you could have it set when you enter that screen and go along to use the variable for another character on another screen. It's better what metatarasal said to do though, I was just providing an example. It's good practice to be conservative.
Let's say you did use a variable for one of the two knights. It would only be for that screen, so you could have it set when you enter that screen and go along to use the variable for another character on another screen. It's better what metatarasal said to do though, I was just providing an example. It's good practice to be conservative.
void main(void)
{
int &guard2 = create_sprite(x,y,brain,seq,frame);
sp_script(&guard2,"guard2");
}
void talk(void)
{
say("BlaBla",1);
say("`7I agree",¤t_sprite);
say("`8So do I",&guard2);
}
That is good. It does save two globals. But when you got the talking bit you said...
say("BlaBla",1);
say("`7I agree",¤t_sprite);
say("`8So do I",&guard2);
That would actually make them all say it at the same time. So you might want to change it to...
say_stop("BlaBla",1);
say_stop("`7I agree",¤t_sprite);
say_stop("`8So do I",&guard2);
{
int &guard2 = create_sprite(x,y,brain,seq,frame);
sp_script(&guard2,"guard2");
}
void talk(void)
{
say("BlaBla",1);
say("`7I agree",¤t_sprite);
say("`8So do I",&guard2);
}
That is good. It does save two globals. But when you got the talking bit you said...
say("BlaBla",1);
say("`7I agree",¤t_sprite);
say("`8So do I",&guard2);
That would actually make them all say it at the same time. So you might want to change it to...
say_stop("BlaBla",1);
say_stop("`7I agree",¤t_sprite);
say_stop("`8So do I",&guard2);
Well, you get the point. The say(); commands where only added to illustrate it really, I mean it should be obvious to replace them with whatever you want. I for one like to add a wait(); command between say_stop(); commands so for me it would look like:
say_stop("BlaBla",1);
wait(200);
say_stop("`7I agree",¤t_sprite);
wait(200);
say_stop("`8So do I",&guard2);
It should be obvious....
say_stop("BlaBla",1);
wait(200);
say_stop("`7I agree",¤t_sprite);
wait(200);
say_stop("`8So do I",&guard2);
It should be obvious....
I don't usually wait unless they're thinking or something like that.