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 08-18-2003, 07:01 AM
Dach Dach is offline
call me Chad, it's cooler
Dach's Avatar
Join Date: Aug 2002
Posts: 1,899
Dach is on a distinguished road
Vector Trigonometry...

This is what I came up with for making a circle without sine or cosine. To me the script looks like its a bit too long for what needs to be done (not talking about relative to using sin and cosine), so I'd appreciate if someone could point out a simpler way to do this. Either way, I'll be able to use this in future scripts to alleviate cpu usage so I'm rather happy. Umm... *runs back to AS*
Attached Files
File Type: graal vector_trig.graal (898 Bytes, 220 views)
__________________
Scripting Documents:Old Script Documentation-Movement Tutorial
Reply With Quote
  #2  
Old 08-18-2003, 07:24 AM
TribulationStaff TribulationStaff is offline
Registered User
Join Date: Jul 2003
Location: Pennsylvania
Posts: 368
TribulationStaff is on a distinguished road
Send a message via AIM to TribulationStaff
Works nicely. However, with such abbreviated variables, some comments would be nice. I can only make guesses at your thought process as is.

Tomorrow I will see what I can do.
__________________


Help me keep scripting
Reply With Quote
  #3  
Old 08-18-2003, 07:28 AM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura aboutadam has a spectacular aura about
Send a message via AIM to adam
*digs out his old trig book*

Hmm.. Yes yes.. Now to try to understand what you just did there.
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote
  #4  
Old 08-18-2003, 10:40 PM
Dach Dach is offline
call me Chad, it's cooler
Dach's Avatar
Join Date: Aug 2002
Posts: 1,899
Dach is on a distinguished road
oops, forgot how hard it is to understand any script without any kind of help;
r - radius
px - pointx
py - pointy
seg - segment length (parts of a tile or something...)
^ edit those to change the effects
dx - x dist from center to point
dy - y dist from center to point
c - vector length from center to point
uc - altered vector length (makes seg usefull)
pdx - dist I want to move point x
pdy - dist I want to move point y
pndx - new dist for point y
pndy - ^ same for x
nc - new radius
unc - altered new radius (keep the radius the same)
pnx - new point x
pny - new point y

basically i'm finding the tangent to the current vector, then changing the vector without altering the radius
__________________
Scripting Documents:Old Script Documentation-Movement Tutorial
Reply With Quote
  #5  
Old 08-18-2003, 10:50 PM
Python523 Python523 is offline
Banned
Join Date: Aug 2001
Location: Illinois
Posts: 3,498
Python523 is on a distinguished road
kai posted something that didn't require sin/cos besides for like 2 vars he created using it...I think I have it somewhere...

NPC Code:

if(playerenters){
this.rad=2.5;
this.x=0;
this.y=this.rad;
this.anginc=16/360;
this.s=sin(this.anginc);
this.c=cos(this.anginc);
timeout=0.05;
}
if(timeout){
this.x2=this.x*this.c-this.y*this.s;
this.y2=this.y*this.c+this.x*this.s;
this.x=this.x2;
this.y=this.y2;
x = 30 + this.x;
y = 30 + this.y;
timeout=0.05;
}


I might've edited it myself a little bit but oh well
Reply With Quote
  #6  
Old 08-19-2003, 01:17 AM
Dach Dach is offline
call me Chad, it's cooler
Dach's Avatar
Join Date: Aug 2002
Posts: 1,899
Dach is on a distinguished road
Quote:
Originally posted by Python523
whatnot
Oh jeez, I've been looking for that on and off since this spring! Never asked anyone for it though...
__________________
Scripting Documents:Old Script Documentation-Movement Tutorial
Reply With Quote
  #7  
Old 08-20-2003, 06:35 AM
wonderboysp2p wonderboysp2p is offline
Registered User
wonderboysp2p's Avatar
Join Date: Sep 2002
Location: -Wonderboy
Posts: 537
wonderboysp2p is on a distinguished road
Send a message via AIM to wonderboysp2p
ask and you shall recieve
__________________

we are the llama FORUms!!!EWQ Ce13d5423f23!! 2e1 @$6tgv3uy65!
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 08:01 PM.


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