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

#21
I want to run an object's animation after the player interacts with a NPC. First, I have the NPC walk to another part of the room, afterwards, I want the object to animate. The problem is, the global script doesn't recognize my object. What I did then is made my code in the global just for the NPC, then in the room I wrote a code for the object to run it's animation under certain conditions. But I don't know what function to place it under. I've tried Room Load after FadeIn and Repeatedly Execute, but to no avail.

Here's my global script code:
Code: ags
function cButt_Interact()
{
cPup.Walk(479, 218, eBlock);
cButt.Walk(500, 127);
cButt.AddWaypoint(557, 303);
cButt.AddWaypoint(441, 385);
cButt.AddWaypoint(37, 353);
cButt.Clickable = false;
}

And my Room code:
Code: ags
function room_AfterFadeIn()
{
if ((cButt.Clickable == false)&&(cButt.Moving == false)) {
  oFrogEatFly.SetView(16);
  oFrogEatFly.Animate(0, 0, eOnce, eBlock);
  cButt.ChangeRoom(2, 583, 450);
  oFrogEatFly.SetView(17);
  oFrogEatFly.Animate(0, 0, eOnce, eBlock);
  }
}

After the NPC walks to his location, nothing happens unless I leave the room and then come back again. Only then does the second code run.
Would the easiest thing be to simply make my object a character and handle it all in the global script? What am I doing wrong?
#22
The SetIdleView works perfectly, thanks! And yes, I ended up using the walks onto/off events. I have the region on a walkable area that has a specific view and with the standing event, if I move the cursor to the GUI toolbar, my character switches the normal view for some reason. In fact, I never have much luck with the standing event. But now it works perfect, so thanks guys.
#23
I get this error message when trying to run the following code...
Code: ags
function region1_Standing()
{
cPup.SpeechView = -1;
cPup.IdleView = -1;
}

Error (line 31): property 'Character::IdleView' is read-only

Just what does it mean by 'read-only'? And is there a different way to disable the IdleView on a region?
Thanks!
#24
Critics' Lounge / Re: Jango Fett
Thu 07/05/2009 17:11:02
The one on the left looks amazing, and I totally get the style. But seeing Jango without his helmet (or Boba for that matter) seems obscene to me. Sorry, I grew up with the original trilogy and loved the mystery of who or what Boba Fett was. I think Jango can only be Jango in full costume. But apart from that I love it and am looking forward to playing your game. How long do I have to wait for it? I was thinking about making a star wars game myself. Is it just about Jango and his adventures?
#25
How about "The Game with No Name"
#26
To GarageGothic, when I tried your code the Speaking View didn't work, so I changed the first else if to an if and it worked like a charm, thanks a lot.

To Hudders, you're absolutely right. I'm actually confused by a great deal. Perhaps I'd better go through the scripting tutorials again.

Thanks for the help guys and the fast responses. Now the only thing I have to figure out is how to add the 'SOLVED' to the subject header.
#27
Yes GarageGothic, the OR applies to the GetLocationType. Good call. The parenthesis worked perfectly. It seems that was the problem all along. And thanks Trent for the tip on cleaning up my code, it does make it easier to read. It was so messy because I did a lot of cutting and pasting.

Now as an addition, if I wanted to add an else statement that displays a message if the player uses the eModeStare on anything that isn't an object or character, basically a hotspot, would I place that at the very end of my code or would I place it after the GetLocationType statement? And would it even be an else, or an else if? Or would it just be another if, specifying eLocationHotspot? I'm pretty sure I've tried all these variations with poor results. Any suggestions?

Thanks a lot guys, you've saved my game again and educated me too.
#28
Me again with another problem...
I have these two mouse modes that I want to animate views when clicked. The Talkto refers to the speaking view of course, and the Stare refers to the Thinking view. I only want the thinking view to show when I click on objects or characters
Code: ags
function on_mouse_click(MouseButton button) {
  // called when a mouse button is clicked. button is either LEFT or RIGHT
  if (IsGamePaused() == 1) {
    // Game is paused, so do nothing (ie. don't allow mouse click)
  }
  else if (button == eMouseLeft) {
    ProcessClick(mouse.x, mouse.y, mouse.Mode );
      if (mouse.Mode==eModeTalkto) 
  player.FaceLocation(mouse.x, mouse.y);
  if (mouse.Mode==eModeTalkto)
      cPup.Say(" "); 
        if ((mouse.Mode==eModeStare)&&(GetLocationType(mouse.x, mouse.y) == eLocationCharacter)||
      (GetLocationType(mouse.x, mouse.y) == eLocationObject)) {
  cPup.FaceLocation(mouse.x, mouse.y);
  cPup.Think("               ");
      ate -= 1;  
        if (ate == 0) {
      btnIconStare.Enabled = false;
        mouse.SelectNextMode(); 
   }
   }
        }

The problem is that every left click on an object/character seems to initiate the eModeStare View whether that mode is selected or not. I know the problem is with my code, as I'm still trying to get the hang of conditional statements and haven't quite got it yet as you can see. I've worked over this for days and days now. Also, if I condense the two ifs:
Code: ags
      if (mouse.Mode==eModeTalkto) 
  player.FaceLocation(mouse.x, mouse.y);
  if (mouse.Mode==eModeTalkto)
      cPup.Say(" "); 

into
Code: ags
if (mouse.Mode==eModeTalkto) {
player.FaceLocation(mouse.x, mouse.y);
cPup.Say(" ");

it doesn't seem to run the eModeStare script at all.

Can someone tell me what I'm doing wrong?
Thanks in advance.
#29
It's okay, I just set it up for something better, where the player can eat all three radishes if he chooses and then after he uses the ability three times, it'll become disabled. I even have it so the cursor stays the same until the ability is exhausted, that way the player won't have to keep going up to the icon bar.

No Trent, there's no reason except that I didn't know anything about copies. I had to give the objects different names so I assumed the inventory items had to be named likewise. It's okay though, it's already done and works great. Thanks guys. I'm sure I'll be back with a new problem.

SOLVED!
#30
Wow, GG's code worked like a charm. I had seperated the three radishes into three if's because I thought I had to specify the item under LoseInventory. I didn't know I could use Active Inventory. It seems so obvious now. The btnIconStare.Enabled = true is necessary because once the icon is clicked and used, it becomes disabled. See the last if in the following code:
Code: ags
function on_mouse_click(MouseButton button) {
  // called when a mouse button is clicked. button is either LEFT or RIGHT
  if (IsGamePaused() == 1) {
    // Game is paused, so do nothing (ie. don't allow mouse click)
  }
  else if (button == eMouseLeft) {
    ProcessClick(mouse.x, mouse.y, mouse.Mode );
      if (mouse.Mode==eModeTalkto)
  player.FaceLocation(mouse.x, mouse.y);
  if (mouse.Mode==eModeTalkto)
  cPup.Say(" ");
      if (mouse.Mode==eModeStare){
  cPup.FaceLocation(mouse.x, mouse.y);
  cPup.Think("               ");
  btnIconStare.Enabled = false;
  mouse.SelectNextMode();

See, I use the Stare ability as the thinking view. Now I'm trying to figure out a way that if the icon is enabled, and he tries using a radish on himself, it'll display a message saying something like "you've already eaten" and not allow him to lose the radish until he uses the ability and disables it. Maybe I have to use variables?

And thank you monkey for telling me about how to post my code. I was trying to figure that out too. I hope it worked. Thanks a lot guys, I was struggling for two days on this.
#31
Hi everyone.
Okay, here's the situation...in my game when the playable character uses specific items on himself, he gains a special ability. The first time he does it, a message will pop up explaining the ability and how to use it. After that, when he uses these specific items, it will simply tell him the ability is activated. With my (probably unnecessarily long) script, I did manage to get that working. And then I added the "else" statement at the end, which would display a message for any other item he uses which would not activate his ability.

The problem is that after the activation message comes up as detailed in my "else if" statements, it follows with my "else" message display. i.e., "Scare Stare Activated" "You can't use that on yourself."

I think I understand why it's doing that, I just can't find away around it. Also, I know my scripts can be condensed in some way but mainly I just want it to work. I've tried it in a number of ways with more or less the same results.

Here's my script:

function cPup_UseInv()
{
  if ((cPup.ActiveInventory == iRadish1)&&(scarestare == 0)) {
  scarestare += 1;
  btnIconStare.Enabled = true;
  cPup.LoseInventory(iRadish1);
  Display(" New Ability Aquired: SCARE STARE!");
  Display(" Upon eating anything that's edible, Pupshaw will gain the ability to intimidate with SCARE STARE. However it may only be used once until Pupshaw finds something else to eat. The SCARE STARE ability can be found in the icon bar above."); 
}
else if ((cPup.ActiveInventory == iRadish1)&&(scarestare > 0)) {
    scarestare += 1;
    btnIconStare.Enabled = true;
    cPup.LoseInventory(iRadish1);
    Display(" SCARE STARE activated!");
  }
    if ((cPup.ActiveInventory == iRadish2)&&(scarestare == 0)) {
  scarestare += 1;
  btnIconStare.Enabled = true;
  cPup.LoseInventory(iRadish2);
  Display(" New Ability Aquired: SCARE STARE!");
  Display(" Upon eating anything that's edible, Pupshaw will gain the ability to intimidate with SCARE STARE. However it may only be used once until Pupshaw finds something else to eat. The SCARE STARE ability can be found in the icon bar above."); 
}
else if ((cPup.ActiveInventory == iRadish2)&&(scarestare > 0)) {
    scarestare += 1;
    btnIconStare.Enabled = true;
    cPup.LoseInventory(iRadish2);
    Display(" SCARE STARE activated!");
  }
      if ((cPup.ActiveInventory == iRadish3)&&(scarestare == 0)) {
  scarestare += 1;
  btnIconStare.Enabled = true;
  cPup.LoseInventory(iRadish3);
  Display(" New Ability Aquired: SCARE STARE!");
  Display(" Upon eating anything that's edible, Pupshaw will gain the ability to intimidate with SCARE STARE. However it may only be used once until Pupshaw finds something else to eat. The SCARE STARE ability can be found in the icon bar above."); 
}
else if ((cPup.ActiveInventory == iRadish3)&&(scarestare > 0)) {
    scarestare += 1;
    btnIconStare.Enabled = true;
    cPup.LoseInventory(iRadish3);
    Display(" SCARE STARE activated!");
  }
else {
  Display(" You can't use that on yourself.");
}
}
#32
Completed Game Announcements / Re: Chatroom
Tue 21/04/2009 19:23:34
This game is really fun. I loved the music too. I played it in the dark and felt like I really was in a Post-Apocolyptic future! I would have loved to learn more about the bots and the war and all of what happened. I was trying to get more out of Luke about those details but he'd rather of talked about art school. Anyway, I'm awaiting a sequel. Or a prequel. It's fun to go into actual chatrooms and pretend that you really are from a dark future, it really freaks people out and makes for funny chats.
#33
The manual tells me that when a NPC changes rooms, he does so instantly. I've found this is true. Even when I code him to walk off the edge of the screen and then change rooms, in runtime he doesn't even walk, he just vanishes. I've tried using regions as well. My question is, is there any way at all to have him walk off screen and then change rooms? And even more so, I'm curious, can he be performing functions in the other room without the playable character even there to see it? I'm not married to the idea, so don't go to any trouble experimenting, if you don't already know a solution. I just made a part of my game where my playable character (who's a sort of dog) can bark at these animals which scares them off in different directions. And I was playing with the idea that perhaps he can (if he chooses) to follow one into the next room to see it continuing it's journey. If the solution is far too complex, I'll probably dump the idea, as it's uneccessary to the game and kind of frivolous. Later on, I'll have much more important problems that I'll need your help with - all you smart folks out there, you know who you are. Thanks.   
#36
I can't thank you enough. One day I hope to be able to understand all that code and why it works. I tried the scripts tutorial, but for some reason I can't make sense of variables. But I'll get it sooner or later. Thanks again.
#37
Wow, thanks man. I should of thought of that. You guys are smart.
#38
Thanks guys! That code does the trick Khris, it looks great, just what I wanted. But let's say I wanted to apply this to the other characters in the room too. I tried using the same code with the other character names, but it wants me to change the variables, x, y, dist....If I change those variables, the code won't work.
#39
Thought I could use FolllowCharacter with special values to have character move away instead of follow. Basically, as my playable character approaches the other character, I want the other character to move away. I didn't want to set coordinates though, but instead have him move a few steps away if my playable character gets too close. Is this possible? I've searched the manual and forum to no end. thanks.
#40
Talking View! Of course! I forgot there was such a thing! Thank you!
SMF spam blocked by CleanTalk