Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Vibration(ish) (https://forums.graalonline.com/forums/showthread.php?t=74170)

theHAWKER 05-24-2007 05:59 AM

Vibration(ish)
 
I want to make a weapon so when you use it your screen shakes up and gives you mp but takes away heath.
i have the heath giving and mp getting things, and they work nicely but when i tryed to make the screen shake nothing eaven hapens :(

im using "setfocus" then quickly changing it a bunch to give that effect.
this is my script test:
PHP Code:

//#CLIENTSIDE
funtion onWeaponFired(){
setfocus(1,1);


i have tryed it without clientside and it still wont work :(

xXziroXx 05-24-2007 06:01 AM

funtion onWeaponFired(){

I believe you want:

function onWeaponFired(){

:p

godofwarares 05-24-2007 12:22 PM

Quote:

Originally Posted by theHAWKER (Post 1311292)
I want to make a weapon so when you use it your screen shakes up and gives you mp but takes away heath.
i have the heath giving and mp getting things, and they work nicely but when i tryed to make the screen shake nothing eaven hapens :(

im using "setfocus" then quickly changing it a bunch to give that effect.
this is my script test:
PHP Code:

//#CLIENTSIDE
funtion onWeaponFired(){
setfocus(1,1);


i have tryed it without clientside and it still wont work :(

Spell 'function' right.

Anyway, I beleive you want:

PHP Code:

for (temp.0temp.100temp.i++)
{
setfocus(player.random(-11), player.random(-11));
sleep(0.05);


If you have any questions, Ask here :]



PS: Congrats on learning GS2, You're getting there!

Novo 05-24-2007 12:58 PM

Add a resetfocus(); at the end too...

The setFocus only works well when your screen ( or character ) isn't at the edge of the level already.

zokemon 05-24-2007 01:52 PM

Quote:

Originally Posted by Novo (Post 1311352)
Add a resetfocus(); at the end too...

The setFocus only works well when your screen ( or character ) isn't at the edge of the level already.

Yeah, I wish you could setfocus off the screen (like see the blackness). It would really move Graal foward towards being able to use tilelayers to have a multi-storied building effect.

DustyPorViva 05-24-2007 05:37 PM

I used a timer and cos, so that it gave a vertical shaking. I'll see if I can get the formula.
Nevermind, it seems I'm having that 'you don't have admin rights' problem everyone else is. So ya... can't access the scripts I had online.
Anyways it was something like:
PHP Code:

function onWeaponfired() {
  
this.force=.5// force of the initial explosion
  
setTimer(0.05);
}

function 
onTimeout() {
  if (
this.force>0) {
    
this.angle=(this.angle+pi)%pi*2;
    
setfocus(player.x,player.y+cos(this.angle)*this.force;
    
this.force-=0.05;
    
setTimer(0.05);
  } else 
resetfocus();


I haven't actually what I just wrote though, so there may be problems.

xAndrewx 05-24-2007 07:21 PM

I made something cool on versus, I'll wip it back up for you.

HTML Code:

//#CLIENTSIDE
function onWeaponFired()
{
  this.weaponMode = !this.weaponMode;
  if (this.weaponMode)
  {
    setTimer(0.05);
  }
}
function onTimeout()
{
  if (this.weaponMode)
  {
    temp.currentAngle = (timevar2 * 5) % (2 * pi);
    tilelayers[0].x = player.x + (cos(temp.currentAngle) * 5);
    tilelayers[0].y = player.x + (cos(temp.currentAngle) * 5);

    setTimer(0.05);
  }
}

Didn't try it, should work though...

sam_is_me 05-25-2007 02:03 AM

k i kept my mouth shut for a while, but what is a temp.i, and why do you add ++ to it?

Sum41Freeeeek 05-25-2007 02:16 AM

Quote:

Originally Posted by sam_is_me (Post 1311615)
k i kept my mouth shut for a while, but what is a temp.i, and why do you add ++ to it?

temp.i is set to 0, it's just a variable

while temp.i is still less than 100, each time it loops, 1 will be added to temp.i, untill it hits 99 (since he didnt use <= ) so it will basically loop the "screen shake" 99 times.

DustyPorViva 05-25-2007 03:06 AM

It's still 100 because it starts at 0.


All times are GMT +2. The time now is 06:42 PM.

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