Author Topic: Simulating a WMP without using the WMP by Ghreyfain and MaxTeamBG  (Read 6259 times)

0 Members and 1 Guest are viewing this topic.

Offline Amy

  • Global Moderator
  • Level 3
  • *****
  • Posts: 1235
  • Karma: +85/-10
  • Gender: Female
    • View Profile
Ghreyfain:

Here's some information for those who already know what the WMP does and how the general idea works.

Instead of using the standard WMP (making a new one), it's possible to simulate worldmap behaviour by using a standard ARE file.

How to do it:

Create the .are using the bitmap of your worldmap, and give it white search/light maps.

For the clickable "areas" that are visitable, make a Trigger Region with an attached script.

This script should be something like:

IF
Clicked([ANYONE])
THEN
RESPONSE #100
ActionOverride(Player1,LeaveAreaLUA("ARxxxx","",[x.y],z)
END

Where ARxxxx = the area you want to travel to
[x.y] being coordinates
z being the direction they're facing

Now convert this Trigger Region to an Info Region using IETME. This retains the script you added, but now the script will actually work (the trigger Clicked() doesn't seem to work for Trigger Region scripts).

That's about all that's necessary.


Some additional features we've been discussing are:

Accessing the world map by use of a hotkey. Add this block to baldur.bcs:

IF
Hotkey(M)
THEN
RESPONSE #100
ActionOverride(Player1,LeaveAreaLUA("MapArea","",[x.y],0)
END

Where x and y equal coordinates of the area you're coming from, as located on the world map. (i.e. you come from The Docks, whose coordinates in MapArea.are are 123.777. Thus the area.bcs for the docks sends you to coordinates 123.777 in MapArea.are)

Making the party unselectable, and the entire map visible (using cutspy.cre).

Travel Time is still a bit iffy, but Max says he knows how to do it.

Other features are still being investigated...

Offline Amy

  • Global Moderator
  • Level 3
  • *****
  • Posts: 1235
  • Karma: +85/-10
  • Gender: Female
    • View Profile
Re: Simulating a WMP without using the WMP by
« Reply #1 on: July 11, 2012, 06:25:32 AM »

Max:

Advancing game time based on where you're travelling to... This took some thinking. hehe.

First, each area, in it's script, will set how far it is from other areas... so the block might look like this:

(Unreachable areas use -1)

IF
Global("SetDistances","GLOBAL",0)
THEN
RESPONSE#100
SetGlobal("SetDistances","GLOBAL",1)
SetGlobal("HoursToARYYYY","GLOBAL",48) //2 days
SetGlobal("HoursToARZZZZ","GLOBAL",4) //4 hours
SetGlobal("HoursToARCCCC","GLOBAL",15) //15 hours
SetGlobal("HoursToARBBBB","GLOBAL",-1) //unreachable
END




Then comes the actual script for the worldmap ARE.

It goes (the rest of these examples will use ARYYY as the example)...

IF
Global("Spawn","MAPARE",0)
THEN
RESPONSE#100
SetGlobal("Spawn","MAPARE",1)
CreateCreature("MAPCRE1",[1.1],0) //invisible/immortal CRE that controls calculations
END

IF
!Global("SetDistances","GLOBAL",0)
THEN
RESPONSE#100
SetGlobal("SetDistances","GLOBAL",0)
END




Next is the script for the Transition Trigger...

IF
Clicked([ANYONE])
!GlobalLT("HoursToARYYY","GLOBAL",0)
THEN
RESPONSE#100
AddGlobals("DistanceToArea","HoursToARYYYY")
SetGlobal("ToARYYYY","GLOBAL",1)
END

IF
Clicked([ANYONE])
GlobalLT"HoursToARYYY","GLOBAL",0)
THEN
RESPONSE#100
DisplayStringHead(Myself,5684) //Destination Unreachable
END




Global("ARYYYY","GLOBAL",1) then triggers the calculating CRE's script...



Here's the CRE's script (MAPCRE1.bcs)... it is used first to set up the calculations, then to finalize the calculations and begin the cutscene to move you to the desired area.

//Start Calculations

IF
Global("ToARYYYY","GLOBAL",1)
THEN
RESPONSE#100
SetGlobal("ToARYYYY","GLOBAL",2)
SmallWait(7)
ChangeAIScript("HOURCALC",OVERRIDE)
END

//Finalize Calculations
IF
Global("ToARYYYY","GLOBAL",2)
THEN
RESPONSE#100
SetGlobal("ToARYYYY","GLOBAL",0)
ClearAllActions()
StartCutSceneMode()
StartCutScene("ToARYYYY")
END




Now, the calculations script... the first one is HOURCALC.bcs. It sets a global ("CurrentHour") to mark what time of day it is. When that's done, it switches the script to DISTCALC.bcs to figure out how far ahead to set the game time.

IF
Global("CurrentHour","GLOBAL",0)
TimeOfDay(0)
THEN
RESPONSE#100
AddGlobals("DistanceToArea","CurrentHour")
SmallWait(7)
ChangeAIScript("DISTCALC",OVERRIDE)
END

IF
GlobalGT("CurrentHour","GLOBAL",0)
THEN
RESPONSE#100
AddGlobals("DistanceToArea","CurrentHour")
SmallWait(7)
ChangeAIScript("DISTCALC",OVERRIDE)
END

IF
Global("CurrentHour","GLOBAL",0)
TimeOfDay(1)
THEN
RESPONSE#100
SetGlobal("CurrentHour","GLOBAL",1)
END

IF
Global("CurrentHour","GLOBAL",0)
TimeOfDay(2)
THEN
RESPONSE#100
SetGlobal("CurrentHour","GLOBAL",2)
END

IF
Global("CurrentHour","GLOBAL",0)
TimeOfDay(3)
THEN
RESPONSE#100
SetGlobal("CurrentHour","GLOBAL",3)
END

IF
Global("CurrentHour","GLOBAL",0)
TimeOfDay(4)
THEN
RESPONSE#100
SetGlobal("CurrentHour","GLOBAL",4)
END

IF
Global("CurrentHour","GLOBAL",0)
TimeOfDay(5)
THEN
RESPONSE#100
SetGlobal("CurrentHour","GLOBAL",5)
END

IF
Global("CurrentHour","GLOBAL",0)
TimeOfDay(6)
THEN
RESPONSE#100
SetGlobal("CurrentHour","GLOBAL",6)
END

IF
Global("CurrentHour","GLOBAL",0)
TimeOfDay(7)
THEN
RESPONSE#100
SetGlobal("CurrentHour","GLOBAL",7)
END

IF
Global("CurrentHour","GLOBAL",0)
TimeOfDay(8)
THEN
RESPONSE#100
SetGlobal("CurrentHour","GLOBAL",8)
END

IF
Global("CurrentHour","GLOBAL",0)
TimeOfDay(9)
THEN
RESPONSE#100
SetGlobal("CurrentHour","GLOBAL",9)
END

IF
Global("CurrentHour","GLOBAL",0)
TimeOfDay(10)
THEN
RESPONSE#100
SetGlobal("CurrentHour","GLOBAL",10)
END

IF
Global("CurrentHour","GLOBAL",0)
TimeOfDay(11)
THEN
RESPONSE#100
SetGlobal("CurrentHour","GLOBAL",11)
END

IF
Global("CurrentHour","GLOBAL",0)
TimeOfDay(12)
THEN
RESPONSE#100
SetGlobal("CurrentHour","GLOBAL",12)
END

IF
Global("CurrentHour","GLOBAL",0)
TimeOfDay(13)
THEN
RESPONSE#100
SetGlobal("CurrentHour","GLOBAL",13)
END

IF
Global("CurrentHour","GLOBAL",0)
TimeOfDay(14)
THEN
RESPONSE#100
SetGlobal("CurrentHour","GLOBAL",14)
END

IF
Global("CurrentHour","GLOBAL",0)
TimeOfDay(15)
THEN
RESPONSE#100
SetGlobal("CurrentHour","GLOBAL",15)
END

IF
Global("CurrentHour","GLOBAL",0)
TimeOfDay(16)
THEN
RESPONSE#100
SetGlobal("CurrentHour","GLOBAL",16)
END

IF
Global("CurrentHour","GLOBAL",0)
TimeOfDay(17)
THEN
RESPONSE#100
SetGlobal("CurrentHour","GLOBAL",17)
END

IF
Global("CurrentHour","GLOBAL",0)
TimeOfDay(18)
THEN
RESPONSE#100
SetGlobal("CurrentHour","GLOBAL",18)
END

IF
Global("CurrentHour","GLOBAL",0)
TimeOfDay(19)
THEN
RESPONSE#100
SetGlobal("CurrentHour","GLOBAL",19)
END

IF
Global("CurrentHour","GLOBAL",0)
TimeOfDay(20)
THEN
RESPONSE#100
SetGlobal("CurrentHour","GLOBAL",20)
END

IF
Global("CurrentHour","GLOBAL",0)
TimeOfDay(21)
THEN
RESPONSE#100
SetGlobal("CurrentHour","GLOBAL",21)
END

IF
Global("CurrentHour","GLOBAL",0)
TimeOfDay(22)
THEN
RESPONSE#100
SetGlobal("CurrentHour","GLOBAL",22)
END

IF
Global("CurrentHour","GLOBAL",0)
TimeOfDay(23)
THEN
RESPONSE#100
SetGlobal("CurrentHour","GLOBAL",23)
END

Offline Amy

  • Global Moderator
  • Level 3
  • *****
  • Posts: 1235
  • Karma: +85/-10
  • Gender: Female
    • View Profile
Re: Simulating a WMP without using the WMP by Ghre
« Reply #2 on: July 11, 2012, 06:25:33 AM »
Now comes DISTCALC.bcs...

This algorithm will take all the previous information and put it to use, increasing the game time by the amount specified in the global variable, "HoursToARYYYY."

If the time to get there is greater than 24, then script will run until it hits 0 or less than 0. It works great.

Finally, once that's all computed, the script switches back to the CRE's original MAPCRE1.bcs.

IF
!GlobalGT("DistanceToArea","GLOBAL",0)
THEN
RESPONSE#100
SetGlobal("DistanceToArea,"GLOBAL",0)
SetGlobal("CurrentHour","GLOBAL",0)
ChangeAIScript("MAPCRE1",OVERRIDE)
END

IF
Global("DistanceToArea","GLOBAL",1)
THEN
RESPONSE#100
DayNight(1)
IncrementGlobal("DistanceToArea","GLOBAL",-24)
END

IF
Global("DistanceToArea","GLOBAL",2)
THEN
RESPONSE#100
DayNight(2)
IncrementGlobal("DistanceToArea","GLOBAL",-24)
END

IF
Global("DistanceToArea","GLOBAL",3)
THEN
RESPONSE#100
DayNight(3)
IncrementGlobal("DistanceToArea","GLOBAL",-24)
END

IF
Global("DistanceToArea","GLOBAL",4)
THEN
RESPONSE#100
DayNight(4)
IncrementGlobal("DistanceToArea","GLOBAL",-24)
END

IF
Global("DistanceToArea","GLOBAL",5)
THEN
RESPONSE#100
DayNight(5)
IncrementGlobal("DistanceToArea","GLOBAL",-24)
END

IF
Global("DistanceToArea","GLOBAL",6)
THEN
RESPONSE#100
DayNight(6)
IncrementGlobal("DistanceToArea","GLOBAL",-24)
END

IF
Global("DistanceToArea","GLOBAL",7)
THEN
RESPONSE#100
DayNight(7)
IncrementGlobal("DistanceToArea","GLOBAL",-24)
END

IF
Global("DistanceToArea","GLOBAL",8)
THEN
RESPONSE#100
DayNight(8)
IncrementGlobal("DistanceToArea","GLOBAL",-24)
END

IF
Global("DistanceToArea","GLOBAL",9)
THEN
RESPONSE#100
DayNight(9)
IncrementGlobal("DistanceToArea","GLOBAL",-24)
END

IF
Global("DistanceToArea","GLOBAL",10)
THEN
RESPONSE#100
DayNight(10)
IncrementGlobal("DistanceToArea","GLOBAL",-24)
END

IF
Global("DistanceToArea","GLOBAL",11)
THEN
RESPONSE#100
DayNight(11)
IncrementGlobal("DistanceToArea","GLOBAL",-24)
END

IF
Global("DistanceToArea","GLOBAL",12)
THEN
RESPONSE#100
DayNight(12)
IncrementGlobal("DistanceToArea","GLOBAL",-24)
END

IF
Global("DistanceToArea","GLOBAL",13)
THEN
RESPONSE#100
DayNight(13)
IncrementGlobal("DistanceToArea","GLOBAL",-24)
END

IF
Global("DistanceToArea","GLOBAL",14)
THEN
RESPONSE#100
DayNight(14)
IncrementGlobal("DistanceToArea","GLOBAL",-24)
END

IF
Global("DistanceToArea","GLOBAL",15)
THEN
RESPONSE#100
DayNight(15)
IncrementGlobal("DistanceToArea","GLOBAL",-24)
END

IF
Global("DistanceToArea","GLOBAL",16)
THEN
RESPONSE#100
DayNight(16)
IncrementGlobal("DistanceToArea","GLOBAL",-24)
END

IF
Global("DistanceToArea","GLOBAL",17)
THEN
RESPONSE#100
DayNight(17)
IncrementGlobal("DistanceToArea","GLOBAL",-24)
END

IF
Global("DistanceToArea","GLOBAL",18)
THEN
RESPONSE#100
DayNight(18)
IncrementGlobal("DistanceToArea","GLOBAL",-24)
END

IF
Global("DistanceToArea","GLOBAL",19)
THEN
RESPONSE#100
DayNight(19)
IncrementGlobal("DistanceToArea","GLOBAL",-24)
END

IF
Global("DistanceToArea","GLOBAL",20)
THEN
RESPONSE#100
DayNight(20)
IncrementGlobal("DistanceToArea","GLOBAL",-24)
END

IF
Global("DistanceToArea","GLOBAL",21)
THEN
RESPONSE#100
DayNight(21)
IncrementGlobal("DistanceToArea","GLOBAL",-24)
END

IF
Global("DistanceToArea","GLOBAL",22)
THEN
RESPONSE#100
DayNight(22)
IncrementGlobal("DistanceToArea","GLOBAL",-24)
END

IF
Global("DistanceToArea","GLOBAL",23)
THEN
RESPONSE#100
DayNight(23)
IncrementGlobal("DistanceToArea","GLOBAL",-24)
END

IF
GlobalGT("DistanceToArea","GLOBAL",23)
THEN
RESPONSE#100
DayNight(0)
IncrementGlobal("DistanceToArea","GLOBAL",-24)
END




After the CRE's script is set back to CREMAP1.bcs, he resets all the used global variables and starts the cutscene moving the party to the specified area.

IF
True()
THEN
RESPONSE #100
CutSceneId(Player1)
FadeToColor([20.0],0)
LeaveAreaLUAPanic("ARYYYY","",[x.y],FACE)
LeaveAreaLUA("ARYYYY","",[x.y],FACE)
ActionOverride(Player2,LeaveAreaLUA("ARYYYY","",[x.y],FACE))
ActionOverride(Player3,LeaveAreaLUA("ARYYYY","",[x.y],FACE))
ActionOverride(Player4,LeaveAreaLUA("ARYYYY","",[x.y],FACE))
ActionOverride(Player5,LeaveAreaLUA("ARYYYY","",[x.y],FACE))
ActionOverride(Player6,LeaveAreaLUA("ARYYYY","",[x.y],FACE))
MultiPlayerSync()
MoveViewObject(Player1,INSTANT)
FadeFromColor([20.0],0)
Wait(1)
EndCutSceneMode()
END





And that's that. I know this *looks* complicated, but it's really not when put into practice. Maybe I'll put up an example area sooner or later.