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

#101
LOOKING FOR VOICE ACTOR(s)

We are looking for someone who is REALLY good at impressions - in particular someone who can nail the original cast and crew of Star Trek the original series.  More specifically than that even, being able to do Kirk (William Shatner), Spock (Leonard Nimoy), Dr. "Bones" McCoy (DeForest Kelley) are ESSENTIAL.  We would also really like to have voices for Scotty (James Doohan), Sulu (George Takei) and Uhura (Nichelle Nichols).

If you can do most or even just one of these voices pretty good (and i don't mean just being able to sound like the character saying one line.  You have to be able to read dialog.  I mean anyone can sound like arnold schwarzenegger saying "I'll be back!".  We need you to be able to speak in this characters voice.) Anyway - if you can do any of these characters let us know.  You can send me a PM and while you're at it go ahead and send us a sample of your impersonation in a sound file to startrekadventures@gmail.com

Thanks,
WWW.StarTrekAdventures.Com  Team
#102
Quote from: Calin Leafshade on Sun 20/06/2010 22:14:51
you need an else if.

using two ifs just causes the code to turn it on and then turn it off again.
or more simply:

Code: ags

function on_key_press(eKeyCode keycode){
  if (keycode == eKeyTab) pressingTAB = !pressingTAB;
}


Ah, thanks.  Adding the word "Else" made all the difference. lol thanks.
EDIT: beaten by Ninja Wizard
#103
Quote from: Crimson Wizard on Sun 20/06/2010 21:52:08
Before even checking your code posted above, I want to ask, why do you use "IsKeyPressed" function at all if TAB toggles some mode on and off? For such behavior it is much better to catch key presses in on_key_press function.

EDIT: As for the code - yes, I can see mistakes there, but first I'll wait for your answer, because it may appear that this code is not needed at all :)

I tried it with on_key_press too and it didn't work... here is my code for that:

At the top of the room script:
Code: ags

function on_key_press(eKeyCode keycode){
  if ((keycode == eKeyTab) && (!pressingTAB)) {
    pressingTAB = true;
  }
  if ((keycode == eKeyTab) && (pressingTAB)) {
    pressingTAB = false;
  }
}


In RepExec:
Code: ags

if (pressingTAB) {
      //Cursor fixed to viewscreen
      mouse.SetBounds(208, 130, 588, 355);
      //Mouse Steer
      if (mouse.x <= 221) cEgo.x = cEgo.x - 6;
      if (mouse.x >= 575) cEgo.x = cEgo.x + 6;
      if (mouse.y <= 143) cEgo.y = cEgo.y - 6;
      if (mouse.y >= 342) cEgo.y = cEgo.y + 6;
        }
  else if (!pressingTAB) {
    mouse.SetBounds(0, 0, 0, 0);
  }
#104
Okay - i know there are like a billion threads similar to this one and i've done a quick search and actually found one that was very similar to what i need.  However, playing with that solution only got me so far.

I want to use the "Tab" key as a "toggle" switch.  When you press the Tab key your mouse is restricted to a certain area of the screen and moving the mouse to the edge of the boundary moves the character in that direction.  ANd when you press the tab key again - you go back to being able to move your mouse wherever you want to.  Well i have everything coded how i think it should work and it doesn't.  When testing, pressing the tab key does nothing.  

Here is my code:

please note that the following script is in the RepExec part of the script and "pressingTAB" is a bool that is defined at the top of the room script.

Code: ags

  if ((IsKeyPressed(9)) && (!pressingTAB)) {
    pressingTAB = true;
  }
  if ((IsKeyPressed(9)) && (pressingTAB)) {
    pressingTAB = false;
  }
  if (pressingTAB) {
      //Cursor fixed to viewscreen
      mouse.SetBounds(208, 130, 588, 355);
      //Mouse Steer
      if (mouse.x <= 221) cEgo.x = cEgo.x - 6;
      if (mouse.x >= 575) cEgo.x = cEgo.x + 6;
      if (mouse.y <= 143) cEgo.y = cEgo.y - 6;
      if (mouse.y >= 342) cEgo.y = cEgo.y + 6;
        }
  else if (!pressingTAB) {
    mouse.SetBounds(0, 0, 0, 0);
  }


So the above code doesn't work like i want it to.  However, when i was testing i added a couple lines to the code (see below) and it worked.  But i need it to work without those lines.

Code: ags

if ((IsKeyPressed(9)) && (!pressingTAB)) {
    pressingTAB = true;
    Display("PressingTAB is true.");
  }
  if ((IsKeyPressed(9)) && (pressingTAB)) {
    pressingTAB = false;
    Display("PressingTAB is false.");
  }
  if (pressingTAB) {
      //Cursor fixed to viewscreen
      mouse.SetBounds(208, 130, 588, 355);
      //Mouse Steer
      if (mouse.x <= 221) cEgo.x = cEgo.x - 6;
      if (mouse.x >= 575) cEgo.x = cEgo.x + 6;
      if (mouse.y <= 143) cEgo.y = cEgo.y - 6;
      if (mouse.y >= 342) cEgo.y = cEgo.y + 6;
        }
  else if (!pressingTAB) {
    mouse.SetBounds(0, 0, 0, 0);
  }
#105
yeah i see now ... but can AGS solve equations like that?
#106
tzachs,

when you said linear interpolation i knewyou were onto something.  I recall linear interpolation from my days of schooling (lol).  But your forumlas you posted confused me a bit.  So i researched linear interpolation and got the actual formula for it ... with that plus what you said i was able to come up with this (which makes more sense to me):

so assume d0 (the furthest distance away) = 500, and d1 (the closest distance) = 100. (both 500&100 represent Y screen cooridnates in ags).  The animtion speed (from furthest to closest) are - let's just say: s0= 5 and s1= 1.  So what we have now is:

(500, 5) & (100, 1) -- where the x value in these coordinates represent distance and the y values represent animation speed.

The only thing we are missing that we need for the linear interpolation formula is another distance.  But this is easy to get - this distance equals the y cooridnate of wherever the player clicks on the screen.  So lets assume the player clicks on a location where the y value is 250 (so dead center between our minimum and maxiumum).  Now using linear interpolation we can figure out what the animation speed should change to for a y vaule (distance) of 250.

The formula:
s3 = (((d3 - d1)(s0 - s1)) / (d0 - d1)) + s1

with:
d0 = 500 (max. distance)
d1= 100 (min. distance)
d3 = 250 (player selected distance)
s0 = 5 (max. speed)
s1 = 1 (min. speed)
s3 = the speed needed to get to the player selected distance (d3).

So we plug everything in and solve for S3,

Solving the equation:
s3 = (((250 - 100)(5 - 1)) / (500 - 100)) + 1

i'm not going to do all the math here but it comes out to s3 = 2.5  .... and to be honest we didn't need the formula to figure this out because obviously if your choosing a point halfway between the minimum and maximum distances then the speed is going to be half of the max. speed.  So i chose 250 as an example to make sure the formula worked and i wasn't doing something wrong.  And it indeed does work.

Now, i'm not home at the moment so i can't test this out in ags but the only problem i forsee running into is that i'm pretty sure animation speeds can't accept non-whole numbers. So it wouldn't recognize 2.5. Which isn't a huge issue cus the animation doesnt have to be exact ... just close enough.  So i would need to tell ags to round the result of s3 to a whole number.

Now, tzachs, it's possible that your forumlas do the exact same thing i just did only a much simpler way ... but i could not see it.

#107
Quote from: Ryan Timothy on Thu 17/06/2010 05:36:25
Answer to question 1, use:
Code: ags

Game.SpriteWidth[object[0].Graphic]


You could then divide the width in half and subtract it from the X.  Or whatever you end up doing with the object to have it centered.

could you explain this a little better please?
#108
I have a couple quick questions here.  Let's knock out the easy one first:

Q1
AGS reads the "location" of a character as the coordinates where the bottom center of the graphic is.  (so say you click on a circle on the ground with your mouse then the bottom center of the characters graphic will move to that circle (in most cases the player character has feet so it looks as if his feet are at that location)).  Okay - well a while back someone told me you could change this by altering the "z" property of the character. (so if you have maybe a snake for a character then you wouldn't want his tail to move to the point you click on, you'd want his head to move there.)

Anyway, can the same be done with objects?  Now if i'm correct AGS does things a little different with objects.  Instead of the bottom center, AGS reads the bottom left corner for object location/positioning.  I'm making a set of laser beams that "fly/shoot" to whereveryou click and as of now if you click a location, ags is putting the bottom left corner of the object sprite there, not the top center like i would like.  (i'd like to avoid using these lasers as a character if possible).

okay, so onto my next question:

Q2
In this first person part of the game where you're firing lasers (the lasers come from off the bottom of the screen to the target) i have a nifty little laser animation that works pretty well but the problem is if you click on a location closer to you "aka bottom of the screen" then the lasers get there faster obviously, and the animation doesnt finish before reaching the location.  So i need some sort of formula that will allow me to match the distance traveled with the animation speed (so that the animation finishes as it reaches the destination).
#109
I figured out that I had to actually copy/replace the sprite file (acsprset.spr) from a backup copy of my game into the current game.  This fixed the problem ... however i have to reimport some images.
#110
Error: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Version: AGS 3.1.2.82

System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
  at GetSpriteHeight(Int32 )
  at AGS.Native.NativeMethods.GetActualSpriteHeight(Int32 spriteSlot)
  at AGS.Editor.NativeProxy.GetActualSpriteHeight(Int32 spriteSlot)
  at AGS.Editor.ObjectsEditorFilter.GetSpriteHeightForGameResolution(Int32 spriteSlot)
  at AGS.Editor.ObjectsEditorFilter.PaintToHDC(IntPtr hDC, RoomEditorState state)
  at AGS.Editor.RoomSettingsEditor.bufferedPanel1_Paint(Object sender, PaintEventArgs e)
  at System.Windows.Forms.Control.OnPaint(PaintEventArgs e)
  at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
  at System.Windows.Forms.Control.WmPaint(Message& m)
  at System.Windows.Forms.Control.WndProc(Message& m)
  at System.Windows.Forms.ScrollableControl.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)

------------------------------------------------------------------------------------------------

Don't know exactly what caused this.  I just know that whenever i try to load a room in my game and edit objects I get this error.

I've searched through the forums for similar problems but no one seems to be giving any answers out.  What's the deal?
#111
works perfectly Gilbet. Thanks so much.
#112
Gilbet,

I've corrected those issues and it works now ... well kind of.

While testing I noticed that if i click the mouse somewhere cNPC does walk somewhere ... but not to where i clicked.  cNPC kind of goes in the opposite direction of where my mouse clicked.  It's a little weird and unexplainable.

Does mouse.x and mouse.y get screen coordinates or room coordinates? I would imagine it would get screen coordinates but my room is larger than the screen resolution so if it IS getting room coordinates then this MIGHT be the issue.  But it doesn't look that way to me.
#113
let me be a little more clear on what i'm doing.

I tried this and it's not working in the room script.  The following code is at the top of room script:

Code: ags

function on_mouse_click(MouseButton button)
{
  if ((Alpha) && (Button = eMouseLeft)) {
     cNPC.Walk(mouse.x, mouse.y, eNoBlock, eWalkableAreas);
   }
}
#114
Here is what I need:

When all the planets are aligned and the stars are just right (i.e. a bool named Alpha is true) then clicking on the left mouse button does something specific.  Now this can't go in the global script because this event should only happen in a specific room.

The code might look something like this:
Code: ags

if ((Alpha) && (button == eMouseLeft)) {
...
}


However, that obviously wouldn't work in a room script.

The solution may be a simple one and i'm just way over thinking the matter or something ...
#115
Ok cool. Thanks Crimson Wizard.  That seems to be working better. But there is still one issue i'm not happy with.  The projectile moves to the Target but it touches the base of the target instead of the center and then resets. (because of the PPCollision code)

It would look more realistic if the projectile could hit the center of the target before resetting.

i.e. if the projectile is being shot at a sprite of a man, whats happening is the projectile is moving from the bottom of the screen to the mans feet - touching his feet and then resetting.  I want the projectile to move from the bottom of the screen hit the man in the chest and then reset.  If that makes sense?
#116
Quote from: Crimson Wizard on Sat 12/06/2010 19:02:02
I have this suggestion: do not use Walk function at all. Increment X or Y coords of cProjectile respectively every tick, using determined speed. You will need to use vector algebra:

Code: ags

float dx = IntToFloat(cTarget.x - cProjectile.x);
float dy = IntToFloat(cTarget.y - cProjectile.y);

float distance = Maths.Sqrt(dx*dx + dy*dy);

float IncX = dx * ProjectileSpeed / distance;
float IncY = dy * ProjectileSpeed / distance;

cProjectile.x = cProjectile.x + FloatToInt(IncX);
cProjectile.y = cProjectile.y + FloatToInt(IncY);



So i would replace "ProjectileSpeed" with a number that represents how fast i want it to be traveling?

Edit:
I tried this and I got an error with the line that holds: "float IncX = dx * ProjectileSpeed / distance;"
It says:
Type mismatch: cannot convert "float" to "int"
#117
Quote from: Wyz on Sat 12/06/2010 13:04:46
Are you making a homing projectile or something that moves in a straight line and would miss in this case?

right.  and it's not supposed to miss its supposed to hit.  the reason is because it's not actually acting like homing device.  its going to the last known coordinates of cPlayerB but by the time it gets there cPlayerB has moved on.  A way to make it act like a homing device would be to have it follow cPlayerB but doing it that way has given me some bugs so that the second part of the code that says if projectile is touching playerb isn't activating because the projectile still isn't ALWAYS going to touch playerb.

I know people have pulled things like this off successfully and i want to know how it can be done.
#118
I have cPlayerA "shooting" cPlayerB.  cPlayerB (the enemy) is moving randomly around the screen. 

The way I'm doing this is i have the projectile as an invisible character that's following the player.
(Note: I'm not using the FollowCHaracter command for this. Rather, I have it simply cProjectile.x = cPlayerA.x (same goes for the y)

Anyway, I have it set up so that when the "Fire" button is pressed the cProjectile becomes visible and cProjectile.Walk (cPlayerB.x, cPlayerB.y);

So to finish up this little action I need to have it when CProjectile reaches the enemy then it resets (becomes fully transparent again and goes back to following cPlayerA) right?

Well all that is good and well but the problem lies here:

cPlayerB is moving so fast that the part of the script that says "if cProjectile is colliding with cPlayerB then do all the resetting stuff" isn't being triggered because by the time cProjectile gets to the cooridnates he is no longer close enough to cPlayerB to trigger a collision.  cProjectile is where cPlayerB was a sec ago.

Does all this make sense? If not, let me know what i need to clear up.

So, can someone tell me a better way of doing this or how to fix this problem?
#119
awesome! thanks!
#120
I need to figure out how to get a characters screen coordinates (NOT room coordinates, as my room is larger than the screen resolution).

I looked into the Character.GetAtScreenXY code but that seems that it only checks if there is a character at screen coordinates but i dont need to check and see if a character is at a specific location ... i need to figure out where the character is in terms of screen coordinates.
SMF spam blocked by CleanTalk