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

Topics - johanvepa

#21
I want my mousemode "look" cursor to be a pair of glasses rather than the traditional eye. No problem. Now i'd like these glasses to have the effect of being semi-transparent, so the spectacle frame is solid while the glass pieces are semi-transparent. Somewhat like the effect of a semi-transparent GUI hovering over part of the screen.

Is this possible?

Perhaps something like a GUI placed wherever the mouse cursor is at a given time, done with rep_exec, but I dont know if this is the most practical solution.

Or perhaps the mouse cursor sprite can be made with a dynamic sprite?

What would you propose as the most feasible solution?
#22
Still toying with the player walking across the large map.

But I find the scrolling feature is a bit hard on the eyes. Are there alternatives? Like instead of scrolling, the screens viewport centering on player character whenever player character walks far enoug away from the last place it centered on.

If any of you remember these games, I liked the way this worked in Dark Sun, but Ultima VII was too stringent in having the camera follow the character excatly.

Is there perhaps a mod for this?

I could probably write some function on my own, but I would still need to turn of the default scrolling. Is this possible?


#23
I'm toying with importing a really large background, its a map that the player character can then walk around on. Scrolling happens.

I'd like game's resolution at 640x400.

Map is 1600x1200.

For starters, I just use the games normal game template.

Here comes what I dont understand: when running the compiled game, map is shown at 640x400 resolution (as far a my eye can see), but player character is shown at 320x200.

I would have expected player character to become smaller, half the height and half the width. Why doesn't that happen? Now I have a 320x200 pixel person walking around on a 640x400 pixel background.
Oh, ans the GUI's too, the actual GUI on top of the screen has become smaller but the pictures on said GUI are still looking like size 320x200.

I don't get it?

#24
Well shoot, I imported a font and now the text on all labels and all buttons are off by half an inch.

Might be because the font is imported at size 16, and the actual letters in the font are only something like 8 pixels high, so the top 8 pixels of each letter are invisible. And so, when putting words on a label thats 12 pixels high, theres not enough room on the label to show the letters. But if I import the font at anything less than size 16, then the letters of the font get downsized.

How to get a size 16 font with letters 8 pixels tall to fit into a label 10 pixels tall?
#25
I'm toying with the idea of adding a feature to my pet project.

It's Sierra-style, but instead of the usual walk-look-use-talk icons rotating by right click, I'd like to make the cursor change into the appropriate mouse.Mode when the mouse is moved onto a select hotspot.

This is very easy using the "Mouse moves over hotspot" event for a hotspot. Then, using the "Any click on hotspot" event, I can execute a command that's appropriate for the particular hotspot.

However, this only works one way. The mouse moves over the hotspot and the cursor changes. I'd like the cursor to change back to default once the mouse moves away from the hotspot again.

I have the feeling this might be accomplished easily using and "if" in repeatedly_execute and mouse.UseDefaultGraphic, but I need to tell the script what event to look for, i.e. something like this in the main script:

Code: ags

function repeatedly_execute()
{
    if (OnTheEventOfTheMouseLeavingAHotspot)
  {
  mouse.UseDefaultGraphic;
  }
}


Now, typing OnTheEventOfTheMouseLeavingAHotspot is rather silly of course, but what should I type in its stead?

#26
Is there a function in AGS to print the current game screen?
I'm toying with the idea of typing in some data in a parser, process the data and pop them into a certain visual presentation, whichcan then be printed. I think I can manage the rest, but before I spend the time on it I need to know if it's feasible to print the end product from the game screen.
If so, perhaps it is even possible to print directly into a pdf file? (Otherwise I'll simply use pdfcreator, just wondering if it might be integrated in AGS already)
#27
Where, exactly, are player.x and player.y, relative to what I can see of the character sprite on the screen?

EDIT: Alternatively, where are player.x and player.y relative to the edge of the actual sprite, even if part of the sprite is not visible?

#28
Is there a way to make a character walk backwards? That is, keep his current view, but reverse his direction and animation.
#29
This thread:
http://www.adventuregamestudio.co.uk/forums/index.php?topic=42816.msg568540#msg568540
gave me inspiration for a set of equipable items, though I had to make do with a simpler solution.
It works, but with performance issues.

This i what I do:

Besides the main character cEgo, I have three characters, cWeapon, cArmor and cShield, whose sprites are as their names imply. They follow cEgo around, thus creating the illusion of cEgo being clothed in certain equipment.

When interacting with an object, oCombat, in my testing room (room 5), cEgo is set to view 2 (combat view), and the three equipment characters are set to follow cEgo, like this:
Code: ags


function oCombat_Interact()
{
if (eKeyboardMovement_Tapping == true)  //not in combat mode, the following vode sets combat mode
  {
  KeyboardMovement.SetMode(eKeyboardMovement_Pressing);
  cEgo.ChangeView(2); //combat view

  cWeapon.ChangeRoom(5, 100, 100);
  cShield.ChangeRoom(5, 100, 100);
  cArmor.ChangeRoom(5, 100, 100);

  cShield.FollowCharacter(cEgo, FOLLOW_EXACTLY, 1); //drawn behind cEgo
  cArmor.FollowCharacter(cEgo, FOLLOW_EXACTLY, 0); //drawn in front of cEgo
  cWeapon.FollowCharacter(cArmor, FOLLOW_EXACTLY, 0); //drawn in front of cArmor
  
  cShield.ChangeView(9); //cape wrapped around arm
  //two other characters still in their "invisible mode", view 10, which is a sprite of blank space

  cWeapon.Loop=0;
  cShield.Loop=0;
  cArmor.Loop=0;
  }
  
else //if already in combat mode, reset to normal
  {
  KeyboardMovement.SetMode(eKeyboardMovement_Tapping);
  cEgo.ChangeView(1); //normal view
  
  cWeapon.ChangeView(10);
  cWeapon.FollowCharacter(null);
  cWeapon.ChangeRoom(3, 100, 100); //somewhere else
  
  cArmor.ChangeView(10);
  cArmor.FollowCharacter(null);
  cArmor.ChangeRoom(3, 100, 100);
  
  cShield.ChangeView(10);
  cShield.FollowCharacter(null);
  cShield.ChangeRoom(3, 100, 100);
    
  }
}



In my room 5, I also have a multitude of objects that when interacted with sets the view of each of the characters cWeapon, cArmor and cShield. Thus, for example the player can clothe himself in chain mail (cArmor is set to view 9, chainmail, by interacting with a certain object in my test room). cWeapon may switch view to dagger, to short sword, to long sword, in the same way.

In room's rep_exec function I have:

Code: ags

function room_RepExec()
{
  
if (cEgo.View == 2) //cEgo is in combat view
  {
  cWeapon.Frame=cEgo.Frame;
  cShield.Frame=cEgo.Frame;
  cArmor.Frame=cEgo.Frame;
  }

  


Now, I can get this to work, the cEgo looks clothed in the armor of choice and with weapon at hand.

However, there are performance issues: The armor and shield blinks, not much, but just enough for the original character image to occasionally show underneath the armor and for the shield to look like its not really there.

Can I alter my code in a way that solves this blinking issue?


EDIT 1: Changed the "walking order" of characters so the weapon is drawn in front, then the armor, then cEgo, then shield or cape.


EDIT 2: Tried out swapping the followcharacter command with
Code: ags

cWeapon.x=player.x;
cWeapon.y=player.y;

and so forth. No difference.

Also noticed that the sprites of the weapons and armor characters seem to be visible on the screen slightly after the player character sprite has updated. To elaborate: When player character is walking to the right side of the screen, the armor characeter sprite is blinking and seen slightly to the left of the character. When the player character is walking left, the armor character sprite is blinking slightly to the right of the player.


EDIT 3: I suspected there might be differences between running local rooms's scripting and globalscript. I've relocated the abovementioned code to repeatedly_execute in globalscript.asc instead of having it in room_RepExec. No difference. It seems the sprites of the player character and the sprites of the following character are not updated at the same instant.
#30
Is there a way to call a function by pressing ctrl-arrowkey? or shift-arrowkey?

I've toyed with using on_key_press in rep_exec, but on_key_press seems to be tied to certain predefined ctrl-keys, like ctrl-A, not ctrl-[anything].

EDIT: I'd better explain what I' trying to do. Character is walking in key pressing mode, instead of the default tapping mode. I want an animation to figure when character is walking and a key is pressed. Also, the animation must be defined by the direction character is walking. I guess the simplest way is to use pressing mode for walking and then tapping or holding a key like shift or ctrl. I guess a function in rep_exec can do that, but how to code what key pressings call the function?
#31
Please share with me if you have used AGS for something fun, practical, work-related or otherwise out of the ordinary game making experience.

These past months I've taken a nostalgic liking to ye olde Fighting Fantasy books. Since many of them are completely impossible to play through, unless we're talking "possible" in a purely statistical sense, I took to typing a game maker in AGS that allows me to play and replay the books with AGS managing all the dice rolls and combats and inventory gathering of particular books (some of them took literally hundreds and hundreds of playthroughs without cheating).

Anyway, AGS has inspired me to use its code for other means, and I was wondering if any of you have funny stories to tell of what you've used it for.

#32
Could someone point me in the right direction here?

In one room I'm doing a blocking animation every 2000 cycles.

I've found out that if I open the inventory window, the buttons of inventory will grey out (rendering it impossible to leave inventory) when the animation starts. And since the animation is followed by a DisplayMessage(0), and I can't click away the message when in the onventory window, the game halts.

I tried going to the
function show_inventory_window ()
and putting in PauseGame(); there. I thought this would mean everything stops and waits for the game to unpause, but it didn't.

Another matter that confuses me is, I have an animation running in the background consisting of small drops of rain travelling across the screen.
I use oRain.Y++; in room_repexec for this feature.
Now, the rain keeps falling in the background, even though I have the inventory window opened, and even though the game is paused when in inventory.

I don't understand, I thougt PauseGame(); would stop any effects going on in the room's repexec?



#33
There must be a simple and straightforward solution for this one. Only I can't really see it. Not with my limited experience.


I'd like Ego to walk through grass, with his feet "sinking into" (somewhat hidden) by the grass. Of course, I can create objects resembling tufts of grass in neat little rows, then place a lot of them in the room with their baselines set, but it still takes a lot and lot of objects and baselines to create a good effect.

Is there a simpler way?
#34
Can I tell AGS to use the function char.setgraphic(view, loop, frame) and collect the values from a global integer?

Ego is doing an animation, and for reasons too long to explain for the purpose here, I'd like this animation done with char.LockViewFrame and an integer counting down to 0 in rep_exec (every time timer is 0, set next graphic and reset timer).

I have integers corresponding to the values of which loop and frame ags must use. My integer "characterloop" will - due to other functions in the script which I will omit here - be set to the value 2 at the same time that char.LockViewFrame must use loop 2 of the current view. When my integer "characterframe" has the value 4, char.LockViewFrame must use frame 4 of the current loop of the current view.

As you can see, this gets rather long-winded (in room's rep_exec, with a default character view of lets say view no. 32):

Code: ags

if (timer > 0)
  (
  timer -= 1;
  )
else
  (
  if (characterloop == 1)
    (
    if (characterframe == 1)
      (
      ego.LockViewFrame (32, 1, 1);
      )
    else if (characterframe == 2)
      (
      ego.LockViewFrame (32, 1, 2);
      )
    else if (characterframe == 3)
      (
      ego.LockViewFrame (32, 1, 3);
      )
    )

  else if (characterloop == 2)
    (
    if (characterframe == 1)
      (
      ego.LockViewFrame (32, 2, 1);
      )
    else if (characterframe == 2)
      (
      ego.LockViewFrame (32, 2, 2);
      )
    else if (characterframe == 3)
      (
      ego.LockViewFrame (32, 2, 3);
      )
    )
  timer = 10;
  )




What I would like is to have the function char.LockViewFrame look for its values in the integers, leaving me to code something like:


Code: ags

if (timer > 0)
  (
  timer -= 1;
  )
else
  (
  ego.LockViewFrame (32, characterloop, characterframe);
  timer = 10;
  )



Can this be done?

#35
When using CallRoomScript to set a bool for use of a given function, the sequence seems to mess up.

In my global script, I have a button which activates a function leading to a chain of ifs and elses with according events.

In that function, I would like to use a callroomscript to set a bool for the success or failure of a given task, determined by a set of conditions in the room script of each room.

So, in the top of the function, I call roomscript no. 1. In the local script, on_call 1 sets the bool that determines wether the action carried out later in the function is succesful. A little further down in the function, the task is carried out, with success determined by the now-set bool.

But, something's awry. Upon testing many times, I have discovered that the callroomscript is for some reason always carried out AFTER the rest of the contents of the function. even though I put the callroomscrpit at the top, the functions FIRST carries out the other events, THEN calls the roomscript. This means the bool is not set before the event is carried out. it is set after the event is carried out (meaning if I do the action twice, the bool return from the first go-around determines the succes/failure of the next attempt).

Anyone see what I'm getting at?
#36
I am in a bit of a fix here.

This shouldn't be a technical problem at all, more of a simple coding error, I just can't seem to put my finger on where the error is.

Would like to hear from anyone who's had similar problems.

In one room, there's an Inn that cEgo can visit by opening the door. He can look at the door, interact with it, and use his inventory on it.

The following code
Code: AGS

function inndoor_UseInv()
{
if (cEgo.ActiveInventory == inventory[19]) //which is a dagger
  {
  Display("You stick a dagger into the doorpost as an ominous warning.");
  }
// lots of other stuff...
}

...works just fine. Message is displayed as it should, in the room with the inn.

Now, I go into another room. Here, the Sheriff's house lies, with promises of jailbreaks and escapes across the rooftops. This door, I can look at and interact with, too.

But this code:
Code: AGS

function oSheriffdoor_UseInv()
{
if (cEgo.ActiveInventory == inventory[19])
  {
  Display("You stick a dagger into the doorpost as an ominous warning.");
  }
// and so on and so forth
}

...does absolutely nothing. I can look at this door too, I can interact with it, but when it comes to using inventory on it, nothing happens. Not even an error message. Nothing.

Both of the objects inndoor and oSheriffdoor are baselineoverridden (baseline 1).

I'm severely puzzled.
#37
How come inventory items still appear as a cursor and in the active inventory item window, even if the quantity of said item is 0 and I've used UpdateInventory()?

Like, cEgo picks up a bunch of carrots. so inventoryquantity is 5. He then eats 4. no problem, theres one left, its still visible in inventory and in acitive inventory. then he eats one more, and the item disappears from the inventory. but it's still there as a cursor item! and if I try to "eat" the zero quantity carrot, then the game crashes. I can work around it by using a display related to there being 0 carrots, but it's unwieldy and buggy.

what can I do?
#38
I would like to have an integer with a value of 0.0025 (zero point zero zero two five).

I declare the integer VARIABLE in the global script, and I only need it in the global script.

Near the top of globalscript.asc, i Have this:
Code: AGS

int VARIABLE;


At game_start, I set the integer value like this
Code: AGS

function game_start()
{   
VARIABLE = 0.0025;

//lots of other stuff and integer values declared

}


I get this error message: Error (line 1140): Type mismatch: cannot convert 'float' to 'int'.

What am I trying to do here that causes error?

The int VARIABLE is not going to change at all, it will stay at this value the entire game, but I need to call it numerous times, and if I want to change the value for testing purposes, it is nice to have it declared as an integer.

Can I declare it as (1 / 400) instead?

I found that I can use (1 / 400) at places in the code where the variable should have been, but I'm not sure I get the same result that way.


#39
I recently got an answer to this topic:

Character status screen

Well, things are going great, but I am reaching a dead end when trying to simplify some functions.

I made an experience system where, whenever you use a skill, you gain one exp. point in that particular skill. Whenever you do gain a point in a skill, it then checks with a random to see if that point gets you a raise in the skill you just used. Some skill stats are harder to raise from experience; whenever a skill is used, gain one exp., then do a check to see if three points are available.  if three points are available, do a random check to see if spending those exp points raises the stat in that skill. if three points are not available, wait until more exp points are gained in the skill.

This repeats every time the skill is used, and eventually, the skill raises. The higher the skill, though, the lower the probability that the skill is raised.


So far so good, I can get that to work.


But, then I try to make a function that collects all possible skills into one function, so I save space and avoid typing in skill raising functions for every possible skill.

In short, I do something like this:

In the global script:
Code: AGS


//skill with a certain spell, skills go from 0 to 100.
int spellBAKECAKE;
export spellBAKECAKE;

int expBAKECAKE; //experience with the same spell
export expBAKECAKE;


//here we insert the characteristics of the spell BAKECAKE into a function and add toughness for how much exp it takes to attempt to raise the stat:

function adjustskillforexp(int Characteristic, int expCharacteristic, int toughness)
{
while (expCharacteristic >= toughness)  //the higher the toughness, the more exp needed to do that random check and see if skill is raised.
  {
  expCharacteristic -= toughness; //when doing the random check, the exp is lost, regardless of the result
  if (Random(100) > Characteristic)
    {
    Characteristic += 1;  //in this case, skill raised
    }
  }
}

function adjustallskillsforexp()
{
adjustskillforexp(STRENGTH, expSTR, 2); //so STRENGTH is attempted raised whenever two exp. points in that skill are gained.
adjustskillforexp(ALERTNESS, expALE, 2);

adjustskillforexp(spellBAKECAKE, expBAKECAKE, 1); //and our spell BAKECAKE is attempted raised whenever one exp point in that skill is gained.
}




What I want to do with this is; whenever exp is gained, do the adjustallskillsforexp(), that way experience is always channeled into stats raising.


This worked until I made the two abovementioned functions. But it should work. Ought to. Really.

Can anyone see the fault?


#40
I think I got the hang of global integers now, but I need to confer upon the player the means of keeping track of certain essential values. I need a status screen, in other words, and I think I should do it as a GUI.
(not that it has to be a GUI, but I believe thats the best way to go?)

I would like to have some global variables shown in a simple manner. Nothing fancy, just like for example:

Attributes:
Strength 12
Dexterity 18
Wits 8

Status:
Health 2 / 15
Magical energy 30 / 65

Basic needs:
You are hungry
You are sleep-deprived

And perhaps a picture or two to top things off. I want to simply allow the player to push a button, which displays this GUI (and pauses the game). On clicking the GUI the game unpauses and the GUI becomes invisible again. I've tried using the standard buttons to come up with something but it seems to be harder than it, well, harder than it seems.

This should be such a simple task, yes? But I can't see the forest for the woods.
SMF spam blocked by CleanTalk