Dark Raven X Posted August 6, 2011 Report Share Posted August 6, 2011 Ok, this is incredibly minor, but I've been looking at it for about an hour now without working out what's wrong. In the SDASH engine, if you go into New Game, then hit Back, the game crashes. This is the error: ___________________________________________ ERROR in action number 1 of Step Event for object objMenuMachine: Error in code at line 13: execute_string(InterfaceReference.ScriptStart); ^ at position 48: Unknown variable ScriptStart So, I went and looked at position 48 in the objMenu, and tried to figure out what the problem was. But I can't see anything wrong with it at all - it reads the same as the first line that opens the main menu in the first place: scrMenuInterfaceAttachControl(MenuInterfaceNewGame, scrMenuControlCreateButton("Button02", "BACK", global.FontSmall, c_red, c_white, c_gray, fa_left, fa_top, 130, 204, "NewInterface = 'Main Menu';", true)); So yeah, I'm still new / don't really know what I'm doing. But this is driving me nuts. I have no idea why it won't work. @___@ 1 Link to comment Share on other sites More sharing options...
DimensionWarped Posted August 6, 2011 Report Share Posted August 6, 2011 execute_string(InterfaceR eference.ScriptStart); should probably be execute_string(InterfaceR eference.ScriptStart()); Because it looks like a function rather than a property. Link to comment Share on other sites More sharing options...
Dark Raven X Posted August 6, 2011 Author Report Share Posted August 6, 2011 Wait wait, I got it. Facepalm. The problem was that hitting "back" lead to 'main menu' - when the main menu was actually identified as just 'main' Welp. One mystery down. Now to figure out how to edit sprites properly. Right now, swapping out Sonic's frames for Shadows doesn't work, cause Shadow's sprites are larger, and he ends up underground, and the skate animation takes 30 frames compared to Sonic's run taking 4. XD Link to comment Share on other sites More sharing options...
VectorSatyr Posted August 6, 2011 Report Share Posted August 6, 2011 EDIT: Oh... you got it while I was typing... welp. EDIT2: Copied from a pm I sent another user. Animations are handled by .ANIM files using a customized file format similar to .ini. [Information]; Character name this file defines animation ofCharacter =[Animation0]; Animation name and sprite usedName =Sprite =; Animation flagsLoopbackTimes = <use -1 for infinite>LoopbackFrame = <frame #>LoopbackAnimation = <name of animation to play after this animation is done>SubAnimation = <name of animation to play alongside this animation, ie. tail's tails>; Frame informationFrame0_SectionStart = <frame #>Frame0_SectionEnd = <frame #>Frame0_Speed = <use 1/"number of frames to wait">; Use this when you only want one frame of a spriteFrame1_Id = <frame #>Frame1_Speed = <use 1/"number of frames to wait">[/CODE]Most of the above is self-evident. A few notes:The numbers next to Animation and Frame are important - everything must be in order, or else some animations might be skipped. None of the lines need to be spaced out if you don't want them to be. If an animation file you want to modify is in a .XANIM format, just go into DASH and use scrEncryptFile to unencrypt it back into a .ANIM file. Using the above, you should realize that the file is really just a text file and can use any extension you want, as long as Game Maker still recognizes it as a text file and the proper syntax shown above is used. As for the sprites themselves, you can either adjust the origin so that they're aligned properly, or go into the movement scripts and change the offsets on each sensor so it matches the boundaries of the sprite. I'll leave it to you to figure that one out. 1 Link to comment Share on other sites More sharing options...
Dark Raven X Posted August 6, 2011 Author Report Share Posted August 6, 2011 :D Just to clarify... when is an ANIM file created? I've been placing the sprites into the sprite>global>player section in GM8. Obviously that doesn't create instructions for when they're used. I was wondering - do I create an ANIM separately, outside of GM8? Link to comment Share on other sites More sharing options...
VectorSatyr Posted August 6, 2011 Report Share Posted August 6, 2011 Yes, you have to make it seperately. If you're using vanilla SDASH, there should already be one for each character available. Just modify it with the frames and speeds you want. Link to comment Share on other sites More sharing options...
DimensionWarped Posted August 6, 2011 Report Share Posted August 6, 2011 *realizes someone who never uses gamemaker should probably avoid dispensing gamemaker advice* Link to comment Share on other sites More sharing options...
VectorSatyr Posted August 6, 2011 Report Share Posted August 6, 2011 Oh, DW, it's not a game maker thing... it's a Sonic DASH thing. =P Link to comment Share on other sites More sharing options...
Dark Raven X Posted August 6, 2011 Author Report Share Posted August 6, 2011 OK, another nub question, and I don't wanna fill up the board with topics, so I'll just leave it here too! Rather than swap out Sonic's sprites and edit the ANIM, I wanted to make Shadow as a seperate character in SDASH, more for self training than anything else, but I'm stuck already: I'm in the objGlobalController and objPlayer, poking around and copying the instances wherever the characters are referred to, adding Shadow. But here's where I'm stuck now! consCharacterSonic consCharacterTails consCharacterKnuckles What is this? I'm guessing it's linked to the ANIM file? I've been adding a consCharacterShadow wherever these appear, but I don't know what that is, and haven't made one for Shadow. ?.? Link to comment Share on other sites More sharing options...
OverbounD Posted August 6, 2011 Report Share Posted August 6, 2011 They are constants. I think they are linked to global.FirstCharacter and global.SecondCharacter. Look in the creation event of objGlobalController its all there. I'll go ahead and explain that you can define constants under Resources<Define Constant Menu. You'll see a lot of constants. Constants are great because they are easier to remember than a value. Plus I understand they run faster too. You will see lots of constants there, specifically a lot that start with consAction. These control what state a character is in when they are assigned to the character's Action variable. So Action = consActionJuming sets sonic in his Jumping state and runs the corresponding script scrPlayerActionJumping(). All of the code for that is found within the step event of objPlayer under Action Management. 1 Link to comment Share on other sites More sharing options...
Dark Raven X Posted August 6, 2011 Author Report Share Posted August 6, 2011 Got it! Cheers. Ahh, I thought I knew what the values were for, but looking through that defining constants menu, a load of unrelated constants share the same value. That's OK, right? And! scrPlayerAnimationHandleSonic Managed to get to the Script tab and start adding scripts in for Shadow. Here's where I'm at; running the game and choosing Shadow crashes the game and gives me this: ___________________________________________ FATAL ERROR in action number 1 of Create Event for object objGlobalController: Invalid first character Been looking around in objGlobalController, and that's the message for "default" - but I have added a consCharacterShadow in there, alongside the other characters, and a scrPlayerAnimationHandleShadow in the scripts, so... what am I missing? :/ I'm not expecting it to work yet, cause no doubt there are 30 other things I need to write in for Shadow, but I don't get why it's crashing there, and giving that message, when there is a line in objGlobalController for Shadow. Link to comment Share on other sites More sharing options...
Dark Raven X Posted August 7, 2011 Author Report Share Posted August 7, 2011 Welp, I've now made a full sprite set for Shadow, and an ANIM, and now I don't know what to do. :/ Link to comment Share on other sites More sharing options...
OverbounD Posted August 7, 2011 Report Share Posted August 7, 2011 I'm not real sure exactly where your problems are from. But its bound to be one of the many places in the engine where the switch(CharacterId) expression is used to change behavior based on the character. scrPlayerStatsCharacter() is one of those places but there's probably more. Link to comment Share on other sites More sharing options...
Dark Raven X Posted August 7, 2011 Author Report Share Posted August 7, 2011 I think the problem might be in objMenu maybe? Cause I've added the option to play as Shadow to the objMenu, but I don't think that's connected to anything. But I can't see what links the other characters to the selection of their name there either - there's no consCharacterSonic in objMenu for instance. I'm talking about this bit: ControlCharacter1Counter = scrMenuControlCreateCounter("Counter01", consMenuCounterTypeStrings, "CHARACTER 1", global.FontSmall, c_red, c_white, c_gray, fa_left, fa_top, 130, 184, 227, 184, "", true); scrMenuControlCounterAddString(ControlCharacter1Counter,"SONIC"); scrMenuControlCounterAddString(ControlCharacter1Counter,"TAILS"); scrMenuControlCounterAddString(ControlCharacter1Counter,"KNUCKLES"); scrMenuControlCounterAddString(ControlCharacter1Counter,"SHADOW"); scrMenuControlCounterTrimString(ControlCharacter1Counter); scrMenuInterfaceAttachControl(MenuInterfaceNewGame, ControlCharacter1Counter); I don't see any mention of scr of con, so I don't get why the selection of a particular character on the menu leads to loading that character up (which I guess is the step I'm missing, as even though I've put Shadow as an option there, there's nothing that makes it load Shadow's stuff up.) Link to comment Share on other sites More sharing options...
VectorSatyr Posted August 7, 2011 Report Share Posted August 7, 2011 scrMenuNewGameCharacterSelect() var CounterReference; CounterReference = scrMenuInterfaceFindControl(InterfaceReference, "Counter01"); global.FirstCharacter = CounterReference.CounterValue+1; CounterReference = scrMenuInterfaceFindControl(InterfaceReference, "Counter02"); global.SecondCharacter = CounterReference.CounterValue; The counter value is simply the menu's position in the array of values. i.e. "TAILS" is at position 1 in the array (position starts at 0). This script will return a value of 2 as the first character. What's this? consCharacterTails has a value of 2. So really, choosing "TAILS" results in "global.FirstCharacter = consCharacterTails;"... Player objects are instantiated in the create event of objGlobalController. ... // ---- Create player objects ----------------------------------------------- switch(global.FirstCharacter) { case consCharacterTails: // ---- Create character and setup ---------------------------------- global.Player1 = instance_create(objEngineStartPosition.x, objEngineStartPosition.y, objPlayer); global.Player1.CharacterId = global.FirstCharacter; global.Player1.ComputerControlled = false; global.Player1.depth = -1; // ---- Setup camera ------------------------------------------------ global.Player1.LinkedCamera = instance_create(global.Player1.x, global.Player1.y, objCamera); view_object[0] = global.Player1.LinkedCamera; view_visible[0] = true; break; ... default: show_error("Invalid first character", true); } ... Do you understand where I'm getting at? Link to comment Share on other sites More sharing options...
Dark Raven X Posted August 7, 2011 Author Report Share Posted August 7, 2011 ... I think... I think I get it! But I still don't get why it's not working! XD Unless... I need to change consCharacterShadow's value, so it fits this? If I'm reading it right, then the menu adds +1 to a counter, and then the final number is the consCharacter's value? Link to comment Share on other sites More sharing options...
Dark Raven X Posted August 7, 2011 Author Report Share Posted August 7, 2011 Changing consCharacterShadow's value to 4, the value that "Shadow" in the menu leaves on the scrMenuNewGameCharacterSelect counter makes it work! I get to the test level now, where I crash due to millions of errors in the animation scripts! Link to comment Share on other sites More sharing options...
Dark Raven X Posted August 9, 2011 Author Report Share Posted August 9, 2011 Buhh. Stuck again. XD --- ERROR in action number 4 of End Step Event for object objPlayer: Error in code at line 21: CharacterAnimationId = global.Animations_Shadow; ^ at position 44: Unknown variable Animations_Shadow That's this line in objPlayer: case consCharacterShadow: CharacterAnimationId = global.Animations_Shadow; I have a scrPlayerAnimationHandleShadow, so what's the problem? @__@ Link to comment Share on other sites More sharing options...
VectorSatyr Posted August 9, 2011 Report Share Posted August 9, 2011 EDIT: Did you remember to load the animation first? scrPlayerAnimationsLoad()? Link to comment Share on other sites More sharing options...
Dark Raven X Posted August 9, 2011 Author Report Share Posted August 9, 2011 I only have the generic scrPlayerAnimationsLoad - reading through it, it refers to the character as "none" - but I'm guess that's all fine, since the default characters all load up fine. @__@ Link to comment Share on other sites More sharing options...
Dark Raven X Posted August 10, 2011 Author Report Share Posted August 10, 2011 Man, still stuck. :/ global.Animations_Sonic And so on. I've got a global.Animations_Shadow, but I don't think it leads to anything. Animations_Shadows in an unknown variable. So... what am I missing now? What do I have to set up for this to work? I do already have a scrPlayerAnimationsLoad, and scrPlayerAnimationHandleShadow, so what else do I need? Link to comment Share on other sites More sharing options...
Goshi68 Posted August 10, 2011 Report Share Posted August 10, 2011 Man, still stuck. :/global.Animations_Sonic And so on. I've got a global.Animations_Shadow, but I don't think it leads to anything. Animations_Shadows in an unknown variable. So... what am I missing now? What do I have to set up for this to work? I do already have a scrPlayerAnimationsLoad, and scrPlayerAnimationHandleShadow, so what else do I need? Your problem exists because you have to set a variable for Shadow, most times, they use numbers to define variables. So just choose the one after Knuckles and you should be okay. Link to comment Share on other sites More sharing options...
Dark Raven X Posted August 10, 2011 Author Report Share Posted August 10, 2011 The variable is the value, right? As in consCharacterShadow? Yah, I have that set (as the one after Knuckles. ) but that's not it. :/ Link to comment Share on other sites More sharing options...
Dark Raven X Posted August 11, 2011 Author Report Share Posted August 11, 2011 Kweh, been at this for hours now, up and down every scr with "player" or "animation" in it, and I can't find the problem. Or rather the solution. I know the problem is that global.Animation_Shadow is an "unknown variable" but I can't see how to fix that. I've set the value of consCharacterShadow to 4 (to fix the crash I had before this) so that isn't it. Ahh... what am I missing!? @__________@ Link to comment Share on other sites More sharing options...
OverbounD Posted August 11, 2011 Report Share Posted August 11, 2011 Where is global.Animations_Shadow variable created/set at? Link to comment Share on other sites More sharing options...
Recommended Posts