Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Molin

#1
yo martinreichl
i did this for you  .. it does what you wanted...
click to go to the post...

http://www.agsforums.com/yabb/index.php?board=2;action=display;threadid=7913
#2
Hi all...
dont know if anybody has done this before but here i  a snippet that puts the hotspot and object test besides the mousecursor in a offset. BASS like.

define globals:
int overlay = 0, olay1;

in repeatedly_execute():
if (IsGamePaused() != 1)
{
if (GetLocationType( mouse.x, mouse.y)!=0 ){
  string buffer;
  GetLocationName(mouse.x, mouse.y, buffer);
  if (overlay == 0)
  {
   
    olay1 = CreateTextOverlay (mouse.x+5,mouse.y-10,120,1,15,buffer);
    overlay = 1;
  }
  if (overlay == 1 && IsOverlayValid(olay1)==1)
  {
    SetTextOverlay (olay1,mouse.x+5,mouse.y-10,120,1,15,buffer);
  }
}
else {
overlay = 0;
if ( IsOverlayValid(olay1)==1 ) RemoveOverlay(olay1);
}
}


/Molin
#3
yes ofcourse..;)... BUT that was just to test the pathfinding. WICH sucks at the moment when trying to cross round things. BUt its all fun anyways.. I think i will get some help from the techs at my gamecompany to help me out. THAT way they can hack away to make it cool...

Ill post the functions here later when they are finsihed.
Later
/Molin
#4
ha a really nice hack this...;))

Anyways it walks sick sack on diagonal walkareas now such as stairs....;D.. UGLY but exactly what i wanted..

ITS STILL not in any way smart so i need to add smartest way prediction and so on..

but this works so far..

globals
int walkmode = 0, x, y, cX, cY;

function repeatedly_execute;
// put anything you want to happen every game cycle here

// <DM> X translation
if (walkmode == 1 && character[EGO].walking == 0 && character[EGO].x != x)
{
 // <DM> For every gamecycle collect character X,Y pos.
 cX = character[EGO].x;
 if (cX < x) { cX = cX+1; } else { cX = cX-1; }
 MoveCharacterStraight (EGO,x,character[EGO].y);
  // <DM> For every gamecycle check 1 pixels ahead in X to se if its walkable
 if (GetLocationType( cX, character[EGO].y )!=0 )
 {
  // <DM> we are here if X is nonwalkable, start Y translation
  walkmode = 2;
 }
 if ( character[EGO].y != y )
 {
  //<DM> We are here if character havent reached X goal
  walkmode = 2;
 }
}

// <DM> Y translation
if (walkmode == 2 && character[EGO].walking == 0 && character[EGO].y != y)
{
 cY = character[EGO].y;
 if (cY < y) { cY = cY+1; } else { cY = cY-1; }
 MoveCharacterStraight (EGO,character[EGO].x,y);

  // <DM> For every gamecycle check 1 pixels ahead in Y to se if its walkable
  if (GetLocationType( character[EGO].x, cY )!=0)
  {
    // <DM> we are here if Y is nonwalkable, start X translation
    walkmode = 1;
  }
  if ( character[EGO].x != x )
  {
     //<DM> We are here if character havent reached Y goal
    walkmode = 1;
  }
}

function on_mouse_click(int button);
StopMoving(EGO);
 x = mouse.x+GetViewportX();
 y = mouse.y+GetViewportY();
 walkmode = 1;

Im off to hackl soms more!
WOA!
/Molin
#5
agsking, then try this one it works..
#6
thx Gilbot.
Ok now it works with scrolling rooms if X and Y var i set like this,
x = mouse.x+GetViewportX();
y = mouse.y+GetViewportY();

#7
hi .
hm i tried this in a wery similar way yesterday and had some trouble when it hits a obstacle on the way. Also some trouble when having a scrolling screen.
What coords are used here for everything..? Charactermovement is Screencoords? Mouse is room coords??


#8
wow great replys.  thx for the transfer admin....

hm yes A L shape pathfinding like BASS is exactly what i meant.
Ill look into scripting this as well.

Perhaps some issues if you have wery narrow diagonal walkareas. HOWEVER that is a layout and design issue if one wants this "L" system.
#9
Hi all,
hm  I have looked through every bit of info i could find. AM I missing something or have none asked about only having 4 views for the pathfinding?? That is, only to have the top,left,right and down directions for character movement.

Anybody has any hints or pointers on  how to do this i would appreciate it.

thx
/Molin
#10
also let me just add that its pretty simple to make use of SetGUITransparency() to fade in/out the ui when it drops in/out.

nice!, this is fun...:)
#11
Hi all.
im new to this editor.
THis is my first script that some might find useful.. Its a function to make a scroll down inventory similiar to that in Beneath a steel sky...
For this particular script to work without modding it you have to set the inventory height to 23.

//in game start;
SetGUIPosition(2,0,-22);

// <DM> define ui timer
int timer = -22; //timer equals the ui height -1

in repeatedly_execute;
// put anything you want to happen every game cycle here

// <DM> UI slidedown
if (mouse.y <= (timer+23))
{
 if (timer <= -1) {
   timer++; SetGUIPosition(2,0,timer);
 }
}
// <DM> UI slideup
else
{
 if (timer >= -22) {
   timer--; SetGUIPosition(2,0,timer);
 }
}

Nothing much but  a start for me anyways....
/Molin
#12
hey man
thx a bunch!. I havent gotten to the ui handling as of yet.
I have done this simple ui slider though...

// <DM> define ui timer
int timer = -22; //timer equals the ui height -1
function repeatedly_execute() {
// put anything you want to happen every game cycle here

// <DM> UI slidedown
if (mouse.y <= (timer+23))
{
 if (timer <= -1) {
   timer++; SetGUIPosition(2,0,timer);
 }
}
// <DM> UI slideup
else
{
 if (timer >= -22) {
   timer--; SetGUIPosition(2,0,timer);
 }
}
/Molin
#13
i added a statement so that i can walk with the left button.

else if (button==LEFT && GetCursorMode() == 2 ) {
ProcessClick(mouse.x, mouse.y, MODE_LOOK); // look mode
}
else if (button==LEFT && GetCursorMode() == 0 ) {
ProcessClick(mouse.x, mouse.y, MODE_WALK); // walk mode
}
else { // right-click
ProcessClick(mouse.x, mouse.y, GetCursorMode()); // the currently selected mode


It would probably be nicer with a variable to set instead of all the ifstatements.. but heyit works anyway...:P
#14
hehe i did notice the missing bracket. No prb i figured it out though BUT bunch of thx for helping me with the script!

now ill try just to get rid of that clock appearing every now and then.... 8) a flickering mousecursor is wery annoying.
#15
hey hey hey!!! O NICE!  ;D

Thx a bunch GinnyW!.  I begin to understand the syntax and script structure as well now so pretty soon ill be off on my own wings.

Ill try installing it and try it out!

#16
hm they dont have what i am looking for. Any help on what i just asked? anyone?
#17
Hi all.
Im new to this editor and i like it so far.
I have some questions about scripting a few cursor and action related issues.

First of, I want to "copy" the functionality of the "Beneath a steel sky" cursor behaviour.

SO... Is there a way that one can script a global function that does this..
SetCursorMode() to swap cursorgfx and mode over hotspots. THEN change back when the user exits the hotspot.
LEFTCLICK should be "lookat" and RIGHTCLICK should be "interact/use".

Thx for any help or pointers...
ALSO i dont use the beta version of the AGS so i cant use any lucasarts GUI that you guys have posted that probably have these funtions.
SMF spam blocked by CleanTalk