Flag Specific Trigger
Hi, I've been helping a friend with a map for a couple of days now. We are trying to go about the flag security in a new and somewhat unique way. However I need certain outputs to take place on whether the flag is in its respawn position or not. So I was thinking making a trigger that is activated by the set team flag. I have messed with the lua a bit but dont have much knowledge on it. I got it to a point where the flag can trigger it however a player had to be present in the trigger also. I would like it to be able to trigger with just the flag in it. If anyone could help me figure this out I would appreciate it. Thanks.
|
Not possible at the moment, but it is high on the lua-priority list.
|
Thanks, how about a script that would constantly check the flag origin and compare it to the location where its suppose to respawn.
|
Well, you can definitely check to see if it's off its origin. In base_ctf, the flag info_ff_script definitions have a status property that starts at 0 and changes to 1/2 after it gets touched initially. Detecting if it's within a certain trigger, though, is impossible.
You may be able to hack a crazy workaround using GetOrigin(), but I'd just wait until we get a real implementation of this. |
Would you have any kind of time frame for this feature. Also could you explain to me how the GetOrigin() works just in case I choose to be crazy as you put it.
|
Quote:
Quote:
Code:
local flag = GetInfoScriptByName( "flag_name" ) Code:
pos.x |
Thanks for the help squeek. However, I guess I just don't understand enough about the lua to get this to work. What I am trying to do is mainly use that getorigin to compare the position of the flag at any given moment to where the flag spawns at. If the flag is there I would like a switch to become usable, and if it is not obviously make the switch unusable. Since I didn't know how to tell the switch to lock or unlock through the lua I tried just changing it to only work for a team that isn't in that map (kGreen or kYellow). However as much as I try I can not get this to work.
Here is my lua code to do this. If any one could take a look and tell me what I am doing wrong. I am sure there are a lot of mistakes to it. So don't hold back on ripping it apart. Code:
button_common = func_button:new({ team = Team.kUnassigned }) |
This doesn't make sense. It's extremely unlikely that a flag will land exactly where it spawns, unless you will cause it to return there. In that case, just use a variable to keep track of whether the flag has been returned or whather it has been picked up (the default CTF flags already do this).
But if for some reason you need to do it this way, I would have the origin check function return a boolean (true/false), and call it from within the :allowed() function. And instead of checking for an exact coordinate, test for a max/min range of x, y, and z. Otherwise it would almost never return true. |
The flag returned or picked up would work perfectly. How would I go about telling it to check this. I am new to lua and it was just a shot in the dark. Thanks.
|
In the base_teamplay.lua, where the base_flag is defined, it seems to have a check for the status of the flag pertaining (i.e., if it's 'home', picked up, or dropped):
Code:
----------------------------------------------------------------------------- |
Code:
flag_button_common = func_button:new({ team = Team.kUnassigned, flagname = "default_flag_name" }) |
Squeek, you rock its working great so far. Thanks to you and crazycarl my friend can now move on with his map.
|
One last question and I promise I'm done for now. :mrgreen: Is it possible to parent something through the lua.
|
Quote:
Code:
OutputEvent( "entity_name", "SetParent", "parent_entity" ) |
Thanks again squeek, I actually just figured it out and was about to edit my question.
|
All times are GMT. The time now is 08:26 AM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.