![]() |
Some more scripts+help on sword/gun script.
Okay, so i have made some more scripts, with the help of a friend aswell, and now i want to make a sword or gun script, and i have found some scripts on testbed to analize, and the help people gave on gultex his script in the code gallery, but im not understanding what to do, i understand the stuff with the playerdirections and with the shoot command, but i don't understand how to make the sword, or bullet hit the player.
anyways here are the scripts i made. I'd like to know if i did anything wrong, or could've done anything better. Bombscript that puts an explosion +-7 yards from the player: PHP Code:
Rotating script, i need some help on this one too, because i failed to make a loop, and i want to make it so that the player keeps rotating on his own when i fire once. PHP Code:
PHP Code:
PHP Code:
PHP Code:
sorry thought i was in the GS2 forum, should've been posted there. |
Quote:
PHP Code:
'==' Also, you have the if statements, which are meant to be checking conditions and a comparison , should be made inside a block of code. To further improve improve the script in a couple of areas, you should separate the explosion block and the direction comparisons block. These areas include:
To add parameters to a function, you simply do this (should be idented, no access to RC at the moment though): PHP Code:
PHP Code:
Also, you've used deprecated in-built variables a few times. For example, 'playerx', 'playery' and 'playerdir'. 'player' is an object in GScript and has properties which give the same results as 'playerx' and 'playery' such as 'player.x', 'player.y', 'player.dir', 'player.nick', 'player.account' (example of a read-only variable). |
Thank you, i've got a few questions tho, what do the Xoffset and the Yoffset do? do they do exactly the same as what i wrote, or do you put them in a database npc and then put somewhere in the weaponscript xoffset=-5 or something?
And what do you mean with indented? Indented in a script? |
Quote:
xOffset and yOffset are function parameters. When you call the function (like you would sleep(0.1)), you have the ability to pass variables to the function. In the script, you just put in this into onWeaponFired() : PHP Code:
|
so this?
PHP Code:
|
playerdir is GS1, to make it GS2 u put a dot in-between player and dir.
also if u could use the RC styling command, it would get a lot easier to read for many of us. Edit: with that i mean there should be some more spaces in the script, for example "player.y+=2;" should be "player.y += 2;", it both looks cleaner and gets a lot easier to read. PHP Code:
|
no, no not at all!
thanks for the help! Im only trying to improve and get my scripts good and clean looking, so any C&C is appreciated! And i really want to stay away from GS1 so im glad you mentioned that. PHP Code:
And can/should getcoordinates be serverside? |
Quote:
Quote:
http://wiki.graal.us/Index This may also come in handy. |
Quote:
i sported some errors, like missing a dot or just the ";" i'll spell it out for you :D PHP Code:
|
All times are GMT +2. The time now is 11:17 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.