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

#2381
function dialog_request(int value) {

   if (value==1) {

      if (character[GetPlayerCharacter(2)].inv[1] > 0) {
         SetDialogOption (topic, 0, 7);
      }

   }
}

"int value" means that the value of the parameter (the "1" in "run-script 1") you pass to this function is stored in the integer variable named value.
With
  if (value==1) {
you check if this variable is set 1 (i.e. "run-script 1" was used). The code enclosed in the brackets is then executed.

To check if "run-script 2" was used, you just have to check if value is 2. Thus you would do:

function dialog_request(int value) {

   if (value==1) {

      if (character[GetPlayerCharacter(2)].inv[1] > 0) {
         SetDialogOption (topic, 0, 7);
      }

   }
   else // value is something else than the above
   if (value==2) { // run-script 2 was used
      // do stuff
   }

   // check for value==3 and so on
}
#2382
1st question:

FollowCharacter(ZOMBIE, -1); // stop following anyone

2nd question:

AnimateCharacter is a non-blocking function, meaning the command
  MoveCharacter(ZOMBIE,189,146);
is executed immediately afterwards before the animation had a chance to play.
Use
  AnimateCharacterEx (3,5,5,0,0,1); // animate blocking
instead.
#2383
1.) Here's a scenario:

Crossfade music tracks: Yes

Room 1
Music volume adjustment: Quiet
Play music on room load: 1

Room 2
Music volume adjustment: Loud

Now, when you change rooms from 1 to 2, music 1 suddenly jumps to the loud volume setting although it is currently being faded out. This is very apparent if there's no other music being started in room 2.
I think it should fade out at the previous room's volume setting?



2.) In the palette window (32-bit), how about making the color number a textbox instead of a label, so the value can be copied into the clipboard?
Also, it would be nice if it could work in reverse, ie you copy or enter a number there and you see which color it is?
#2384
You're welcome. :)
#2386
Is
SetDialogOption (int topic, int option, int new_state)
what you're looking for?
#2387
Advanced Technical Forum / Re: Mirror effect
Mon 24/05/2004 22:02:36
You might want to use the new repeatedly_execute_always, so the mirror character gets updated even when the game is blocked (talking etc.).
#2388
Quotecheck if a config file exists, and if it does not i run setup

Good idea, that would be nice if it were done automatically.
#2389
There's no built-in function to move a non-player character (NPC) to a new room.

However, using script, you could do:

StopMoving(NPC); // you have to stop characters before manipulating x and y coordinates
character[NPC].room = 7; // number of room you want to put him in
character[NPC].x = 160; // x-coordinate of character in new room
character[NPC].y = 120; // y-coordinate of character in new room

You can also write a custom function if you need to use this often:

Global script (outside of any other functions)

function NewRoomExSpecial(int charid, int room_number, int x, int y) {
  if (charid == GetPlayerCharacter()) // specified character is the current player character
    NewRoomEx(room_number, x, y); // use the normal NewRoomEx function
  else { // for non-player characters
    StopMoving(charid);
    character[charid].room = room_number;
    character[charid].x = x;
    character[charid].y = y;
  }
}

Script header
import function NewRoomExSpecial(int charid, int room_number, int x, int y);

Then, in the Interaction editor -> Run script, for the first example, you would only have to write

NewRoomExSpecial(NPC, 7, 160, 120);

Hope this helps.
#2390
Sorry for being such a pain, but if plugins can draw directly onto the screen (that gets redrawn by AGS), could that be made possible from within AGS too?
#2391
Braces.

if (character[GetPlayerCharacter()].inv[3]) || (character[GetPlayerCharacter().inv[4]) { // player has cab fare

has to look either like

  if ( (this) || (that) ) { // proper syntax

or like

  if ( this || that ) { // works too

Edit: Btw, the character[].inv variables are whole integers, not just 0 and 1.
So you could have an inventory item MONEY with the value representing how much of it you have.
#2392
Beginners' Technical Questions / Re: hotspots
Sat 22/05/2004 21:01:01
I thought he meant how to use hotspots 17-19 since they all have the same color in the editor.
#2393
SetGlobalInt(23, GetGlobalInt(23)-GetGlobalInt(2));

should do it?
#2394
Right, just use MoveCharacterBlocking.

Edit: Come to think of it, the whole SetPlayerCharacter thing is pretty unnecessary. See my modifications above.

Edit 2: And the location variable is unnecessary now, too. :P GI 77 holds that value.

Edit 3: Aargh, no it's not. run-script 10 needs it. :P

Edit 4: No, it doesn't. Or does it? :D
#2395
I see. Thank you!
#2396
A single-color, partly transparent graphic overlay double the screen size causes about 15fps dropoff on my computer (640x480x32).
You're right, not much difference to RawRestoreScreen... :-\

Thanks anyway. :)

Edit: One last thing.

You said:
QuotePlugins don't tend to have this problem because they aren't copying such large chunks of data on a regular basis.

You mean restoring the background image?
Then how does the SnowRain plugin manage to be so fast? It has to clear the screen too somehow, right?
#2397
I was thinking about doing something like this myself, but haven't got around to it yet.
How about this (haven't tested it):

- CAB: Car character in map room
- CABDRIVER: Character to talk to when you want to use the cab
- Dialog topic 1: Talk to cab driver
- GlobalInt 77 stores which location to drive to when entering map screen

Dialog script for Topic 1

@S
option-on 1
option-on 2
option-on 3
option-on 4
//...
run-script 10
return

@1 // ego: Take me to location 1
set-globalint 77 1
run-script 11
return

@2 // ego: Take me to location 2
set-globalint 77 2
run-script 11
return

//...

Global script

int location=2; // game starts at this location

function dialog_request (int parameter) {
  if (parameter == 10) { // run-script 10: dialog startup
    SetDialogOption(1, location, 0); // turn off dialog option for current location
      // location number=dialog option number for this to work
  }
  else
  if (parameter == 11) { // run-script 11: player has chosen a destination
    if (character[GetPlayerCharacter()].inv[1]) { // player has cab fare
      location = GetGlobalInt(77); // set current location to destination
      NewRoom(MAPROOMHERE); // go to map room
    }
    else { // player doesn't have the cab fare
      string buffer;
      GetMessageText(500, buffer);
      DisplaySpeech(CABDRIVER, buffer); // cabdriver: Sorry, not enough money!
    }
  }
   
}

Map room

Player enters screen (after fadein)

  StartCutscene(4);
  if (GetGlobalInt(77) == 1) { // Player has selected location 1
    MoveCharacterBlocking(CAB, x, y, 0); // drive to location 1 on the map
    NewRoom(z); // go to this room when arriving at location 1
  }
  else
  if (GetGlobalInt(77) == 2) { // location 2
    MoveCharacterBlocking(CAB, x, y, 0); // drive to location 2
    NewRoom(z);
  }
  //...
  EndCutscene();

Edit: Changed everything back. This happens if I start to think too much. :P
Should work as it is now.
#2398
With "Disney style" I just meant not too much shading.

So, yes, that's exactly what I had in mind. Good job! :)

Keep 'em coming.
#2399
What I mean is this:
If you DON'T use the RawDraw functions in rep_ex, and only use them now and then as you say, there won't be a noticable difference if you use an additional overlay to draw upon.

But, if you DO use the RawDraw functions in rep_ex, there will be a significant performance gain since you don't have to use RawRestoreScreen to clear the screen.

Wouldn't this RawDraw overlay be a nice thing implement then?
#2400
Right, technically, you don't need brackets for every
if (character[GetPlayerCharacter()].inv[1] > 0) SetPlayerCharacter(HANSON);
but I recommend adding the brackets anyhow in case you decide to put more lines in there later.

I don't know what you're trying to do exactly. There's a lot of duplicate code in there. Could you elaborate?

QuoteI want it to be the character I am talking to, not my character.

You'd have to store the number of the character you're talking to in a variable before running the dialog. Then you could do
  string buffer;
  GetMessageText(500, buffer);
  DisplaySpeech(VARIABLECONTAININGCHARACTERYOURETALKINGTO, buffer);
SMF spam blocked by CleanTalk