![]() |
Small question
Okay, I'm doing a huge revamp on Graal and combining it with an RPG. I believe it would be sort of like Graal Kingdoms, as it has stats and things... anywho, the movement speed of the player is derived from a 'Speed' stat using the following formula:
spd = 0.5 + ((Speed - 20)/100) A quick note if anyone cares: the max Speed you can have is 100. spd is how many tiles a character moves every 0.05 seconds. Using this and a bunch of code from premade NPCs using a lot of vecx and vecy and all that other crap, I completely recreated the movement system of Graal (yes, I know I did it the hard way, but it allows for more flexibility, I suppose). Now, all that is well and good, but I have two questions. 1) Because this project isn't even CLOSE to being finished, I have made a prototype level that allows you to change your speed by typing 'setspeed #'. Now, all this is fine and dandy, and perhaps it's been a bit too long since I last scripted, but how do you set a variable to a string? Namely, speed = #t(1);. 2) This is not going to be needed for a while, but how would I be able to script a weapon that hits multiple areas that are close together, but does not hurt the target multiple times? This idea came from a sword scenario: in reality, a person does not have to be directly in front of you to be hit; they could be at the very beginning or end of the swing (to the near left or right) and still be hit, and so you see my need for multiple areas of damage dealing. Whew, that took a while... ideas and answers welcome. Ciao |
Quote:
Quote:
In either case, you'll probably want to use the 'getnearestplayers' function to get a list of players near to the damage area and then iterate through them all to determine which should be affected. I've never used the function personally, but it's included in the tutorial I linked and it seems fairly simple. |
I keep hearing about a new GScript engine, aka GScript 2... what is everyone talking about?
|
Quote:
It is also somewhat fluffy, but I can excuse that. |
Quote:
|
Quote:
|
How is that bad advice, he CAN search for it in the commands rtf. If i explain him the whole thing then:
Quote:
|
Quote:
However, I must admit at this point that I'm no longer sure what the original poster was asking. Accordingly to my original interpretation, strtofloat would have no applicability (which is why I objected). But I accept that his words were ambiguous, and that either version is viable. I still think that ambiguity could have been tackled if you'd gone into more depth, but I'm not blaming you any more. |
speed = #t(1); > test > Error: Expected format var, var[i], obj[i].attr, function(a), function(a,b)
speed = strtofloat(#t(1)); > test > Error: (none) |
Actually... Luigi was he who saved me from my demise... it has simply been so long that I forgot about strtofloat()... Kaimetsu, how do I 'upgrade' to this new GScript? I know I have not already, because the x = string; did not work. But I now have another problem...
Excuse the crude ASCII (and the sets of X's), but see the following diagram: O = player X = blocking tile O XXX XXX XXX If my player were to go down continuously, running into the blocking tiles, and then (while pressing down) hit left or right, the ganis would mess up, because it is constantly checking the onwall (which is hitting the blocking tiles) and setting the gani to idle, whereas there is no blocking tile to the left or right, so it sets it to walk, and so because it constantly switches between idle and walk, it looks like it is frozen in the first frame of walk. So... know how to fix that? Should I post my code? |
I dont know what your script looks like, post your onwall detection, but if you're using playerdir in a vecx and vecy to check for the onwall, that might be messing it up. Try using the for loop in a timeout to check for the keys 0-3 being pressed, and use that same var from the for command as the index of all vectors.
|
Quote:
Quote:
|
1 Attachment(s)
Sweetness! Somehow, I fixed the code... maybe it's because I just put in a for loop... anyway, I have yet another problem (you can download my script at the bottom of this post for reference).
This problem was actually there before, I just wasn't thinking about it. See the diagram again... O XXX XXX XXX If my character was in the middle row (not the left one) and hit the obstacle, all is well, but then, if I slowly edge to the left (while still going down) I will walk through the leftmost coloumn of blocking tiles. However, this only happens when going these directions: Down-left, Up-left, Right-up, Left-up. See my attached script for reference. Another thing... does offline mode emulate serverside and clientside scripting? I do not own or work for a server, and I probably won't any time in the near future, so I don't have any way of testing such things. |
Quote:
Offline Mode = No NPC-Server. |
Quote:
First off, your node creation is rather odd. This little graphic will show you what you're script does to find the nodes, red being the x,y of player and the blues being the newx/newy then the testx/testy (what I'm refering to as nodes): http://members.aol.com/michaelangelo36/Graphic.jpg Just find the center of the player then add the vecx/vecy stuff to that. (center of feet is playerx+1.5 playery+2, center of player graphic is playerx+1.5,playery+1.5) This will pretty much accomodate the corner-jumping problem you're having. Quote:
I don't work for any servers yet I have access to a couple of servers just to test stuff. Point being, you can get limited RC access to some servers to learn scripting. (there is a "Graal Test Server" that should work out for you, it's enabled for the new engine, but it's backwards combatible so you don't have to worry about that if you don't want to) |
| All times are GMT +2. The time now is 08:22 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.