Game Development Community

Creating sandstorm when colliding with object(stuck)

by Hazeeq Zainal · in Torque Game Engine · 11/18/2015 (6:28 am) · 10 replies

I am stuck on trying to create a sandstorm after colliding with an object. I've created the object and got it working with stuff like applying damage etc. I've also managed to create precipitations by adding it through the World Editor Creator. Now I want to be able to create a sandstorm effect whenever the player collides with my object. So far from what I've research I've only coded:

sandstorm.cs

function createSandStorm()
{
%handle = new InteriorInstance(){
position = "0 0 0";
rotation = "0 0 0";
interiorFile = %name;
}
}

I know interiorFile should be the path name but I don't know which file to use. Should it be the environment.cs where I've created the precipitation data blocks?

About the author

Recent Threads


#1
11/18/2015 (9:17 am)
Which version of Torque are you using?
#2
11/18/2015 (5:35 pm)
I'm using TGE v1.11
#3
11/19/2015 (8:55 am)
Sorry Hazeeq, but I can't be of help here. The latest and greatest version of the engine is Torque 3D, which is what is currently supported by the community. TGE 1.1 is ancient, not even the last version of that particular engine. Additionally, working with TGE (legacy) requires a license for official support.

I suggest switching over to Torque 3D MIT, which is a far better experience: Torque 3D MIT
#4
11/19/2015 (4:39 pm)
It's actually a module I'm taking in school so I guess the school has a license. But yea thanks anyway, I'll try to find another way.
#5
11/20/2015 (10:23 am)
The interiorFile should be the path and name of the Interior asset which in old TGE should be somewhere within gameFolder/data/interiors.
#6
11/27/2015 (10:39 am)
@Michael: A compiled demo TGE 1.1 shipped on a companion CD with at least one important game reference text (pretty sure a version came w/ my old "Tricks of The 3D Game Programming Gurus" too ... but not sure).

The whole gig with early TGE was that the compiled demo was made freely available to allow entry-level participants to start creating mods with the script engine. Then, there was a low-cost "indie" license for people who wanted to take it to the next level (and then the full-commercial license for big-name titles).

I think there were limitations on commercial release or something, but the core was definitely put out there to attract script-only developers into the ecosystem. This was true at least up through TGE 1.52 which has a free core demo release. So working with the engine doesn't always require a (development) license. I don't know how easy it is to get a copy of the old demos though (FWIW, I still have 'em bundled w/ my TGE product download in the console).

So at that time, a dev license was only required to access the codebase and/or release commercial titles. Which meant there were two classes of TGE resource: script only resources that everyone could access and codebase resources that only license holders were allowed to see. IIRC the same was true with the forums.

I don't know how many old-timers still pop in occasionally, but trying to help out students on older versions who ask questions has always been kind of a tradition. If you haven't done a diff, you might be surprised how much code from the 1.x days is still lurking in T3d.
#7
11/27/2015 (10:58 am)
@Hazeeq:

If you want to spawn a sandstorm, why are you creating an interiorInstance? Interiors won't work like that. There are issues with lighting (among other things) when you try to create them dynamically.

If you want the "sandstorm" to be reasonably small and of short duration, I think what you want would be more based on particle effects. Take a look at how the exploding crossbow bolt works (in ~/server/scripts/crossbow.cs). Play around with the various parts and see what they do.

If you want the entire setting to change into a lasting sandstorm, you'd need to set up and trigger an environmental effect.
#8
11/27/2015 (8:17 pm)
Thanks for the response guys. I found out I was doing it the wrong way.

At my onCollision function for the object I just had to add:

if(!$a)
$a = new Precipitation(){datablock = "SandStorm";};

Which is exactly what I wanted to do. I was able to add the precipitation before but only through the world creator. Not sure how I ended up thinking about creating a new instance of an interior. Once again, thanks all.

P.S. How do I format code in comments/posts?
#9
11/28/2015 (2:49 pm)
Click the MarkupLite is enabled link that can be found above every post text box. It shows you the markup tags to display source code (and other things).
#10
11/29/2015 (4:30 am)
I see, didn't notice that. Thanks Richard.