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

#1
Thanks for the help.  I'll definitely look into the plugin module.  I'm reading through the module manual now.  I'm sure it's mainly due to by inexperience, but it seems confusing at this point....I'm definitely up for the challenge and I'm taking it one line at a time.

@Khris:  Since my initial question was regarding doing this without a module, I have a follow up question.  I should have mentioned this before, but I do not need the NPCs to always show up in the same room as the player.  I wasn't sure if I could start them in a particular room and then have them follow a path through all 8 rooms and if the player enters a room where they would be located, then the player could interact.  I may not be thinking enough of of the box for the logic on this one.  I'm still sorting what's code logic and what's "perceived" logic, if that makes any sense.  :P

Again, since I'm, not familiar with using global scripts much, I wasn't sure if the logic would go there or if I had to build it in each room.  Would timers be a viable solution?

Here's my vision:
Map:
1
|
2-3-4-5-6-7-8

At game start, player will start in room5, NPC1 starts in room5 and NPC2 starts in room8.  Each room will have a single walk path that both NPCs will follow and only 1 NPC will be on screen with the player at any given time.  All rooms (1-8), will have a path so the NPC, in theory, will walk all 8 rooms.  As the player moves, depending on where the NPCs are in their 8-room "route", there may or may not be an available interaction between the player and NPC.  Also, if the player remains idle, in time, the player will see both NPCs walk through the current room as they follow their "circuit"/walk path.  Also, the NPCs will endlessly repeat their paths.

I'm open for any other suggestions and I'm not opposed to using the module if it looks like it will be the best solution, as long as there is nothing to worry about when the game is compiled and packaged.  Thanks to all for taking time to answer a planning-type question...hopefully it will help someone else as well.
#2
I'm needing to create a walk path for NPC that theoretically needs to span across 8 rooms.  Would it be possible to do this globally or would I have to code each path in each room?  For the coding, am I on the right track by using:
Code: AGS
cChar1.Walk (100,100, eNoBlock); //start him walking
    cChar1A.AddWayPoint(230, 150); //add some more waypoints to his path
    cChar1.AddWayPoint(20, 120);


Thanks!
-j
#3
Thanks geork.  I'll give it a try!
#4
This may be a quick yes or no answer, but now with my NPCs moving simultaneously, I need to have them continue to move while Room messages are displayed.  Is there a way to do this??

Here's the code I'm using: (thanks Khris):

Code: AGS
// room script file
function room_Load()
{
  mouse.UseModeGraphic(eModeWait);
  mouse.SetPosition(312, 192);
  //mouse.UseDefaultGraphic();
}

function room_AfterFadeIn()
{
  SetTimer(1, 400);
}

int delay;
     
function room_RepExec()
{
  if (!cAerialGirl1.Moving && delay) //only check if the NPC isn't moving
  {
    if (cAerialGirl1.y == 136) cAerialGirl1.Walk(203, 149, eNoBlock, eAnywhere);
    else if (cAerialGirl1.y == 149) cAerialGirl1.Walk(204, 136, eNoBlock, eAnywhere);
    delay = 0;
  }
    else if (!delay) delay = 1;
  
  if (!cAerialGirl2.Moving && delay) //only check if the NPC isn't moving
  {
    if (cAerialGirl2.x == 237) cAerialGirl2.Walk(170, 142, eNoBlock, eAnywhere);
    else if (cAerialGirl2.x == 170) cAerialGirl2.Walk(237, 147, eNoBlock, eAnywhere);
    delay = 0;
  }
    else if (!delay) delay = 1;

  if (!cAerialGirl3.Moving && delay) //only check if the NPC isn't moving
  {
    if (cAerialGirl3.x == 303) cAerialGirl3.Walk(235, 144, eNoBlock, eAnywhere);
    else if (cAerialGirl3.x == 235) cAerialGirl3.Walk(303, 135, eNoBlock, eAnywhere);
    delay = 0;
  }
    else if (!delay) delay = 1;
    
  if (IsTimerExpired(1))
  {
    DisplayMessageAtY(0, 20);
    DisplayMessageAtY(1, 20);
    DisplayMessageAtY(2, 20);
    DisplayMessageAtY(3, 20);
    cEGO.ChangeRoom(1, 229, 156);
  }
}


Everything works that in the code, however I would like for the NPC movement to continue while the messages were displayed.  I've searched for a eNoBlock type of condition to put on a textbox/message and can not find anything.

Thanks!
-j
#5
I'm sure I *should* have known that!!  At least now I understand the complete code that I'm using.  Believe it or not, it is getting easier  :P

Thanks Khris!  Works like a charm!!
-j
#6
Thanks Khris for the quick reply.  I can't seem to make your code work.  The character does nothing.  I've tried starting cAerialGirl1 at 204, 136..that did not work and I've also tried adding
Code: AGS

cAerialGirl1.Walk(204,136, eNoBlock, eAnyWhere);

to the room_Load() event, which makes it walk to the coords, however when it gets there, it stops.

I totally removed what I had and added your code to the repeatedly_execute event.  Did I do something wrong? Also, there is nothing else going on in the room.  This is the only code.
Thanks again,
-j
EDIT:  also, the whole screen is a walkable area....
#7
I'm needing to have 3 characters (or objects) walk/move on the screen at the same time.  I say either, because it doesn't matter to me which they are for this scene.  I have tried tackling it with timers, regions, hotspots, however nothing yields a successful result.  I've tried numerous blocking style arrangements, but I either get 1 moving and the other 2 not moving or I get all 3 moving to one location, then nothing.

For the scene, I have 3 characters/objects that each have their own separate 2 locations (walking points).  I need each to walk continuously back and forth between point A & B.

I think I'm on the right track with this code, but I seem to be missing something.  This is for one of the 3 (cAerialGirl1), which I'm assuming if I get it working, I can replicate it across the other 2 characters (cAerialGirl2 & 3).

Code: AGS

function room_RepExec()
{
  int characterLocation;
  if (!cAerialGirl1.Moving) //only check if the NPC isn't moving
  {
    if (characterLocation==1)
    {
      cAerialGirl1.Walk(203, 149, eNoBlock, eAnywhere);
      characterLocation=2;
    }
    else
    if (characterLocation==2)
    {
      cAerialGirl1.Walk(204, 136, eNoBlock, eAnywhere);
      characterLocation=1;
    }
  }
}


Again, I apologize if it's something simple.  Integers are not my strong suit yet and I'm learning as I go.  I've searched high and low in the manual, wiki and forums and the search has turned up nothing.  I may not be using the correct search criteria, but in any case, I'm stumped.  Thanks in advance for the help....AGAIN!!  :P
-j
#8
Well at my current coding level, you'll have to assume that I know nothing...  :P  But I'm working to change that...heh.

I was thinking that a variable would be possible, in fact my main problem with the schema earlier was because I thought that the -1 was a variable of sort, taking the player from -1 of current room, but it made alot more sense once I realized that it was just the default (invalid) property.  :)

My current project's map isn't that uniform, so I think what you gave me earlier will work the best.

Thanks again!  Another problem solved!!


#9
Thanks Khris.  I understand now...(thanks for the db analogy).  I was unclear on setting the custom properties, but I have figured it out now.  I was going into the schema and trying to change them there.  The room changes are now working.  Something I did has now caused cEGO to change his starting point, but I'm working on the fix now.  Next, I'll be working on the exceptions for the room to room transition that needs to go from the edge of current room to the middle of the next room, etc...  I'm guessing that this will need to be done manually from a separate region for that particular direction...(if I read it correctly from your first reply).

You've given me a great base to start with.  Can't thank you enough!!  Sorry for needing it spelled out more.

-j
#10
Thank again Khris.  Makes sense and I'm able to follow it.  One last question is on the schema changes.  I followed your directions, but can you explain them?  I'm getting this error when changing rooms "AGS had a problem running your game, etc...etc...  NewRoom:  room change requested to invalid room number -1.

Doing some testing with it (since I'm not familiar with the schema settings), I changed the east from -1 to 1, just to see and that makes cEGO go back to Room1 from any room that I have the NextRoom(); in the region's walksOnto event.  I'm going back through the code again to see if I may have missed something.  However, even though I have cEGO moving to Room 1 from any other room, the placement is working correctly.  :)

Thanks for your patience.
-j
#11
Thanks for the help guys.  Using my vast ignorance in scripting, I'm still a bit confused with a couple of items with the suggestions.

@Khris:  Since I've been digging through the forums for all of my questions, I've noticed that my reply in this case should be "Oh yeah, I meant to say that is what I planned to do...I happened to forget that part."  :P
However, I'll just stick to "I have no idea what I'm doing here."  I've taken each line and attempted to breakdown and dissect each line, so I can get everything out of it.  Here's what "I think" I know about the code:
Code: AGS

// add to global script
     
    #define border 10 //setting border size to 10
    bool map_room_change; //sets boolean for map_room_change (false by default)?  Yes, that's a question..  :P
     
    void NextRoom() {  //having issues with this one.  Not sure if I need to configure NextRoom somewhere.  void states that I don't need a value returned, correct???
      if (player.x < border) player.ChangeRoom(GetRoomProperty("west"));  //if cEGO x coord is less than border (10), cEGO goes west
      if (player.x > Room.Width - border) player.ChangeRoom(GetRoomProperty("east")); //if cEGO's x coord is more than the Room's width (320 - 10 = 310), cEGO goes east
      if (player.y < border) player.ChangeRoom(GetRoomProperty("north"));  //if cEGO's y coord is less than 10 (border), cEGO goes north
      if (player.y > Room.Height - border) player.ChangeRoom(GetRoomProperty("south"));  //if cEGO's y coord is 190 (200-10), cEGO goes south
      map_room_change = true; //
    }
     
    void on_event(EventType event, int data) {  //not sure here either...is this defining the return for all on_events for the map_room_change?
      if (event == eEventEnterRoomBeforeFadein) {  //if any room event occurs before fade in..????
        if (!map_room_change) return;  // exit here if intro / menu / other room -- Not exactly sure what this is doing
     
        int pr = player.PreviousRoom;  //defining int pr
        if (pr == GetRoomProperty("west")) player.x = border+2; //if cEGO's previous room was west of current room, cEGO will be placed at previous x coord +12 (10 for border + 2)
        if (pr == GetRoomProperty("east")) player.x = Room.Width - (border+2);  //if cEGO's prev room was east of current room. cEGO will be placed at 308 (320 for roomWidth - 12)
        if (pr == GetRoomProperty("north")) player.y = border+2;  //if cEGO's prev room was north of current room, cEGO will be placed at previous y coord +12
        if (pr == GetRoomProperty("south")) player.y = Room.Height - (border+2);  //if cEGO's prev room was south of current room, cEGO will be placed at 188 (200 for roomHeight - 12)
        map_room_change = false;
      }
    }


So how far off am I?  Hopefully not too far....Also all of my rooms are the standard 320x200, so I wont have any custom ones, at least not now...

Thanks again for all of the help!
-j
#12
Not sure where to start, but I'm needing a way to make characters change rooms and be positioned to a relative coordinate from the previous room.  (for example:  When cEGO is leaving the right edge of Room #1 at (317, 125), cEGO should appear at (3, 125) and so on...  I'm guessing I need to define this in the globalscript, since I need this for any/all rooms.  I'm familiar with the basic cEGO.ChangeRoom and cEGO.ChangeRoomAutoPosition commands, but I'm guessing that there's an easier way to do this than to have up to 200 cEGO.ChangeRoom.(#,x,y) commands...

I would assume that this has been implemented in other projects, however my searches are not producing anything helpful.  I'm 99% sure I'm not using the right criteria to find it, so if anyone could at least point me in the right direction, I would appreciate it.

Thanks in advance!!
-j
#13
Both worked great!  Thanks again for your help!!

I went with the globalscript option and added an animation of cEGO rising from his chair.  Here's my changes:

Code: AGS

if(Mouse.Mode == eModeWalkto && cEGO.View == 17)
      //if the user clicks in walk mode and the view of the character is 17
      {
        
        cEGO.LockView(14);
        //sitdown view
        cEGO.Animate(0, 7, eOnce, eBlock, eBackwards);
        //playing sitdown view in reverse for standing cEGO from seat
        cEGO.UnlockView();
      }


So does everything look clean?  Also, if I need cEGO to perform another sit/stand procedure, I should just add another if statement, with a different view, correct? (to the globalscript.asc file)

For the pixel shift, adding additional columns of pixels to offset the change worked perfectly...(took a few attempts, but all is well).

Thanks again!!!
#14
Thanks to you both for the guidance.  I'll be implementing this shortly and will report back with the results. I'm sure it's a valid fix, assuming I use it correctly  :P
#15
Here's what I'm trying to achieve:
My game starts with cEGO sitting in a chair.  Once the game starts, the player can either interact (HAND or EYE) an object on the table next to the chair or use WALK to stand up and move freely around the room.  While cEGO is sitting, there is an animated view that shows cEGO reaching out to the table next to the chair that he's in.

Here are the problems that I am running into:
Starting out with cEGO sitting:
Code for room_load:
Code: AGS
function room_load()
{
cEGO.LockViewFrame(17, 0, 0);
}

Currently, cEGO is sitting when the game starts, however if I use the WALK cursor anywhere else in the room, the view (17) is used as cEGO moves around the room (the game crashes once loop 0 completes, since its not a standard 4 loop view for walking.  Once cEGO starts moving using the sitting view, the wait cursor is displayed and nothing else can be done.  I have found that if I unlock the view under the function room_AfterFadeIn, cEGO will stand on his own and then everything works (WALK, etc...).  I'm using:
Code: AGS
function room_AfterFadeIn
{
cEGO.UnlockView();
}


Wasn't sure if I need to use IdleView here, since an animation plays while cEGO is sitting.  Also, I thought about using a hotspot for the entire room to make cEGO stand when the WALK cursor was used, but I read in the manual or wiki that the "any click on hotspot" was for anything EXCEPT the walk icon...so I'm stuck at what I need to do from here on this piece.

Next issue is the animation while cEGO is sitting.  cEGO "shifts" when the frame is played with his arm outstretched.  The view that I'm using is 5 frames.  Using the Preview option on the view animates it correctly (no shift), however if I check the Character View (centre pivot) option, the "shift" is there.  I have tried using cEGO.LockViewAligned with all 3 alignments with no luck.

In my game's current state, I am doing everything from the room script.  I have not attempted and global scripts and/or variables.  I'm not opposed to them, it's just not a topic that I've attempted yet... I am not an experienced programmer by any definition (which I'm sure is apparent).  Everything that I have has been a self discovery process using the forums/wiki/manual.  Please accept my apologies ahead of time if I'm unclear with my explanations.

Thanks in advance for any help/advice!

-j
SMF spam blocked by CleanTalk