![]() |
GBaddy v.2.0
You can find version one here.
Updates . Code optimization: restyled the entire script to make it more legible (also added new comments and changed around some old), changed some this. vars to temp. vars where they better fit, and I added two new functions: - healBaddy(amount) - heals the baddy for specified amount - baddyReset() - resets baddy back to its starting position (automatically done when the baddy kills a player to prevent the player from getting constantly harassed by the baddy) . Variable-value changes: changed some values such as the baddy's speed, amount of damage taken, and also played with the chance-probability of the baddy either attacking with its sword, causing an explosion, or healing itself . Smarter AI: when a baddy is low in health, it will cycle through the other NPC's in the level to see if any of them are joined to the "public_gambet_gbaddy" class (which means you must either add this script to a class titled the same, or tweak this portion of the script), and if they are, they will then check to see if the baddies found are currently attacking the same player, if they aren't, then they will call those baddies to help fight the player. Important: You will need to replace 'PERCENTSIGNHERE' with the actual percent symbol in lines 58 and 69 when uploading because the forums does not allow the posting of percent signs. Also, the function onWas.Hit() will need the period removed. PHP Code:
|
Good stuff, as always :).
Also, if you want to include an actual %, you can use this "percent transform." It's a funky way of posting percent signs, but they just wont fix it... |
Quote:
I just tried editing my original post with that and I still got that bad request error (I'm using the new Internet Explorer 8 Beta - I have Firefox as well, but I've been testing around the new I.E.), not sure if my browser has anything to do with it but I actually had to write this thread twice because of the percent problem. The first time that I wrote this thread I had completely forgotten about the percent problem and I lost everything that I wrote, I even tried using the back button on my browser but all of the information was lost through the bad request. I made sure not to make the same mistake twice. >_< Thanks for the link, though, it's just really annoying to have to go through all this trouble. |
Nice.
Is there any way to try out GS2 scripts offline? (I don't have access to any server) |
Quote:
|
Quote:
|
Would it be possible for you to record a video of your baddy functioning with the things that you've described? I'd be interested to see it, and don't really have a server I could just throw it on and test it.
|
1 Attachment(s)
I added an attachment that contains an avi file straight from my videos folder of the GBaddy in action (more or less since I was lagging a bit due to my connection being split at the moment). I've never before used the video capturing feature that the new Graal version has, so my apologies if it's small or whatnot since I don't really know how to make it bigger.
Although you can't really tell from the video due to the small resolution, the baddies do walk around the level if there is no player within their attack radius. |
Quote:
|
nice work, and if u forget where the percent transform is, i have it in my sig.
|
Quote:
|
Quote:
Its up of course. Just forum pm Tigairius about it if you have any questions. |
Looks like fun!
Suggestionssss It should victory dance when it kills! As well as taunt, and when he is aggro'd. Could have a setup in the onCreated() this.vocals_taunt = "y so bad"; this.vocals_victory = "come back when u r not suck"; this.vocals_aggrod = "cum get summmmm"; this.victorygani = "dance"; Also where you have the whole isinclass("public_gambet_gbaddy"); Could use a onCreated string as well. this.classname = "public_gambet_gbaddy"; So anyone who uses it can use a different class name and figure out to change that right away. Possibly tweak so it can use a longer timer instead of 0.1, however I don't think this is that important depending on how widespread it becomes. The above should be worthy of a 2.1 release ;) rep++ |
My only complaint is that it basically runs into your sword a number of times before it attacks you back.
|
Quote:
tell gimmeh the script! i nvr been good at greasemonkey.. |
Not meaning to revive this thread, but out of curiosity, why does this baddy not move unless on the default pics1.png tileset? I tested this on a type 1 tileset and the baddy would not move. With the same code, I tried it on the default tileset, it worked fine. I also have a custom HP system in play. When the baddy attacks the player, it subtracts from player.hearts, not the clientr var I set it to. wutdo?
|
Quote:
PHP Code:
|
You can also do newtilesets=true if your entire server uses a type 1 tileset.
|
Quote:
Quote:
Now it still subtracts from player.hearts, when that's not defined anywhere... Any ideas? |
Quote:
The easiest solution is just to make a new GANI named "myserver_sword.gani" (which is a clone of sword.gani) and use this in place of "sword". |
Quote:
I remember at one point doing: replaceani("sword", "idle"); caused NPCs to 'attack' you if you touched them that was a good laugh. |
I released version 3 of the GBaddy not that long ago (you can find it here). Just figure I'd point that out in case you didn't notice since you should be using the most recent version of the script before changing it around.
As for wanting the baddy to work with custom systems, you would have to make alterations to the damagePlayer() function (particularly the setcharani("sword", ""); line). You can place your custom health variable under that line and it should deduct straight from it but the system will still remove from player.hearts due to the baddy using sword.gani, so you'll need to address that. The onCounter() event also uses a setcharani("sword", ""); line so keep that in mind as well. Edit: Looking back at it, the script as a whole could use a complete overhaul (especially with there being a lot of redundancy), but investing anymore time in it would be a waste; nonetheless, it's complete enough for what it's worth--a learning tool to help get you started, not something to be used on a server without major modifications. |
| All times are GMT +2. The time now is 04:58 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.