Kay-No Posted February 7, 2011 Author Share Posted February 7, 2011 Hello, i've been checking around in the source and saw that there was player movement constants that changed the movement speed of the character.```' Speed moving varsPublic Const WALK_SPEED As Byte = 4Public Const RUN_SPEED As Byte = 6```While i think that the NPC as it is now, is to easy to kite around and not getting hit because of their slow movement speed.Then i thought about making a variable in the NPC editor that determes the movement speed of characters.``` If MapNpc(MapNpcNum).Moving = MOVING_WALKING Then Select Case MapNpc(MapNpcNum).Dir Case DIR_UP MapNpc(MapNpcNum).YOffset = MapNpc(MapNpcNum).YOffset - ((ElapsedTime / 1000) * (WALK_SPEED * SIZE_X)) If MapNpc(MapNpcNum).YOffset < 0 Then MapNpc(MapNpcNum).YOffset = 0 Case DIR_DOWN MapNpc(MapNpcNum).YOffset = MapNpc(MapNpcNum).YOffset + ((ElapsedTime / 1000) * (WALK_SPEED * SIZE_X)) If MapNpc(MapNpcNum).YOffset > 0 Then MapNpc(MapNpcNum).YOffset = 0 Case DIR_LEFT MapNpc(MapNpcNum).XOffset = MapNpc(MapNpcNum).XOffset - ((ElapsedTime / 1000) * (WALK_SPEED * SIZE_X)) If MapNpc(MapNpcNum).XOffset < 0 Then MapNpc(MapNpcNum).XOffset = 0 Case DIR_RIGHT MapNpc(MapNpcNum).XOffset = MapNpc(MapNpcNum).XOffset + ((ElapsedTime / 1000) * (WALK_SPEED * SIZE_X)) If MapNpc(MapNpcNum).XOffset > 0 Then MapNpc(MapNpcNum).XOffset = 0 End Select```If a switch out the WALK_SPEED with a constant that is determed from the NPC editor, would that work? If so, how do i make it to save this constant from the NPC editor to the NPC.dat files and then make it read from that? Im not that familiar with VB6 so dont laugh if it sound stupid. :P Link to comment Share on other sites More sharing options...
interloper Posted February 8, 2011 Share Posted February 8, 2011 you cant use constants because you cant change them Link to comment Share on other sites More sharing options...
Guest Posted February 8, 2011 Share Posted February 8, 2011 You **can** change constants. GAME_NAME is a constant, you not able to change that then? Link to comment Share on other sites More sharing options...
Kay-No Posted February 8, 2011 Author Share Posted February 8, 2011 @interloper:> you cant use constants because you cant change themWell, nvm constants.Let's call it a value instead.My question is. How do I save a value from npc editor to the npc file, and then make it read from it.If i make a new scrollbar in npcEditor with the values 2,4,6,8,10,12 for example and save it as NPC_MOVEMENTSPEED. Then use it when npc is moving;``` If MapNpc(MapNpcNum).Moving = MOVING_WALKING Then Select Case MapNpc(MapNpcNum).Dir Case DIR_UP MapNpc(MapNpcNum).YOffset = MapNpc(MapNpcNum).YOffset - ((ElapsedTime / 1000) * (NPC_MOVEMENTSPEED * SIZE_X)) If MapNpc(MapNpcNum).YOffset < 0 Then MapNpc(MapNpcNum).YOffset = 0 Case DIR_DOWN MapNpc(MapNpcNum).YOffset = MapNpc(MapNpcNum).YOffset + ((ElapsedTime / 1000) * (NPC_MOVEMENTSPEED * SIZE_X)) If MapNpc(MapNpcNum).YOffset > 0 Then MapNpc(MapNpcNum).YOffset = 0 Case DIR_LEFT MapNpc(MapNpcNum).XOffset = MapNpc(MapNpcNum).XOffset - ((ElapsedTime / 1000) * (NPC_MOVEMENTSPEED * SIZE_X)) If MapNpc(MapNpcNum).XOffset < 0 Then MapNpc(MapNpcNum).XOffset = 0 Case DIR_RIGHT MapNpc(MapNpcNum).XOffset = MapNpc(MapNpcNum).XOffset + ((ElapsedTime / 1000) * (NPC_MOVEMENTSPEED * SIZE_X)) If MapNpc(MapNpcNum).XOffset > 0 Then MapNpc(MapNpcNum).XOffset = 0 End Select``` Link to comment Share on other sites More sharing options...
Guest Posted February 8, 2011 Share Posted February 8, 2011 I personally would look at things that do that, like HandleSaveNPC or something and learn from them, study it a bit, etc. Link to comment Share on other sites More sharing options...
Kay-No Posted February 8, 2011 Author Share Posted February 8, 2011 @Sekaru:> I personally would look at things that do that, like HandleSaveNPC or something and learn from them, study it a bit, etc.Thanks, i'll go and check in some of the tutorials that uses npc editor. 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