|
setfocus (none) loadroom (worldmap) |
|
on (click) {   setfocus (last)   beamto (self ; DestinationRoom ; 12 ; 27 ; 1) } |
|
on (loop1) {   setlight (room ; 50 ; 50 ; 50)   wait (1)   setlight (room ; 210 ; 150 ; 50)   wait (0,1) } |
|
on (loop2) {   follow (followcharacter ; self)   wait (1) } |
|
on (loop2) {   if_num (talknumber ; 0)   {     speech (figure1 ; Dialogtext 1)     setnum (talknumber ; +1)     wait (2)   }   if_num (talknumber ; 1)   {     speech (figure2 ; Dialogtext 2)     setnum (talknumber ; +1)     wait (2)   }   if_num (talknumber ; 2)   {     speech (figure1 ; Dialogtext 3)     setnum (talknumber ; +1)     wait (2)   } } |
|
on (use) {   taskbar (false)   setfocus (none)   loadroom (keypad) } |
|
on (enter)   setnum (click_count ; 1) |
|
on (mouse)   showinfo(Number 1 ; false) on (click) {   playsound (click)   if_num (click_count ; 1)     setnum (number1 ; 1)   if_num (click_count ; 2)     setnum (number2 ; 1)   if_num (click_count ; 3)     setnum (number3 ; 1)   setnum (click_count ; +1) } |
|
on (loop1)   if_num (click_count ; 4)   {     setnum (click_count ; 5)     if_num (number1 ; 3)       if_num (number2 ; 7)         if_num (number3 ; 2)           {           cutscene (right)           break()           }     cutscene (wrong)   } |
|
setfocus (last) taskbar (true) |
|
if_bool (flashlighton ; true)   setobj (flashlight ; 1) if_bool (flashlighton ; false)   setobj (flashlight ; 0) setnum (posx ; [mousex]) setnum (posx ; -50) setnum (posy ; [mousey]) setnum (posy ; -50) moveobj (flashlight ; 0+[posx] ; 0+[posy] ; 0) |
| setnum (number1 ; +[number2]) |
| setnum (number1 ; [number2] - [number3] * 3) |
|
if_num (number1 ; >20) oder if_num (number1 ; <[number2]) |
| offspeech (10 ; 3 ; Your Score : [score]) |
|
setstring (room ; firstroom) setnum (red ; 120) setnum (green ;200) setnum (blue ; 25) setlight ( [room] ; [red] ; [green] ; [blue] ) |
|
timer (seconds)   cutscene (anyblah) |
Look closely at the feet of the character. You will see that it has some minor glitches, but usally these aren't very bad.The floormirror-effect is placed after objects with the viewstyle "BACK". If you wanna place an objekt on the floor (like a carpet for example) you have to add it as an object with the viewstyle "MIDDLE". The character walks over it but the mirrored one will be covered by it. |
If you have objects that stand on the floor so they have their own reflections, too, you can use "BACK" Objects now.
|
You can select the option "depending on roomposition" in the roomwindow, which is highly recommended to make it look more real (You can see on the screen here what i mean). Because the character will be copied into the distance you have to make sure that the depthmap does not end at the bottom of the wall. Otherwise the character won't be mirrored down sized. Just like an object with the viewstyle "middle" a wallmirror FX-Shape has a middlepoint. This must be placed to the bottom of the mirror where the character stands in front of. If the reflection is to high adjust this middlepoint. Small corrections can be done with the position adjustment you can use when FX-Shapes are enabled in the roomwindow. The Wallmirror-Effect uses the opposite action that your character has. If he looks to the front and talks he will look back and talk in the mirror. Extra-Animations are always mirrored with a character looking back, because there is no opposite. So better don't let your characters make special animations infront of a wallmirror. Usally it will look stupid. If you want to place something onto a wallmirror (like a writing for example) you have to use an middle-object. The middlepoint must be on the same level as the one from the FX-Shape, then this object will be exactly between mirror and character. |
As you can see here you can use this FX Shape to adjust a weathereffect around any architecture in your room. The Barrier Shape should be a little bit larger as needed. To avoid seeing a particle disappear at once you can use the instruction "particleview" to set the rendermode for particles to BEHIND "Front"-Objects. Then you can place an object over the area and particles will smoothly vanish behind this object.
|
|
If your adventure gets bigger it often gets more complicated to script. Sometimes you will have to do some calculations in different locations in your game. Instead of having to copy/paste these Scriptparts over and over again you can use a function. How does that work? A function is a created script that can be executed with function (scriptname). A cutscenes interrupts the gameplay, a function will not. So functions are supposed to be for calculations and not for game-events. Example : Imagine you have a game with RPG values like HP and MP.These values will be changed everywhere in the whole game. If you want the display of these values to have a color depending to the values itself (red = low, blue = high) you will have to make some calculations to get the right colorvalue. (the downloadable example "Textout Demo" shows how this is done) So now, to prevend you from copy/pasting these color calculations to all places in the game where the HP/MP Values are changed you can create a function, write the scriptlines into a script called "textcolor" and execute them with function (textcolor) . Et voila. Looping functions : If you wanna use a scriptpart that loops everywhere in the game you had to use the mainscript. (see the Flashlight Tutorial for example) but, if you want these looping scriptlines to stop from time to time you had to enable/disable them with a variable. The bad news is that with this way your mainscript gets bigger and bigger. The solution is a looping function : function (scriptname ; infinitly) will loop a function until you stop it with stopfunction. To create a gameclock you can use a function. Create a script called gameclock and fill it with this :
Be sure to call these variables seconds, minutes ect and NOT second or minute cause these names are used by pacdk for the current system time. In your startscript you will have to reset these values :
To display this gameclock use : textout (1 ; Gametime : [hours]:[minutes]:[seconds] ; x ; y... ect) You can now enable and disable your gameclock by using : function (gameclock ; infinity) and stopfunction (gameclock) To tie events on your clock just check the vars... if_num (hours ; >1) for example makes things happen after two hours of playing. If you want to create an elevator (or a moving platform) in your game you want to move a character but the character should not "walk". For this you can use the new instructions Linkchar and Unlinkchar. These will link a character to an object and its movements, which means he will be moved when the object is moved (by "moveobj") but without performing a walk animation. Also the player cannot controll a linked character. What you have to make sure : To prevent your character from zooming back when he moves up on an elevator use the instruction stopzooming. A linked character can be moved over blocked walkmapareas BUT, when you unlink him be sure that the spot he is standing on is free, otherwise he will be stucked. The Functiondemo contains a little demo in room 8, which shows you how an elevator can work. - In the projectsetup turn the standard "Actiontext" off. - Within your startscript set a textoutline (with the look and position you wish) and make sure it contains the variable [actiontext]. - If you want your line to be binded with the taskbar, coinmenu ect use the bindtext instruction. - Use textalign for changing the alignment of the textoutline. Thats it. Every animationframe of an item, object or character can have a single line of script. The simpliest way to use this is to play a soundfile at a certain point of an animation. For this there is an easy way : Just Drag&Drop a soundfile onto a single frame and a playsound instruction will be created. Other possibilities : A self-coloring object via setobjlight, a character who shakes the screen with every step by using jiggle or an object that moves itself with moveobj. Remember : For example, if you oszilate the color of an object in its state 2 you have to reset the color in the first frame of all other states its using, because you don't know at which point of an animation the state will change! Moving Objects : With the command Moveobj you can move objects to another location in a room. With if_xobj and if_yobj you can check the current position of an object. Use the keyboard : With the commands if_keydown and if_keypressed you can access the keyboard for use it in minigames. Object Groups : With the instruction group you can group up to 20 objects together. This group can be used with setobj and moveobj for moving or changing all objects within a group at once! |