News:

One Minute Game Review by The Happy Friar: https://ugetube.com/@OneMinteGameReviews
Also on Rumble: https://rumble.com/c/c-1115371

idTech 4 (aka Doom 3 tech) Discord Server! https://discord.gg/9wtCGHa

Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - calan

#1
id Tech 4 Scripting / Re: remove cutscenes
November 06, 2014, 05:14:26 PM
Thanks for the info.

I'm still trying to learn my way around the editor, and it's slow going. How can I find and see an entity? For example, I know an imp is connected to "trigger_relay_82". How can I find that trigger, and follow it's connections? The "Find replace entity" command doesn't seem to do anything. (I've never been able to see any connections in the grid, but I know they are there.)

Which brings me to the view selection. Holy crap, what a mess. I have checkboxes checked for stuff that isn't visible and vise-versa. Checking a box sometimes doesn't change it's state, but items appear or disappear on the grid. View selected sometimes makes everything disappear, and hide may show them. Why can't I just click one command to make everything hidden, and then select what I want to see (and all at once...without having to open the menu for every stinking box I want checked).

What a mess. Ok, /end soapbox.  :)
#2
id Tech 4 Scripting / Re: remove cutscenes
November 06, 2014, 03:03:17 PM
I've been poking around in alphalabs1 where the maggots are introduced, and I can't even find the cutscene. I'm guessing it is a combination of effects or something, rather than a single entity.

And BTW....why are all the maggots triggering delays, other maggots, etc? This seems like a hugely over-complicated area of the map for no apparent reason.
#3
id Tech 4 Scripting / Re: Random non-encounters?
November 06, 2014, 01:26:56 PM
That is awesome!  Thanks much for your help with this (and everyone else also).


*****

I think part of the problem with no monsters spawning is that they don't "exist" yet as far as the random encounters code is concerned, since a lot of them are set to hide, sleep, or whatever until the player interacts with them. I haven't seen the RE code, but I think it will only re-spawn monsters that are active in the level...so maybe there just aren't enough monsters around to respawn?

I dunno....  just speculation.
#4
id Tech 4 Scripting / Re: Random non-encounters?
November 06, 2014, 11:52:15 AM
This is the script as it sits now:



/*
=====================
monster_base::monster_begin
=====================
*/
void monster_base::monster_begin() {

// ***************************************  CAS random non-encounters begin  **********************************
float spawnControl = 0;
float rndNumber = 0;
spawnControl = getFloatKey( "spawn_control" );

if (spawnControl == 0 ) {
// No chance of spawning, just remove.
self.remove();
sys.print( "spawnControl = 0; monster removed\n");
return;
} else if (spawnControl == 1) {
// always spawn
sys.print( "spawnControl = 1; monster spawned\n");
} else if (spawnControl == 2) {
// spawn, then kill
self.hide();
self.kill();
sys.print( "spawnControl = 2; monster spawned and killed\n");
return;
} else if (spawnControl == 3) {
// randomized.appearances
rndNumber = int(sys.random(100));
if (rndNumber >= 50 ) {
// spawn
sys.print( "spawnControl = 3; monster spawned (random: " + rndNumber + ")\n");
} else {
// spawn, then kill
self.hide();
self.kill();
sys.print( "spawnControl = 3; monster spawned and killed (random: " + rndNumber + ")\n");
return;
}
}
// ***************************************  CAS random non-encounters  end  ***********************************

float teleportType;
string triggerAnim;
        ...
        ...
        ...



"spawn_control" is always "3", as set in the monster_default.def file.

I'm not sure the "spawn, then kill" approach is working. I believe it should finish the begin procedure and then kill it, but not sure. I've tried it both ways and haven't noticed any difference other than the visibility of the monster. (it stays visible and then commits suicide if moved to the end of the function.  :)  )

Regardless, the sikkmod random encounters doesn't seem to be getting triggered by the monster deaths as I had hoped.




EDIT: It does appear to be pretty random now. I dunno... maybe something wasn't saved or refreshed.

(thanks for the sys.print tip BTW.  ;) )

Now if I could just get my suicidal monsters to spawn new random ones....
#5
id Tech 4 Scripting / Re: Random non-encounters?
November 06, 2014, 11:29:25 AM
First, thanks so much for the SDK fix Solar.  ;)

Second...  when I load a map using this in my script:


...
...
rndNumber = int(sys.random(100));
sys.warning( "random: " + rndNumber);
...
...


I now get mostly decreasing integers. The first half of the monsters get a random value above 50, the second half below. :wtf:
#6
Haunting of Deck 12 / Re: Random non-encounters?
November 06, 2014, 11:24:02 AM
First, thanks so much for the SDK fix Solar.  ;)

Second...  when I load a map using this in my script:


...
...
rndNumber = int(sys.random(100));
sys.warning( "random: " + rndNumber);

...
...


I now get mostly decreasing integers.  :wtf:
#7
id Tech 4 Scripting / remove cutscenes
November 06, 2014, 12:50:58 AM
What is the easiest way to completely remove all the cutscenes?

For some reason, Google doesn't seem to turn up anything, and I can't find a cvar reference that would do it.
#8
id Tech 4 Scripting / Re: Random non-encounters?
November 06, 2014, 12:40:07 AM
I'll give the integer approach a try.

Those script utilities look very interesting, if I can ever figure out what they are doing and how to use them.  My approach to using the scripted death of existing monsters to create new ones via sikk's random encounters isn't working out so well (random number issues aside). I usually just end up with a lot less monsters. I really wish it was simpler to just spawn monsters randomly anywhere in a map.

Thanks for the help!
#9
id Tech 4 Scripting / Re: Random non-encounters?
November 05, 2014, 05:18:49 PM
Ok, I have some more info, and I'm even more confused.  :)


I changed the script up a little. The value for "spawn_control" can now be:

0 = monster never spawns
1 = monster always spawns
2 = monster spawns then dies
3 = one of the above behaviors is randomly selected every time the monster is created.

Here is the script in ai_monster_base.script. Notice that I added some sys warnings to show what is going on.:


/*
=====================
monster_base::monster_begin
=====================
*/
void monster_base::monster_begin() {

float spawnControl = 0;
float rndNumber = 0;

spawnControl = getFloatKey( "spawn_control" );
rndNumber = sys.random(3) ;

if (spawnControl <= 0 ) {
// No chance of spawning, just remove.
self.remove();
sys.warning( "spawnControl = 0; monster not spawned");
return;
}

if (spawnControl > 0 && spawnControl <= 1) {
// always spawn
sys.warning( "spawnControl = 1; monster spawned");
return;
}

if (spawnControl > 1 && spawnControl <= 2) {
// spawn, then kill immediately
self.hide();
self.kill();
sys.warning( "spawnControl = 2; monster spawned and killed");
return;
}

if (spawnControl > 2) {
// randomized.appearances

if (rndNumber > 0 && rndNumber < 1 ) {
// don't spawn
self.remove();
sys.warning( "spawnControl = 3; monster not spawned (random: " + rndNumber + ")");
return;
}
if (rndNumber >= 1 && rndNumber < 2 ) {
// spawn
sys.warning( "spawnControl = 3; monster spawned (random: " + rndNumber + ")");
return;
}
if (rndNumber >= 2) {
// spawn, then kill immediately
self.hide();
self.kill();
sys.warning( "spawnControl = 3; monster spawned and killed (random: " + rndNumber + ")");
return;
}
}

        ...
        ...
        ...



and here is the default value in monster_default.def:


        ...
        ...
"spawn_control"  "3"   //   set to random behavior for testing an unmodified map
"editor_var spawn_control"    "Controls how often monster spawns. 0 = never, 1 = always, 2 = spawn and die, 3 = random. A value of 2 causes the monster to spawn and then be killed immediately, to trigger a random encounter."
        ...
        ...


First, the good news. I loaded up an unmodified Alpha Labs 1 map, and the script seemed to work fine. Unfortunately, their weren't many monsters hanging around. For some reason, the random values assigned to each monster increase in an almost linear fashion as each monster is created. So the first monsters were all between 0 and 1, and never spawned. The middle monsters were set from 1 to 2 and did spawn, and by the end of the map the monsters were in the 2's and were being set to spawn and then be killed. While this may have made for a crazy map (easy at first, nightmare at the end), it isn't what I want.

Why would the random numbers increase as the monsters are being created? (It almost has to be a function of the RNG not being reseeded on each call I think).  How do I get a truly random number between 0 and 3 when each monster is created, if I can't re-seed the RNG each time?

Another issue I'm having is that the spawn_control values in my test map (with 3 monsters) don't appear to be getting passed through. The monsters always get created with whatever spawn_control value I set in the monster_default.def file...or so it seems.

So close!   :)


FWIW, even with this only partially working, playing through the first part of Alpha Labs (which I've gone through a hundred times) was quite different and fun.
#10
id Tech 4 Scripting / Re: Random non-encounters?
November 05, 2014, 12:22:10 PM
Still no worky.

I've discovered that if I use a spawn_control value of .5 or lower, Bernie never spawns. If I use .6 or higher, he always spawns.

Something else that is a bit odd....if Bernie is set to not spawn (either by a value of 0 or anything below .5), there is a brief flicker of his flame that fades out as the room comes into view. Not sure if that is relevant or not.

EDIT: Would re-seeding the random generator help? How (can) you do that in the D3 scripting engine?
#11
id Tech 4 Scripting / Re: Random non-encounters?
November 05, 2014, 11:40:54 AM
Still no luck. Here is what I have:

monster_default.def

entityDef monster_default {
"editor_color" "1 .5 0"
        ...
        ...
        ...

// ***** CAS random non-encounters *****
"spawn_control"    "1.0"
"editor_var spawn_control"    "Controls how often monster spawns. 0 = never, 1 = always. Values between 0 and 1 cause monster to spawn x% of the time. A value of 2 causes the monster to spawn and then be killed immediately, to trigger a random encounter."

}


ai_monster_base.script

void monster_base::monster_begin() {

// ***************************************  CAS random non-encounters begin  **********************************

float rndChance = 0;
float rndNumber = 0;

rndChance = getFloatKey( "spawn_control" );
if ( rndChance == 0 ) { rndChance = 1.0; } // Need to set a default value of always spawn.
rndNumber = random( 1.0 );

if ( rndChance == 0 ) {
// No chance of spawning, just remove.
self.remove();
return;
}

if ( rndChance == 2 ) {
// Always kill.
self.hide();
self.kill();
return;
}

if ( rndChance > 0 && rndChance < 1 ) { // If rndChance == 1 always spawn.

// If a random number between 0 and 1 is greater than
// the AI chance number then remove the AI.

if ( rndNumber > rndChance ) {
self.remove();
return;
}
}

// ***************************************  CAS random non-encounters  end  ***********************************


float teleportType;
string triggerAnim;
float waittime;
        ...
        ...
        ...
        ...
}



big_map.map

...
...
...
// entity 1
{
"anim" "idle"
"classname" "monster_zombie_boney"
"name" "monster_zombie_boney_1"
"origin" "272 168 0"
"angle" "180"
"trigger" "1"
"spawn_control" "0.5"
}
...
...



I know the script is reading the spawn_control value from the map, because I can change it from 0 to 1 in the map entity def and it responds as it should. But, the script isn't working as I expect it to.

rndChance = 0, no monsters (as expected)
rndChance = 1, monsters always spawn (as expected)
rndChance = anything between 0 and 1, monsters always spawn
rndChance = 2, monsters never spawn and nothing ever happens. Random encounters is working though, because if I spawn a monster and then kill it, another one will spawn.

Still investigating....

EDIT:

Ok, it looks like the random encounters is working when rndChance = 2. The RE monsters weren't spawning because I'm in the corner of a test room, and they won't appear until I look away. I thought if I set the teleport value, they would spawn no matter if I was looking or not, but that doesn't seem to be the case. I still have to look away, and then POOF!...  there they are.

Still can't get the random appearance to work though.
#12
id Tech 4 Scripting / Re: Random non-encounters?
November 05, 2014, 10:10:10 AM
That's what I thought on defining the spawn_control values... tried it both ways and not having luck yet, but still working on it. Probably just operator error.  :)

Interesting thought on the scripting errors. Is there an easy way to see which monsters in a level are "needed" and should be left alone?
#13
id Tech 4 Scripting / Re: Random non-encounters?
November 05, 2014, 09:24:16 AM
Awesome, but I have a dumb question.

How do I add the "spawn_control" value to the monster defs? Is it as simple as just putting "spawn_control   1.0" in "monster_default.def", and then over-riding it in whatever monster defs that I want a different value?

Thanks much!
#14
id Tech 4 Scripting / Re: Random non-encounters?
November 04, 2014, 05:14:01 PM
someone add this entity/value pair to ai_monster_base, that can be set for each monster in a level:

spawn_control
0 = never
1 = every time (normal)

Between 0 and 1 is a probability of spawning percentage. (I.E. a value of .4 would mean that the monster comes to life and shows up about 40% of the time.)

2 = invisible spawn and quick death, to trigger sikkmod random encounter.


*****

...or if it can be done without recompiling the SDK, teach me.   :D
#15
id Tech 4 Scripting / Re: Random non-encounters?
November 04, 2014, 11:55:41 AM
Thanks BloodRayne.

What I'm shooting for right now is much simpler.... I just want a way to make existing monsters only appear "sometimes". Some type of script that uses random numbers to control if they can spawn, or if they stay inactive and hidden.

Another thought I had was to use something like that ^ in conjunction with the random encounters code in sikkmod. This is all speculative without any study of the code (I'm still in learning mode), but would it be possible to invisibly spawn a pre-placed monster and then kill it immediately...thus setting up a random respawn? If so, it should be fairly easy to generate a lot of randomness without changing the existing maps...other than adding the script to each existing monster.

My thought experiment is that you add a script to each desired monster (or maybe a global script in the monster ai?) that sometimes lets it function as scripted, sometimes keeps it completely inactive, and sometimes spawns it invisibly and then immediately kills it (thus hopefully triggering a random respawn).

Seems doable, but I don't have the scripting/level knowledge to actually put it in place to test. If someone can help me with the script and process (or just help flesh out the details as I'm learning), I'll go through the maps and set it all up. Could be very interesting.