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 11-19-2009, 07:59 AM
Jman9912 Jman9912 is offline
Registered User
Join Date: Jun 2001
Location: North Carolina
Posts: 114
Jman9912 is on a distinguished road
Send a message via AIM to Jman9912
Farming Script

Hey guys. I'm coming back to graal and trying to adapt to gs2. It's going decent so far. There isn't much documentation. I'm working on a farming script for a bit of practice and was hoping I could get a little insight.

Pretty much, I am going to make a class NPC which will hold the code for the actual plant, a weapon npc for seeds which when used will trigger the class. I can't seem to find many examples or anything remotely close to learn from. Would anyone happen to have an example? Or maybe a bit of elaboration on what I am trying to do.

it doesn't seem too difficult, I just loose myself a bit and don't know which direction to go.

Thanks.
Reply With Quote
  #2  
Old 11-19-2009, 11:40 PM
Switch Switch is offline
o.o
Switch's Avatar
Join Date: Jan 2007
Location: Philadelphia
Posts: 3,038
Switch has a spectacular aura about
Send a message via MSN to Switch
You can use putnpc2() serverside to place the plant, and of course check if other plants are in the area of the new one before planting.
http://forums.graalonline.com/forums...57&postcount=3
__________________
Oh squiggly line in my eye fluid. I see you lurking there on the peripheral of my vision.
But when I try to look at you, you scurry away.
Are you shy, squiggly line?
Why only when I ignore you, do you return to the center of my eye?
Oh, squiggly line, it's alright, you are forgiven.
Reply With Quote
  #3  
Old 11-20-2009, 12:53 AM
Jman9912 Jman9912 is offline
Registered User
Join Date: Jun 2001
Location: North Carolina
Posts: 114
Jman9912 is on a distinguished road
Send a message via AIM to Jman9912
Thanks. That helps alot. What would be the best way to check in front of the player? I know I can use tomething like tile(x,y). But how would I check about 2 tiles in front of the player without having to do manually code each direction? I know it would have something to do with vecx,vecy.
Reply With Quote
  #4  
Old 11-20-2009, 02:06 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
This is pretty much the standard for getting the coordinates in front of the player.

PHP Code:
//#CLIENTSIDE
function onCreated() {
  
temp.target_x player.1.5 vecx(player.dir) * 2;
  
temp.target_y player.vecy(player.dir) * 2;

__________________
Quote:
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 04:41 AM.


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