Page 1 of 1

Scripting, matcen > action

Posted: Sat Sep 13, 2008 3:06 am
by LEON
Sup folks

Im new to scripting. Have just made a few that works. Get a key to open a door, end level on either room enter or bot killed, and stuff.
What I can't figure though, is how to....like...when all bots from an matcen is spawned and killed---> open a door. Or, all matcen bots killed ---> end level.

Anyone?
Thanks

Leon

Posted: Sun Sep 14, 2008 12:38 am
by Kyouryuu
It's been a really long time since I touched DALLAS.

I'm not sure if what you are asking is possible. In order to track the death of a given robot or robots, you have to give them individual names if I remember correctly. The problem with the Matcen is that it is spawning robots on-the-fly and therefore you can't name them.

Posted: Mon Sep 15, 2008 7:32 am
by LEON
Ah, ok, thats some bad news.
Hmmm, I wanted to make a SP lvl where the main fokus was to fight bots. like, you enter a room, the door locks behind you, a matcen start to spawn bots, and when you have killed them all you get access to what ever you was looking for in that room, and the door opens again.
Maybe theres some other way around this, I dunno, if its possible to script the matcen (not the bots) so when its finish, then you get what ever effect you want.

Posted: Mon Sep 15, 2008 11:30 am
by Kyouryuu
Maybe don't rely on a Matcen to do it?

Maybe look at how Proving Grounds set this up in Descent 3. I think in those situations, the boss robot was just there already, waiting for your arrival. Another potential option is that you can hide robots until you are ready to use them, IIRC.

Posted: Wed Sep 17, 2008 12:12 am
by LEON
Matcens is kind a useless if you cant script them. They are just there.....but not part of the story!?

Yes, the bot can be there from the start, but I was thinking of a lot more than just one or even 2-3. More like 20, but fighting 20 bots at the same time is just over the top.
I can hide them you say? Does that mean I must script every single bots? Sound like an option, must be a lot of scripting, though.

If I can't figure a way to do this, I'll come up with another gameplay or story. Is just that I wanted a kind of \"anarchy\" feel on the mission. You advance from one area to the next one by killing all the bots. What I like about SP levels is the fighting. I don't mind pusles much, and the replay value is low as well.

Ok, I'll try somting
Thanks for your help Kyouryuu

Leon

Posted: Wed Sep 17, 2008 8:23 am
by Foil
I'm not sure it can be done through DALLAS (I'd have to go back and look), but it's certainly possible. After all, there's the scripting in the SP level where you have to kill all but a few of the troops.

Posted: Wed Sep 17, 2008 12:49 pm
by Duper
I think the problem would be in what you 're trying to do Leon, is that in order complete your script, you would have to ID each bot spawned so the script would know when to go to opening the door.

I'm not sure that the D3 engine allows for that kinda process. You can script metcens and there is also a tool within the editor that allows you to assign certain properties outside of scripting. (triggers and such) But assigning an ID or name to each bot as it is spawned? I'm not certain that, that is possible.

Posted: Wed Sep 17, 2008 2:11 pm
by LEON
Hey.

I'm really new to this, so my sugestions might sound stupid.
When I make a matcen I set maximum bots to produce, so d3 at least know how many bots the matcen will generate. Then it should be possible to script ' when matcen1 has produced 20 objects, open door1'
This script wouldn't be optimal though, cus you get and complete message before you have killed the last bot, kind a odd.
I haven't find out how to script matcen at all, so I dunno about this.

Edit, Or maybe its possible to set a timer on the matcen. Matcen will be active for.....lets say 5 min. and door opens after 5 min, as well.

Posted: Wed Sep 17, 2008 2:33 pm
by The Lion
There's an event generated when a matcen spawns a bot, which can give you
its object handle.

Finding out when such newly generated bots are destroyed is another matter.
I'm pretty sure it can be done, but maybe not using just DALLAS since it only
lets you tie events to pre-existing objects.

You'd have to trap all \"Object destroyed\" events and compare the handles to
a list of spawned bots which you are maintaining.

Posted: Wed Sep 17, 2008 6:38 pm
by Kyouryuu
I don't have DALLAS installed, but maybe an if-then can do this? If you use an if-then, you may be able to capture the robot as the owner in the \"if\" clause, and then check against it in the \"then\" clause?

Re:

Posted: Thu Sep 18, 2008 2:06 pm
by Foil
The Lion wrote:I'm pretty sure it can be done, but maybe not using just DALLAS since it only
lets you tie events to pre-existing objects.
Agreed, it wouldn't be too hard to do using the D3 SDK C++ code.

But I think Leon is strictly using the DALLAS script editor... correct?

Re:

Posted: Thu Sep 18, 2008 2:17 pm
by LEON
Foil wrote:
The Lion wrote:I'm pretty sure it can be done, but maybe not using just DALLAS since it only
lets you tie events to pre-existing objects.
Agreed, it wouldn't be too hard to do using the D3 SDK C++ code.

But I think Leon is strictly using the DALLAS script editor... correct?
Correct!

Posted: Sun Oct 26, 2008 8:15 am
by WillyP
I think this can be done with DALLAS: There is an event 'Matcen Spawned' where the matcen id is specified and the spawned object becomes 'IT'.

Two ways I see it could done, either count the number of spawns and trigger when the last bot spawns... would open the door with one bot alive...

or: Make the last spawn of the matcen be a non robot object, like a power up, then the script could check for a non-robot spawn. (IT is (object type robot) = false) Then the player would be left with a power up and an unlocked door.

oops... sorry for the bump... and I see LEON has already released his level. :oops:

Posted: Sun Oct 26, 2008 9:53 am
by LEON
Thanks WillyP, I'll take a look at it.

As for my level, I droped the story and made a fight only level :)

Leon

Posted: Sun Oct 26, 2008 3:20 pm
by LEON
Ok, did some testing.

when matcen [matcen ID] has spawned an [IT]
IT is an powerup
Then open door 1

I made a matcen that spawned 4 robots first then last spew was an shield powerup.

And the door open up :)

Only thing i couldnt figure was to ID the matcen, since thers no matcen identification, as far as i know.
So if i have several matcen in a level, it would be
an problem, no?

Edit: Checked some more, matcen are named 'matcen1' 'matcen2' and so forth. I might use those ID's.
But i didn't find a way to set matcen ID in dallas.