I've been trying to make an idle animation by having a npc that is taking place over the charecter, how would I do this?
Here's my level: https://www.dropbox.com/sh/0614muxfus4a ... SnHma?dl=0 | ||
What's the code to change transparency of an NPC?How to change the transparency of an NPC with scripts?
Also, how to make NPC hurt only at certain transparency levels? Edit: found it, nevermind. | ||
How to fix this?How do i fix this error?
Code: Select all call sysval "(sys "Disablejump") edit: I did it with events -No interesting comments here-
| ||
Holding ID?Hello, I just want to know how can I identify using the tea-script what NPC ID is the player holding?
I support these projects:
[list]MARIO & LUIGI - The Great Quest Super Mario - Rainbow Road Super Mario Bros.: The Great Adventure Adventures in 2DU [/list] | ||
Layer Won't SpinI'm Trying To Make A Ring Of Coins Spin Around A ? Block, Yet Using The LSpin Command On A Layer Called "Block 1" Does Nothing. Can Someone Help Me Here?
If You're Wondering, Here's The Command. Call LSpin("Block 1", -199568+16, -200144+16, 0.02) Why are you looking at my signature, anyway? There's nothing of importance here.
| ||
Hmm, Well, Sorry For My Error, I'm Still New To Scripting, But I Thought The Scripts Triggered Automatically Unless Specified Not To. (EDIT: I Figured Out Where In The Events Section Where To Trigger Events. Thanks For Telling Me That Events Triggered Them.) Edit #2: I Have Some New Problems, Specifically, 2. I'm Trying To Add To The Coin Counter, Since I'm Making 5, 10, 50, And 100 Coin NPC's. But The Script I'm Using Is Not Working. Here's The Script (Remember, I'm Pretty New To Scripting, In Fact, The Level I'm Scripting Is My First Scripted Level, So If It's All Wrong, Sorry): (BEGIN SCRIPT) If Val(CoinCount)>Val(LocalCCount) Then Val(LocalCCount)=Val(CoinCount) Else Val(LocalCCount)=Val(LocalCCount) End If If Val(LocalCCount)=Val(CoinCount) Then Val(CoinCount)=Val(LocalCCount) Else Val(CoinCount)=Val(CoinCount) End If (END SCRIPT) I Also Wrote A Second Script That Adds To The LocalCCount Variable: (BEGIN SCRIPT) Val(LocalCCount)+1 (END SCRIPT) Now, The Second Problem. Since The 100-Coin Object Has To Be The 3-Up Moon, Because I Ran Out Of Other Coin Objects To Use, It Doesn't Make A Coin Sound When Collected, So I Tried Using The AudioSet Command To Play A Sound Effect. But It Brings Up A '12' Error, So It Does Nothing. The Following Is The Script: (BEGIN SCRIPT) AudioSet(1, 14, 0, "coin.ogg") AudioSet(2, 14, 0) AudioSet(3, 14, 0) (END SCRIPT) Why are you looking at my signature, anyway? There's nothing of importance here.
| ||
No problem, I understand you may be new at teascript. Well, here's an error:
Code: Select all If Val(CoinCount)>Val(LocalCCount) Then The code inside "else" block is redundant, saying X variable is equal to its value won't change anything, so with the first "if" block would've be enough, you don't need to cover actions that won't change anything. This syntax is wrong: Code: Select all Val(LocalCCount)+1 It'll produce error. The right way to type it is: Code: Select all Val(LocalCCount) = Val(LocalCCount) + 1 Another problem with the syntax is this: Code: Select all Else Val(CoinCount)=Val(CoinCount) When using "else" keyword there's no need to be condition in font of it, because else itself means "if any of the previous conditions were met". So unless you use a "elseif", don't put a condition in font of "else". Also your code seems very confusing to me. A simpler way to do it is create 4 different scripts (one that adds 5, 10, 50 and 100) 1st script: name it "5 coins" and put this code in there: Code: Select all sysval(coincount) = sysval(coincount) + 5 Click the 5-coin NPC in the NPC tab, go to Advanced > Events I > Death > 5 Coins [script] 2nd script: name it "10 coins" and put this code: Code: Select all sysval(coincount) = sysval(coincount) + 10 Do the same you did with 5-coin NPC, but this time it triggers this script. Now do the same with the 50-coin and 100-coin, just remember to change the value in the code to the respective addition. By this method all coins must trigger this script when collected ("dies"), if there's a coin that it's not configured like above it will work like an standard coin. There are other ways to do this, but I wanted to keep it simple. Since when a NPC dies the script stops executing inmediately, these kind of npcs needs to be treaty differently. You can use GFX expansion feature, then you can have multiple coins in the same slot. Also I don't think is a good idea use the 3-up moon, it'll give you 4 lives when collected, you better use GFX expansion feature. Regarding the sound effect: AudioSet(1, 14, 0, "coin.ogg") This first line loads a custom sound. This is not needed if you'll play a default sound. AudioSet(2, 14, 0) This is the correct line since it'll play a default sound. AudioSet(3, 14, 0) This line is unneeded. When a sound effect is called, it'll play at once and then stop (this unless you introduce special parameters). Here you only need the second line so get rid of the first and third one. The reason why it drops error is because you missed the string at the second and third line (and first line string is wrong, it won't produce errors but if you're going to use custom sounds it wouldn't work, just to clarify). So change the second line like this: AudioSet(2, 14, 0, "") The things between quotation marks is optional, it doesn't matter what you type here unless you're loading a sound effect, but you always need the quotations marks (remember; 1 for load sound effect, 2 for play and 3 to stop it). | ||
(Lx Xzit, I Would've Quoted That Block Of Text Here, But It Was Too Big.)
Firstly, I Planned To Add The 5, 10, 50, And 100 Bonuses Separately After You Explained What Was Wrong With My Scripts, (Since If It Was Already Broken, I Didn't Really Need To Make More of The Useless Thing, Right?) Secondly, The 3-UP Bonus For The Moon Is Not Actually Hard-Coded, So Just Changing The "Score" Setting In A Custom .TXT NPC File Was All I Had To Do. I Think Though I Will Use The GFX Expansion Idea, But Since I Didn't Use It For The 100-Coin, You Can Probably See That I Don't Know How It Works (I Haven't Really Dipped Into All The Fancy Features Yet.) For The AudioSet Loading Option Though, The Scripting Help File Never Said Anything About It Only Loading Custom Files, So I Blame That Error On It. For All The Other Errors I Made, Those Were Mostly My Fault, I Kind of Rushed Making That First Script. I Was Really Impatient That It Would Work, So I Was Too Hasty. Lastly, Thanks For Helping Me With The Scripts! I'm Glad This Help Thread Exists. (Knowing That I Can Directly Add To The CoinCount System Value, Kind Of Defeats The Purpose Of The LocalCCount Value, As I Thought The CoinCount Value Couldn't Be Directly Changed, Since The Scripting Help File Said System Values Couldn't Be Edited Directly. Someone Should Really Edit That Thing.) EDIT: Something ELSE Has Gong Wrong With The Scripts, Sure, The 5, 10, 50, And 100 Coin NPC's Work Now, But, The Coin Counter Stops At 99 If I Collect Any Scripted Coins. Only Un-Scripted Coins Can Go Over 99 And Give The 1-UP. Which Means, The Scripted Coins Are Useless. Why are you looking at my signature, anyway? There's nothing of importance here.
| ||
Coins Not Adding UpWell, I May Be Thankful For That Coin Adding Script, It Does Not Seem To Work Like I Thought It Would. Mainly Because Once The Coin Count Reaches 99, Unless A Un-Scripted Coin Is Collected, The Scripted Coins WON'T Make The Coin Counter Go Over To 100, And Give The Player A 1UP, As Such, The Script Seems To Be Practically Useless Due To This Error.
(Lx Xzit, You Made That Error Since You Corrected The Script, So Technically, You Have To Fix It. Sorry, Its Classic "Your Fault" Rules.) Why are you looking at my signature, anyway? There's nothing of importance here.
| ||
Teascripting IssuesI am new to Teascripting in SMBX 1.4.4 (38A), so I guess feel dumb for saying this, but, using this tool to script NPCs is a lot more complicated then I hoped for. I tried researching it up, and I got almost nothing. So I was wondering if anyone can give me a tutorial on how to script NPCs. If anyone is able to help, then I respect that.
| ||
Broken VariablesHey, I've been on this topic before, clearly, but I have something else I need help with: Variables. I hadn't done anything with them until now, although the scripts I constructed aren't working. It's supposed to be 8 NPC's circling around a core. Each time a piece of the shield is destroyed, the circling NPC's move a little faster. Once all 8 Shield NPC's are destroyed, the core becomes vulnerable. Although, the scripts don't seem to work.
Here's the two scripts: Script Name:ProtectShieldDamage Code: Select all if var(ShieldDamageActive) == 1 Script Name:ProtectShieldSpin Code: Select all Call Var(ShieldSpeed) The Variable "ShieldSpeed" Starts at 0.01, meanwhile "ShieldDamageActive" starts at 0 and turns to 1 once a shield part is destroyed. I plan to make a script to handle the incrementing of ShieldDamageActive once these scripts are fixed. Why are you looking at my signature, anyway? There's nothing of importance here.
| ||
Remember that Tea-Script is not related to C nor JavaScript, it's a pseudo-language and the syntaxis is different.
When you use a variable, you must create it in the variables tab (which is found in "view" > "variables"). Once you do so the variable is already initialized and you can use them as you want. But when you use variables in scripts, they must be in parenthesis and accompanied by the keyword "var" or "v". So for example if you have a variable called "blocks": Code: Select all var(blocks) are both valid. Aside from that, I noticed some syntaxis errors: For the first script: 1-"if" statements should have an "end" at the end of the line. You also don't use double "=" to differentiate between assigning values and comparing them. So under any circumstance you should use two "=" together. 2-"tcreate" needs a "call" For the second script: 1- You don't need to "call" a variable, this line is unnecessary. 2- In the last parameter of "LSpin", everytime you use a variable you should put it in parenthesis and use the keyword "var" or "v" (to be honest I never use "var"). | ||