Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Farming Script (https://forums.graalonline.com/forums/showthread.php?t=134256983)

Jman9912 11-19-2009 07:59 AM

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.

Switch 11-19-2009 11:40 PM

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

Jman9912 11-20-2009 12:53 AM

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.

fowlplay4 11-20-2009 02:06 AM

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;




All times are GMT +2. The time now is 08:02 PM.

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