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

#1
I spent several hours making this half-finished system in order to perform chemistry (albeit a novice form) but am now wondering if there is a simpler, less redundant and time-consuming method... Here is my code:

Code: AGS
// CHEMISTRY



// DXM EXTRACTION



//USES iNH3 ON iRobo IF POSSIBLE
function iNH3_UseInv(){
if (player.ActiveInventory == iRobo){ 
Display ("You basify 30mL of cough syrup with 30mL of ammonia.");
  player.InventoryQuantity[iNH3.ID] -= 30;
  player.InventoryQuantity[iRobo.ID] -= 30;
  player.AddInventory(iSyr_Amm);
  player.InventoryQuantity[iSyr_Amm.ID] += 59;
  }  
}


 //USES iRobo ON iNH3 IF POSSIBLE
function iRobo_UseInv(){
if (player.ActiveInventory == iNH3) {
Display ("You basify 30mL of cough syrup with 30mL of ammonia.");
  player.InventoryQuantity[iNH3.ID] -= 30;
  player.InventoryQuantity[iRobo.ID] -= 30;
  player.AddInventory(iSyr_Amm);
  player.InventoryQuantity[iSyr_Amm.ID] += 59;
  }  
}


// INSPECTS iRobo+iNH3 FLASK
function iSyr_Amm_Look(){
Display ("A flask filled with %dmL of ammonia and cough syrup", player.InventoryQuantity[iSyr_Amm.ID]);
}


// ADD 5mL OF iNaphtha TO FLASK OF 30mL iRobo+iNH3 IN POSSIBLE
function iNaphtha_UseInv() 
{
if (player.InventoryQuantity[iSyr_Amm.ID] > 0){
Display ("You add 5mL of naphtha to 30ml of the ammonia/syrup");
  player.InventoryQuantity[iNaphtha.ID] -= 5;
  player.InventoryQuantity[iSyr_Amm.ID] -= 30;
  player.AddInventory(iSyr_Amm_Nap);
  player.InventoryQuantity[iSyr_Amm_Nap.ID] += 34;
}
else{
  if (player.InventoryQuantity[iSyr_Amm.ID] < 1){
    player.LoseInventory (iSyr_Amm);
    }
  }
}


// ADD 5mL OF iNaphtha TO FLASK OF 30mL iRobo+iNH3 IF POSSIBLE
function iSyr_Amm_UseInv()
{
if (player.InventoryQuantity[iSyr_Amm.ID] > 0){
Display ("You add 5mL of naphtha to 30ml of the ammonia/syrup");
  player.InventoryQuantity[iNaphtha.ID] -= 5;
  player.InventoryQuantity[iSyr_Amm.ID] -= 30;
  player.AddInventory(iSyr_Amm_Nap);
  player.InventoryQuantity[iSyr_Amm_Nap.ID] += 34;
}
else{
  if (player.InventoryQuantity[iSyr_Amm.ID] < 1){
    player.LoseInventory (iSyr_Amm);
    }
  }
}


// INSPECTS iRobo+iNH3+iNaphtha FLASK
function iSyr_Amm_Nap_Look()
{
 Display ("A flask filled with an %dmL of an immiscible mixture of ammonia/ cough syrup and naphtha at 30mL:5mL", player.InventoryQuantity[iSyr_Amm_Nap.ID]);
}

#2
I'm having trouble finding a way to slow down/speed up time when using certain drugs. My game has a clock GUI binded to global scripting which uses variables to change time based on default game FPS. When the user drinks cough syrup, 1 is added to a variable vDXM2, and after some time passes to allow for onset, vDXM2's value is sent to a variable named vDXM, which will have all the drugs effects once scripted in. Here is the code:

Code: AGS

function repeatedly_execute_always() {
  

// CLOCK

if (gPause.Visible) return;

    if (IsTimerExpired(1)) {
    vDXM = vDXM2; vDXM2 = 0;
    Display("You start feeling the DXM");
    }
    

  // advance game clock
  time_loop++;
  if (time_loop == 40) { // advance game minutes
    time_loop = 0;
    time_min++;

    if (time_min == 60) { // advance game hours
      time_min = 0;
      time_hour++;
    if (vDXM > 0) {
      vDXM -= 1;
      }
      
      if (time_hour == 24) { // advance game days
        time_hour = 0;
        time_day++;
      }
    }
  }


  // update clock label
  if (time_hour < 12) {
    if (time_hour == 0)  lblClock.Text = String.Format("12:%02d a.m.", time_min);
    else lblClock.Text = String.Format("%02d:%02d a.m.", time_hour, time_min);
  }
  else lblClock.Text = String.Format("%02d:%02d p.m.", time_hour-12, time_min);
  

  
  

// DRUG EFFECTS

lblDrug1.Text = String.Format ("DXM %d", vDXM);
lblDrug2.Text = String.Format ("DXM2 %d", vDXM2);

//DXM

 if (vDXM > 1) {
}
  
}  



My question is how should I go about slowing time once enough DXM has been used (say if vDXM > 1)? Should I temporarily increase framerate per second or temporarily change the clock so that 40 frames = one half or a fourth of a second versus one, and how?

Also, after an hour passes I want the drugs effects (vDXM) to decrease by a certain amount. At the moment it decreases by 1, but is there a way to decrease by a half or a fourth? When I tried using 0.5 the output window says:
QuoteGlobalScript.asc(94): Error (line 94): Type mismatch: cannot convert 'float' to 'int'
and when I tried using 1/2 my gDrugs GUI (which displays vDXM value) doesn't decrease even after waiting several minutes, meaning -= 1/2 has no effect.

Code: AGS

if (time_min == 60) { // advance game hours
      time_min = 0;
      time_hour++;
    if (vDXM > 0) {
      vDXM -= 1;
      }

Thanks in advance!
#3
This is my code

Code: ags

function repeatedly_execute_always() {

if (gPause.Visible) return;

    if (IsTimerExpired(1)) {
    vDXM += 1;
    Display("You start feeling the DXM");
    }
    

  // advance game clock
  time_loop++;
  if (time_loop == 40) { // advance game minutes
    time_loop = 0;
    time_min++;
    if (time_min == 60) { // advance game hours
      time_min = 0;
      time_hour++;
      if (vDXM > 0) {
      vDXM -= 1;
      }
      if (time_hour == 24) { // advance game days
        time_hour = 0;
        time_day++;
      }
    }
  }
  
lblDXM.Text = String.Format("DXM: %d", vDXM); // GUI that displays vDXM value


==================================and==================================

Code: ags


function iRobo_Talk()
{
  if (player.InventoryQuantity[iRobo.ID] == 0) { // Discards the bottle if none is left
    Display ("An empty bottle of cough syrup");
    player.LoseInventory (iRobo);
    UpdateInventory();
  }
  
  else {
    if (vDXM == 0) { // Drinks an ounce if you have it, starts timer
    Display ("You swig an ounce, and though its horrid taste does not deter you from its abuse, the resultant nausea- stymied from consuming surplus ammounts of saccharin-laden syrup within a brief time- makes you reluctant to take another.");
    player.InventoryQuantity[iRobo.ID] -= 1;
    SetTimer(1, 200); // 1200
  }
    if (vDXM > 0) { // If you are already feelin it, drinks another ounce and makes you higher/ removes an ounce 
    vDXM += 1;
    Display ("You swig another ounce.");
    player.InventoryQuantity[iRobo.ID] -= 1;
    }
  }
}



The problem is that when the timer (which simulates drug onset time) is started by the drinking of an ounce of cough syrup, and subsequent ounces are drank before said timer expires, the vDXM global variable value is only 1 after the timer expires (as if only 1 ounce was drank), though the inventory quantity depletes. How would one go about changing it so that even if multiple ounces are drank at once the effects (vDXM += 1) are not felt until after the timer expires?

#4
I have searched the forums for a thread that would help me with this, but all talk about room-based time and thus are unhelpful.

Basically, my game is going to be grand theft auto + the sims, and I want to create time within the game's global script so it is continuous throughout the entire game.

For every second = 1 minute, every minute = 1 hour and for every in-game hour I want the character's stats (need for hunger, sleep, bathroom, etc.) to change within a range of 1-10. Also, I want to make a digital clock GUI that progresses, along with the time script, from 12am (midnight) to 12pm (noon) and back to midnight.

So say the player is tired (sleep > 4) then they can sleep, which advances time 8 in-game hours and resets sleep counter to zero. but say the player stays up within game for a long time (by either sleep deprivation or use of stimulants), and sleep is 8+, then the next time they have to sleep it will last for more than 8 in game hours and leave the player groggy (sleep counter 3). Im sure the stats can be attributed to global variables easily.

Any help with this, specifically the global time scripting, would be great.
#5
I have a problem when I'm  trying to make cJohn talk to cMike. When cMike asks cJohn to buy him some crack, I want to make the dialogue give you 2 options: A.) John: Yeah man.. whatever. & B.) John: Nah bro, I'm not getting any heat on me. When you choose A.) for the first time, I want cMike to give you $50 for buying it, and then have that option never appear again (so you can't keep talking to cMike and getting $50 each time), and if you choose B.) I want it to stop the dialogue and reset it next time you start up the dialogue. Here's what I have so far:

@S
Mike: Mike: Hey.. hey man.
John: John: Hey bro. You okay?
Mike: Mike: Yeah yeah yeah. Kind of..
John: John: You look fucked up.
Mike: Mike: (Laughing) Was.. coming down now. Think you can do me a favor? Here's $50; take it and go buy 3 rocks from Paul, the big dude with the gray jacket, I really need it. I would, but I don't think I would make it far.
return
@1
Mike: Mike: Thanks.

if (vMike == 0)
  Display("Mike reaches into his pocket and retrieves $50.");
  player.InventoryQuantity[iMoney.ID] += 50;
  UpdateInventory();
Mike: Mike: Keep the change.
  if (vMike == 1);
    Display("Did you get the rocks?")
   
  if (vMike < 1);
    vMike += 1;
   
stop
@2
Mike: Mike: Damnit man. Alright.. I'll just hit up one of my friends, have them do it.
stop


But it says

Dialog 0(11): Unknown command: if (vmike == 0). The command may require parameters which you have not supplied.
Dialog 0(15): Error (line 15): PE04: parse error at ';'

line 15 is

  if (vMike == 1);



PS: In case you were wondering, my dialogue I have it so it says the person's name in front of their dialogue I.E:

Mike: Mike: Hey.. hey man.
#6
Is there any way to make it so that whenever an item is added to the inventory it doesn't stack on top of items already in there?
#7
I searched for help for this topic but the only answers I found were "use the variable system/ score system" which is where my problem lies. I want the player to start out with $0 and, after looking through the couch, receive $10, which adds an inventory item (which I have already made, called "iMoney"), and makes the item display $10, which increases with each subsequent profit. I don't want to use the score system because I plan on using that for experience that levels the player up, so my only choice is the variable system. I made a global variable called "myMoney", but every time I try to enable it in my room script (room1.asc) by typing "int myMoney;" in line 2 (line 1 is a //description), it says "room1.asc(2): Error (line 2): Variable 'myMoney' is already imported". Any help on how to fix this and make a working money system would be great. Also, whenever I select the money item in the inventory, it makes it appear on my GUI and I can't remove it, any way to disable this? Thanks in advance.
#8
When ever I try to draw a section of walkable area, nothing is drawn and it says "You are currently using the eraser. To draw new areas, change the selected area number." I do not see an area number box or setting anywhere. Please, any help would be nice.
#9
Okay I made several different rooms with doors too small for the characters =/ and I am using the basic view (white and pink roger) as my characters. I want to know if there is some way I can edit the basic character view so I can make them smaller and possibly even change the colors of the frames for different characters with Paint. If not i will have to make whole new views, I'm not that skilled and I'm too lazy :P. Please help, thanks.
#10
I have a merchant with a drink, and i want to give the drink for free to my main character. when the player clicks the option text "What type of drink is it" in the dialogue dWares, the merchant says "It is a very tasty beverage, have a sample!" and at that point i want to add the drink to the players inventory. This is what i have in my globalscript.asc:

function dialog_request;
{
if cMerchant.Say("It is a very tasty beverage, have a sample!");
cEgo.AddInventory(iDrink);
}
#11
i want to put music in my game but im terrible at scripting and i need to know how to put the music in the scripting and where to put it in :(
SMF spam blocked by CleanTalk