enabling hotspot in dialog

Started by , Wed 03/03/2004 21:21:36

Previous topic - Next topic

Rd27

Is it possible to enable a new hotspot in dialog?

There is a dialog in my game, where I want this to happen:
When the player choose the right option. Hotspot 11 turns on.

rtf

Add this to your global script:...

function dialog_request (int xvalue){
if (xvalue ==1){
EnableHotspot(11);
}
}

and in the Dialog Script Editor, do this under whatever option you want the player to click on:

EGO: Watch this, I can turn a hotspot on!
Run-script 1
EGO: Now, when I end the dialog, the hotspot will be mine for the taking!

That's all you have to do!
I fail at art.

Rd27

I already have something in dialog_request. So how do I do this new command there?

I tried, but when I start the game, it says: error(line 234) Nested functions not supported(you may have forgotten a closing brace).

This is my script:

function character2_a() {
 // script for character2: Talk to character
FaceCharacter(OLLI,ARI);
FaceCharacter(ARI,OLLI);
RunDialog (0);  

}
function dialog_request(int value){
 
if (value==1){
  MoveCharacterBlocking(ARI,249,194,1);
  DisplaySpeech(ARI,"Sain sen!");
  DisplaySpeech(OLLI,"Loistavaa!Heita tanne!");
  FaceCharacter(ARI,OLLI);
  FaceCharacter(OLLI,ARI);
  AddInventory(4);
 
  if (value==2){
    EnableHotspot(12);
  }
  }


function character2_b() {  <--- Line 234
 // script for character2: Look at character
DisplaySpeech(OLLI,"Siin on Ari,vanha paska!");  
}

function character2_c() {
 // script for character2: Interact character
DisplaySpeech(OLLI,"Jos ei kuitenkaan");  
}

function character0_a() {
 // script for character0: Talk to character
MoveCharacterBlocking(OLLI,229,205,0);
FaceCharacter(LEPPALA,OLLI);
RunDialog (2);  

}

Kweepa

You have forgotten a closing brace:

put it after

FaceCharacter(OLLI,ARI);
AddInventory(4);

}  // like so
Still waiting for Purity of the Surf II

Rd27

I got the game wrok now, but the Hotspot 12 still doesn't turn on >:(

First time player enters the screen,I have place that hotspot 12 is disabled.Is that correct way?

Hotspot12 is in room1 and the hotspot turns on in room2,when player chooses right dialoque option. Is that the problem?

Thanks for help ;D

Scorpiorus

Quote from: Rd27 on Thu 04/03/2004 19:20:12Hotspot12 is in room1 and the hotspot turns on in room2,when player chooses right dialoque option. Is that the problem?
Yes, you enable the hotspot in the current room. To enable a hotspot in a different room you need to set a global variable insetad of enableHotspot in the dialog_request then check that variable on player enters room 1:

function dialog_request(int value){
...
if (value==2){
//EnableHotspot(12);
SetGlobalInt(100, 1);
}

}

room 1 script (player enter room before fadein):

if (GetGlobalInt(100)==1) { //if GI#100 was set to 1
EnableHotspot(12); //enable hotspot
SetGloblalInt(100,0); //just reset GI back to 0
}

Rd27

Thanks!

It works now!
I had to remove SetGloblalInt(100,0); because it cause error and I don't know why. Is it bad thing that I remove it?

Can you tell me more about this SetGlobaInt thing? I have read it about in the manual,but I don't understand it. Now I just put the script that you told, but I don't know why I did it :-[

What if I have to do more these?How do I know what values I have to put?

Thanks

Scorpiorus

Quote from: Rd27 on Sat 06/03/2004 11:38:33I had to remove SetGloblalInt(100,0); because it cause error and I don't know why. Is it bad thing that I remove it?
I misspelled it - should be SetGlobalInt(100,0). If you don't put that command the hotspot will get re-enabled again and again every time player enters room 1.

QuoteCan you tell me more about this SetGlobaInt thing? I have read it about in the manual,but I don't understand it. Now I just put the script that you told, but I don't know why I did it :-[
Well, the SetGlobalInt command sets (hence the name) the global integer with the number stored in the 1st parameter to a value you specified as the 2nd parameter, so:

SetGlobalInt(100, 1);

will take the Global Int number #100 and set it to hold a 1, i.e GlobalInt100 = 1;

Later you can check if a certain global int holds a value:

if (GetGlobalInt(100) == 1) {

 EnableHotspot(12);  // enable hotspot
 SetGlobalInt(100, 0); // set global int number 100 to a new value (0)

}


QuoteWhat if I have to do more these?How do I know what values I have to put?
You choose the values you like. Just make sure you don't use the same global int number for two different things. Like in regards to the script above you really shouldn't use GlobalInt number 100, say, to store player's money also.

~Cheers


SMF spam blocked by CleanTalk