One button with distinct functions in diferent rooms

Started by I<3Pindorama!, Sun 04/01/2015 18:16:28

Previous topic - Next topic

I<3Pindorama!

I created a button and would like it take different actions
depending on the room in which it is engaged.

For example, if he is in the room 1 then when clicked
the player will go to room 2, but if he is in the room 2
then the player will go to room 3 or if you are in room 3
the player back to room 1 (or go to any other room that I indicate).



Always grateful for any help or information where
i find a solution for this question!  :-D

Gurok

If this is a GUI button and you want to do this from a global script, you can use player.Room

Code: ags
function btnTeleport_OnClick(GUIControl *control, MouseButton button)
{
    if(player.Room == 1)
        player.ChangeRoom(2, 100, 50);
    else
        if(player.Room == 2)
            player.ChangeRoom(3, 100, 50);
        else
            if(player.Room == 3)
                player.ChangeRoom(1, 100, 50);
            else
                Display("No!");
}
[img]http://7d4iqnx.gif;rWRLUuw.gi

I<3Pindorama!

Perfect!


It was exactly what I needed!

Sorry for not mentioning this detail (Gui Button) because at first
it did not seem relevant ... naive mistake on my part, given that it
takes a different condition in Ags.

After all you helped me 2 times!
Thank you very much, Gurok!
;-D

SMF spam blocked by CleanTalk