September 21st, 2011

ALPACA Help Open Thread

Hi everyone, I’m going to leave this post up as an open thread for any questions, comments or issues you have using ALPACA. I can’t always answer questions immediately but I’ll do my best to respond promptly. Have at it!

113 comments to ALPACA Help Open Thread

  • David

    These are the part of my puzzle.as.

    case “[object action_LADDER_STAIR]“:
    Engine.newBack = “room2″;
    stageRef.dispatchEvent(new Event(“changeBackground”));
    break;

    case “[object action_COINS_BAGGER]“:
    Engine.newBack = “room3″;
    stageRef.dispatchEvent(new Event(“changeBackground”));
    break;

    Room1 changebackground to room2 is success.
    But room2 changebackground to room3 is failed.
    The message is

    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at com.laserdragonuniversity.alpaca::Engine/createBackground()
    at com.laserdragonuniversity.alpaca::Engine/changeBackground()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.display::Stage/dispatchEvent()
    at com.laserdragonuniversity.alpaca::Puzzle/performedAction()
    at com.laserdragonuniversity.alpaca::PlayerAction/returnPlayerControl()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at action_COINS_BAGGER/frame22()

    What should i do? thank you, Mr.Quinn

  • Coppero

    1. So there is no solution, hm? When you put an obstacle in the middle, it’s ok. Yet when you place it somewhat on the top or bottom of the room, the character will always go to the node first. And that looks awfully whacky… :(
    2. I’ll try that.
    3. I’m getting error #1007. I changed config.js and put “useAudio”: true, but the subtitles now don’t display at all and the audio is not played. I placed audio files in the library (does it matter which folder?). I think I called them properly. Say I have shop_L and so I named the audio file SHOP_look, as per your Panda tutorial. Doesn’t seem to work. What is wrong?

  • Coppero

    *Slaps my head* #3. Forgot to export the files for Actionscript. Works like a charm now. :) Thanks.

  • Coppero

    Apologies for this triple post. (can’t edit my posts in any way, apologies)

    I’m messing around with dialogs. And I seem to have the following problems:

    1. I used the Panda dialog in my project (under speechlines.js). I can only alter the text, but whenever I add some more options or submenus, the dialog is inactive in game mode. It seems to hang, when you click on the Talk icon, nothing happens. Why is that? Should I define this new dialog anywhere?
    2. Is the dialog limited to only 4 lines? Can I add more talk lines/options?
    3. After the lines from a submenu play, it returns to the main dialog index. Any way so it would return to the submenu instead?
    4. Any way to have the ‘Exit’ or ‘Never Mind’ line from the submenu, so it returns directly to the main dialog?

  • Quinn

    @David – Something is missing in room3, most likely a startPoint (or if there is one, it isn’t named properly). Check that your room has all the stuff it needs, and everything has the right instance name.

  • Quinn

    @Coppero (first post):
    1. Yeah, it’s not ideal. One of these days I’ll have the time to implement real pathfinding into the engine :)
    (second post)
    1. I’m guessing the issue is that…
    2. …yes, you can only do 4 lines right now, but it’s not too hard to add more. Just add more manually to the dialog movieclip in the library, give them an appropriate instance name (option4, option5, most likely) then open up Dialog.as and go to line 72:
    optionButtons = new Array(option0, option1, option2, option3);
    Add the names of your new options to this array. That should work.
    3. You’d have to change the nextStep method in the Dialog class for this one; it would take some playing around but it’s doable.
    4. See above. The dialog system isn’t super flexible so it could certainly use improvement.

  • Martina

    Hi Quinn, so i came back with many question. Not very big problems î think and hope.

    I had january posted a Problem with my item Saugnapf. You said :

    In your puzzle class, in performedAction after you open the air vent, set the sucker’s lookTag to 2 (or whatever you want). This will be a lot like how the pyramid’s looktag changes in the sample project after you sharpen it.

    var saugnapf;
    var currentItems:Array = inv.returnItems(null);
    for (i in currentItems){
    if (currentItems[i].displayName == “SAUGNAPF”)
    saugnapf = currentItems[i];
    }
    saugnapf.lookTag = “2″;

    Then change the name of your action movieclip to action_SAUGNAPF2_SCHACHT. Now it should only work when the other action has been played.

    So far so good, it works but now i have seen a second bug, if i havent get the Saugnapf i get a problem.

    TypeError: Error #1010: Ein Begriff ist nicht definiert und hat keine Eigenschaften.
    at com.laserdragonuniversity.alpaca::Puzzle/performedAction()
    at com.laserdragonuniversity.alpaca::PlayerAction/returnPlayerControl()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at action_BRECHEISEN_SCHACHT/frame50()

    Here is my Script:

    case “[object action_BRECHEISEN_SCHACHT]“:
    var currentItems:Array = inv.returnItems(null);
    var schacht;
    var saugnapf;
    for (a in currentItems){
    if (currentItems[a].displayName == “SAUGNAPF”)
    saugnapf = currentItems[a];
    }
    for (var a in Engine.obstacles){
    if (Engine.obstacles[a].displayName == “SCHACHT”)
    schacht = Engine.obstacles[a];
    }
    schacht.gotoAndStop(“open”);
    speech = new Speech(stageRef, schacht, “usedbrecheisen”);
    schacht.lookTag = “2″;
    saugnapf.lookTag = “2″;
    schacht.usable = false;
    inv.removeInvItem(“BRECHEISEN”);
    allPuzzles.mischhallelinks.usedSchacht = true;

    this is the script for the cupoard where i get my Item Saugnapf:

    case “SCHRANK”:
    var schrank;
    var saugnapf;
    for (var a in Engine.usableItems) {
    if (Engine.usableItems[a].displayName == “SCHRANK”)
    schrank = Engine.usableItems[a];
    if (Engine.usableItems[a].displayName == “SAUGNAPF”)
    saugnapf = Engine.usableItems[a];
    }
    schrank.gotoAndStop(“open”);
    speech = new Speech(stageRef, schrank, “use”);
    allPuzzles.mischhallelinks.usedSchrank = true;
    schrank.usable = false;
    schrank.lookTag = “2″;
    saugnapf.visible = true;

    How can i work around that if i havent taken the Saugnapf the Sschacht Moviclip works?

    My second question is with the Subtitel from other charakter than my player.
    I have a Girl and if I ask her my question her answere is many point above her head. Where can i Change that?

    My third question is with the subtitel too. With the optional Dialog. Can i make the dialogwindow above the player too?

    And my last question is about objekts before the player. I have a szene where the player is kidnapped and put in a cage. I want that my player can walk on a small ground in the cage and get item at the border of the cage. He can use movieclips of course but i´m afraid if he walks on the ground or take an item he is suddly before the cage. Any Idea how i can my that?

    i hope you can help me

  • Quinn

    @Martina – I noticed this part in your code snippet:

    for (a in currentItems){
    if (currentItems[a].displayName == “SAUGNAPF”)
    saugnapf = currentItems[a];
    }
    for (var a in Engine.obstacles){
    if (Engine.obstacles[a].displayName == “SCHACHT”)
    schacht = Engine.obstacles[a];
    }

    You need to make sure that for (var a... comes first; the “var” part of that is declaring the variable. Notice how you declare the variable “a” in the Saugnapf section – that means when the user gets the Saugnapf first, “a” gets defined, so the Schacht section works. But if the user doesn’t get the Saugnapf first, then it comes upon this code:for (a in currentItems){ and it doesn’t know what “a” is, so it throws the error.

    The Subtitles are designed to appear right over the characters’ heads (the code for this is in Subtitle.as around line 104). If it’s appearing way over the girl’s head, maybe there’s something in her movieclip that’s very tall or high above her? The code looks for the full height of her movieclip to determine where her “head” is.

    The Dialog box sets its position to (100,200) in Dialog.as – right around line 60. You can change that to anything you want.

    For your last question, have you tried setting the cage movieclip as a foreground element by putting “_F” at the end of its instance name?

  • Martina

    i understand what you mean, but how do i change that? i have to define a as saugnapf or? How can i write that a is the saugnapf?

    as the suptitles i look at the girl but she has nothing above her head. The subtitle from my player works just fine. I try tomorrow to make the girl in a new movieclip maybe it will work.

    for the Dialogbox i tried to change the place like in the subtitle.as. I defined this Char, but i dont understand where you gets the back.height from. I tried to copy “back.height = textbox.height + 10;” but i think thats not right, because he needs textbox and there are so many textbox lines that i dont know which one is needet. (sorry i´m not sooo good in AS to know this. I understand the most but on my owne its really heavy)

    For my last Question thank you i only have to look at my cage that the invisible is not touchable ^^ But it works just fine thank you :3

  • Quinn

    @Martina – just put “var” before “a” wherever it first appears. Or use a different variable for each for loop (a, b, c, whatever you want).

    To change the dialog placement, you don’t need to do anything fancy. On lines 60-61 it should read:
    x = 100;
    y = 200;

    Just change those values and the dialog box will appear elsewhere. Or did you want the box to change its position based on where your character is?

  • Martina

    i want to change its position based on where my player is. I found the line yes und tried to use the line from subtitle.as but that dosent work.

  • Martina

    wahhhhh x.x it dosn´t work

    if i make a var bevor a i get the error that i have a already used… if i change a to another letter i get a error if i use the prybar(Brecheisen). and dont take the sucker(Saugnapf).

    case “[object action_BRECHEISEN_SCHACHT]“:
    var currentItems:Array = inv.returnItems(null);
    var schacht;
    var saugnapf;
    for (var a in Engine.obstacles){
    if (Engine.obstacles[a].displayName == “SCHACHT”)
    schacht = Engine.obstacles[a];
    }
    for (var b in currentItems){
    if (currentItems[b].displayName == “SAUGNAPF”)
    saugnapf = currentItems[b];
    }
    schacht.gotoAndStop(“open”);
    speech = new Speech(stageRef, schacht, “usedbrecheisen”);
    schacht.lookTag = “2″;
    saugnapf.lookTag = “2″;
    schacht.usable = false;
    inv.removeInvItem(“BRECHEISEN”);
    allPuzzles.mischhallelinks.usedSchacht = true;

    case “[object action_SAUGNAPF2_SCHACHT]“:
    Engine.newBack = “dorfmitte”
    stageRef.dispatchEvent (new Event(“changeBackground”));
    inv.removeInvItem(“BRECHEISEN”);
    inv.removeInvItem(“SAUGNAPF”);
    inv.removeInvItem(“SCHLUESSEL”);

    I get this error if i trie it with other letter or if i trie it with one var and the rest the same letter like in your as file…

    TypeError: Error #1010: Ein Begriff ist nicht definiert und hat keine Eigenschaften.
    at com.laserdragonuniversity.alpaca::Puzzle/performedAction()
    at com.laserdragonuniversity.alpaca::PlayerAction/returnPlayerControl()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at action_BRECHEISEN_SCHACHT/frame50()

    Sorry that i dont get it >.< I really dont know what i should Change. i understand the problem what you said why the problem comes, but i dont know where i can change it all.

  • Quinn

    @Martina –

    For moving the dialog box, try using this code in its main function (public function Dialog(…)), right where it currently sets x and y:
    x = player.x – this.width/2;
    y = player.y – player.height – this.height;
    Then just copy the code from Subtitle.as that keeps the box visible within the Stage (lines 109-120).

    For your other issue, do you have a break statement before case “[object action_SAUGNAPF2_SCHACHT]“:? Like this:

    break;
    case “[object action_SAUGNAPF2_SCHACHT]“:

    If you don’t, then it might be trying to execute the code in the next block, which could be the source of your error.

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>