Want npc to move on specific dialog option

Started by harmonicapress, Fri 17/07/2015 06:36:37

Previous topic - Next topic

harmonicapress

I'm making a police farse and I have a character I want to leave the room when I choose a dialog option. I tried coding cCharacter.Walk(x,y,eblock,walkableareas) in the actual dialog, but the character does not execute. Here is what my dialog looks like...
Code: ags

Mackey: What, you gonna do some weird stuff with the body?
Bingo: Gross Macky. Would you just give me some space and let me do my thing?
Mackey: Sure thing, pervert. 
  cMackey.Say("Go outside McMurphy. Secure the perimeter McMurphy. Secure this.");
  cMackey.Walk(611,396,eBlock,eWalkableAreas);


note: the area he is supposed to walk to is a walk behind (hides him)
Then I'm using if cMackey.x<612 to change how my character interacts with the door he was blocking (else my character says "mackey is blocking the door"). Does this sound like the best way to execute this set-up?

Let me simplify this by complicating it for you, Mackey is blocking the door, I have an if else statement saying if mackey x>612 say "the door is blocked" else I can manipulate the door (open door visible = false, closed door visible = true, revealing his coat hanging behind the door with a pocket full of clues. I want a dialog option that tells mackey to bug off so I can get to the door, close it and examine the coat. Pretty sure I have the open/door part down (per the tutorial), just cant get mackey to move with the dialog command function. Help!
Thanks folks!:-D

Mandle

I don't know if it's because the command is eBlock, but I think it's something like that.

There's probably a better way to do it, but I would probably just do something like:

Code: ags
Mackey: What, you gonna do some weird stuff with the body?
Bingo: Gross Macky. Would you just give me some space and let me do my thing?
Mackey: Sure thing, pervert. 
  cMackey.Say("Go outside McMurphy. Secure the perimeter McMurphy. Secure this.");
  IsMackeyLeaving=true;
//IsMackeyLeaving is a Global Bool Variable originally set to false

Then in Room Script: RepeatedlyExecute:

Code: ags

if(IsMackeyLeaving==true){
cMackey.Walk(611,396,eBlock,eWalkableAreas);
IsMackeyLeaving=false;
}


(Code untested)

Khris

How exactly does the script fail?
I assume you're getting the dialog, including line 4 in the snippet, but then cMackey refuses to walk?
Does it work if you use eAnywhere as the last parameter? If so, make sure cMackey is standing on a walkable area when the command is called.

harmonicapress

SOLVED
Changed from walkable areas to anywhere and he took a hike. I suspect it was because someone mentioned above, he was not standing on a walkable area to begin with.
Thanks!

SMF spam blocked by CleanTalk