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!
|
September 21st, 2011
ALPACA Help Open ThreadHi 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 |
|
|
Copyright © 2012 Quinn Stephens - All Rights Reserved |
|
Hi Quinn!
I’m a university student and I’m trying to make a Point and click adventure, so I came across Alpaca. I used to use Flash Develop instead of Adobe Flash. So there it is my question: can I use Alpaca with Flash Develop or not?
Pd: I apologize for my grammar, as you probably has notice, i do not speak english properly
You speak English more properly than 99% of the Internet, so I wouldn’t sweat it! As for your question, unfortunately ALPACA doesn’t support FlashDevelop, at least not in its current form. The engine is built with the idea that you’re going to set up most of your game without code, using Flash’s user interface.
If you’re willing to rewrite a lot of the code, it could be done; you’d just need to figure out how to set up all the backgrounds, items, and animations without using Flash, and honestly I have no idea how to do that.
So if you’re a real AS3 coding whiz, I’d say go for it, and fork the project on GitHub while you’re at it! If you’re relatively new to Actionscript, though, it might not be worth the effort. You could try the Pushbutton engine instead – from what I hear you can make it work in FlashDevelop, although it’s a much broader engine and not totally focused on point and click adventure games.
Thanks for the early reply! I’m a “rookie” in AS… I’m reading this book:
http://www.8bitrocket.com/books/the-essential-guide-to-flash-games/
So, next step should be probably continue learning Action Script, and then… well we’ll see ^^
Hello Quinn im trying to use the same code you used in the sample project to brake a door with the stone, but in my project it dosnt work! can you show me a litte example on how you do that?
Can you give me a little more detail? Does the whole game not work, or just that one event? Does your error log show anything?
I need one object to be invisible then when I use another object the first object change to visible and the used object change to invisible, the code is working if i go to another room and then go back to the first one but when the game starts both objects are visibles.
If the make-things-invisible code works when you leave the room and come back, I’m guessing the code is in the newBackground method in the Puzzle class? That method actually doesn’t get called when you first load the game; it only gets called from the second room onward. Try using the firstAction method in the Puzzle class; just call the newBackground method manually. So it’ll look something like this:
public function firstAction():void{
newBackground("the-name-of-your-background");
}
Hello, Quinn!
Is it possible to create an animation of the turning side to side while moving? Because of the lack of this movement, transition seems too abrupt. Sorry for bad English. Thanks in advance!
Certainly you can, although it may be a little tricky. First I’d create the turning-around animation for the character, and put that animation into a frame on the character’s main timeline with a frame name of “turn” or something, just like you’ll already have for “walk,” “talk”, and “grab.” Then in the Player class, you’ll need to change the way the orientPlayer method works. RIght now this method gets called constantly while the player is in motion and it just switches the player’s orientation instantly when it needs to. You’ll need to change this so that it stops the walking animation and movement, turns the character around, and then resumes the movement. It’ll look something like this:
private function orientPlayer():void{
// Make sure the player is pointed in the right direction
var dummyEvent:Event = new Event();
if (xinc < 0 && scaleX > 0){
stopWalking(dummyEvent);
gotoAndStop("turn");
// You'll need to have your movie clip dispatch the "clipFinished" event, like in custom animations
stageRef.addEventListener("clipFinished", resumeWalking);
}
if (xinc > 0 && scaleX < 0){
stopWalking(dummyEvent);
gotoAndStop("turn");
stageRef.addEventListener("clipFinished", resumeWalking);
}
}
And then you'll add a resumeWalking method like so:
private function resumeWalking():void{scaleX = -scaleX;
startWalking(targetX, targetY);
}
I think that will work. Hope that helps!
Thank you for your decision.
Hey Quinn,
In you sample project, how do you get the box puzzle to stay on the ‘open’ frame once you have used the pyramid item on it?
I am trying to do the same thing with a lockpick item opening a drawer, but when I use the item on the drawer it plays the action movie clip but reverts back the ‘closed’ state when finished, I can’t get it to stay on the ‘open’ frame.
You need to add some code to the performedAction method in the Puzzle class. Take a look at all the code under
case "[object action_BOX_USE]":You’ll note that there are a couple lines giving the box a “lookTag” to indicate its new state, along with making it no longer usable. And don’t forget to add the same code in the newBackground method, so that if the player has opened the drawer, it will stay open if they leave the room and come back.Would it be possible to get a snippet of code to insert in to the dialog.as file that will let me call up a character portrait during dialog? I am still kind of a newbie and I’ve been trying but I keep breaking everything. Sorry for the question! Amazing engine by the way, this has really helped teach myself flash!! You rule!
If you’re having a lot of trouble rewriting code then I would recommend some basic game-creating tutorials; actually setting up your own game from scratch will help fill in a lot of the gaps in your knowledge, and that will make editing ALPACA a lot easier. When I was first learning AS3 games I used these, and they were a great help: http://www.foundation-flash.com/tutorials/index2.php
Dear Quinn
I am a student in Taiwan
currently, I am working on alpaca engine with my project
It is a great engine, which inspire me to make a game like machinarium
( http://machinarium.net/demo/ )
and now, i am trying to modify the movement system to node-base pathfinding with this website
http://active.tutsplus.com/tutorials/games/artificial-intelligence-series-part-1-path-finding/
normally, I meet some problem in integrated those code to alpaca engine
how each background keep their own node-base movement
any suggestion well be appreciate
p.s. sorry about my poor English
expect your next release
Regards
Node-based pathfinding is a great idea, and I plan to integrate it eventually. I can’t promise that will be anytime soon, though, so you’re probably better off integrating it yourself if you’re on a deadline. My advice would be to place the nodes on the stage in the Flash project, the way you currently place obstacles and extis and all of that. Then I’d create a new class to handle the pathfinding – the class would be pretty self-contained, you’d just feed it all the nodes you have, the spot where the user clicked, and where the player is currently standing; have the class return an array of nodes to visit. Then you’d have the Player class call the pathfinder class whenever it needs to start moving and get the order of nodes, and have the player travel from node to node (you’ll probably want to rewrite the way the player currently walks entirely). Hope that helps!
Hello, Mr.Quinn.
If i want get a item after i use an object to another object, how shoud i do?
For example,using the keycard to teleport, after this i get a item.
(using A to B, and i get C in inventory)
Thanks a lot!
In the Puzzles class, you’ll make a call to the Inventory class’s addInvItem method in order to add an item to the inventory. Take a look at part 4 of the ALAPCA tutorial (http://quinnstephens.com/blog/2011/05/creating-your-first-alpaca-game-part-4-inventory-items-and-puzzles/) – about halfway down the page you’ll find an example of doing this.
thank u, sir.
excuse me, i still have no idea about that…sorry i’m fool
Can u tell me more detail, thank you.
the last question, sorry:(
how can i changebackground after the ActionMovieclip?
public function performedAction(actionMC:MovieClip):void{
this.actionMC = actionMC;
var clipString:String = String(actionMC);
switch (clipString){
case “[object action_KEYCARD_]“:
Engine.newBack = “room3″;
stageRef.dispatchEvent(new Event(“changeBackground”));
break;
default:
break;
}
}
this is what i type, it changed to room3, but the player dissppeared and there is nothing to do.
thanks, Mr.Quinn.
I’d recommend going through the whole tutorial step-by-step; that should make it clearer how everything in the engine works together.
Room 3 might be missing a startPoint if the player isn’t appearing. Make sure there’s one on the stage with the proper instance name.
it’s so kind of you, Mr.Quinn.
i’m so careless that asking many stupid questions. =(
case “[object action_ROPE_WOOD]“:
var bow = new bowInv;
bow.displayName = “BOW”;
inv.addInvItem(bow.displayName);
break;
That’s my idea, and it works.
Refer to “keycard to teleporter”, and i have a new question again.
When the ActionMC is over, how to remove the item(ex:wood, teleporter, or something in the background)?
thanks you, Mr.Quinn.
Just set the item’s visibility to false, as in
nameofitem.visible = false;
And make sure your Puzzle class sets that item as invisible every time the player reenters the room (in the newBackground method).
I know how to change utf-8 to big5(chinese character) in xml.
But i have no idea how to do this in javascript, and what should i edit in Engine.as.
Thank you, Dr.Quinn.
Great engine
Look forward to your next release
@David – Sorry, I really have no idea. I would maybe look for some Chinese-language Flash tutorials and see if they deal with this kind of thing at all (importing text and data from external files), and hopefully it can be applied to your situation.
thank you Quinn, i’m sorry about bothering you for a while, looking forward to your next release !
Hallo Quinn,
I really like your engine und have my own projekt now. The Tutorial are really helpfull for all thinks I need. For the other i use the sample project which makes wonder ;P
I have only one thing to ask. At the 4th tutorial there are Items and uses which it. I have read that i cant use an item which an other item. You said in an other post:
1. You can’t, in ALPACA’s current version. You’d need to customize the Inventory and DraggedItem classes so that the inventory doesn’t disappear when you use one if its items, and go from there. A few people have asked about this, so I’ll be sure to add it to the next release.
Is there a development for this kind of things? Or which way can i go?
I have to edit the Inventory and the Dragged Items classes, is there are a change in puzzles.as too? I´m not sooo good with action script but i can work, i need only a prode in the right direction.
My other question is about dialogs. I want to start a dialog with the beginn of the game… Where do i write that the dialog start, if i start te game?
Thank you for your help and for this nice engine ^-^
I hope you can answere my question
PS: sorry for my english i try my best.
@Martina – it’s a bit hard to explain, but basically in the UseBox class, in the useThing method, the second line says inv.visible = false; – that’s the code that makes the inventory go away when you “use” an inventory item. You’ll want to get rid of that line of code, and in its place you’ll need to determine when the new DraggedItem that’s been created moves outside the inventory and have the inventory disappear then (assuming you still want the player to be able to use inventory items on the environment, in addition to other inventory items). That means you’ll probably want to add an ENTER_FRAME event listener to the DraggedItem class (one that gets called on every frame) and have it check to see if the item is overlapping the inventory; if it is, remove the inventory, then remove the event listener, and everything else should work the same. SHOULD work, but it’s always possible there will be bugs after changing something like this.
As for the dialog starting the game, just put the code to begin the dialog in the firstAction method in the Puzzle class – it’ll execute that code as soon as the game loads.
Hope that helps!
Thank you for your quick help. I try it at the next time :3
The Dialog works just fine thank you ^-^
I have a quick question about hidding Items. I tried to hide a Item in a cupboard. I used the technik with the card to change the closed cupboard to an open cupboard. Only that i dont get an item if i open the cupboard. Now i have the item in the cupboard to the frame 2 “open”. I see the item but i cant use it, because it is on the cupboard movieclip. How can i get this item?
I want to open the cupboard first, bevor i take it.
thank you for your help Martina
@Martina – try adding the item dynamically, instead of putting it inside the movieclip. In your Puzzle class, in the usedItem method where you changed the frame of the cupboard, write some code to place the item on top of the cupboard movieclip. It’ll look something like this:
var yourItem = new yourItemMC; // This will be a library item, exported for actionscript, like the keycard
stageRef.addChild(yourItem);
yourItem.x = cupboard.x; // Fine-tune this so it appears in the right place
yourItem.y = cupboard.y;
yourItem.gettable = true;
Make sure the yourItemMC has a usePoint, too!
so i have tried your code and i get the item on the screen at the right place, but first. I can´t get it, i have a usePoint but the file dosn´t recognies it as item. I have a speech and such, i have an Inventar Movieclip and i have a Proper movieclip. In the ItemMC is on a second Layer the UsePoint with the name UsePoint and the Item is the Proper Item. All Items are Exported.
The second Problem i see is, if i change the screens i see my Item on the other screen.
I hope you can help me. If you need the script say it :3
Ah yes i have a third problem with duplicate variable definition at the used Item Block in puzzles. At the new Background i coud combine two puzzles, but at the used Item Block i have two cases and not one.
The source says its the line “for (var i in Engine.usableItems) {
What is here the best way to go? Can I rename the case in openThings and combine it or is this the wrong way? I can combine the line “for (var i in Engine.usableItems) { but than i dont now what if i could use to make the gotoandStop, or the speech command.
i hope you can help me and thank you again ^-^
OK, forget my earlier answer – just put the item in your background manually, on top of the cupboard, but in the Puzzle class, in the newBackground method, set its visiblity to false. Then you can just make it visible once the player opens the cupboard. Like so:
case "thisbackground":
var hiddenItem;
for (var i in Engine.usableItems){ // There should really be a separate method for this, sorry
if (Engine.usableItems[i].displayName == "ITEMNAME")
hiddenItem = Engine.usableItems[i];
}
hiddenItem.visible = false;
if(allPuzzles.thisbackground.cupboardOpen)
hiddenItem.visible = true;
Then in the usedItem method:
case "cupboardName":
// Loop through the usableItems like you did before to get the hiddenItem movieclip
hiddenItem.visible = true;
allPuzzles.thisbackground.cupboardOpen = true;
The duplicate variable definition is from defining i twice. Just change it to
for (i in Engine.usableItems){Hope that helps!
First Thank you for your Help, I dont know what i would do without you. And sorry for the many Problems i have v.v But it dont want to work. If i open the Cupboard, Flash says one term has no definition and attribute. My Item (Saugnapf) is on the plane and has the properties of Saugnapf_O_G. It has a usepoint, nodes and all such. I have an saugnapfInv, an saugnapfProper Movieclip too.
Here are my code:
At new Background
case “mischhallelinks”:
var schrank;
var fussmatte;
var schacht;
var saugnapf;
for (var i in Engine.usableItems){
if (Engine.usableItems[i].displayName == “SCHRANK”)
schrank = Engine.usableItems[i];
if (Engine.usableItems[i].displayName == “FUSSMATTE”)
fussmatte = Engine.usableItems[i];
if (Engine.usableItems[i].displayName == “SCHACHT”)
schacht = Engine.usableItems[i];
if (Engine.usableItems[i].displayName == “SAUGNAPF”)
saugnapf = Engine.usableItems[i];
}
if (allPuzzles.mischhallelinks.usedSchrank == false){
saugnapf.visible = false;
}
if (allPuzzles.mischhallelinks.usedSchrank == true){
schrank.gotoAndStop(“open”);
schrank.usable = false;
schrank.lookTag = “2″;
saugnapf.visible = true;
}
at usedItems
case “SCHRANK”:
var schrank;
var saugnapf;
for (var i in Engine.usableItems) {
if (Engine.usableItems[i].displayName == “SCHRANK”)
schrank = Engine.usableItems[i];
}
schrank.gotoAndStop(“open”);
speech = new Speech(stageRef, schrank, “use”);
allPuzzles.mischhallelinks.usedSchrank = true;
schrank.usable = false;
schrank.lookTag = “2″;
saugnapf.visible = true;
For the duplicate variable definition. If i write “for(i in Engine.usableItems){”
i get many errors because the lines
if (Engine.usableItems[i].displayName == “SCHRANK”)
schrank = Engine.usableItems[i];
want i as right property. And i is now an undefined property.
I hope you can help.
thank you :3
In the main Puzzle method at the top of the class, did you define allPuzzles.mischhallelinks and allPuzzles.mischhallelinks.usedSchrank?
If you’re still having issues with i, you can always declare a variable with a different name in each for…in loop. for (var j in Engine.usableItems), for (var k in Engine.usableItems), etc.
My issues with i are gone thank you ^_____^
at the top of my puzzles code i have only this, if i write allPuzzles.mischhallelinks.usedSaugnapf = false noting change. What do i have to write to include my Saugnapf Item? :
allPuzzles.mischhallelinks = new Object;
allPuzzles.mischhallelinks.usedSchrank = false;
allPuzzles.mischhallelinks.usedFussmatte = false;
allPuzzles.mischhallelinks.usedSchacht = false;
thank you for your help i can only repeat that i dont know what i would do without you ^____^
It looks like in your usedItems method, you’re running the loop to determine which MovieClip is the schrank, but not which item is the saugnapf – make sure you have
if (Engine.usableItems[i].displayName == “SAUGNAPF”)
saugnapf = Engine.usableItems[i];
in that code block as well. This is a very clunky system on my part, so apologies for that
thank you thank you thank you. Its going ^_____^
And for your apologies. I´m happy for alpaca i dont care how clunky the system is. It works and for me it is very good, because i dont know how i could make a point and click game with object programing… My best way to work with flash is via time frames…. and i dont think time frames are very good with many szenarios ^^
so no apologies, because many here are happy for this system ^^
And your help is the best point in this. You try to help and this very fast :3 So im really happy ^.^
Glad to hear things are working for you! Be sure to post a link to your game when you’re finished, I’d love to set up a gallery of ALPACA games.
so i´m again ^.^ alpaca works just fine, i can now open my air stack with a prybar and the animation is good. But i have a second animation with the air stack. I can get 2 sucker and can use this item (is as one item in the inventar) on the air stack. It is favoured if i only can use the sucker if i have used the prybar first. What do i have to write in the puzzle code? I´ve tried to look at the source, but there is the box and than i can use the box again to aktivate the ballon movieclip… but i dont get how i can say action_SAUGNAPF_SCHACHT play after action_BRECHEISEN_SCHACHT
I hope you can help me again ^.^ And off course when i´m finished i upload it and give you the link :3 Its the last i can do for your great work here ;P
Do you want action_SAUGNAPF_SCHACHT to play automatically after action_BRECHEISEN_SCHACHT? Or do you want the player to be able to perform action_SAUGNAPF_SCHACHT only after action_BRECHEISEN_SCHACHT has played?
i want that i can use first Brecheisen with schacht to open the air stack and than the user have to use the sucker with the air stack to enter it and leaf the frame. But at the moment i can use the sucker on the closed air stack whats wrong
Ah, I see – this is a problem with the way I set up the DraggedItem class. If it finds a movieclip that corresponds to the two items you’re using together, it just plays it, without checking with the Puzzle class first. You’ll need to make use of the lookTag for this. It’s a clumsy workaround, but it should work. 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. Keep in mind that if you have any other action movieclips that use the sucker, you’ll have to put the “2″ in those as well; you’ll also need to change any speechlines that make use of it.
It would make more sense to be able to change the lookTag of the shaft instead, but unfortunately I set up the code wrong
Hopefully this should work.
Hello Quinn,
-> I would like to use this function, to:
I have one question on spokeDialog function in Puzzle class. There is no example in tutorial, so that makes it a bit difficult for me.
Actually I have 2 questions
1. Change the frame of the character that the player is speaking to. It is great, that player has those 4 frames (walk, grab, talk, etc.). But how to make the other characters “speaking” as well? can it be made within spokeDialog?
2. Sec thing. is to make things happen thanks to speaking to other character. For example -> player asks: What is the magical spell, characer: bum bum bum, and then,
movie clip starts playing with some explosions or, window opens and becomes EXIT in the meaning of ALPACA – could you just write example code for “changing the reality”?
How to “mark” in the code, that it will happen after specified answer or sentence?
Thanks in advance
I am developing my game for some months now, and I hope to finish it soon!
One more thing I encountered: when we give our object name with “T” instance, like character_T – movieclip of character doesn’t play. For example movieclip of a man standing on the street, nodding his head -> if the instance property is “whatever”, it plays, when it is “whatever_T”, you can obviously talk to it if you set dialogs, but it stands still. Do you know how to fix it?
(I did like this: I made another movieclip symbol with alpha=0 with “T” property, covering the actual character, and this works, but I am sure, that there is better solution)
@Kate:
1 – The character can have a “talk” frame just like the player character; check the door in the sample project (http://alpacaengine.com/downloads/alpaca_sample_project_2-1.zip) for an example. It should play automatically when that character’s dialogue comes up.
2 – You can do this with the spokeDialog method in the Puzzle class that you mentioned, and by putting an “action” into the dialog line in your dialog.js file (technically you can make this any property that you want, but let’s stick with “action” since it’s what I used in the sample project). Open up your dialog.js file and add an action property with whatever value you want (let’s say “explosion” for example) inside that dialog option:
{
"option":"This is my dialog option",
"response":"This is the response",
"action":"explosion"
}
Now open up Puzzle.as and add some code to the spokeDialog method:
public function spokeDialog(thisDialog:Object):void{
switch(thisDialog.action){
case "explosion":
// Put whatever code you want in here to make something explode
break;
}
}
If you wanted an explosion, I'd probably make a movie clip, put it on the stage where it will occur, and then in the top of the puzzle class (and in newBackground) make it stop on the first frame and be invisible. Then in this part of the code you could call gotoAndPlay() on it and make it visible. Generally you're better off putting anything you want to create on the background and making it invisible, rather than calling it up with code, since ALPACA is not as good with that
@Kate part 2 – is your character’s animation contained within its “default” frame? Or is the character just a movieclip with a single, looping timeline? Try making the character’s head-nodding animation into its own movieclip, then put that movieclip in the character’s movieclip on the frame with the “default” label (the same way the player character has the walking animation embedded on its “walk” frame). Otherwise the Dialog class is calling gotoAndStop on the character during dialog and that’s probably what’s causing the animation to stop.