Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-24-2007, 05:59 AM
theHAWKER theHAWKER is offline
**FLIP OUT**
theHAWKER's Avatar
Join Date: Mar 2006
Location: canada, vancouver
Posts: 768
theHAWKER is an unknown quantity at this point
Question 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
__________________
**FLIP OUT**
Reply With Quote
  #2  
Old 05-24-2007, 06:01 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
funtion onWeaponFired(){

I believe you want:

function onWeaponFired(){

__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #3  
Old 05-24-2007, 12:22 PM
godofwarares godofwarares is offline
Webmaster
godofwarares's Avatar
Join Date: Dec 2006
Location: Florida
Posts: 552
godofwarares is on a distinguished road
Send a message via ICQ to godofwarares Send a message via AIM to godofwarares Send a message via MSN to godofwarares Send a message via Yahoo to godofwarares
Quote:
Originally Posted by theHAWKER View Post
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!
__________________
What signature? I see no signature?
Reply With Quote
  #4  
Old 05-24-2007, 12:58 PM
Novo Novo is offline
[TServerDeveloper]
Join Date: Jun 2006
Posts: 448
Novo will become famous soon enough
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.
Reply With Quote
  #5  
Old 05-24-2007, 01:52 PM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
Quote:
Originally Posted by Novo View Post
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.
__________________
Do it with a DON!
Reply With Quote
  #6  
Old 05-24-2007, 05:37 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
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.
Reply With Quote
  #7  
Old 05-24-2007, 07:21 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
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...
__________________
Reply With Quote
  #8  
Old 05-25-2007, 02:03 AM
sam_is_me sam_is_me is offline
Registered User
Join Date: Sep 2004
Posts: 195
sam_is_me is on a distinguished road
k i kept my mouth shut for a while, but what is a temp.i, and why do you add ++ to it?
__________________
Aim: xxspazmxx929


Reply With Quote
  #9  
Old 05-25-2007, 02:16 AM
Sum41Freeeeek Sum41Freeeeek is offline
Future Coder
Join Date: Feb 2004
Location: New York
Posts: 376
Sum41Freeeeek is on a distinguished road
Send a message via AIM to Sum41Freeeeek
Quote:
Originally Posted by sam_is_me View Post
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.
__________________
Frankie Cassini: ex-Era LAT
Quote:
Originally Posted by brakk View Post
omg just go to your room and draw a pony then

**** the chicken wings!
Reply With Quote
  #10  
Old 05-25-2007, 03:06 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
It's still 100 because it starts at 0.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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