Instalează Steam
conectare
|
limbă
简体中文 (chineză simplificată)
繁體中文 (chineză tradițională)
日本語 (japoneză)
한국어 (coreeană)
ไทย (thailandeză)
български (bulgară)
Čeština (cehă)
Dansk (daneză)
Deutsch (germană)
English (engleză)
Español - España (spaniolă - Spania)
Español - Latinoamérica (spaniolă - America Latină)
Ελληνικά (greacă)
Français (franceză)
Italiano (italiană)
Bahasa Indonesia (indoneziană)
Magyar (maghiară)
Nederlands (neerlandeză)
Norsk (norvegiană)
Polski (poloneză)
Português (portugheză - Portugalia)
Português - Brasil (portugheză - Brazilia)
Русский (rusă)
Suomi (finlandeză)
Svenska (suedeză)
Türkçe (turcă)
Tiếng Việt (vietnameză)
Українська (ucraineană)
Raportează o problemă de traducere
Doing this does stop the error, however the object now just stays in place and dosen't move into it's chase state when the player object is nearby.
I'm thinking that since "scr_nme_idle_state();" is in a step even it's executing this script in every frame, essentially keeping it in that state and preventing it from changing into running a new script (like the chase script). Does this sound right or does game maker work differently than this?
I understand you're working with limited information, if I'm leaving out any key details in understanding this problem just let me know, I'll provide what I can. I try to present what I think is relevent so I'm not bogging people down with useless info.
I am curious though as to why it keeps trying to run the first script in my script list all the time. Like if I set it to script_execute(7); it will run the 7th script down the list, so I can have it play the idle script that way, but it's the same problem as before where now it's stuck in that script and I need the script executed to be able to change.
again, thanks for taking your time to help me with this.
https://www.youtube.com/watch?v=huvEsQ-U3Is&t=385s
I don't expect you to watch a 17 minute video to be sure, but were you to skim through and look at the code bits, you would see the code I have in my game. I've re-watched this sevral times, as far as I can tell I've copied his code exactly, yet it results in this error. I'm thinking that since this video is so old, maybe he's working with code that is no longer viable in the modern version of game maker?
I hope you find this useful.
Things happen so fast at 30/60 steps per second that what you think should happen may in fact not be happening. In fact something totally unforeseen might be happening showing you a bug where you thought it wouldn't be.
Most of the time the answers to my solutions are staring me in the face and I'm too blind to see them in their simplicity. But using the debugger as a lense to peer into my game I find my solutions and feel somewhat dim-witted when I do. "Check the fuses" my grandad would say. "Why rebuild the engine if it's only a fuse?"
EDIT: if you need some education on how to use the debugger or maybe a refresher coarse try THIS[www.yoyogames.com] blog from YOYO
In the create event I have:
state = scr_nme_idle_state;
In the step event I have:
script_execute(state);
Yet it keeps trying to run a different script. I don't understand what I did wrong here, but I'm clearly not getting something right.
-Thanks Winter Bud!
Maybe you might want to run teh parent's script after the state script
As for the assigning value to the "dir" varible, the object shouldent be running the script calling for the "dir" variable in the first place. It shouldent be running the script scr_get_face either. Those scripts are more for the player object so they have quite a few more varibles after "dir" that the enemy object just won't have. This stubborn thing just needs to use the script I tell it to use!
But yes, this enemy object DOES have the same parent as the player object, and the player object ALSO has a "state" varible. I thought if I changed the name of the varible in the enemy that it would fix the problem (instead of "state" I called the varible "nmestate" in the enemy object") but I was wrong, it dosent seem to make a difference.
As it stands, both the player and the enemy object are both the children of "obj_lifeform", but the parent object doesent have a "state" varible. I dunno, like I said, I'm looking into this now, though we havent quite solved the problem yet, I feel like you've given me a good lead. If anything I said so far give you in idea on what might be going on please let me know! Otherwise, thanks for your time.
Additionally, what does the "error" say if you put the following within the create event of a used object and then run the game?
Using the debugger is your only hope here. Put a break point above the script_execute(state) in teh step event and then step through the code one line at a time if you have to, to see where you are actually chaning the state.
EDIT: again I reiterate that things happen fast at 30/60 times per second. Stopping the game and stepping through it so you can see things one at a time is the easiest way to find your problem.
To answer in order of posts received:
Zappy- if I use scr_nme_idle_state directly I don't get an error, but the enemy (nme) object dosn't move or do anything anymore which is not what the idle state is set up to do. It's supposed to wander around a set amount of space. It just kinda looks stuck.
as for using the code offered I ran into a problem with it before I could run the game. Maybe there's a "common sense" thing I'm supposed to do with it before running the game but as it stands if I copy/paste it I shows that a string is not closed on the second line. Closing that string presents another error saying an assignment operator is expected
Winter Bud- I'll keep using the debugger for sure, and I don't mind agreeing that my design is VERY much flawed. I'm still trying to learn the ropes of this thing, but I do intend to get better at coding.
I have also stopped my abusive child/parent relationship. With therapy, and time, perhaps we can become a family again. I've taken care to separate them more and give them their own specialized code. I've kinda scrapped what I was doing before and started anew. Not sure if it's the most efficient way to code, but it works.
Thank you to everyone who responded to this post, you're all wonderful people and have been very helpful.
If you there's anything else you think I should know before moving forward with game maker I'll be sure to listen, otherwise I'd be fine saying this problem is resolved.
Is it possible that you had an unclosed quote/string before where you pasted it, or pasted it inside of a closed quote/string (and/or replaced the ending quote of a string with it)?