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

#41
I figured it out. I don't know how to delete posts.

Here is just a small part of the code. The rest is more specific for my game.

if(GUIControl.GetAtScreenXY(mouse.x, mouse.y) == LeftHand && mouse.Mode == eModeUseinv && LHITEMSET != 1)
  {
    InventoryChar1.AddInventory(cEgo.ActiveInventory);
    cEgo.LoseInventory(cEgo.ActiveInventory);
    LHITEMSET = 1;
    InventoryChar1.SetAsPlayer();
  }

As for the rest, this post helped me a great deal as well as my more recent post:

http://www.adventuregamestudio.co.uk/forums/index.php?topic=46243.msg621216#msg621216
#42
Room 301 is the title screen and Room 1 is my first town. All of the buttons work fine. My base code is from the demo for Smooth Scrolling & Parallax (if that helps any).

Some of my GlobalScript code is derived from the demo included with this:
The Parallax Module

Main Issues
1. Music will not play in the title screen.
2. When I click "start game" everything works perfectly EXCEPT that the Smooth Scrolling module seems to be disabled. I can move the character around, but I'm stuck in the boxed area instead of being able to walk around the town with the scrolling screen. When I set the main character as "cEgo" vs the default "TitleChar" then he auto starts in town and everything works as I want with the scrolling. I obviously want a title screen so I have the character set back as TitleChar. I notice that it seems to turn on and the character is centered for a split second, then it pans to the left some and is stuck.
3. Not a must, but if anyone would like to share their Options Gui (title screen Settings menu) or just the code for it I'd love to see :).

Thanks in advance for any help!

I noticed that people seem to not know what to say to this issue  :(; that's not a good sign...


Here's part of my GlobalScript:


Code: AGS

function repeatedly_execute() 
{
 
  if(gIconbar.GetAtScreenXY(mouse.x, mouse.y) == gIconbar && Mouse.Mode != eModeUsermode3) 
  { 
    Mouse.Mode = eModeUsermode3;
  }
  else if(gIconbar.GetAtScreenXY(mouse.x, mouse.y) != gIconbar && Mouse.Mode == eModeUsermode3 && TitleChar.Room != 301)
  {
    Mouse.Mode = eModeWalkto;
  }
  else if(TitleChar.Room == 301)
  {
    Mouse.Mode = eModeUsermode3;
  }
 
 
}



The Title Screen script is as follows:
Code: AGS

function room_AfterFadeIn()
{
  


  aTest1Title.Play();
  mouse.UseModeGraphic(eModeUsermode3);
  gIconbar.Visible = false;
  gStatusline.Visible = false;
  gTitleScreen.Visible = true;
  
  Mouse.Visible = true;
  Mouse.Mode = eModePointer;
  

}



and the Code for the button when I click "Begin" in the Title Screen:
Code: AGS

function TitleBegin_OnClick(GUIControl *control, MouseButton button)
{
    gTitleScreen.Visible = false;
    cEgo.SetAsPlayer();
    SmoothScroll_PxOn();

}


Edit: I think I found the culprit  :).
While browsing through the code over and over, I noticed this function:

function game_start(){
 
  targetCharacter = player;
 
  system.vsync=true;
}

So naturally I added "targetCharacter = cEgo;" to my Begin button on the title screen and now it centers on the character. My controls are wonky now with right clicking, but I feel like I can probably do the rest on my own. I hope this helps some poor soul in the future when they have the same problem  :tongue:



Update #2: Fixed the Smooth Scrolling Module entirely.

I ended up adding a global variable to trigger in the begin button so that the global script knew when to stop forcing the title screen mouse state (I need it to change when right-clicking to walk, use, look at, talk).

My "repeatedly_execute()" script was slightly modified to:
"else if(TitleChar.Room == 301 && clickbegin == 0)" to take the global variable into account.

function TitleBegin_OnClick(GUIControl *control, MouseButton button)
{
    clickbegin = 1;
    gTitleScreen.Visible = false;
    cEgo.SetAsPlayer();
    targetCharacter = cEgo;
   
}
#43
Quote from: amateurhour on Tue 16/10/2012 01:33:15

Note: The mouse visible was activated because the mouse, status bar, and icon bar are turned off during my opening credits cutscene (room) and I don't turn them back on until later, except for the mouse temporarily so that I can navigate the title screen itself.

It was literally that simple, unless I've done it wrong, but it works.     

I just made a title screen that does the job pretty well using a static image background with three hotspots for new game, load, and quit, and here's the code I used, if it helps.       

Thanks! I went ahead with the Gui option but a lot of the coding will be good to have since I have to script the buttons the same way. I was able to make a title screen and now it's just a matter of linking everything the right way. Really appreciate the help  :)
#44
Update: I made the bottom bar Gui (gIconbar) initially off instead(in gui settings). I don't know why I can't just disable it in the map scripting, but oh well.

For the town1 map script I added:
gIconbar.Visible = true;
gTitleScreen.Visible = false;

For the Title Screen map (301) I added:
gIconbar.Visible = false;
gStatusline.Visible = false;

and now I'm able to switch from the title screen to first map just by changing who the default character is (player 1 or TitleScreen character) since they, of course, have different starting maps. The title screen character is just a box that is invisible. So that's a baby step and thank you for the code :). I think I will choose the Gui method since you can do the nice press-down effect when clicking a button. I do want it to look professional.
#45
"
Few tips:
1. Use Room number > 300. This room won't save it's state and everything will reset to starting position if player re-visits Main Menu.
2. Set Room property "ShowPlayerCharacter" to false (where applicable), since you probably won't want your player character appear on the screen with menu options (or would you? in which case don't :)).

Actually I think most AGS games I saw used text drawn on room background or on objects to make main menu, rather than gui.
"

Hah, thanks I actually just changed ShowPlayerCharacter to False a bit ago. Alright so I can try objects on the room background and then from there see about using the keyboard to select them.

I still can't seem to get the Gui to go away. I went ahead and set the room number to 301 for the title screen as well.
#46
I have a rough shell of the game so far so I would like to add a title screen and menu when you first run the game.

My problem is that I literally have no idea where to start besides making a new Room (importing the Title screen image as the background) and attempting to disable the main game Guis so they are not visible.

I tried doing this but the Gui is still visible (bottom bar).

function room_AfterFadeIn()
{

  gIconbar.Visible = false;
}

Keep in mind that I have already made intros, mini cutscenes and understand basic scripting so I'm not completely oblivious to what's going on. What code do I need to disable the Guis and bring up a menu (start game, load, exit)?

Is there an example Gui I can import and modify as my title screen with buttons?

Any help is greatly appreciated. I really tried searching this topic so I'm sorry if it's been asked countless times. I can't seem to find anything that will take me through step 1. I'm still looking through help topics and will post updates if I figure out something.

Basically right now I have a town that you can roam around in and talk with npcs. After realizing that I wanted to make the intro/menu part before I continue, I decided to create another blank map, import a title screen image and attempt to make the Gui vanish. I set the player as default starting on the blank title screen map, but I can't figure out the best course of action for making title screen buttons and the (repeatedly mentioned) Gui not being in the way.


Steps I need to do:

1. Start up the game, Title screen loads the background with no bottom bar Gui blocking it.
2. Have the menu with a few buttons that I can control with keyboard arrow keys and press enter to select one
3. Once you select "new game" it will shift to another menu with a "create character" button (I'll add more options myself when I figure out the process)
4. A character creation screen where you can place stats, skills, age, name, etc.
5. Cutscene plays
6. Current map loads with the character stats implemented, including character graphic customization (very limited, will expand upon it)

I am very determined in continuing this project with pages upon pages of backstory/general ideas. I'm sure some of you have felt that inspiration where you work on a project night and day. I'm in charge of all coding since I have a background in it (hard to believe with how awful I am with this), soundtrack creation and sound effects. My friend at the Airforce Academy is especially good with artwork and storybuilding. I want to thank this forum for the people really out to help big projects get started. Rest assured your submitted responses will not be in vain and I'll eventually post a demo in a year or two so that you can see where your help went towards.
#47
Quote from: geork on Sun 14/10/2012 23:10:15
Hope this solves it :)

I added to your code once I figured out what was going on. Here's what I ended up with to make it 100% what I wanted =]

Thanks again.

Code: AGS
function repeatedly_execute() 
{
  // put anything you want to happen every game cycle here

  if(gIconbar.GetAtScreenXY(mouse.x, mouse.y) == gIconbar && Mouse.Mode != eModeUsermode3) 
  { 
    Mouse.Mode = eModeUsermode3;
  }
  else if(gIconbar.GetAtScreenXY(mouse.x, mouse.y) != gIconbar && Mouse.Mode == eModeUsermode3)
  {
    Mouse.Mode = eModeWalkto;
  }
  //probably other code

}
#48
Quote from: Khris on Sun 14/10/2012 23:13:06
Quote from: Vault15 on Sun 14/10/2012 22:40:13"#sectionstart repeatedly_execute"

Wait a second, "#sectionstart"...?
Are you using some old game template? Or tutorial?

The "#sectionstart" stuff was discontinued as of AGS 3.0.

Well, you got me there. I noticed this template had a different method of doing that vs my other game using newer code. I guess I figured there's no point changing it. My game has nothing to do with this so I deleted almost everything but the shell and Smooth Scrolling/Parallax scripts. The reason being that I couldn't seem to get the smooth scroll to work starting from scratch. The guy who came up with that is brilliant and it is a huge building block to my project.

Edit: The 1 screen game came with the script to demonstrate what it can do. It's a very helpful tutorial sortof thing.
#49
Quote from: geork on Sun 14/10/2012 23:10:15
If you want the mouse cursor to change when it moves over the GUI, use GUI.GetAtScreenXY(x,y). This approach will mean it's in repeatedly_execute(), but I can't really think of another function to put it in, since AGS has to constantly check whether the mouse is in a certain area... 
something like:
Code: AGS

function repeatedly_execute(){
  if(GUI.GetAtScreenXY(mouse.x, mouse.y) == gGUI && Mouse.Mode != eModePointer) { //you'll want to check whether the mouse mode has already been changed...no point doing it twice!
    Mouse.Mode = eModePointer;
  }
  //probably other code
}

Where "gGUI" is the name of your GUI

Hope this solves it :)


Fantastic, thanks for the quick response! All I did was substitute my Gui in the code and it changed as I wanted. By the way, when I move the cursor back to the main area, what's the script to set it back to my mouse cursor 0 (first one)? I feel like if I force it back it will interfere with how it's currently set up. I have it where I right click in the main screen and it changes from look, use, talk, walk. I almost want to leave it as is, but if there's some simple code I can add then I'm all for it =P
#50
Hey, I just had another quick question. Now that I have my Gui setup nicely, I just want the mouse cursor to change automatically when moving to it at the bottom.

Would I need to add something in the "#sectionstart repeatedly_execute" part of the globalscript or is there a better way? I am able to solve many of my problems with the included manual (incase anyone thinks to mention it). I just haven't quite got the gist of scripting.


Thanks again!
#51
Quote from: Khris on Sun 14/10/2012 19:16:35
Sure it does: in the GUI's properties, in the "Layout" category, change the "Top" value. (Make sure the dropdown menu is set to the GUI itself, not one of its controls.)
You can also change a GUI's position in scripts: gGUI.SetPosition(x, y);

Thanks to both of you for the info. Wow, I don't know what I did but initially I actually did mess with the "top" value and it didn't change the Gui at all in game. I'll try it again and definitely try the setposition script =]

Edit: I tried it again and the "top" value worked...*sigh* I should have just tried that again.
#52
Quote from: slasher on Sun 14/10/2012 19:01:29
May I ask why you have a screen sized gui simply for some buttons at the bottom of it?

Alright, so I had found an example Gui that was at the top of the screen. I was able to modify it so that it has inventory and menu buttons, but I wanted the Gui at the bottom instead. The only way I found to modify the example Gui so that it was on the bottom was to make the Gui the same height as the screen (it's invisible, but it allowed me to create another bar at the very bottom). I know it sounds ridiculous, but I honestly couldn't figure out any other way.

The Gui says Height: 768, Width: 1024 (completely transparent). I then made a rectangle button and imported the image of the bottom character bar that I want to display at all times in game. How else could I do this without the Gui being the same size as the screen?
#53
I'm working on an RPG and have a bottom bar that is permanently displayed as the player walks around (using smooth scrolling & parallax).

I got it on the bottom by making a huge transparent block (the height of the game screen, 768 pixels). The problem is that the game doesn't let me click anything but the buttons. I can't make the character walk or anything unless I put the Gui at the top. I'm doing something wrong and making it harder than it is I'm sure.

If I set "Clickable" on the Gui as "False" then I have the desired effect where the bottom bar stays visible as I move the character around, BUT I can't click any of the buttons. If I set it as "True" then the only things I can click are the buttons of the Gui and I can't move the player. Hopefully this information is all that is needed for a solution to click.

Any responses are greatly appreciated! I can't continue production until I get past this small, but major, issue.
#54
Surprisingly I have, although I realize now that it must have been for an older version. A lot of that looks familiar but beefed up info (I had found it on this forum earlier I believe). Definitely worth a bookmark, thanks.
#55
Outstanding, that did it! This makes the coding incredibly easy now =]

Also thank you for noting "SLoop or SRandom" as a comment since I do want some conversations to have a random response. I was actually trying to figure that out as well.
#56
Thanks for the info. I don't mean for someone to have to hold my hand, but is there any way you'd be able to explain the exact code I should add within MultiResponse? I feel like I will screw it up for sure just attempting that.
#57
I did actually try that as well and it seems to just literally display "&1". I don't know if it's the module's issue?
#58
I'm fairly sure this could be an easy fix. I was unable to find a solution so my apologies if it was obvious.

I'm just trying to make it where the sound clip of the character speaking starts right as the text comes up. Right now it's playing once I click out of the text that appears above the character.

My code:
Code: AGS

function Toilet_Interact()
{
  
  int state=Multi.Say("Look around. Can you see anything? I can't either.>I only remember where things are because my days are the epitome of redundancy.>I don't have to go and it's too dark.");
  if (state==1) aCell_toodark1.Play();
  if (state==2) aCell_toodark2.Play();
  if (state==3) aCell_toodark3.Play();

  
}
#59
(erased) - I can't seem to delete posts. Originally I had my entire code but it bloated the discussion far too much so I'm going to zip them all instead into 1 file. It's much better for everyone that way.

If a mod sees the (erased) posts, please delete them.
#60
What should I do with the VerbCoin gui script I have already? I'm not sure what all I need to keep or what will conflict with your code exactly. I can still tell that this is a tremendous help, so I was just checking since I'm sure my code conflicts somehow (is your code meant to work with the default verbcoin gui in ags?).

For some reason I get a compile error with "int width = GetTextWidth(text, lblStatusline.Font);"  - The error was in lblStatusline



Edit 2: Alright, here's exactly what I modified now. Is this correct?:

Code: ags

String oldLocationText;

function repeatedly_execute()
{
  if (!gVerbCoin.Visible)
  {
    String text = Game.GetLocationName(mouse.x, mouse.y);
    if (text == null) text = "";
    int width = GetTextWidth(text, Game.NormalFont);
    int height = GetTextHeight(text, Game.NormalFont, width);
    gOverhotspot.X = mouse.x; // text position begins at mouse.x
    gOverhotspot.Y = (mouse.y - height - 5); // position text 5px above mouse.y
    overhotspot.Text = text;
    oldLocationText = text;
  }
  else
  {
    // reposition gStatusline as needed
    GUIControl *control = GUIControl.GetAtScreenXY(mouse.x, mouse.y);
    Button *button = null;
    if (control != null) button = control.AsButton;
    if (button == null) return; // end the function if there mouse isn't over a button
    overhotspot.Text = "";
    if (button == look_button) overhotspot.Text = "Look at ";
    else if (button == interact_button) overhotspot.Text = "Use ";
    overhotspot.Text = overhotspot.Text.Append(oldLocationText);
  }
}




The default Guis mine came with were:

0: gOverhotspot
1: gVerbcoin
2: gInventory
3: gInvUnderlay


Thanks for your continued help.


Also if you do happen to look at the code I have, ignore the comments since they are unedited from the default gui script. Some comments won't make any sense (text saying right mouse when it's left, etc)
SMF spam blocked by CleanTalk