Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   binocular action (https://forums.graalonline.com/forums/showthread.php?t=74167)

Raeiphon 05-24-2007 03:31 AM

binocular action
 
PHP Code:

function scope()
{
//scope function - triggered through onkeypressed
client.freezetime = -1;
this.xmod playerx;
this.ymod playery;
this.scopeon true;

onTimeout();
}

function 
onTimeout()
{
if (
this.scopeon) { setfocus(this.xmod,this.ymod); player.chat format("x-%d,y-%d",this.xmod,this.ymod); }

setTimer(.05);
}

function 
unscope()
{
this.scopeon false;
client.freezetime 0;
resetfocus();
setTimer(0);
}
function 
onKeyPressed(keycodekeyname)
{
 switch (
keyname)
 {
  
//scope xy modifiers
  
case "i"this.ymod += 1; break;
  case 
"j"this.ymod -= 1; break;
  case 
"k"this.xmod -= 1; break;
  case 
"l"this.xmod += 1; break;

  case 
"f"scope(); break;
  case 
"g"unscope(); break;
 }


What this is supposed to do, is to act like binoculars - the onkeypressed call giving the respective keys control over the view, by increasing xmod or ymod (which the setfocus is supposed to be derived from in the first place) when pressed. However, it's not working. To my knowledge, onkeypressed is called whenever the key is pressed, so there's really no excuse for it not to be working - as far as my logic chain goes.

Assistance here would be lovely. I honestly can't figure out why this isn't working, and I'm sure some of you scriptgods would love the opportunity to make me look bad. :p

Actually no, I just made myself look bad. This works, but not when you're fullscreened because the focus movement is so minimal. Begin laughing at me please. However, I could still use some assistance if you see anything you think should be changed.

-whimper-

EDIT: however, it does seem to have a 2x2 level limitation on a gmap. Is there any way to extend this range, or is this an engine limitation?

DustyPorViva 05-24-2007 03:49 AM

Well, that's because you're moving outside of the range of the loaded levels on a gmap. In gmap's, only the levels surrounding the player are loaded, and because you're just moving the camera focus and not the player, it doesn't load up any of the other levels.
You can overcome this by using a gmap option, though I don't remember it.

Raeiphon 05-24-2007 04:06 AM

I'm only after a 5x5 level range, so it's not like I'm after loading 50+ levels at once or anything.

DustyPorViva 05-24-2007 04:14 AM

You just have to tell the gmap to load all the levels at once.

zokemon 05-24-2007 01:46 PM

Place this in your GMAP file (edit it with notepad):
LOADFULLMAP


All times are GMT +2. The time now is 11:11 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.