Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-22-2011, 12:55 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
Online Level NPC Editor (OLNE)

Purpose
To allow quick and painless updating of hard-coded level NPCs while in-game.

On Zodiac for me, it was to finally change those yellow lights outside of OSL to orange.

Video


How-to Install
Add the script as a weapon on your server. Also update the levelfolders array on the server-side to match your server's folder setup. I set a default one that covers a fairly common/generic set though so it may not be required.

Also upload npc_placeholder.png in your server's images folder for blank NPCs to display properly. You can re-configure it to an image of your liking as well.

You will also need to give the (npcserver) write access to the level. I.e: rw levels/*.nw

In order to make changes to the levels you will also need write access to the levels as well.

OLNE Usage is automatically logged to logs/olne_log.txt

How-to Use
Press F9 to toggle the editor on and off.

It works pretty much exactly like it does in the offline level editor. Most showcharacter, and showimgpart NPCs (even the ones that use math in them) are displayed correctly as well. The editor windows are also unique to each NPC so you can open multiple NPCs at once.

Left-click to select an NPC.

Left-click and drag to move an NPC. NPCs will be made transparent while you're dragging them to make them easier to place in groups. I.e: Placing a light image over a lamp.

Double-click to open the NPC Script Editor.

Right-clicking an NPC will duplicate it.

Except when it comes to creating new NPCs. In my editor it's a mouse gesture.
  1. Hold down the right mouse button after 0.3 seconds the menu will appear. (You can re-configure this time easily)
  2. While holding down the right mouse, hover your mouse over the NPC you want to create.
  3. It will be created upon hovering over it and you can continue holding down the right mouse button to drag it into position.

If you make a change and don't want to save it, you can simply leave the level (or: reconnect, update level) to discard your changes as well. A level will only be updated if you make a change though.

Press F9 to save your changes and exit the editor.

Drawbacks
It does support GMAPs but only for editing the level you are currently in so be cautious of that. It will display the boundaries of the level when on a GMAP while dragging the NPC, as long as you keep it in the boundaries it will save in the correct spot.

Due to the way NPCs are stored in the level I also have it so levels get locked to prevent other users from making changes while you are. You will get a message stating who is currently editing the level if a locking conflict occurs.

Doesn't support default baddies, or chests nor do I plan on supporting them.

Editor doesn't support testing or styling. Use http://fp4.ca/gs2beautifier if you really need your code styled for you.

Detection of showimgpart, and showcharacter is lazy. It picks up the first occurrence and doesn't care if the line is commented out or not. Personally I kind of like it this way, lets me assign an editor-only image to an otherwise blank editor NPC.

The Script

Latest version at http://forums.graalonline.com/forums...1&postcount=69.
Attached Images
 
__________________
Quote:

Last edited by TSAdmin; 09-07-2013 at 10:02 PM.. Reason: getVarValue loop limit fix, updated link to download
Reply With Quote
  #2  
Old 08-22-2011, 01:04 AM
ff7chocoboknight ff7chocoboknight is offline
Skyzer Zolderon
ff7chocoboknight's Avatar
Join Date: Dec 2006
Location: New Hampshire, United States
Posts: 725
ff7chocoboknight is a glorious beacon of lightff7chocoboknight is a glorious beacon of lightff7chocoboknight is a glorious beacon of light
Send a message via AIM to ff7chocoboknight Send a message via MSN to ff7chocoboknight
Neato. :O
__________________
Reply With Quote
  #3  
Old 08-22-2011, 01:08 AM
0PiX0 0PiX0 is offline
Coder
0PiX0's Avatar
Join Date: Jan 2011
Posts: 130
0PiX0 is a jewel in the rough0PiX0 is a jewel in the rough
Seems like a very useful tool.

Quote:
Originally Posted by fowlplay4 View Post
It does support GMAPs but only for editing the level you are currently in so be cautious of that.
Maybe, if the player is in a gmap, outline the player's current level with a polygon.
Reply With Quote
  #4  
Old 08-22-2011, 01:26 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
Quote:
Originally Posted by 0PiX0 View Post
Maybe, if the player is in a gmap, outline the player's current level with a polygon.
I will be updating my script to do that shortly, it will also display a message when you do so.

Edit: Updated.
__________________
Quote:
Reply With Quote
  #5  
Old 08-22-2011, 02:46 AM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
Thats part of the best and most useful things for scripters I think but do you need to change anything in the serveroptions? I mean like for the online level editor the serveroptions also have some stuff to be setted. What about this?

Well anyway rep++ after I can rep again
__________________
MEEP!

Last edited by callimuc; 08-22-2011 at 03:18 AM..
Reply With Quote
  #6  
Old 08-22-2011, 03:10 AM
0PiX0 0PiX0 is offline
Coder
0PiX0's Avatar
Join Date: Jan 2011
Posts: 130
0PiX0 is a jewel in the rough0PiX0 is a jewel in the rough
Quote:
Originally Posted by fowlplay4 View Post
as long as you keep it in the boundaries it will save in the correct spot.
The image displayed should be forced to stay within the boundaries.

e.
Also, while dragging, I think that the player's position should not be able to change, so player.level cannot change while dragging. Not sure if that is an issue or not though since I'm just reading through the code.

Last edited by 0PiX0; 08-22-2011 at 03:28 AM..
Reply With Quote
  #7  
Old 08-22-2011, 07:00 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
Quote:
Originally Posted by 0PiX0 View Post
The image displayed should be forced to stay within the boundaries.

e.
Also, while dragging, I think that the player's position should not be able to change, so player.level cannot change while dragging. Not sure if that is an issue or not though since I'm just reading through the code.
Yeah you're right about that so it forces them inside the boundaries now.

As for the dragging thing, it isn't onPlayerEnters gets called and deactivates the editor.

Quote:
Originally Posted by callimuc View Post
Thats part of the best and most useful things for scripters I think but do you need to change anything in the serveroptions? I mean like for the online level editor the serveroptions also have some stuff to be setted. What about this?

Well anyway rep++ after I can rep again
Nope, all the level security is based around your's and the (npcserver)'s folder rights.
__________________
Quote:
Reply With Quote
  #8  
Old 08-22-2011, 06:13 PM
0PiX0 0PiX0 is offline
Coder
0PiX0's Avatar
Join Date: Jan 2011
Posts: 130
0PiX0 is a jewel in the rough0PiX0 is a jewel in the rough
Quote:
Originally Posted by fowlplay4 View Post
As for the dragging thing, it isn't onPlayerEnters gets called and deactivates the editor.
Ah, alright. I'll definitely try out the OLNE as soon I can. I'm just waiting for a replacement hdd to arrive. I'm betting this tool will make editing level npcs much more convenient, so I can't wait to try it out.
Reply With Quote
  #9  
Old 08-22-2011, 04:36 PM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
Ah ok thats good
__________________
MEEP!
Reply With Quote
  #10  
Old 08-22-2011, 04:51 PM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
Well I just tested it and it seems buggy. NPC images got suddenly changed, scripts like
Graal Script Code:
//#CLIENTSIDE
function onCreated() {
  
blockagain();
  
drawunderplayer();
  
setimgpart("callimuc_extra-sprites.png",32,0,32,32);

suddenly changed to
Graal Script Code:
//#CLIENTSIDE
function onCreated() {
  
blockagain();
  
drawunderplayer();
  
setimgpart("callimuc_extra-sprites.png,32,0,32,32);

or image names got completely removed. Would be nice if it could be fixed
__________________
MEEP!
Reply With Quote
  #11  
Old 08-22-2011, 08:03 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Quote:
Originally Posted by callimuc View Post
Well I just tested it and it seems buggy. NPC images got suddenly changed, scripts like
Graal Script Code:
//#CLIENTSIDE
function onCreated() {
  
blockagain();
  
drawunderplayer();
  
setimgpart("callimuc_extra-sprites.png",32,0,32,32);

suddenly changed to
Graal Script Code:
//#CLIENTSIDE
function onCreated() {
  
blockagain();
  
drawunderplayer();
  
setimgpart("callimuc_extra-sprites.png,32,0,32,32);

or image names got completely removed. Would be nice if it could be fixed
Was really funny, red and yellow squares everywhere. Nice code though fowlplay. Rep+
__________________
Reply With Quote
  #12  
Old 08-22-2011, 09:55 PM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
Quote:
Originally Posted by fowlplay4 View Post
Are you using V5 or V6?
Used v6
Quote:
Originally Posted by Emera View Post
Was really funny, red and yellow squares everywhere
Those where from the image as template xD
__________________
MEEP!
Reply With Quote
  #13  
Old 08-24-2011, 08:17 AM
0PiX0 0PiX0 is offline
Coder
0PiX0's Avatar
Join Date: Jan 2011
Posts: 130
0PiX0 is a jewel in the rough0PiX0 is a jewel in the rough
I tried this out. It is quite nice. Great work.

There is a bug when you change the npc's image to be nothing.

Please fix double-click detection. Sometimes if you click GraalControl then click a npc too soon, the script editor opens.
Reply With Quote
  #14  
Old 08-22-2011, 04:57 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 really like it- I'd use it if there was a tile preference too. [So I can edit the tiles in the level]

I'd rep too, but can't. Very well done, nice
__________________
Reply With Quote
  #15  
Old 08-22-2011, 05:14 PM
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
Quote:
Originally Posted by xAndrewx View Post
I really like it- I'd use it if there was a tile preference too. [So I can edit the tiles in the level]
It was designed to be used in conjunction with an online tile editor (why I used F9 instead of F4 to toggle it) and there's a few of those in the Code Gallery already.

Quote:
Originally Posted by callimuc View Post
Well I just tested it and it seems buggy. NPC images got suddenly changed, scripts like

or image names got completely removed. Would be nice if it could be fixed
Attach the level for me if you could. My editor checks if the images exist on the server when it goes to save them, which is probably what happened there. I will have to change that behavior. Edit: I fixed this behavior and now image is tracked with a different variable than image.

Are you using V5 or V6? There are some issues with getlines, and setlines in V5. I also was able to open, edit, and save your script without it messing up. I uploaded an updated version that prevents V5 from using it.
__________________
Quote:

Last edited by fowlplay4; 08-22-2011 at 05:55 PM..
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 08:13 PM.


Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright (C) 1998-2008 Linux cyberjoueurs All Rights Reserved.