alertentity not working right


(denizsi) #1

If anyone has read my previous posts about some stupid gate and door and area portals… this is about them.

Download the .map, .script file and .bsp files all here in this zip (25 kb)
http://www32.brinkster.com/godexiled/mapping/aportal.zip
And just in case the above one doesn’t work
http://www32.brinkster.com/godexiled/mapping/aportal2.zip

Problem: If you download and check the .map, you’ll see there’s a gate with a func_door in it, which has an areaportal with it.
When you open the gate, func_door is also opened, and so is the areaportal. And when you close the gate, all the others close too. Everything fine so far. But if you interrupt the gate during closing,which means you hit the switch again to open the door before it’s completely closed, changing the gate’s direction, areaportal will screw up. Look at the script and you’ll understand. In the .script file you’ll see a script to trigger alertentity, which works at one place, but won’t in another.

The script you’ll be looking for is “fdoor”, and the lines with “trigger fdoor doit” which has “alertentity fdoor” (fdoor also being the targetname of this func_door).

Load the .bsp (don’t forget the sv_pure 0 and set g_gametype 2) and do a r_showtris 2 to see when the areaportal works and when it won’t

EDIT: (This is gonna be long) I forgot to add why I think It’s a problem.
If you look at the .script and understand how it all works, you’ll see that there are 3 instances where fdoor doit is triggered. one of them is in spawn. 2nd, it is triggered from within another script -which controls the setstate for the other doors (which are a part of the gate (immersion-wise)) which is triggered after the gate is closed. and the 3rd, triggered from within another script of the same type, which controls the setstates, which is triggered before the gate is opened.
Now if you hit the switch again to open the door before it’s closed, setstates are NOT triggered even though alertentity IS, and even though both are BEFORE the gate/doors are triggered to open. I can’t figure out this.


(Ifurita) #2

Add a lockout function to your scripting so that the switch cannot be used again when the door is opening or closing. It would be a simple accum * abort_if_equal 1, with accum * being set to 1 whenever the button is toggled and then reset to 0 whenever the gate finishes opening or closing


(denizsi) #3

unfortunately not that simple, because if I do that, then the gate won’t be interruptable, which means you’ll have to wait until it’s completely opened or completely closed. I don’t want that. Just check the files, all of them. See it in action and examine the map&script


(EB) #4

your file is corrupted/not a valid archive, try re-zipping it


(denizsi) #5

ok I’ve zipped the files with 2 different compression softwares, so at least one of them should work for everyone now.

http://www32.brinkster.com/godexiled/mapping/aportal.zip
http://www32.brinkster.com/godexiled/mapping/aportal2.zip


(Ifurita) #6

You can still use the same structure to execute the alert entity upon either state: 1) start open or 2) fully closed


(EB) #7

Your .zips do not work dude !!
Test them b4 you link them.
They are coming up as 258 bytes.


Found the problem…I opened it with Notepad and got this:

HTTP1.1 STATUS 403 Remote Access to this object forbidden

<html>
<head><title>Direct Access Forbidden</title></head>
This file cannot be directly accessed from a remote site, but must be linked through the Brinkster Member’s site.</body></html>

Comprende Godexiled ?


(SCDS_reyalP) #8

download and zip worked fine for me, just copy/paste the url


(EB) #9

Thanks ReyalP, I should have tried that. >>>> This script below works the way you want it to work…although there is a small bug that comes up; if the map loads without recognizing the fdoor, it can’t be re-alerted at all - but if it is there upon map load(99% of the time it is)…it works fine. It is probably a small timing issue, I may look into it more tomorrow, but this is 98% good if not 99%. Give it a try. NO VISIBLE HOM !!! (This is pretty much what Ifurita was telling you to do. There are so many ways to do so many things.)


tunnelgate_trigger
{
	spawn
	{
		accum 1 set 1
		wait 500
		trigger tunnelgate_trigger main
	}

	trigger main
	{
		trigger tunnelgate_trigger up
		trigger tunnelgate_trigger down

	}

	trigger up
	{
			accum 1 abort_if_not_equal 1
			resetscript

			trigger tunnelgate_lever up
			accum 1 set 0
	}

	trigger down
	{
			accum 1 abort_if_not_equal 0
			resetscript

			trigger tunnelgate_lever down
			accum 1 set 1
	}
}

tunnelgate_lever
{
	spawn
	{
	}

	trigger down
	{
		faceangles 0 0 180 400
		playsound sound/movers/switches/butn2.wav
		trigger tunnelgatedoor open
		trigger tunnelgatedoor2 open
		trigger tunnelgate open
	}

	trigger up
	{
		faceangles 0 0 0 400
		playsound sound/movers/switches/switch.wav
		trigger tunnelgatedoor close
		trigger tunnelgatedoor2 close
		trigger tunnelgate close
	}
}

tunnelgate
{
	spawn
	{
	wait 50
	trigger fdoor doit
	}

	trigger open
	{
		wait 500
		playsound sound/movers/misc/big_gate1.wav volume 127
		wait 350
		trigger fdoor doitopen
		gotomarker tunnelgate_pc2 20 wait
		playsound sound/movers/misc/big_gate3.wav volume 127
	}

	trigger close
	{
		wait 500
		playsound sound/movers/misc/big_gate1.wav volume 127
		wait 400
		gotomarker tunnelgate_pc1 20 wait
		playsound sound/movers/misc/big_gate3.wav volume 127
		trigger fdoor doitclosed
	}
}

fdoor
{
	spawn
	{
	}

	trigger doit
	{
	alertentity fdoor
	}
	
	trigger doitclosed
	{
	accum 1 abort_if_not_equal 0
	resetscript
	trigger fdoor doit
	accum 1 set 1
	}
	
	trigger doitopen
	{
	accum 1 abort_if_not_equal 1
	resetscript
	trigger fdoor doit
	accum 1 set 0
	}
	
}


tgate_rotdoor
{
	spawn
	{
	}

	trigger load
	{
		trigger tunnelgatedoor2 unload
		setstate tgate_rotdoor default
		setstate tgate_rotdoor_toi default
	}

	trigger unload
	{
		setstate tgate_rotdoor invisible
		setstate tgate_rotdoor_toi invisible
		trigger tunnelgatedoor2 load
	}
	
}

tgate_rotdoor2
{
	spawn
	{
	}

	trigger load
	{
		trigger tunnelgatedoor2 unload
		trigger tunnelgatedoor unload
		setstate tgate_rotdoor2 default
		setstate tgate_rotdoor_toi2 default
	}

	trigger unload
	{
		setstate tgate_rotdoor2 invisible
		setstate tgate_rotdoor_toi2 invisible
		trigger tunnelgatedoor2 load
		trigger tunnelgatedoor load
	}
	
}

tunnelgatedoor
{
	spawn
	{
	}

	trigger load
	{
		setstate tunnelgatedoor default
	}

	trigger unload
	{
		setstate tunnelgatedoor invisible
	}

	trigger open
	{
		wait 500
		wait 350
		gotomarker tunnelgate_pc2 20 wait
	}

	trigger close
	{
		wait 500
		wait 400
		gotomarker tunnelgate_pc1 20 wait
	}
}

tunnelgatedoor2
{
	spawn
	{
	}

	trigger load
	{
		setstate tunnelgatedoor2 default
	}

	trigger unload
	{
		setstate tunnelgatedoor2 invisible
	}

	trigger open
	{
		wait 500
		wait 350
		trigger tgate_rotdoor unload
		gotomarker tunnelgate_pc2 20 wait
		trigger tgate_rotdoor2 load
	}

	trigger close
	{
		wait 500
		wait 400
		trigger tgate_rotdoor2 unload
		gotomarker tunnelgate_pc1 20 wait
		trigger tgate_rotdoor load
	}
}

-Cheers :chef:


(denizsi) #10

Shweet!! Thank you so much, both of you! I can’t believe I couldn’t think defining additional routines, but I’d probably fail anyway, I’m not good with accums. Thanks

Now one more thing please :slight_smile:
If you open the door (either when the gate is open or closed), and you hit the switch before the door is closed, it will look ugly like being magically shut all of a sudden. Loffy said that I could use gloabaccum with the doors, so whenever a door is opened, the switch is not operatable until it’s closed again. But I have no idea how to make the engine recognize via scripting that either the door is open or closed. Could you help there as well?


(EB) #11

NP, glad to help with that, but…do want me to make the map for you too ? … :stuck_out_tongue: hehehehe.

I would do it for you, but to be honest, how about you give it a try first. This way you’ll learn. Even if you only learn what NOT to do. Scripting Tutorial w/ accums. ( Get adobe reader if you don’t have it. )

-cheers


(denizsi) #12

Thanks :slight_smile: I’ve spent a great deal of time with all the documentation and guides that came with ET Radiant, but mystery of accums has always eluded me :slight_smile: The script I managed to get the switch and the script_movers working is a product of desperate ‘try and see’ trials. So even though I wrote it, I can’t say I understand how the accum part works. If this guide is any better, than I’ll definitely try to grasp it.

I have acrobat reader but the link seems to be broken.


(EB) #13

hmmmm… it is a direct download. What browser are you using ? What error do you get ?


(denizsi) #14

ok I downloaded it, my connection was probably sucky when I tried to open it first


(G0-Gerbil) #15

Yay multiple threads on the same subject started by the same poster - gotta love it. I’ll just copy and paste what I wrote in the other one:

Why are you bothering with area portals?
In a MP game (and ET only supports this) your framerate is only as bad as the worst case scenario.
And in worst case scenario, all doors will be open = no gains whatsoever from area portal.

In other words, if your map requires area portals to have a reasonable framerate, your map is doomed and you need to think about how to re-work it so that normal structural + hints keeps the speed smooth enough.


(EB) #16

Yay multiple threads on the same subject started by the same poster - gotta love it
LOL…I agree. I think he had 3 all together…


(denizsi) #17

if you really read the 1st posts, you should know they are not the same at all. they only leaned towards the same results.

one of them was about having an entity be operated through script, through which I learned the command “alertentity”
one of them was about how to get areaportal work with a script_mover which I solved after I learned that script command but it worked buggy.
and the other one was about how to have a script_mover which could only be activated by a certain team, which turned out it isn’t possible at all without having to activate it by entering a trigger_multiple even though I made it clear that I want it to be operated only by -manually activating- it, just like you would open a regular door, and still I was told it was possible, was shown a way which didn’t work that way at all
and this one here, was about that bug. I’ve already partially solved the HOM in THAT thread, it was just this bug which I found later, which was about alertentity wasn’t working the way I thought it should. Sure, all of these collaborate into the same conclusion but except for this one, all the previous are subjects on their own. if I didn’t explain why I needed them at those threads,or if there were 2-3 week margins between the threads, there would be no way that you could say “same subjects started by same poster”, since it really is not the case. and this makes it 4 threads, you know :slight_smile:

I’ve read your post as well, but I was only trying to accomplish what I set in my mind. I’ll find out later if it will do any good, but I was obsessed with it, so I had to do it before going on.

don’t get me wrong, I appreciate all help, all the positive & negative input, just don’t misinterpret what I was asking


(denizsi) #18

back to scripting. now as far as I’ve read (and I’ve read it all, I can’t claim I understand it all though), 2 accums in 2 different scripts have no connections, so one can use an accumX and play with its values while there is also another accumX as long as they both are in the seperate scripts. This is also written so in the pdf you pointed me at. I’m looking at your fix in my script, and I ‘guess’ the fdoor script uses the very same accume# defined in another script at the beginning and since these 2 scripts are seperate, I have to assume what I read to be false if I didn’t misunderstand them (which is surely possible).

anyway, I still can’t see how I can use accums with a regular rotating door. as far as i’ve seen, accums are used with entities which have at least 2 different routines defined in the script, like open/close, but func_door_rotating is just an unscripted entity, with no on/off type routines defined so I can’t even think of a way to experiment unless I’m missing some commands.


(EB) #19

Glad to see you’re trying to grasp this stuff!!!
Basically all I did was cut and paste your accum scripting and change the triggers that the accums allow for the scripting to call. But then again, you already know this.
Learn about GlobalAccums …Oasis’ and Railgun’s scripts should make it easier to learn.

-Good Luck Again


(denizsi) #20

Add a lockout function to your scripting so that the switch cannot be used again when the door is opening or closing. It would be a simple accum * abort_if_equal 1, with accum * being set to 1 whenever the button is toggled and then reset to 0 whenever the gate finishes opening or closing

Back to the start. Reading, examining other scripts and I still have no idea on how to tell the script when the door is opening or closing. This lockout you mention, is this a script command or an idea? I just can’t figure out a way to check the door’s state since it’s not script controlled. Could you give some hints, I’d still like to solve this myself but I can’t find any reference at all to compare to learn