Vortigem Posted June 7, 2013 Author Share Posted June 7, 2013 I'm using a DX8 engine, based on CS:DE. This is an unsupported engine, though a learning experience for me.I have a few cool ideas I'd like to pixel for something like this and it seems like it would be an easy mod. Is there a tutorial out there for something like this or would anyone mind lending me a hand?Example:Playercharacter reaches 25% HP; Draw Animation #5 at Playercharacter. Link to comment Share on other sites More sharing options...
barreytor Posted June 7, 2013 Share Posted June 7, 2013 I don't really know how CS:DE works, but from what I know from Eclipse, you'd likely have to find a sub that runs every so often, like SendPlayerVitals or something like that, and slap the send drawanim in there. You'd have to add a variable to check if you've sent the anim already to not spam the animation, too.Is this any help? Link to comment Share on other sites More sharing options...
abhi2011 Posted June 7, 2013 Share Posted June 7, 2013 In the DrawPlayer sub check the character's health. If it is said value then just draw said anim and said sprite. Link to comment Share on other sites More sharing options...
ThomasEB Posted June 7, 2013 Share Posted June 7, 2013 Sub NpcAttackPlayer, look at check where player HP is 0 and another if there and add there is players hp is 25% and then use SendAnimation Attacker…. etc. Link to comment Share on other sites More sharing options...
abhi2011 Posted June 7, 2013 Share Posted June 7, 2013 > Sub NpcAttackPlayer, look at check where player HP is 0 and another if there and add there is players hp is 25% and then use SendAnimation Attacker…. etc.I am pretty sure that the HP updates are sent to all map players. Therefore it would be better to handle all the stuff ClientSide. (If the animations are same for different then this would be preferred over sending extra packets.) Link to comment Share on other sites More sharing options...
ThomasEB Posted June 7, 2013 Share Posted June 7, 2013 > I am pretty sure that the HP updates are sent to all map players. Therefore it would be better to handle all the stuff ClientSide. (If the animations are same for different then this would be preferred over sending extra packets.)Yeah, but it will require alot more work, you must make something like client-side map animations etc etc so my way is alot more simple. And nope, player HPs are not sent to all players, only if you are in party then it is sent to party members too, so your method will fail. Link to comment Share on other sites More sharing options...
abhi2011 Posted June 7, 2013 Share Posted June 7, 2013 Since the players HP isn't being send the HP. I don't see how my method is a way more work. I am pretty sure all you have to do is change the Anim to whatever the animation number is. Link to comment Share on other sites More sharing options...
Zeno Posted June 7, 2013 Share Posted June 7, 2013 I don't have the CS:DE source handy, but here's how you'd do it very easily in EFF, which also uses DX8\. Possible that the animations are done a little differently (see final note). Doing the following will render an animation under your character when below 25% HP. If you'd like it to be over, you'll have to move that animation uniquely past DrawPlayer in render_graphics (DX8 renders back-to-front; since most animations should be below, you can't move all of them).In modGlobals add:```HurtAnimTrigger As Boolean```In SetPlayerVitals, add:``` If Index = MyIndex Then If Vital = hp Then If value <= GetPlayerMaxVital(Index, hp) / 4 Then If HurtAnimTrigger = False Then AnimationIndex = AnimationIndex + 1 If AnimationIndex >= MAX_BYTE Then AnimationIndex = 1 With AnimInstance(AnimationIndex) .Animation = 34 .x = Player(Index).x .y = Player(Index).y .LockType = TARGET_TYPE_PLAYER .lockindex = Index .Used(0) = True .Used(1) = True End With HurtAnimTrigger = True End If Else: HurtAnimTrigger = False End If End If End If ```You can remove the "If Index=MyIndex Then" and the last "End If" if you'd like the animation to trigger for any other players whose hp vital you're privy to (I think just party members, as discussed above).Change 34 to your desired animation # and the engine should take care of the rest. The boolean ensures that this will only happen once per cross below 25% and will not be triggered again while from below 25% to below 25%, such as through regen.Note: if lock types aren't supported, add HurtAnimIndex as Byte in modGlobals. Set HurtAnimIndex= AnimationIndex in SetPlayerVitals. In the DrawPlayerSub, set AnimInstance(HurtAnimIndex).x and .y to equal x and y. I think the animation will always be a pixel behind though, because it happens before the player is drawn, so it would get its x from the previous player x… Link to comment Share on other sites More sharing options...
abhi2011 Posted June 8, 2013 Share Posted June 8, 2013 That will work only for the end user playing. The end user won't see it for others. You can do what Zeno told but put the boolean in PlayerRec below the ' Client Side Only Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now