How do you duplicate scripts?
Discodude16
Member Posts: 5
Hello! My question is how to duplicate long backstage scripts in gamesalad so I don't have to rewrite it over and over for my game.
Best Answer
-
Braydon_SFX Posts: 9,273
You can create 'custom' behaviors after you've set them up. Simply select (click) a rule, behavior or stack of logic. It should highlight in blue. Then drag and drop that selected bunch to the Behavior Library in the bottom left. This will add that stack to the 'custom' tab. You can then go into different actors and drag that behavior into the logic stack as you normally would.
Does that help?
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
Answers
Hello @Discodude16 - good question.
One way is to create a game attribute (boolean type, or integer) and set it to false or 0.
When you want to execute that block of code, change the game attribute to true ( or 1, if you created an integer). Then, you'll have a rule somewhere that says:
After the code has executed, make sure to set the game attribute back to false or 0 so it can be triggered again. This usually works well in a RoundRules actor; an actor that I use to keep all of my major logic (change scenes, determine game over, etc).
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
That was sort of what I asked. I am making a game, and I have all of the attributes, but the problem is that the script is long and I have to rewrite it for every level and other actors who should run the same script. I calculated it, and found out I would have to write the script 45 times, which I don't want to do.
Can you explain why you have to rewrite the script? There are often ways to simplify complex rules. Are you needing different attributes for each actor or each level? Tables can help with that, for example. If we know more about the specifics of what you are doing, we can suggest things that might help.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
That Worked! Thanks a lot for the help!