Switching an Object back on in another room

Started by Fightmeyer, Tue 12/10/2004 12:33:03

Previous topic - Next topic

Fightmeyer

Hello Folks,

i made some kind of city-map for my game. If the player leaves a location, he can chose his destiny from the map. I used objects on the maps as symbols for the location. But not all objects are initially visible. THey only become visible if the player has done some special things.
If he had done these things, getting an information about a new location) i will switch over to the room (map) and i want to make the object blinking. Then he should return to the current room.

Room1 -> Get information -> Map (New Location blinking) -> Room1

I would like to bring the hole stuff in the script of Room 1. Is this possible or do i have to make this in Room Map?

I thought like this:

Room1

goto room Map
switch object back on (New Location)
wait 100
remove object (New Location)
switch object back on (New Location)
wait 100
remove object (New Location)
switch object back on (New Location)
wait 100
remove object (New Location)
return to Room1


Is this possible?

Scorpiorus

Yep, that's possible to implement. I'd use scripting to generalize the whole thing:

// script header

import function ShowMap();
import function HideMap();
import function ShowNewLocation(int newObject);


// main global script

function game_start() {
Ã,  // called when the game starts, before the first room is loaded
   SetGlobalInt(0, -1);
}

function HideMap() {
   NewRoom(character[GetPlayerCharacter()].prevroom);
}

function ShowMap() {
   NewRoom(MAP_ROOM);
}

function ShowNewLocation(int newObject) {
   SetGlobalInt(0, newObject);
   ShowMap();
}



// Map Room

on player enters screen (after fade-in)

int delay = 20; // delay of blinking
int times = 5;Ã,  // how many times it will blink
Ã, 
int newObject = GetGlobalInt(0);

if (newObject > -1)
{

   int i = delay*(times*2);
   while (i > 0)
   {
      if (i % delay == 0)
      {
         if (IsObjectOn(newObject)) ObjectOff(newObject);
         else ObjectOn(newObject);
      }
      Wait(1);
      i--;
   }

   ObjectOn(newObject);
   SetGlobalInt(0, -1);
   HideMap();
}

Thus, the following commands are provided:

ShowMap()
Opens the map room.

HideMap()
Return back to the current room. Should usually be called from withing the map room when player presses an exit button or whatever.

ShowNewLocation(int objectNumber)
Shows map with an objectNumber object blinking. See the delay and times parameters to control that blicking.

Hope it helps :)

Fightmeyer

Thanx. I will try it as soon, as i'm home again.

SMF spam blocked by CleanTalk