Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-27-2007, 08:29 PM
Jeffyy Jeffyy is offline
Graphics Artist
Jeffyy's Avatar
Join Date: Dec 2007
Location: USA, NJ
Posts: 82
Jeffyy is an unknown quantity at this point
Gmap

Is it possible to make 2d images or flowers and trees lay randomly over a 2d gmap? If it is can anyone explain to me how?
Reply With Quote
  #2  
Old 12-27-2007, 08:36 PM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
have you read the levelgenerator tutorial/doc yet?
__________________
Deep into the Darkness peering...
Reply With Quote
  #3  
Old 12-27-2007, 08:40 PM
Jeffyy Jeffyy is offline
Graphics Artist
Jeffyy's Avatar
Join Date: Dec 2007
Location: USA, NJ
Posts: 82
Jeffyy is an unknown quantity at this point
Yes, I generated a g map with mountains and everything, im talking about images though not tiles.
Reply With Quote
  #4  
Old 12-27-2007, 09:09 PM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
oh, no, there no way to automatically add NPC's (Images)
__________________
Deep into the Darkness peering...
Reply With Quote
  #5  
Old 12-27-2007, 09:26 PM
Jeffyy Jeffyy is offline
Graphics Artist
Jeffyy's Avatar
Join Date: Dec 2007
Location: USA, NJ
Posts: 82
Jeffyy is an unknown quantity at this point
Ah, damn... thanks anyways.
Reply With Quote
  #6  
Old 12-27-2007, 09:43 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
Yes you can, in the editor at least:
Make a txt file in the folder levels/npcs... save it as something like
editnpcRandomTrees.txt
make sure the editnpc is at the beginning.
Then inside put:
PHP Code:
if (mousedown && leftmousebutton) {
  
treecount=10;
  for (
i=0;i<treecount;i++) putnpc door.png,tree.txt,(int(mousex/64)*64)+int(random(0,64)),(int(mousey/64)*64)+int(random(0,64));

You'll also have to make a file called tree.txt and put it in your Graal folder. Inside the tree.txt, have the script for your tree.
This will drop 10 random trees in the level, but you can change treecount to change that. Not much, but I'm sure you get the idea and can work from it.
Afterwords, open up the editor, then go to Predefined NPCs and go down to Editor Control-NPCs and click it, you should see the editnpc you created in the list. Select it, then just click on the level and it'll drop the trees in the level. DON'T click again unless you want to add more trees, change the tabs to like tiles or such so you won't drop anymore, then simply save the level.
Reply With Quote
  #7  
Old 12-27-2007, 09:58 PM
Jeffyy Jeffyy is offline
Graphics Artist
Jeffyy's Avatar
Join Date: Dec 2007
Location: USA, NJ
Posts: 82
Jeffyy is an unknown quantity at this point
Quote:
Originally Posted by DustyPorViva View Post
You'll also have to make a file called tree.txt and put it in your Graal folder. Inside the tree.txt, have the script for your tree.
What do you mean by "tree script"?
Reply With Quote
  #8  
Old 12-27-2007, 10:18 PM
Nabru Nabru is offline
100 IFP and runnin'
Nabru's Avatar
Join Date: Aug 2005
Location: Wisconsin
Posts: 440
Nabru will become famous soon enough
Send a message via ICQ to Nabru
Quote:
Originally Posted by Jeffyy View Post
What do you mean by "tree script"?
something of the setshape brand, for the most part.
__________________
~Urban
Reply With Quote
  #9  
Old 12-27-2007, 10:18 PM
Codein Codein is offline
jwd
Codein's Avatar
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
Codein has a spectacular aura aboutCodein has a spectacular aura about
Send a message via AIM to Codein Send a message via MSN to Codein
Quote:
Originally Posted by Jeffyy View Post
What do you mean by "tree script"?
Like if you're using setshape2 and what not, so only part of it's blocking and the rest is walk under.
Reply With Quote
  #10  
Old 12-27-2007, 10:26 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
If you're using NPCs for trees, then you'll be using GANI's and setshape. How about you post the tree image and such so we can better help you?
Reply With Quote
  #11  
Old 12-27-2007, 10:47 PM
Jeffyy Jeffyy is offline
Graphics Artist
Jeffyy's Avatar
Join Date: Dec 2007
Location: USA, NJ
Posts: 82
Jeffyy is an unknown quantity at this point
Well here,its not a tree, but the same basic idea... and i did as you said. But i have no idea what you mean by setting shape. I don't think i ever used it before. I'm fairly new to scripting if you couldn't tell.
Attached Images
 
Attached Files
File Type: txt editnpcRandomGstone.txt (189 Bytes, 143 views)
File Type: txt gstone.txt (4 Bytes, 144 views)
Reply With Quote
  #12  
Old 12-27-2007, 10:56 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
PHP Code:
//#CLIENTSIDE
function oncreated() {
  
setshape(0,48,32);

This will set the shape of the rock to 48x32 pixels. But in reality it sets the blocking shape, IE, how much of the NPC is like a wall. It really is hard to explain this stuff to a new scripter because manipulating setshapes for GANI's is slightly complicated in terms of explanation.
Reply With Quote
  #13  
Old 12-27-2007, 11:55 PM
Codein Codein is offline
jwd
Codein's Avatar
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
Codein has a spectacular aura aboutCodein has a spectacular aura about
Send a message via AIM to Codein Send a message via MSN to Codein
Quote:
Originally Posted by DustyPorViva View Post
If you're using NPCs for trees, then you'll be using GANI's and setshape. How about you post the tree image and such so we can better help you?
Why? I just use setshape2 in a class and join it to the trees :P
Reply With Quote
  #14  
Old 12-28-2007, 12:33 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
Because if you're doing something like a tree or house where you want the tree to have an overlapping top and only block at the base of the trunk, you're going to have to position it correctly in Graalshop and understand that setshape on Gani's start at the (0,0) position of the showcharacter(if using showcharacter, which you should) character box, and not at the corner of the gani like regular NPCs.
Reply With Quote
  #15  
Old 12-28-2007, 01:37 AM
Codein Codein is offline
jwd
Codein's Avatar
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
Codein has a spectacular aura aboutCodein has a spectacular aura about
Send a message via AIM to Codein Send a message via MSN to Codein
Quote:
Originally Posted by DustyPorViva View Post
Because if you're doing something like a tree or house where you want the tree to have an overlapping top and only block at the base of the trunk, you're going to have to position it correctly in Graalshop and understand that setshape on Gani's start at the (0,0) position of the showcharacter(if using showcharacter, which you should) character box, and not at the corner of the gani like regular NPCs.
But why a gani?
Reply With Quote
  #16  
Old 12-28-2007, 01:41 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Because if you've got a script in it, when you're using the editor, you can see what it will look like online, versus where it will just show the image.
__________________
Reply With Quote
  #17  
Old 12-28-2007, 02:01 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
Quote:
Originally Posted by Codein View Post
But why a gani?
Gani's let you specify where the setshape will be. I'll write up a tutorial on it later and make a webpage out of it. Right now, dinner must be cooked.
Reply With Quote
  #18  
Old 12-28-2007, 03:37 AM
Codein Codein is offline
jwd
Codein's Avatar
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
Codein has a spectacular aura aboutCodein has a spectacular aura about
Send a message via AIM to Codein Send a message via MSN to Codein
Quote:
Originally Posted by DustyPorViva View Post
Gani's let you specify where the setshape will be. I'll write up a tutorial on it later and make a webpage out of it. Right now, dinner must be cooked.
Hrm. To the pixel?
Reply With Quote
  #19  
Old 12-28-2007, 04:06 AM
Jeffyy Jeffyy is offline
Graphics Artist
Jeffyy's Avatar
Join Date: Dec 2007
Location: USA, NJ
Posts: 82
Jeffyy is an unknown quantity at this point
Quote:
Originally Posted by DustyPorViva View Post
PHP Code:
//#CLIENTSIDE
function oncreated() {
  
setshape(0,48,32);

This will set the shape of the rock to 48x32 pixels. But in reality it sets the blocking shape, IE, how much of the NPC is like a wall. It really is hard to explain this stuff to a new scripter because manipulating setshapes for GANI's is slightly complicated in terms of explanation.
The script doesn't work because of "setshape(0,48,32);" isn't correct... or somthing
Reply With Quote
  #20  
Old 12-28-2007, 04:08 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Jeffyy View Post
The script doesn't work because of "setshape(0,48,32);" isn't correct... or somthing
Remove the parenthasis.

In a GANI, you can always do something to see if it's online, carry this out offline, this out online.

I think there is if (playeronline) or something, if not you could do something like if ( serverr.onlineVar == 27) then online, else offline.
__________________
Reply With Quote
  #21  
Old 12-28-2007, 06:01 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
Well, a couple things wrong with what I posted earlier. I assumed this was for online... Either way, there are going to be some complications... You can either go ahead with this and do it for GS1 so you can see it offline in the editor... or do it in GS2 and not see the immediate effects offline... but make things way easier for you later. If you do it for the editor you're going to have a HELL of a lot of editing to do if you need to change even the slightest thing in the NPCs.
I suggest just going and putting this in the qstone.txt:
PHP Code:
//#CLIENTSIDE 
// (not sure if this script needs to be clientside or not)
function onCreated() {
  
this.join("qstone");

And have the script inside the 'qstone' class on the server. This way if you need to change anything, you simply change the class script and tada, all the trees are changed. You won't be able to see the effects offline, but I think the pros outweigh the cons. You'll still be able to see where the NPCs are placed in the editor, though.

EDIT: oh ya, and it's setshape(1,32,32); not 0, sorry about that.
Reply With Quote
  #22  
Old 12-28-2007, 03:44 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by DustyPorViva View Post
Well, a couple things wrong with what I posted earlier. I assumed this was for online... Either way, there are going to be some complications... You can either go ahead with this and do it for GS1 so you can see it offline in the editor... or do it in GS2 and not see the immediate effects offline... but make things way easier for you later. If you do it for the editor you're going to have a HELL of a lot of editing to do if you need to change even the slightest thing in the NPCs.
I suggest just going and putting this in the qstone.txt:
PHP Code:
//#CLIENTSIDE 
// (not sure if this script needs to be clientside or not)
function onCreated() {
  
this.join("qstone");

And have the script inside the 'qstone' class on the server. This way if you need to change anything, you simply change the class script and tada, all the trees are changed. You won't be able to see the effects offline, but I think the pros outweigh the cons. You'll still be able to see where the NPCs are placed in the editor, though.

EDIT: oh ya, and it's setshape(1,32,32); not 0, sorry about that.
First, the class should be joined serverside, not clientside.
but yah, I agree with you.
__________________
Reply With Quote
  #23  
Old 12-28-2007, 08:45 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
Hence my little comment, thanks for the correction
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 09:21 PM.


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