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

#21
if you play with the a and b values you'll get a somewhat parabolic movement, so you will if you use the last code with the sin equation.
#22
No it's not a physical rule, if you want to do it physically you would have to built a physics engine and that is beyond me at this point. It's just simple math:

I haven't tried them yet but they just give you a circular movement and you can control where the trajectories land. The first one is the equation of a circle (y2-y1)raise_to_2 + (x2-x1)raise_to_2 = (radius)raise_to_2

the second just give's you the x and y as a vector from the center of a circle to a point on the circle changes it's angle:
y = cos(f)
x = sin(f)

here's another one if you want a more periodic movement:

if (y > = 0){
x = x_mov *a; //a changes the speed
y = FloattoInt(Maths.Sin(Maths.DegreesToRadians(x_mov + 2 *Maths.Pi))) *b; //b is a value that changes your y, if b was 1 then the values of y would be 0 to 1.

x_mov++;
}

Oh and you don't really need decimal precision for the x and t coordinates, it only takes intergers as it's values

if you want to do it with physics (i wouldn't recommend it) take a look at this:

http://en.wikipedia.org/wiki/Trajectory

oh and of course it is nice that you want to write your own code, me as well have never put anything in my code that i don't understand...
:)
#23
By the way what would max_y and max_x represent. And what would max_scale and min_scale be, cause the engine doesn't provide you with the max and min scaling parameters of the room i would have to define those values in every room wouldn't i?
#24
I already tried that using arrays for every character, it just seems to recognize the walkable area as 1 but still  gets the wrong scaling. But i kind of fixed it in another way, i used to call the player's function every game cycle, now that i put him with the rest of the characters every second it doesn't do it any more except from very rarely, i guess it's good enough. thank you...
#25
ask me to explain anything you don't understand
#26
I haven't tried this but this is what comes to mind

float ang;
float x_mov;
float x_center;
float y_center;
float radius;//changeradius to correspond for different axis point
float a;//change a to correspond for different axis point and to make a more realistic parapolic movement
...
repeatedly execute:
x = FloattoInt(x_mov * a);
y = FloattoInt(Maths.Sqrt(Maths.RaiseToPower((x_mov - x_center),2.0) - Maths.RaiseToPower(radius)) - y_center);
x_mov++;

OR

x = FloattoInt(Maths.Sin(Maths.DegreesToRadians(180 - angle)) *radius - x_center) + a *x_mov;
y = FloattoInt(Maths.Cos(Maths.DegreesToRadians(180 - angle)) *radius - y_center);
if (angle >= 0)
angle++

(x and y are cRock.x and cRock.y)
#27
this is a game sample, not just the compiled. i have circled some of the problem areas. just walk close to the limits of the walkable area, you will see the problem

http://www.easy-share.com/1903572559/test.zip
#28
I tried that... i tried adding the GetWalkableAreaAt condition, i checked a few pixels around the player but nothing changes. It seems like it finds the walkable area under the player but it reads the scaling property as 0. Isn't there a way to manually scale a character correctly? How is it normally done? This is my only big problem. I forgot to mention that i run this function in repeatedly execute where every game cycle the character scaled is a different one (it cycles among the characters in the game...). Any ideas? Even if when the character loses his scaling the wrong scaling was close to the right one so that this wasn't so obvious that would be enough for me... Can someone test any of these?
#29
A little fix: cBall.y = 2dy(bz, by); actually is 300 + cBall.y = 2dy(bz, by);
#30
 :D Thank you man... for going into the trouble to be so analytic, i probably wouldn't have realized it any other way, i find it difficult to read other peoples script. Thanks. I don't know if you noticed but we have a few common points, you use len which is cos(f) where i use tan, which is tan(f). For speed i was using the y coordinate but your way is much better. You have great insight, i will try it out but i am sure it will work...
#31
I find it more confusing to use z as depth as it is not used in that way by the game. How do you figure the path of the bullet using vectors, i was never too good with vectors. If you could explain that would be great. The mouse only determines the angle but the projectile doesn't stop there. I see you are not using z at all, are you suggesting that i should find the hit point and use the walk function? The way i am trying to get this to move it simple disappears for some reason.
#32
Ok, this is what i have been doing
Code: ags

function shoot(){
  if (go == true){
  float middle_virtual_x;
  float middle_virtual_z;
  middle_virtual_x = (IntToFloat(stat_mouse_x) - 200.0)/75.0;
  middle_virtual_z = (150.0 - IntToFloat(stat_mouse_y))/75.0;
  if (middle_virtual_x == 0.0) middle_virtual_x = 0.1;
  if (middle_virtual_z == 0.0) middle_virtual_z = 0.1;
  float tan1 = 50.0 /middle_virtual_x;
  if (tan1 <= -0.75) {
    if (person[cBall.ID].virtual_x < -200.0){
      go = false;
      return;
    }
  } 
  if (tan1 >= 0.75) {
    if (person[cBall.ID].virtual_x > 200.0){
      go = false;
      return;
    }
  }
  float tan2 = 50.0 /middle_virtual_z;
  if (tan2 <= -1.0) {
    if (person[cBall.ID].virtual_z < -150.0){
      go = false;
      return;
    }
  } 
  if (tan2 >= 1.0) {
    if (person[cBall.ID].virtual_z > 150.0){
      go = false;
      return;
    }
  }
  if (person[cBall.ID].virtual_y > 150.0){
    go = false;
    return;
  }
  person[cBall.ID].virtual_y++;
  person[cBall.ID].virtual_x = person[cBall.ID].virtual_y /tan1;
  person[cBall.ID].virtual_z = person[cBall.ID].virtual_y /tan2;
  cBall.y = 150 - FloatToInt(person[cBall.ID].virtual_y);
  cBall.x = 200 + (FloatToInt(person[cBall.ID].virtual_x) *GetScalingAt(200, FloatToInt(person[cBall.ID].virtual_y)) /100);
  cBall.z = 150 + (FloatToInt(person[cBall.ID].virtual_z) *GetScalingAt(200, FloatToInt(person[cBall.ID].virtual_y)) /100);
}
}

...

else if (mouse.Mode == eModeAim) {
  person[cBall.ID].virtual_x = 0.0;
  person[cBall.ID].virtual_y = 0.0;
  person[cBall.ID].virtual_z = 0.0;
  stat_mouse_x = mouse.x;
  stat_mouse_y = mouse.y;
  go = true;
}

.. in room script

function room_RepExec(){

shoot();
}

Now this should work but the virtual x and z are always much lower than they should be and when i call the function the ball (projectile) disappears... I just can't seem to get my mind around these things... If anyone understand anything ... i was pretty sure i made no mistake...
#33
I know this must have been brought up before but i couldn't find any post that really helped at what i am trying. I want to calculate the paths of projectiles, leaving from the center of the screen and see where they hit. I have trouble converting the 3d coordinate system into 2d. At this point i am calculating as the projectile is moving at a fixed rate on the y-axis (the depth) the angle on the y-z level and y-x level. I understood that in order to figure out these angles (let's say tan1 and tan2) i am going to need two fixed points. One is 0,0 (the starting point) and the other would be on another level parallel to x-z (width, height) on a specific y where we are using the coordinates of the mouse to calculate the projectiles direction. When i convert them to 2D coordinates using x as width z as height and y as depth everything goes wrong.... Has anyone done this before? I could really use some help. At this point the space i have created is perspective decreasing the coordinate values as the y (depth) value increases, leading to a point on the middle of the screen. Sorry if i wasn't very clear... any suggestion? Also someone suggested i use a matrix but i don't fully understand them and i feel it would be confusing without a real reason...

Thanks
#34
QuoteWhat bothers me is when you have a shitload of inventory items that will solve a particular puzzle logically but only one ridiculous solution works.  A perfect example of this is going back to the crowbar thing.  I've played so many games where you'll have 2-3 items in your inventory that could be used to pry something open (a hammer, a metal pipe, a common screwdriver), but then you need to specifically find a crowbar to do it.

That's why i prefer Adventure/RPG games, i am tired of picking up every single junk i find in a game knowing that if i try to get in character and don't pick it up that i am going to have to go way back to do so. I don't like it when every item is destined for one solution only and that they all need to be used. I remember the example here of Atlantis, a game around 1998 where an orb was NOT used in the game and the whole gaming community was upset searching for months what was it's purpose but there was none, and i liked that. I don't like to know that there is only ONE solution for every problem and i need to get in the designers head to figure it out no matter how absurd it sounds. In a game i've been working on you can carry as many items on your inventory as your back can lift and there are many items that you will probably never need to use so the challenge here is to find what item is that you really need for the job and go get it. Think logically where you would find one or simply go and buy it, but even then i prefer the designer to have thought of other solutions as well. If you believe for example that the hammer will do the same work as the crowbar the designer would have better made the both work...
#35
Can't the same problem be solved using the dot product of the vectors? Maybe we can solve this without resulting to the euclidean rule a = square((b*b) + (c*c)), which could slow down the engine....
#36
I tried to Split it into two functions and it worked. Why would that even happen, is there a limit to the parameters?
#37
I get an error in my script and i frankly can't find anything wrong with it, the message i get is:

An internal error has occurred.....
(ACI version 3.10.10.50)

Error: Unable to create local script: Runtime error: unresolved import 'NPC::set_stroll^13'

I am working on AGS 3.1

Does anyone have any idea what that might be? In the referred function i am using optional parameters....what could it be?
Also the import declaration of this function belongs to a struct.... any thoughts?

this is in the script:

function NPC::set_stroll(short ch_numb, short timer_numb, int timer_min, int timer_max, short max_mov, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4){
......
}

and this is in the header

import function set_stroll(short ch_numb, short timer_numb, int timer_min, int timer_max, short max_mov, int x1 = 0, int y1 = 0, int x2 = 0, int y2 = 0, int x3 = 0, int y3 = 0, int x4 = 0, int y4 = 0);

I use this function in a room script but when i delete it from there it compiles just fine....

room script:

person[2].set_stroll(2, 3, 400, 800, 3, 200, 180, 1175, 210, 685, 250);
#38
Thank you  :)
#39
I can't get it to work.... i get this message:

CharacterControl_084b.asc(52): Error (line 52): Array size must be constant value
#40
Thank you, i will let you know...
Also if you have any good input about the story i would appreciate it as well. I am currently working on it but i would really like to know what everyone expects from a RPG, i will take every idea into account.
SMF spam blocked by CleanTalk