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 - daniel

#1
Hey guys,

I'm freaking out a little right now because I just noticed one of the rooms in my game won't load anymore.
It throws an unhandled error in 4.3.2.1 (as well as 4.3.3)...and completely crashes 4.5.0 alpha 10.

This is the error I'm getting:

Quote
Error: LoadRoom: unexpected end of block 6 in in 'room3.crm'
Version: AGS 3.4.2.1

AGS.Types.AGSEditorException: LoadRoom: unexpected end of block 6 in in 'room3.crm'
   at ThrowManagedException(SByte* message)
   at load_room_file(SByte* )
   at load_crm_file(UnloadedRoom roomToLoad)
   at AGS.Editor.Components.RoomsComponent.LoadNewRoomIntoMemory(UnloadedRoom newRoom, CompileMessages errors)
   at AGS.Editor.Components.RoomsComponent.LoadDifferentRoom(UnloadedRoom newRoom)
   at AGS.Editor.Components.RoomsComponent.LoadRoom(String controlID)
   at AGS.Editor.Components.RoomsComponent.ItemCommandClick(String controlID)
   at AGS.Editor.Components.BaseComponentWithFolders`2.CommandClick(String controlID)
   at AGS.Editor.ProjectTree.ProcessClickOnNode(String nodeID, MouseButtons button)
   at AGS.Editor.ProjectTree.projectTree_NodeMouseDoubleClick(Object sender, TreeNodeMouseClickEventArgs e)
   at System.Windows.Forms.TreeView.OnNodeMouseDoubleClick(TreeNodeMouseClickEventArgs e)
   at System.Windows.Forms.TreeView.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)


I really hope somebody can help me figure this out...all the other rooms are loading fine.

cheers
#2
Hey guys,

I have these tweening objects moving and resetting at their final position.
However, when the room first loads I would like them to be at somewhat random positions and I need some way to calculate the required tween-time according to the objects actual start position.
Otherwise, if the object starts close to the end point it would be moving way too slow...

Code: ags
#define Cloud1Speed 50.0
#define CloudsEndPosition 185

void InitClouds()
{
  oBeachCloud1.SetPosition ((Random(20)+120), (Random(20)+20));
  oBeachCloud1.TweenX(Cloud1Speed, CloudsEndPosition, eEaseLinearTween, eNoBlockTween);
}

function room_Load()
{
  InitClouds();
}


The standard distance for the tween is -(Game.SpriteWidth[oBeachCloud1.Graphic]) to "CloudsEndPosition". The correct tween-time for the object starting at -(Game.SpriteWidth[oBeachCloud1.Graphic]) is "Cloud1Speed".
So basically what I need is to get a percentage of how far along X the object starts within the tween-space, so I can use that to calculate the adjusted tween-time, right?

Can anybody tell me how to do this in AGS?

cheers
#3
EDIT 3:
Just in case somebody comes here looking for a solution, here's the code I'm using now which seem to work nicely:

Code: ags
#define Cloud01MoveSpeed 2.0
#define Cloud01FadeSpeed (Cloud01MoveSpeed/2.0)
#define CloudStartPosition (Random(40)+70), (Random(40) +90)
#define CloudEndPosition Random(20) + 190

void MoveFrontCloud01()
{
  oCloud01.StopAllTweens();
  
  oCloud01.Transparency=100;
  oCloud01.SetPosition(CloudStartPosition);
  oCloud01.TweenX(Cloud01MoveSpeed, CloudEndPosition, eEaseLinearTween, eNoBlockTween);
  oCloud01.TweenTransparency(Cloud01FadeSpeed, 0, eEaseInOutSineTween, eReverseRepeatTween);
}

function room_Load()
{
  MoveFrontCloud01();
}

function room_RepExec()
{
  if ((oCloud01.Transparency==100)&&(oCloud01.X>189)){
    MoveFrontCloud01();
  }
}


EDIT 2:
Well ok, it kinda works but it's a bit glitchy. If anybody has an idea how to solve this in a better way I'd really appreciate it.

EDIT:
Sorry, I think I just figured it out. I moved the transparency tween into the room_Load() function instead and that seems to do the trick.

Hey guys,

so I've got those clouds that move along X, and at the same time tween from 100 transparency to 0 and then back to 100, before being reset and doing it all over again.
I've basically got it working but for some reason it only works -exactly- 3 times and then the transparency tween seems to go crazy, flickering seemingly randomly.(?)
Does anybody have an idea what's going on?

Here's my code:
Code: ags
void MoveFrontCloud()
{
  oCloud01.SetPosition((Random(20)+100), (Random(20) +80));
  oCloud01.Transparency=100;
  oCloud01.TweenTransparency(1.5, 0, eEaseInOutSineTween, eReverseRepeatTween);
  oCloud01.TweenX(3.0, (Random(20) + 190), eEaseLinearTween, eNoBlockTween);
}

function room_Load()
{
  MoveFrontCloud();
}

function room_RepExec()
{
  if ((oCloud01.X>=190)&&(oCloud01.Transparency==100)){
    MoveFrontCloud();
  }
}


cheers!
#4
Hey guys,

I have this overview map with 3 hotspots that are connected by a path that "snakes" up a mountain.
The pathfinding doesn't seem to like the corners.
I've made a little diagram:



When at either Hotspot 1 or 2, the character will not go to Hotspot 3 directly.
Only once the character is at the corner marked green does he find his way up.

I already tried thickening the walkable areas but that didn't help.

What's the simplest way to get something like this to work? Is there some way to make pathfinding more effective?

cheers
#5
hey guys,

sorry if this is not the right place...i wasn't sure where to post this.

to reproduce this bug:

- on windows 10 open AGS on a laptop (i'm using the surface pro 4) with a touchpad and then open any script
- move the mouse cursor over the open script windows using a touchpad

result:

- while moving, the mouse cursor keeps changing back and forth from the "edit text" icon to an arrow icon really quickly
- as a result of this the mouse cursor lags heavily

any idea how i can avoid this?

cheers
daniel
#6
hey guys,

another day another question:P

i'm creating audio for a character who's animating in the background.
what i want is to play one of a couple of random sounds at certain frames in the characters view.
this is what i have:

Code: ags
void PlayMomSounds(){

  int RandomHackSound=Random(2);
    
  ViewFrame* MomHackFrame1 = Game.GetViewFrame(26, 0, 2);
  ViewFrame* MomHackFrame2 = Game.GetViewFrame(26, 0, 6);
  ViewFrame* MomHackFrame3 = Game.GetViewFrame(26, 0, 10);
  
  if (RandomHackSound==0){
    MomHackFrame1.LinkedAudio = aKnifeHack1;
    MomHackFrame2.LinkedAudio = aKnifeHack1;
    MomHackFrame3.LinkedAudio = aKnifeHack1;
  }
  else if (RandomHackSound==1){
    MomHackFrame1.LinkedAudio = aKnifeHack2;
    MomHackFrame2.LinkedAudio = aKnifeHack2;
    MomHackFrame3.LinkedAudio = aKnifeHack2;
  }
  else if (RandomHackSound==2){
    MomHackFrame1.LinkedAudio = aKnifeHack3;
    MomHackFrame2.LinkedAudio = aKnifeHack3;
    MomHackFrame3.LinkedAudio = aKnifeHack3;
  }
}


this actually works nicely but:

a) is there a smarter way to assign multiple frames to the same group of random sounds? (i.e. if i have a really long animation with 30 frames that all use the same random sounds i would end up with a huge big block of code and lots of copy/paste...)
b) i can't set the ViewFrame.LinkedAudio to an Audiochannel*...how can i control panning, volume, position, etc. of the random sounds?

cheers
#7
hey guys,

i have a scrolling background with a doorway and i want it to scroll over all the way only when the character walks into/through the doorway.
right now i'm using this:

Code: ags

function room_RepExec()
{
  //Viewport Scroll
  if (player.x > 300) {
    while (ViewportX < 250) {
    ViewportX = (ViewportX) +5;
    SetViewport(ViewportX, 0);
    Wait (1);
    }
  }
  else {
    while (ViewportX > 10) {
    ViewportX = (ViewportX) -5;
    SetViewport(ViewportX, 0);
    Wait (1);
    }
  }


this works totally fine actually but yesterday i discovered the magic that is the tween module and thought some easeInOut is exactly what that scrolling needs.
once i put in the tween though i get the "more than 64 tweens" error and the game crashes. which made me realize that this is probably a bad way to check if the scroll should be executed at all.

setting the check to a specific coordinate like
Code: ags
if (player.x == 300)
doesn't work since that only seems to click if the character stops at exactly 300 X. also if the player would leave the character standing on that coordinate a while the game would crash again i suppose.
is there a way to check if the character started at a certain point < 300 and then stopped at a point > 300 so that the code only gets executed once when needed?
or is there some other smart way of doing this?

thanks!
#8
hi,

i'm trying to animate my 2-part logo on the title screen.

what i'd like to do is:
1. fade in the BG from black. (i'm using a black object and fade it to 100% transparency because i couldn't get the FadeIn and FadeOut to work without the BG flashing on the screen for a second at the start)
2. fade in the main logo
3. once the main logo is at 50% transparency start fading in the second part of the logo while it's moving down into position along Y

when i put this code into function room_RepExec() it just executes one command after the another:

Code: ags
int BlackoutTrans = oBlackout.Transparency;
int LogoTrans = oLogo.Transparency;
int LogoExtraTrans = oLogoExtra.Transparency;

  while (BlackoutTrans < 100){
    BlackoutTrans++;
    oBlackout.Transparency = BlackoutTrans;
    Wait(1);
  }
    
  while ((BlackoutTrans == 100)&&(LogoTrans > 0)){
    LogoTrans--;
    oLogo.Transparency = LogoTrans;
    Wait(1);
  }
  
  while ((LogoTrans < 50)&&(LogoExtraTrans > 0)){
    LogoExtraTrans--;
    oLogoExtra.Transparency = LogoExtraTrans;
    Wait(1);
  }
  
  while ((LogoTrans < 50)&&(oLogoExtra.Y < 30)){
    oLogoExtra.Y++;
    Wait(1);
  }


how can i execute all of these at the same time without them blocking each other?
when i use "if" instead of "when" the script stops after the blackout is at 100% transparency.
so, once again my noob skills have failed me...

cheers
#9
hi,

i'd like to build a custom function to quickly call default interaction animations for my character.
my character has views for interacting "high", "middle" and "low" (i.e. vCharInteractHigh etc.) with corresponding animation loops for facing "up", "down", "left" and "right" (0 - 3).

what i would like to end up with is a function that works something like this:

Code: ags
CharacterInteract (high, down);

or
Code: ags
CharacterInteract (middle, left);

etc.

i'm pretty much clueless how to achieve this. my guess is i'd need to use "pointers" somehow...?
which, unfortunately i still haven't managed to wrap my head around completely what they are or how they work.

any help would be appreciated.

cheers!
#10
hey guys,

i would like to play a background sound in my room and randomize certain aspects:

1. i would like to define a certain time frame to randomize the delay between each played sound (somewhere between 40-400 cycles)
2. i would like to randomize which sound is getting played (something like 3 different sounds should be fine)
3. i would like to randomize the panning property of the played sound so each time it plays from a different "spot"

first i thought i could just use random() to define the length of a timer but then realized that random() always starts at 0.
so i guess defining different timers is the only way?
anyway here's what i came up with so far:
Code: ags
function WoodCreak () {
  AudioChannel *WoodCreak1Channel = aWoodCreak1.Play (eAudioPriorityNormal, eOnce);
}

function CreakPlay () {
  int CreakRandom=Random(2);
    if (IsTimerExpired(2)) {
      if (CreakRandom==0) {
      WoodCreak();
      SetTimer (2, 100);
      }
      else if (CreakRandom==1) {
      WoodCreak();
      SetTimer (2, 200);
      }
      else if (CreakRandom==2) {
      WoodCreak();
      SetTimer (2, 400);
      }
    }
}


with CreakPlay (); in room_RepExec() this works fine to somewhat randomize the delay between each play. however if i now start to introduce 3 different sounds i would end up with a whole bunch of if statements...which would be fine but i'm sure there's some smarter way to go about this? also i would still be missing the random panning for the sound which i have no idea how to achieve.

any advice would be appreciated:)

cheers
#11
hi there,

like the title says i'm using the 9verb template (1.5.1...the one that came with the AGS install) and when i'm trying to repeatedly run code in "room_RepExec", to animate a background object, the cursor disappears.

can anybody tell me why that's happening?

thanks!
#12
Hey guys,

I'm just starting out with AGS and built a small test scene following the tutorials provided. So far so good.
The only thing I can't seem to figure out right now is how to avoid the "mixed resolution" effect when characters scale to a smaller size.
It seems to me the game is scaling to the final resolution before rendering...?
I tried setting up the game to be 320x200 and after building the exe I set the options to use "native game resolution" and "stretch to fullscreen".
However what's happening is:

1. my monitor switches resolution (to 640x480 I believe)...happens on both my PC screen (1920x1200) and TV (1920x1080)
2. the scaled characters' pixels are still noticeably smaller than those of the background (about 1/4, which coincides with my guess of the screen switching to 640x480)

What I believe should be happening is:

1. The screen stays at it's native resolution (i.e. 1920x1080)
2. After rendering the game in it's native resolution (320x200) the engine should upscale the graphics to the screen's resolution

What am I missing? Is it even possible to use character scaling without that "mixed resolution" effect occurring at the moment?

thanks!
daniel
SMF spam blocked by CleanTalk