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

#1
hmm, i remember this was easier with the old audiosystem.

all i want to do, is play an audioclip, but take care if it is playing already.
So i have:
Code: AGS

// ROOMSCRIPT
AudioChannel *channel;

function room_RepExec()
{
   if(channel)
    {
      if(!channel.IsPlaying)
        channel = aJB_crash_small.Play();
    }    
    else
      channel = aJB_crash_small.Play();
}


this construct doesnt work, i dont know why?



#2
This is tricky (for me)


As you can see on the picture, when a guard is knocked out he falls to the ground in Top Down View.
The problem is to ensure that he lies only on a walkable area and dont cover a wall (regions).
With monkeys code i know how to measure the sprite, but i need two calculations which i dont know how to start.
The first one is to determine, if there is a region underneath a single pixel of the sprite, and when yes
to find the nearest spot from the npcs origin on the walkable area, where i can place the sprite.

#3
well my construct looks like this:
(the critical section is commented right now, so it works smooth) 

Code: AGS

function room_RepExec()
{
  int i = 0;
  
  while(i < Game.CharacterCount)
  {
    if(Guard[i].alerted)
    {
      
      /*
      int j = 0;
      while(j < Game.CharacterCount)
      {
        if(i != j)
          if(Guard[j].alive)
             if(character[i].ROC_FUNC_Get_Distance_From(character[j]) < 300)
                   character[j].ROC_FUNC_Guard_Alerted();
            
     */

       if(character[i].IsCollidingWithChar(player))
         if(thief.guards_alerted > 1)
         player.ChangeRoom(5);        
         else
         {

            character[i].ROC_FUNC_JB_Startfight(); 
         } 
         
        // j++;
         
      //}
       
    } 

    i++;
  } 
}



but its obivious when the other section isnt commented, it brings the PC down to his knees.
i thaught about a gamecycle counter, only execute this code every 3rd frame or so, but i guess this isnt a convenient solution either..
And suggestions how to solve this?
#4
I need the sprite height from the current character.Frame.

edit:
ok found the solution from monkey in another codesnippet somewhere: :)
Code: AGS

ViewFrame *frame = Game.GetViewFrame(cGuard_1.View,cGuard_1.Loop, cGuard_1.Frame);
int sprite_height = (Game.SpriteHeight[frame.Graphic]);


#5
i would need a room function
Code: AGS
function room_RepExec_always()

cause when the player performs an additional animation with LockView and animate....
some things that are going on in the background stucks meanwhile.
Is there a an similar function like the normal repeatedly_execute_always() function for rooms?
#6



An intrigue has brought you to prison, so your goal is to escape and find the evil who brought you in this mess.


Game Facts:
- Stealth Game -
- 4 Levels -
- Beat'm Up Mingame -
- Driving Sequence -

Game Technics:
800x600 32bit
Top-Down View
Keyboardcontrol (Mousecontrol optional)


WIP Screenies:






WIP-Music Snippet:
Short Jailbreak Credits Screen - Single String Demo


additional Infos:
The Game is intented to be part of the Summerbatch Bundle, so if i can hit the Deadline, its my first Game who will be sold worldwide, commercial..... Wohoohooohooooo
Its also the first time (ok, the first and a half considering Airbreak  :P), where i try to combine my ambitions to make games and music.
So i try to compose and record the whole gamemusic bymyself, which is a frightening task, cause differently to work with AGS where i'm roughly know what im doing (or where i found Khris PN-Button to make him mad ;)),
i'm a relative unexperienced in homerecording, so we will see or better hear what comes around.






(Mods edit - fixed broken link)
#7
I try to integrate a little chase sequenz,
the problem is, i dont know how to mathematically code that the new waypoint avoids the path direct to the chaser (player).

Code: KHRIS_related
  bool found;
  int x,y;
  
  float dx = IntToFloat(cEscape.x - player.x); 
  float dy = IntToFloat(cEscape.y - player.y);
  float d = Maths.Sqrt(dx*dx + dy*dy);  // distance
  
   if (d < 30.0)
    if(!cEscape.Moving) {
     while(!found) {
     // HERE SHOULD COME THE CALCULATION TO TRY TO AVOID THE WAY TO THE PLAYER
      x = Random(Room.Width);
      y = Random(Room.Height);
      
      if (Region.GetAtRoomXY(x, y) == region[2]) found = true;

     }
    cEscape.Walk(x, y);
  }

#8
Dont know if this is the right place to post this,

I'm wondering if the searchfunction is out of order.
Every time i try a search i get:

Database Error
Please try again. If you come back to this error screen, report the error to an administrator.

btw: when someone is fixing this issue with the searchfunction, please add the possibility to sort the founded entrys via date.
(I'm missing this feature ever since i'm here.)
#9
I encounterd a strange behavior, which i dont understand:

I did a little game a while back and i opened it with AGS 3.2.1.111
It works fine without errors, all is good.

Now I'm working on another game, with the same AGS Version (3.2.1.111)
I imported a module from the game above and got errors.

***t.asc(106): Error (line 106): Undefined token 'AnimateCharacterEx'
***t.asc(106): Error (line 106): Undefined token 'RawSetColor'

So, these old commands work inside AGS 3.2.1.111 in one game,
but produce errors in another game using the same AGS Version.

What is going on here?

#10
City of Thieves: Rescue Sandy

Burglar Simulation
inspired from They stole a million and The Clou.




Story:
Dave Miller, an retired burglar is forced to burglarize until his depts are paid off.
The syndicate boss underlines this special pressure by hijacking and imprison Sandy, Daves beloved Girlfriend.
Only successfull burglarys can avert the evil events.

Mingames:
- Picklock
- Alarm deactivation
- safe cracking




* Released for MAGS 04/2011


Download the game HERE.
#11
well the actual cursormode management is a pain in the ass.

ok i have several functions to prevent some modes to show up, but it wont work without problems:

Code: ags
 
function Interface_Interact()
{
    mouse.DisableMode(eModeTalkto);
    mouse.DisableMode(eModeUseinv);
    mouse.DisableMode(eModeWalkto);
    mouse.DisableMode(eModeLookat);
    
    mouse.Mode = eModeInteract;
}

I call this function for example on room_load,
but when i click the right button or turn the mousewheel, the first mode eModeWalkto appears and further rightclicking changes between the interact and walkto mode, which is an undesired behavior, cause i disabled the walkto mode explicit.

It obiviously is related to this line(s) in the global script:
Code: ags

else if (button == eMouseRight || button == eMouseWheelSouth){
    // right-click our mouse-wheel down, so cycle cursor

    if (mouse.Mode == eModeUseinv) {
      player.ActiveInventory = null;
      mouse.Mode = eModeWalkto;
    }
    else mouse.SelectNextMode();

..

else if (button == eMouseWheelNorth) { 
    // Mouse-wheel up, cycle cursors 
    // If mode isn't WALK, set the previous mode (notice usage of numbers instead
    // of eNums, when it suits us)...
    if (mouse.Mode>0) mouse.Mode=mouse.Mode-1; 

.....
if (player.ActiveInventory!=null) 
      {
        //...and the player has a selected inventory item, set mouse mode to UseInv. 
        mouse.Mode=eModeUseinv; 
      }
      else 
      {
        // If they don't, however, just set it to mode TALK (change this line if you add more cursor modes)
        mouse.Mode=eModeTalkto; 


is there another solution beside to operate in this code sections?
#12
im struggeling with my speech fonts, the result is way beyond from what i expected.

look at the example pic.



i know the background is the worst you can imagine for speech text,
but all my imported fonts are not quite good readable, doesnt matter if i use automatic outline or not.



#13
in the old days there was often horizontally text scrolling in the games.

Hostages:
AMIGA - http://www.youtube.com/watch?v=T3ja89l95Ts&feature=player_embedded#at=81
C64 - http://www.youtube.com/watch?v=i0o0aCnaKHM&feature=player_embedded#at=162

What is a good way to achieve this with AGS?
#14
i had this several times and dont know a convenient solution.

i want to know if an object is in range within say 10px of another one, and have to write the complicate way like:

if((object[0].X - object[[1].X) < 10 && (object[0].X - object[[1].X) > -10)
do stuff

this construct works, but i'm knowing there is an easier way for this,
cause i have to calculate these several times in my script.
#15
i want to add a FLoating RGP-Stats system, like the old rpg games,
to give the player direct visible feedback, if he takes a  few dollars, or reach a higher skill level.


Maybe like this - the text (dollars +25) is faded in at player position, maybe moves a bit up and disappears a little over the players head.
I guess i saw a code snippet with similar functionality around here, but cant find it.
If i have to code this by myself, was would be the best approach to achieve this?




#16
Advanced Technical Forum / math problem
Thu 18/03/2010 17:26:08
i have this code
Code: ags
  index_pic = (sprite_ammount * (-currentPosition)); 

but get not the result i expected.

example
index_pic = 10 * (-7);
if i type this in my calculator i get = 3
if this code is executed in AGS i get = -30

how must this statement look like, to get the result i need?
#17
Version:      1.00
Date:           21 November 2009
Author:        Rocco
Description: GTA-Style Drive Modul

Requires AGS 3++



Setup Instruction:
============================================================================================
-------------------------------------------------------------------------------------------
create one room where the driving takes place
import one car sprite - up-view (carnose must be straight up)
remember the sprite slot number of your car sprite.

---------------------------------------------------------
this is the only required function to run the module, so with only calling this function you can have a driving car on screen
call function (for instance in the after fade in section of the drive room) :
FUNC_RocGTA_Driver_Init(26,100,180,315);    // first is the sprit slot number of the car, then are the starting coordinates - x and y, the 4th value is the starting angle of the car where 0 = ->

-----------------------------------------------------------
if you want carsounds you have to call this function
here it is important that the rpm sounds are in one row.
FUNC_RocGTA_SetSounds(int engine_rpm_first = -1,  int engine_rpm_last = -1, int engine_start = -1, int engine_idle = -1, int crash_sound = -1, int horn_sound = -1, int backgroundmusic = -1);

---------------------------------------------------
use this function if you want to stop driving
FUNC_RocGTA_Stop_Drive();

----------------------------------------------------
now its also possible to abort driving and go to the last room or quit the game with the <escape> key
you can change this behavior in the Drive.asc script at the bottom in the rep_execute function

**************************************************************************************************
REGIONS:
Region 1 are walls
Region 2 are oil slops where you cant steer
Region 3 are areas where the car slows down

// Use this functions to alter the Car behavior during game play (at gamestart you can set up this values in the DriverInit Function)
import function FUNC_RocGTA_SetTempo(float maxspeed, float minspeed);   // set Tempo
import function FUNC_RocGTA_SetSteering(float steering_angle);            // set Steering Angle
import function FUNC_RocGTA_SetFriction(float friction);                     // set Groundfriction
import function FUNC_RocGTA_SetAccel_Decel(float accel, float decel);   // set Acceleration and Decelaration
import function FUNC_RocGTA_SetDamage(int damage);                           // set Damage
import function FUNC_RocGTA_Change_Driver_Sprite(int vehicle_sprite); // set new car sprite


---------------------------------------------------------------------------------------
in this module-version the handling of tyre-wear, fuel consumption, and car damage is deactivated
you can see this behavior in the demo, where this functionality are in use


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



DOWNLOADS:
AGS-GTA-Style Driving Module (AGS Version 3.00 and above)
AGS-GTA-Style Driving Demo (module included) -> AGS GTA Demo and Source
AGS-GTA-Style Driving Module -> AGS GTA Driving Module


This Game also uses this module -> Super Pitstop Racing


Big Thx and Credits:
Chris Jones - AGS,
KhrisMUC & AGS-Community - Forum help

I hope this module is useful and come in handy one day.
It this happens, I would be very pleased if the game creator sends me a message when their game is finished
so i can play it. :-)

greets,
Rocco


sidenotes:
This module is far away from perfection, the car physic is very basic, the collision response is somehow crappy, and you can get stuck on the oil slops.
I have this module a long time on my harddisk, and think its better to release it as it is now, before it rottens on my computer. (thanks NsMn for making enough pressure)  ;) Maybe someday developers with more physic and math knowledge can enhaunce the module.

#18
i use a birdeye view.
So when i click some where on the screen, and the player walks to this point,
he doesnt stand in the right spot (allways to far above), cause the offset point is set to the feet of the characters (down-edge of sprite) per default.
how is it possible to change that point, within the character views?

the other problem based on this fact is, that the character moves way to far beyond walking areas
#19
I recognized strange behavoirs with my struct.variables.
i use modules and structs.

Code: ags

// RPG.ash
struct Roc_Struct_RPG
{
   String name;
   int money;
   int searching;
   .
};  

Roc_Struct_RPG thief;
export thief; 


Code: ags

//RPG.asc

function game_start() 
{   

  thief.money = 1000;
  thief.searching = 5;
  
} 



now i try to use that vars and get strange results,
when i use the vars in the RPG.asc file, all is fine the values are correct,

Code: ags

RPG.asc
player.say("My Money = %d", thief.money);   // value ist correct


but when i try to use the vars in another module or the room scripts.
Code: ags

othermodule.asc
player.say("My Money = %d", thief.money);   // value is wrong (always 0) 


Code: ags

roomxx.asc
player.say("My Money = %d", thief.money);   // value is wrong (always 0) 


i get vars with value 0.
what is wrong in this case?
#20
I have no idea how could possibly convert a String containing the script name of an InventoryItem into the actual script object.

I have this function;

Code: ags


  function Func_Roc_Searching(String loot)
 {
   if(String.IsNullOrEmpty(loot))
   { }
   else  
   {
     int value;
     value = loot.AsInt;
       if(value)
       {
         GiveMoney(value);
       } 
       else
       player.AddInventory(loot);  // <- here is the problem
      
     PlaySound(4);  
   
   } 

....
}
SMF spam blocked by CleanTalk