|
Post by Beack on Jan 31, 2011 23:18:31 GMT
Forget my sky questuion, but there is a way to change the font of the Help trigger, messages, etc, I found that in a MBR video I want do the same with the messages
|
|
|
Post by Jeff on Jan 31, 2011 23:24:03 GMT
@stall I would think it is possible. The following code that I posted is not for ids but should answer some questions. HiGuy or Spy47 (or Phil), could you please look at this and tell me if this would work: Note that this is only for the landmine. This is not the full script. Not guarentteed to work. I am only guessing. I just copied and pasted from other scripts You would need: datablock TriggerData(CaboomTrigger) { tickPeriodMS = 100; }; function CaboomTrigger::onEnterTrigger(%this,%trigger,%obj) { //This is what happens when you enter the trigger function LandMine::onCollision(%this, %obj, %col) { %obj.setDamageState("Destroyed"); %resetTime = (%obj.resetTime $= "Default")? %this.resetTime: %obj.resetTime; if (%resetTime) { %obj.startFade(0, 0, true); %obj.schedule(%resetTime, setDamageState,"Enabled"); %obj.schedule(%resetTime, "startFade", 1000, 0, false); } } } At beack This is just a guess: datablock TriggerData(Help2Trigger) { tickPeriodMS = 100; }; function Help2Trigger::onEnterTrigger(%this,%trigger,%obj) { // Leaving an in bounds area. addHelpLine(%trigger.text, true); displaytext<font:DomCasualD:32><color:ffff00>""; }
|
|
|
Post by Perishingflames on Jan 31, 2011 23:38:17 GMT
For the landmine, that doesn't look like it would work at all lol
|
|
|
Post by Jeff on Jan 31, 2011 23:40:19 GMT
PF, its just a guess. I am not the greatest coder in the world. I just know some stuff.
|
|
|
Post by Stal on Feb 1, 2011 0:26:54 GMT
The ID idea was to make it easier to delay the times of land mine explosions so they didn't all go off at once, by adding a bunch of schedule lines. Fans etc have both an on and off state I think, should be able to switch. However in any case, level with code doesn't work. Also how is it supposed to work? It triggers all the land mines in the level?
|
|
|
Post by picklecow10 on Feb 1, 2011 1:02:37 GMT
Trigger. @phil execute code every time in increments? Figured a trigger would work, just think itd be a lot of effort to add triggers to every surface of the level, so was looking for a more scriptable solution.
|
|
|
Post by Jeff on Feb 1, 2011 1:04:08 GMT
As far as I know, triggers are the only way to go. Sorry Picklecow.
|
|
|
Post by phil on Feb 1, 2011 11:04:21 GMT
Trigger. @phil execute code every time in increments? Yeah you could, but the marble would just constantly jump (basically the same effect of incrementing the variable once but just a bit weirder) You can't 'nest' functions within another function... it doesn't make any sense. Instead you could do something like this in ::onEnterTrigger(): function CaboomTrigger::onEnterTrigger(%this, %trigger, %obj) { // Replace <landMineReference> with the name of the mine or a variable if you created it from script <landMineReference>.setDamageState("Destroyed"); // This causes the mine to blow up, and you can get affected by it if you're near it (not directly touching it!) // For it to reappear, we'll just schedule it to happen whenever <landMineReference>.schedule(<timeInMS>, setDamageState, "Enabled"); }
(egh why does the forum kill the indentation of the code) I had the same problem... as far as I know there doesn't seem to be any kind of onCollision() callback for an InteriorInstance (though it does exist for StaticShapes).
|
|
|
Post by picklecow10 on Feb 3, 2011 7:32:17 GMT
Damn.
OK, how about a way to tell if the marble is falling? Just some way to determine if it's heading up or down...
|
|
|
Post by CyberFox on Feb 3, 2011 9:55:23 GMT
compare the z variable's value each frame?
|
|
dobrakmato
Advanced Marbler
C# Code master[ss:Default Skin]
Are you a XNA developer? Contact me!
Posts: 314
|
Post by dobrakmato on Feb 3, 2011 18:41:41 GMT
How to save the file prefs.cs string and then also the value of it to load?
|
|
|
Post by Jeff on Feb 3, 2011 21:25:37 GMT
Off topic: your english is hard to understand If I am correct, if I may say, it should be because it is somehow set to a command that it is either true (1) or false (0). Also, thanks for the advice Phil about not to nest functions. I did not know that
|
|
Marblemaster1 (Frosty)
Professional Marbler
Master of the Spam Board, that is[ss:Default Skin]
I have CDO. It's just like OCD, except the letters are in alphabetical order AS THEY SHOULD BE.
Posts: 361
|
Post by Marblemaster1 (Frosty) on Feb 4, 2011 0:36:24 GMT
Hi, I gotta problem. I've been trying to make a powerup that makes you immune to all hazards for a few seconds. Right now, it's supposed to make you invincible forever, because I haven't gotten it to wear off yet. It shows up in MB fine, but as soon as I touch it, my C++ compiler (which is not open at the time) gives me an error message, asking if I want to debug it. I choose yes and the C++ compiler opens but nothing happens, I choose no and MB closes. WTF? Here's the code: datablock ItemData(InvinciMarbleItem) { category = "Powerups"; className = "PowerUp"; powerUpId = 6;
pickupAudio = "PuAntiGravityVoiceSfx"; pickupName = "an InvinciMarble PowerUp!";
shapeFile = "~/data/shapes/items/InvinciMarble.dts";
mass = 1; friction = 1; elasticity = 0.3; emap = false;
maxInventory = 1; };
function InvinciMarbleItem::onAdd(%this,%obj) { %obj.playThread(0,"Ambient"); }
function InvinciMarbleItem::onPickup(%this,%obj,%user,%amount) { PlayGui.setPowerup("InvinciMarbleItem"); }
function InvinciMarbleItem::onPowerUpUsed(%obj) { DuctFan.forceStrength[0] = 0; SmallDuctFan.forceStrength[0] = 0; Tornado.forceStrength[0] = 0; Tornado.forceStrength[1] = 0; Tornado.forceStrength[2] = 0; LandMineExplosion.ImpulseForce = 0; }
|
|
|
Post by Jeff on Feb 4, 2011 1:19:50 GMT
I believe you have to set the powerup id in the marbles.cs file. Also, why in c++. Marble blast runs off of torque script and torque script is c#. so, make sure your file extension is .cs (thats if it is a seperate file)
If it is a seperate file:
Please execute it in the init so that the game know to execute the code. The game will automatically compile it if it is a seperate file.
|
|
Marblemaster1 (Frosty)
Professional Marbler
Master of the Spam Board, that is[ss:Default Skin]
I have CDO. It's just like OCD, except the letters are in alphabetical order AS THEY SHOULD BE.
Posts: 361
|
Post by Marblemaster1 (Frosty) on Feb 4, 2011 1:27:08 GMT
Let's see... I did set the powerup id in the marble.cs file (I think). Weird, because my C++ compiler opens, and on the GG website, it says that Torque script is based off of C++.
|
|
|
Post by Jeff on Feb 4, 2011 1:31:07 GMT
let me look over it again... (will replay ~5mins or less)
btw, is it in powerups.cs or a seperate file?
You forgot to end the datablock with a ;
the last bracket of the datablock in its intierity needs a ;
try this:
datablock ItemData(InvinciMarbleItem) { category = "Powerups"; className = "PowerUp"; powerUpId = 6;
pickupAudio = "PuAntiGravityVoiceSfx"; pickupName = "an InvinciMarble PowerUp!";
shapeFile = "~/data/shapes/items/InvinciMarble.dts";
mass = 1; friction = 1; elasticity = 0.3; emap = false;
maxInventory = 1;
function InvinciMarbleItem::onAdd(%this,%obj) { %obj.playThread(0,"Ambient"); }
function InvinciMarbleItem::onPickup(%this,%obj,%user,%amount) { PlayGui.setPowerup("InvinciMarbleItem"); }
function InvinciMarbleItem::onPowerUpUsed(%obj) { DuctFan.forceStrength[0] = 0; SmallDuctFan.forceStrength[0] = 0; Tornado.forceStrength[0] = 0; Tornado.forceStrength[1] = 0; Tornado.forceStrength[2] = 0; LandMineExplosion.ImpulseForce = 0; } };
|
|
Marblemaster1 (Frosty)
Professional Marbler
Master of the Spam Board, that is[ss:Default Skin]
I have CDO. It's just like OCD, except the letters are in alphabetical order AS THEY SHOULD BE.
Posts: 361
|
Post by Marblemaster1 (Frosty) on Feb 4, 2011 1:54:39 GMT
Nope, doesn't work. It doesn't appear in the LE now. I don't think you're supposed to put functions in a datablock. Just a guess, though.
|
|
|
Post by Seizure22 (Witty Title) on Feb 4, 2011 2:19:44 GMT
@dobrák You probably want a function of this sort (for an item): (Use the item datablock name in place of DBNAME) function DBNAME::onPickup(%this, %obj) { $pref::HAVEITEM = 1; } picklecow10 Compare Z values to tell if the marble is falling. However, this isn't 100% accurate because of framelag (and the getvelocity function doesn't work). To 80%+ solve your original problem, though, check for $testCount == 1. (This value can be from 0-1; generally, partial values can be seen when bouncing off a surface). This value equals 1 when the marble is rolling on a surface (any surface, including a flat wall). You can raycast down to check if there's an interior under the marble. However, this will not account for those weird jumps on edges that you can sometimes perform. Jeff TorqueScript is similar to C languages but is not identical. Marblemaster1 (Frosty)That is because the default powerups are hardcoded in the engine, and there are no definitions of what to do for powerupid > 5. To fix this, you would need to edit the Marble::setPowerUp function to account for ID > 5 (and thus make functions to do what you want to accomplish) OR create a separate class of item object altogether (such as the gems are) with custom scripting to interface with the powerup variables, functions, and GUI element(s). And you're correct about having no functions in datablocks. You must declare things separately from each other, not inside each other. The only exception is when you smash the declaration together in a text string and run Eval on it.
|
|
|
Post by picklecow10 on Feb 4, 2011 6:43:02 GMT
$testCount is exactly what I needed, thanks
|
|
Marblemaster1 (Frosty)
Professional Marbler
Master of the Spam Board, that is[ss:Default Skin]
I have CDO. It's just like OCD, except the letters are in alphabetical order AS THEY SHOULD BE.
Posts: 361
|
Post by Marblemaster1 (Frosty) on Feb 4, 2011 15:42:57 GMT
OK, let's see. *goes into marble.cs* Here's the function SetPowerup: function Marble::setPowerUp(%this,%item,%reset) { PlayGui.setPowerUp(%item.shapeFile); %this.powerUpData = %item; %this.setPowerUpId(%item.powerUpId,%reset); }
I have no idea what to edit. I'm not that good at coding... I'd imagine it's the 3rd line, but I don't know which part. EDIT: Well, I'm not completely clueless. I'd imagine it's something like: if (%item.powerUpId == 6) { //not sure what to put in here... }
|
|
dobrakmato
Advanced Marbler
C# Code master[ss:Default Skin]
Are you a XNA developer? Contact me!
Posts: 314
|
Post by dobrakmato on Feb 4, 2011 18:19:35 GMT
Seizure22 (Witty Title)Thank you, but now i have another question. I have function: function DobrakmatoBox::onPickup(%this, %obj) { $pref::DobrakmatoBox = 1; }
How to add currently loaded mission to the value like the best saved times in prefs.cs: $pref::highScoresmarble["/data/missions/advanced/a-maze-ing.mis_0"] = "6973\tw"; $pref::highScoresmarble["/data/missions/advanced/a-maze-ing.mis_1"] = "90000\tNardo Polo"; $pref::highScoresmarble["/data/missions/advanced/a-maze-ing.mis_2"] = "90000\tNardo Polo"; And how to load value in choosegui.dso and then display image? I'm trying to code somethin as easter egg feature..
|
|
|
Post by Seizure22 (Witty Title) on Feb 4, 2011 20:35:16 GMT
@ Beack Font of help line can be changed at client/scripts/chathud.cs in function addHelpLine. Marblemaster1 (Frosty)Yeah that's right, just make sure the rest of the code there doesn't set the true PowerUpID on the marble else you'll have a crash again. @dobrák function DobrakmatoBox::onPickup(%this, %obj) { $pref::DobrakmatoBox[$Server::MissionFile] = 1; } ------- Try this (edit the fields to customize it): PlayMissionGui::onWake(%this, %obj) { if($MissionType $= "") $MissionType = "Beginner"; PMSetMissionTab($MissionType); //function from original file if (!isobject(dbText)) { new GuiMLTextCtrl(DBText) { profile = "ChatHudMessageProfile"; horizSizing = "center"; vertSizing = "center"; position = "288 232"; extent = "64 32"; minExtent = "8 8"; visible = "1"; helpTag = "0"; lineSpacing = "2"; allowColorChars = "1"; maxChars = "-1"; }; new GuiBitmapCtrl(DBBoxImage) { profile = "GuiDefaultProfile"; horizSizing = "center"; vertSizing = "center"; position = "300 6"; extent = "97 96"; minExtent = "8 8"; visible = "1"; helpTag = "0"; bitmap = "./game/DBBox.png"; wrap = "0"; }; PlayMissionGui.add(DBText); //add GUI elements to PlayMissionGui PlayMissionGui.add(DBBoxImage); } %id = PM_missionList.getSelectedId(); %mission = getField(PM_missionList.getRowTextById(%id), 1); %text = $Pref::DobrakmatoBox[%mission.file] == 1 ? "YES DB BOX" : "NO DB BOX"; DBText.setText(%text); //set the text of the GUI element }
|
|
dobrakmato
Advanced Marbler
C# Code master[ss:Default Skin]
Are you a XNA developer? Contact me!
Posts: 314
|
Post by dobrakmato on Feb 4, 2011 21:41:04 GMT
|
|
|
Post by Jeff on Feb 5, 2011 1:35:30 GMT
I was wondering if this could work. For mbopal, I want a power up that will temporarly increase the surface friction of the default materials to increase to 10.
|
|
|
Post by IsraeliRD on Feb 5, 2011 1:38:56 GMT
Does it really work above 6? When I tested for MBP, I didn't notice that the frictions went higher than 6, as in there was no noticeable effect. I put 6 as the limit, but I suspect it's somewhere between 4-6 including.
|
|
|
Post by Jeff on Feb 5, 2011 1:42:37 GMT
frictions can be over 6.
|
|
|
Post by IsraeliRD on Feb 5, 2011 1:59:33 GMT
Really? Because as I said, when I test MBP, it never seemed to have an effect higher than 6 (as in, marble doesn't slow down faster).
|
|
|
Post by Jeff on Feb 5, 2011 2:03:32 GMT
Matan, it is coded in mbopal. It works, also, off topic:
is the colmesh.dts that cyberfox released to the public for any mod to use ie mbopal?
|
|
|
Post by IsraeliRD on Feb 5, 2011 2:05:13 GMT
Yes
and Jeff, I know it works, I'm just stating that based on my own experience and testing, it doesn't have any greater effect than lower friction values. For example, try putting in 100, you'll not notice any difference to stop faster than 10 or 6.
|
|
|
Post by Jeff on Feb 5, 2011 2:06:51 GMT
oh, ok
missunderstood you matan.
Also, about my coding question, would what I have actually work. I have not tested it out yet. I wanted to make sure first.
Will download colmesh.dts to mbopal staff version
|
|