![]() |
Names in an array
Okay I haven't scripted much in GS2, infact the majority of the scripting I've done on Graal has been before the NPC Server so I am rusty (actually I think the last time I actually scripted I was using QBasic so rusty is an understatement).
Now that my situation has been explained, I'll ask my question; I'm doing my best to script a quest (rather simplistic one) that requires a player to do the work. At this point I want to store a list of titles, first names, and last names which will get randomly paired together the first time you talk to a certain NPC so a player can't just PM an FAQ to get this name for the second part of the quest. I'm really only looking for help on how to store a list of names, in QBasic you could easily store your names in an array and used a loop function to recall them. I'm wondering if there is a similar way in GS2? |
PHP Code:
|
Quote:
PHP Code:
|
GS2 is so neat, I didn't know you could assign multiple values to this.variables (and text values? Things sure have changed since I was last scripting). So basically this is the new way to create arrays?
Oh and thanks! |
Yo're welcome, and yes :]
New GS2 incorporates a lot more flexible and powerful features than the old scripting engine. It's really quite interesting and fun :] Any other questions, feel free to ask :D |
Okay I have another question, if nobody minds if I reuse this thread; I have an NPC that I want to move to certain points in a level, but I don't want it moving off the path. The following is a rough interpretation of my path.
HTML Code:
--------OO------ |
Quote:
|
Quote:
|
Quote:
Should show the basics of an A* path finding algorithm. |
1 Attachment(s)
OR instead of making a pathfinding algorithm, you could map out nodes and use those instead :)
Attachment 47391 The problem with A* path finding is that it will not always do well over distances with (quite) detailed terrain (many blocking tiles). |
Quote:
|
Quote:
|
Quote:
The path finder I made for my tactics engine is based on the A* path finding algorithm, just slightly different. |
reviving this thread for questions relating to A*.
I'm working on a script right now (only in testing phase, mostly consists of comment lines planning out what I'm doing). I've done what the tutorial you provided tells me; divided the area into a grid --I'm using 2x2 grid, the size of block.png-- checking clockwise starting from the right and only looking at the up/down - left/right squares. When the NPC finds a square that fits the criteria (in my case a grid that has 4 of the specific tiles I'm looking for) it'll move towards that square, and mark the previous square checked so it won't get stuck in a loop (while I'm on this subject, how do I add variables to an array without clearing the previous?) I'm using replacestring to keep track of this, and I don't believe I need to). My question; is there a more efficient way of checking what tiles are around me other than: "Grid 1 check... to the right - [one x away, one y away], [two x away, two y] [away, one x away, two y away], and two x away, and one y away]" - if return negative then "Grid 2 check... below -[one x away, one y away], [two x away, two y] [away, one x away, two y away], and two x away, and one y away]" SO ON AND SO FORTH. I am writing a function for each grid check, so I am writing for different things. Can I condense this? |
A* between nodes :)
edit:sorry, this isn't exactly on-topic. |
Video: http://forums.graalonline.com/forums...0&postcount=68
Screenshots: http://forums.graalonline.com/forums...3&postcount=71 Above shows the tactics engine I made, which uses a concept quite/very similar to the A* concept. (Tweaked for obstacles and 4 direction movement, instead of diagonal). Working with the A* concept is quite fun, and can be challenging when it comes to fixing bugs/weird paths :) |
| All times are GMT +2. The time now is 12:39 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.