Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - johanvepa

#201
Oh, and here's the code:


Code: AGS

function oChair_Interact()
{
if (isegoseated == false)
 {
 cEgo.Walk(147, 123, eBlock, eWalkableAreas);
 cEgo.LockView(25);  //ego not visible and not clickable
 oChair.SetView(24, 1); //ego in chair
 cEgo.Walk(137, 125, eBlock, eWalkableAreas);
 isegoseated = true;
 }
else
 {
 cEgo.UnlockView(); //ego becomes visible and clickable
 oChair.SetView(24, 0); //ego not in chair
 isegoseated = false;
 }
}


function hDontwalk_WalkOn()   //walking on the hotspot that directs him towards the point in front of the chair
{
if (isegoseated == true)
 {
 cEgo.Walk(137, 125, eNoBlock, eWalkableAreas); //since ego is standing on the hotspot he will continuously walk towards this point
 }
}



#202
Oh, I like simple. Simple is the real me.

I also worked a bit more on it:

I created another view for the character (4 loops, one for each direction, otherwise it doesn't work). This view consist of empty sprites, nothing but transparency there. Then instead of using transparency, I just lockview the character unto that "not there"-view when he is sitting in the chair. This also stops messages popping up when interacting with or looking at the invisible character (Like the "Damn I'm looking good" message). When interacting with the chair again, Ego gets up, and I unlock the view.

It's impossible to break the little holding spell on the lockviewed Ego since he is continuously walking towards the same point. The hotspot is large, too.
#203
Well, I got food and a drink for him on a plate that the waitress placed there. Got a neat little function setting the objects' transparencies, so Ego can interact with the food if transparency is 0 (food is on the table) and nothing happening if transparency is 100 (no food). I even got the view to change into an empty plate afterwards. Can't remember all the code, though.

I'll also have him talk to other people.

Anyway, I solved the walking away problem. When interacting with the chair, in addition to "setting the object's view into ego sitting down", I had ego blocking walk to a point beside the chair. Then I placed a hotspot underneath his feet and a function on the hotspot making ego repeatedly walk to that point, but only if he is invisible. It works. the moment He stands up, he becomes visible and walks freely.
#204
Yeah, I wondered if it could be done by having Ego lockview to a view where he is sitting in the chair. But I guess that still wouldn't stop him walking around. Then I would have Ego in a chair floating around the room?

Having him invisible means I can still use all characterrelated interactions, like eating food on the table, talking to the person next to him, talking to the waitress etc. I just need a function keeping him from walking away from the spot.
#205
A question from a hopeless newbie:

I want cEgo to sit down on a chair.
So I make a function when interacting with the chair resulting in Ego walking to the chair (blocking walk), then setting the chairs view to a picture having ego sitting in it.

So far, so good. The chair now looks like Ego is sitting in it.

But what about Ego himself?
Well, I try to make him invisible by setting his transparency to 100, but he can still walk around, open doors, leave the room etc.
Is there a way to make the transparent Ego rigid while he is "sitting in the chair", or am I missing something real simple here?




Example from my room script. Its working, apart from the invisible poltergeist cEgo stalking around:

Code: AGS

bool isegoseated;

function room_FirstLoad()
 {
 isegoseated = false;  //ego is not sitting down yet
 oChair.SetView(24, 0);  //empty chair
 }


function oChair_Interact()
 {
 if (isegoseated == false)
   {
   cEgo.Walk(147, 123, eBlock, eWalkableAreas);
   cEgo.Transparency = 100;  //ego poltergeist
   oChair.SetView(24, 1); //ego in chair
   isegoseated = true;
   }
 else
   {
   cEgo.Transparency = 0;
   oChair.SetView(24, 0); //ego not in chair
   isegoseated = false;
   }
 }
#206
It DOES work.

Yay!   :)

So, create an integer for MONEY, export it then import it through globalscript.ash, create an inventory item named POUCH, use the scripts to set and raise/lower money amount in specific functions and use the lookinventory command to keep track of the MONEY integer.

It's that easy   :)
#207
Thanks, Khris, for those last pointers.

I've got a bit to work on now. Can't wait to see it work   :)
#208
The above totally makes sense. Thanks, Crimson.

One more slight problem, which may or may not have to do with the scope of visibility:

For testing, I created an object called GroundMoney, ie. "money lying on the ground", and put this into the room script:

Code: ags

function oGroundmoney_Interact()
 {
 MONEY += 10;
 Display("You find 10 silver pieces on the ground.");
 UpdateInventory();
 }


but I get an error when saving, stating that theres an error in the line where MONEY is present, error message " Undefined token 'MONEY' "
Have I forgot to somehow make the MONEY integer from the global script become visible to the room script? And more importantly, how do I do that?

It worked when I used this:
Code: ags

player.InventoryQuantity[iMoney.ID] += 10;

#209
Code: ags
[quote author=Crimson Wizard link=topic=47664.msg636446583#msg636446583 date=1361387525]
No, it won't work. There is a number of mistakes there.
[/quote]

But I got the general idea, haven't I? I'd never heard of an "integer" until a couple days ago    :)

[quote]
First of all, you are using "int" keyword in a very wrong way. Khris already mentioned, that it is a variable type declaration. You should use it [u]only to declare the variable[/u], not when using it further.

Therefore command "int[MONEY]" makes no sense. You should use just "MONEY".
[/quote]

Got it. Thanks.

[quote]
The syntax "A[ B ]" is actually used when you have an array. Array is a [u]group of variables of the same type[/u] joined together for the sake of convenience.
For example:
int PEOPLE_HAVE_MONEY[10]; // declare an array of 10 variables of type integer

PEOPLE_HAVE_MONEY[0] = 50; // assign value 50 to the 0th (first) variable in the group.
[/quote]

So what this means is: you can make lots and lots of integers? And give them similar names, yes?

[quote]
variable exists only in the block where you declare it.
If you declare variable outside of all functions, it will exist until game end. If you declare it inside the function, it will exist until function exits.
[/quote]

Thank you. That's important. So I can declare a variable in the general script (which will last for the game, and which I can vary in all rooms), a variable in a room (which will last for the room only, I cannot manipulate its value in other rooms) and a variable in a function (as you said, variable ends when function ends). This opens up quite a perspective.

[quote]
int MONEY; // put this outside of any function
[/quote]

Thanks. That cleared up a relevant issue.

[quote]
Also, in your script up there, I can see that game_start function has opening bracket { but no closing bracket }.
[/quote]
Bear with me.


Conclusively, I seem to have the right idea, only need to know more exactly what words to use and more exactly where in the script to use them, right?
And integers can be set up as I like them, as many as I like them. And an integer set in the global script is always "on", no matter what room I'm in, so I can use it to for example register the completion of a certain quest in one room by altering the integer value by a function in that room, and then have someone/something in another room react to that new value of the integer, right? I think I've got a hold of some pretty decent basics, now.

Thank you again.
#210
Quote
First of all, if you want to put code in a post, you can use code tags. They will do all the coloring and stuff for you. Just click on the dropdown menu above the message area that says "Code" and select "AGS". This will insert code tags into your post at the cursor position. Now paste the code in between.

/Thank you for that  ;)

/ and thank you for answering my # 2, I see it working now.

/I think I got the hang of using the "if", the "else if" and the "else" now.

/About integers and money, and looking at the bag without there being any money "in" the bag, I think I got a little more than I bargained for. Don't get me wrong, I believe I can see the general idea in what you're telling me here, and if I may attempt at explaining it to myself in layman's terms, it goes something like: Make a variable called an "int" and name it MONEY. Now make another variable called "int" and name it AMOUNT. Then make a bool ("true or false" test) based on the int AMOUNT, so I can use the bool to test if I've got enough MONEY to perform a given action based on an AMOUNT (e.g. buying stuff).

A bit more thorough than using the code I found from earlier years, yes.
But I should be able to simplify it a bit, yes? If I stick with just one integer for money, called for example MONEY, by defining the integer in the globalscript.asc, give it a gamestart value, and then allow it to vary as the game progresses, I can use it to keep track of money.
Then I need to
1) add or subtract from the integer as my character recieves or spends money
2) compare the  value of the integer "at the given time" with the value needed to make a given transaction, and
3) I can use the "%d" in a LOOK function in the inventory to call forth the "at the given time" value of the integer.

It would go something like this in the globalscript.asc:

Code: ags


function game_start() {
int MONEY = 50   //gives cEgo 50 MONEY at game start. He may choose to keep track of this integer through looking at his pouch.

//So, instead of using the integer embedded in the inventory thingamagig, I can create another integer to do the same as a "player.InventoryQuantity" can do, and this integer has no connection to the pouch except for the fact that I can keep track of the MONEY integer by coding a function that links the integer to using or looking at the pouch.

function iPOUCH_look   //assuming I have an inventory item called iPOUCH that cEgo begins the game with.
  {
  Display("You have %d silver coins!",int[MONEY]);
  }


//Now, in a given room where I might find money, I can do this:
function DeadCorpse_Interact
   int[MONEY] += 7;
   Display("You find 7 silver pieces on the corpse")


//And in the dialog tree which I use to initiate the bargain (Ego has already walked up and chosen topic "Buy 10 apples", I would have this:

 if (int[MONEY] > 0)     //We can spend one coin
   {   
   int[MONEY] -= 1;
   Display ("You buy ten apples for a silver piece");
   player.InventoryQuantity[iApples.ID] += 10;
   UpdateInventory();
   }
 else    //We cannot spend a single coin
   {
   Display ("You don't have any money!");
   }
 


WOULD THIS WORK?
#211
Well, now I know what "Indenting the code" means.

Thanks a lot, there's something to work on here. Been sitting up for way too long, coding the shop function at Hilde's groceries, and I am proud to report that it works!. I even typed in a few messages about how much you're carrying around if you buy this or that amount of a given thing. It's tough work typing all the code, but it is so rewarding to see things work    :)

I'm not done yet, though. I still haven't figured out what all the "bool" stuff is about (but I'm learning as I go). And why do you call it "moniez"? Any special reason?
#212
Site & Forum Reports / But report in AGS
Tue 19/02/2013 21:04:47
Not sure this is the relevant forum, couldn't find any on bug reports, I just got this message when shutting down my most recent exe of the game I'm working on, here goes (couldn't replicate the error):



Error: Object reference not set to an instance of an object.
Version: AGS 3.2.1.111

System.NullReferenceException: Object reference not set to an instance of an object.
   at AGS.Editor.ScintillaWrapper.scintillaControl1_MarginClick(Object sender, MarginClickEventArgs e)
   at Scintilla.ScintillaControl.DispatchScintillaEvent(SCNotification notification)
   at Scintilla.ScintillaControl.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
#213
I have made an attempt at using money in a game, and have gotten quite far, I think. However, I stumble upon a couple of hurdles now. I hope someone out there will answer me these two simple questions.


First, bear with me for not being a tech. I have attempted to read the manual, but I must admit, the wiki on using money in the game was just about useless to me, being a newbie. I was looking for a quick "how-to" way. All this talk of strings, variables, ints and all that jazz just gets me confused. I need to see things working by example before I can wrap my mind around the theory (what on earth is an int, unless you've seen what it looks like in the script?). Happily, there have been many posts on this topic.

Thanks to TerranRich for a post from 2004 informing me of how to setup the inventory so I can count my money by looking at them in the inventory screen. And to Jordan, also from 2004, for telling me to use the global script to fix the amount of money from the beginning of the game. And to someone I don't remember for showing me a working way of deducting and adding amounts of ANY sort of inventory, without (very) complicated codings in the global script.

Anyway, I made an inventory item called iMoney, imported a sprite with a picture resembling gold coins, made another inventory item called iApples, imported a sprite for that, too, and ended up with this in my global script:


// In the global script, somewhere under
function game_start() {   
// I put this:
  player.InventoryQuantity[iMoney.ID] = 30;

// and somewhere further down I put this:
function iMoney_Look()
{
Display("You have %d golden coins!",player.InventoryQuantity[3]);
}
//since my gold coins is inventory item no. 3.

// For buying apples at the farmer's daughter (the character Hilde), I scripted this:
function cHilde_UseInv()
{
if (cEgo.ActiveInventory == inventory[3]) {  //here I use the inventory item iMoney on Hilde
if (player.InventoryQuantity[iMoney.ID] > 0) {  //and only if there's still at least one left
cEgo.Walk(265, 175, eBlock);   // Character walks up to the stand
Display ("You buy ten apples for a silver piece");
player.InventoryQuantity[iMoney.ID] -= 1;   //paying the cost
player.InventoryQuantity[iApples.ID] +=10;   //and receiving said and paid apples
UpdateInventory();  //dunno what this does, but I dare not leave it out.
}
else Display ("You don't have any money!");
}
}

// And for keeping track of same apples (inventory item 2), I have:
function iApples_Look()
{
Display("You have %d small apples from last Fall's harvest",player.InventoryQuantity[2]);
}



IT WORKS! What a feeling. This has taken me hours to set up right. Now I can do this with more shops    :)


For my question # 1:
Now, I would like very much to have my moneybag present in my inventory, even when the count is 0! At present, the iMoney sprite disappears from my inventory when it reaches 0, until I find some more. Can I have it just sit there being empty, telling me that I have 0 coins, when I look at it?


Question # 2:
Second, I would like to be able to put this script in with a dialog, so I can buy apples by choosing that topic in a dialog, with the obvious bonus of being able to choose from different wares from the same seller. I figured something like this might do it (assuming I initiate the dialog by for example clicking the iMoney inventory item on the seller):

// Dialog script file
@S  // Dialog startup entry point
narrator: Would you like to buy something?
return
@1   //choose topic: apples
{
if (player.InventoryQuantity[iMoney.ID] > 0) {
Display ("You buy ten apples for a silver piece");
player.InventoryQuantity[iMoney.ID] -= 1;
player.InventoryQuantity[iApples.ID] +=10;
UpdateInventory();
}
else Display ("You don't have any money!");
}
return
@2   //choose topic: nothing
narrator: You decide to buy nothing after all.
stop

But something is horribly wrong here. It seems I can't just adopt the same approach when it comes to dialogues. Am I totally on the wrong track here, or am I missing some small but vital detail?




#214
Thank you, that's just what I was looking for.

Damn, there's such a lot to LEARN with all the things you'd like to have the character do. Until now, I've only just found out about objects, characters and dialogs. It's a real gem to have that "blank" game in there to begin with, otherwise I'd never get anything done.

Onwards to inventory management   :)

Oh, one more thing: For some reason, the text in my topics choosing window is red. I would like it to be just black.

And how do I add my own font? EDIT: Found out about the font   :)
#215
Havin trod my first steps into this brave new world of custom adventures, I have made a couple of dialogues, and am not so happy with the result. They are presented by red text on a black background, and with just a few topics to choose from, the dialog window fills out the whole screen.

How do I make dialogues sierra-style with the dialog options in a window in the middle of the screen?
#216
Just wanted to check in on this, being a fanboy myself. I made a horribly embarrassing first post about how much I love QfG I, and now I'm trying to recreate a few of the screens from the old game (the only real QfG I game) as an exercise. Harder than you'd think, this game making. Best of luck to you.
#217
I've been a fan since the very first time I landed in Spielburg. Granted, the fourth of the series was unearthly great, but the first one always had a special place in my heart. The openness of the game (all the little silly things you could do that wasn't really necessary), the innocent way of going on adventure for the fun of it (hello there, I'm trying to be a hero), and the sad story of the land falling to pieces with the local lords' grief.

And as I explored all the ins and outs of the game, and finally after years and years of casual replaying every once in a while, finding out where those last puzzle points were hidden, I also had an itch to do stuff that was sort of hinted at in the game but not really there. I guess we can all remember the log in the woods, yes?

So what's on your "would have liked to do"-list for this game?


Here's mine. I would have liked:

* To open the workshop door and find someone working there, perhaps a dwarf hammering at something

* To burglar the workshop at night

* To visit the rest of the shops

* To search the big log in the forest and find something there (actually, I remember having a dream about this once)

* To give the little old lady a kiss on the cheek

* to fight Otto

* To come back to the kobold's cave for the showdown

* To have the brigands inside the fortress courtyard fire arrows like they do in the hidden valley

* To grab a skull off Baba Yaga's fence

* To best the Sword Master. No wait, I did that already. Beat the antwerp, then. No, by golly, I did that too   :)

* To swim in the Spiegelsee

* To actually play a game of cribbage with Henry, not just being told about having played

* To nick something from Erasmus' livingroom

* To buy the shield in the dry goods store. Oh my how I've wanted that shield.

* To get a sword for the thief (I know, you can tweak the character generation to give a fighter the thief skills, but he can't enter the thieves' guild)

* To search the brigand leaders room just a little more.

* To strip the dead goblin of equipment. I want that mace

* To enter the goblin cave and go berserk

* To enter the meep tunnels (fortunately, you can do that in QfG 4½)

* To have a romance with the dryad

* To feed the vegetables to the horse


Whev, that was quite a bit. And that was just in a few minutes' brainstorming.
#218
In the undying words of Dr. Fred:

"It works, I can't believe it!"

Right now trying out a few things, like mapping out a walkable area. Ripped a background from an old favorite and playing around a bit.

I am overjoyed with this   :)
#219
I am pretty sure it's 32 bit windows. To my knowledge, I've never had a 64 bit PC.

I also think the compact version does not work with a desktop PC. I did a search of the microsoft homepage but couldn't find any 2.0 downloads but the compact.

Anyway, I've removed all of the .NET framwork 4.0 from my PC, it slowed everything down dreadfully. And I succeeded in finding an installation of .NET framework 2.0 runtime on filehippo. I am going to try and run it now, wish me luck!

#220
Hmm, that seems to be a service pack for the framework, not the framework itself. Thanks, though.

I may have found the framework by searching microsofts homepage, but I am now not sure whether I should download the .net framework 2.0 Redistributale package (x64) or the .net framework 2.0 software development kit (x86).

I tried the redistributale package, but got the following error message: error creating process c:/docume.../something/something/install.exe. reason: c:/windows/system32/advpack.dll

Huh?
SMF spam blocked by CleanTalk