Help triggerzone!
5 posters
Operation Flashpoint Dragon Rising OFDR Forums :: OPERATION FLASHPOINT: DRAGON RISING :: OFDR EDITING :: EDITING Q+A
Page 1 of 1
Help triggerzone!
hello!
I want to run a triggerzone with 4 players, I used the script of SAR! but not seem to work:
Any idea?.
-------------------------------------------------
Hola!
Quiero que se active un triggerzone al pasar todos los jugadores por el,, Alguna idea??.
I want to run a triggerzone with 4 players, I used the script of SAR! but not seem to work:
- Code:
function onEnter_triggerzone(zoneName, unitName)
if (OFP:isInEchelon(unitName, "Echelon")) then -- Echelon is Player´s
end
end
Any idea?.
-------------------------------------------------
Hola!
Quiero que se active un triggerzone al pasar todos los jugadores por el,, Alguna idea??.
juank.zero- Points : 19
Reputation : 0
Join date : 2013-02-26
Re: Help triggerzone!
try this:
you don't really need the parenthesis in the if statement iether tbh. You can write this also:
- Code:
function onEnter(zoneName, unitName)
if (OFP:isInEchelon(unitName, "Echelon")) then -- Echelon is Player´s
end
end
you don't really need the parenthesis in the if statement iether tbh. You can write this also:
- Code:
function onEnter(zoneName, unitName)
if zoneName == triggerzone and unit name == your unit
end
end
Re: Help triggerzone!
I have not worked!
I will have a problem in EntityDatabase?
- Code:
function onEnter(zoneName, unitName)
if zoneName == "triggerzone" and unitName == "Echelon" then
OFP:displaySystemMessage("Prueba numero uno");
end
end
I will have a problem in EntityDatabase?
juank.zero- Points : 19
Reputation : 0
Join date : 2013-02-26
Re: Help triggerzone!
The only thing that always worked flawlessly for me is:
any variant of onEnter me to run
- Code:
function onEnter_triggerzone_usa ()
end
any variant of onEnter me to run
juank.zero- Points : 19
Reputation : 0
Join date : 2013-02-26
Re: Help triggerzone!
I think the problem is that "Echelon" is really "echelon". DR always wants to change names to lower-case, so it is best to name things that way. Try either of these options...
- Code:
function onEnter(zoneName, unitName)
if zoneName == "triggerzone" and OFP:isInEchelon(unitName, "echelon") then
-- do something
end
end
- Code:
function onEnter_triggerzone(zoneName, unitName)
if OFP:isInEchelon(unitName, "echelon") then
-- do something
end
end
Regg- Veteran
- Points : 143
Reputation : 10
Join date : 2013-02-22
Re: Help triggerzone!
Yep, it will be a upper/lower case issue like Regg said.
tjdagger- Admin
- Location : Silverdale, Queensland, Australia
Points : 107
Reputation : 7
Join date : 2012-12-17
Age : 48
Re: Help triggerzone!
sorry!
I tried different ways but it does not work.
I tried different ways but it does not work.
juank.zero- Points : 19
Reputation : 0
Join date : 2013-02-26
Re: Help triggerzone!
juank.zero wrote:sorry!
I tried different ways but it does not work.
Hi juank.zero! Can you explain in more detail what you are trying to create. We can help you out but, without knowing what the situation is you are doing for your mission, we are limited on resources for helping your problem. Cheers
MD.
Re: Help triggerzone!
hello,
I wish is that all players when passing operate a triggerzone. My English is very bad and google translate does not seem to work properly, so I realisado so a couple of graphics:
Imagen 1: Al pasar jugador por triggerzone, este se activa:
Imagen 2: Al pasar todos los jugadores, triggerzone se activa:
Saludos!.
I wish is that all players when passing operate a triggerzone. My English is very bad and google translate does not seem to work properly, so I realisado so a couple of graphics:
Imagen 1: Al pasar jugador por triggerzone, este se activa:
Imagen 2: Al pasar todos los jugadores, triggerzone se activa:
Saludos!.
juank.zero- Points : 19
Reputation : 0
Join date : 2013-02-26
Re: Help triggerzone!
Lets try this approach
One way others have simplified trigger coding is to group them all into one area like this:
what your event triggers is up to you.
I hope that translates well enough for you.
One way others have simplified trigger coding is to group them all into one area like this:
- Code:
Function onEnter(zoneName, unitName)
--example 1 - all entities trigger an event
if zoneName = "trigger1" then
displaySystemMessage( “trigger1 entered” ) --execute your code
return --use this to exit out of the "On Enter" routine
end
--example 2 -- only one entity triggers an event
if zoneName = "trigger1" and unitName = "someone_special" then
displaySystemMessage( “someone_special entered trigger1” ) --execute your code
end
end
what your event triggers is up to you.
I hope that translates well enough for you.
Last edited by John J. Stevens on Thu 04 Jul 2013, 19:13; edited 2 times in total
John J. Stevens- Admin
- Location : WV/PA
Points : 285
Reputation : 22
Join date : 2012-12-19
Re: Help triggerzone!
Question @JS:
When you use the return keyword is like saying OFP:disableEvent(myEvent) etc???
When you use the return keyword is like saying OFP:disableEvent(myEvent) etc???
Re: Help triggerzone!
RETURN forces an exit from the routine/function it is in - you would use it in situations when a routine has a lot of individual IF conditions and processing other IFs in that routine are unneeded.
Basically freeing up the processor to other things
Basically freeing up the processor to other things
John J. Stevens- Admin
- Location : WV/PA
Points : 285
Reputation : 22
Join date : 2012-12-19
Re: Help triggerzone!
in this example to mount all the players something happens!:
I want same thing but with the function onEnter
- Code:
function onMount_vu25mh60s(vehicleName, unitName, echelonName)
if OFP:isAllMounted("Echelon") == true then
OFP:move("EchelonI1", "waypointI4", "ADDTOFRONT");
end
end
I want same thing but with the function onEnter
juank.zero- Points : 19
Reputation : 0
Join date : 2013-02-26
Re: Help triggerzone!
OK! few things need to change here for starters.
when writing your functions I'd get in the habit of writing, things like this if you are using specific vehicle names and unit name.
change it too:
Do that for onEnter functions too.
Also..., Regg explained about case lettering for strings in OFP commands. Always use lower case. your OFP:move command has "EchelonI1". change that to "echeloni1".
If you want something to happen in the onEnter such as mount a vehicle. Use an OFP:mount command to initialize the mounting event.
Then write a complete separate function for the onMount command. like this:
It think that last code is correct, I've not tested it. try it out and see what happens.
when writing your functions I'd get in the habit of writing, things like this if you are using specific vehicle names and unit name.
- Code:
function onMount_vu25mh60s(vehicleName, unitName, echelonName)
change it too:
- Code:
function onMount(vehicleName, unitName, echelonName)
if vehicleName == vu25mh60s then
-- execute your code
Do that for onEnter functions too.
Also..., Regg explained about case lettering for strings in OFP commands. Always use lower case. your OFP:move command has "EchelonI1". change that to "echeloni1".
If you want something to happen in the onEnter such as mount a vehicle. Use an OFP:mount command to initialize the mounting event.
Then write a complete separate function for the onMount command. like this:
- Code:
function onMount(vehicleName, unitName, echelonName)
if vehicleName == "vu25mh60s" and OFP:isAllMounted("echelon") then
OFP:move("pilot","waypointI4","ADDTOFRONT");
end
end
--
It think that last code is correct, I've not tested it. try it out and see what happens.
Re: Help triggerzone!
I think I now what you want juank.zero
or a self generating table, by placeing all triggers in a single entityset and spawning at mission start...
- Code:
function onEnter_triggerName(zoneName, unitName)
if OFP:isInEchelon(unitName,"Echelon") then
OFP:disableEvent("onEnter_triggerName")
--do stuff eg. activate an entitySet
end
end
function onLeave_triggerName(zoneName, unitName)
if OFP:isInEchelon(unitName,"Echelon") and not OFP:isInTrigger("Echelon") then
OFP:enableEvent("onEnter_triggerName")
--do stuff eg. destroy an entitySet
end
end
or a self generating table, by placeing all triggers in a single entityset and spawning at mission start...
- Code:
function onMissionStart()
OFP:activateEntitySet("triggers")
end
function onEnter(zoneName, unitName)
if do_stuff_triggers[zoneName] and do_stuff_triggers[zoneName] == "on" and OFP:isInEchelon(unitName,"Echelon") then
do_stuff_triggers[zoneName] = "off"
--do stuff eg. activate an entitySet
end
end
function onLeave(zoneName, unitName)
if do_stuff_triggers[zoneName] and do_stuff_triggers[zoneName] == "off" and OFP:isInEchelon(unitName,"Echelon") and not OFP:isInTrigger("Echelon") then
do_stuff_triggers[zoneName] = "on"
--do stuff eg. destroy an entitySet
end
end
function onSpawnedReady( setName, setID, tableOfEntities, errorCode )
if setName == "triggers" then
if not do_stuff_triggers then
do_stuff_triggers = {}
end
for i = 1,#tableOfEntities do
if debug:getTemplateName(tableOfEntities[i]) == "triggerzone" then
do_stuff_triggers[tableOfEntities[i]] = "on"
end
end
end
end
tjdagger- Admin
- Location : Silverdale, Queensland, Australia
Points : 107
Reputation : 7
Join date : 2012-12-17
Age : 48
Re: Help triggerzone!
would I be right in saying the OFP:activateEntitySet command needs a variable to be set for it first??
then that would be used again where you have the do_stuff_triggers[zoneName]--Variable placed in here.
then that would be used again where you have the do_stuff_triggers[zoneName]--Variable placed in here.
Re: Help triggerzone!
- Code:
function onEnter_triggerzone(zoneName, unitName)
if OFP:isInEchelon(unitName, "Echelon") then -- players enter = activated triggerzone... script not working
OFP:displaySystemMessage("Soldiers Enter");
OFP:disableEvent("onEnter_triggerzone");
OFP:addTimer("TEMPO", 1000);
remain = 10
end
end
function onTimer_TEMPO ()
remain = remain - 1
OFP:displaySystemMessage("Target Capturing:"..remain);
OFP:displaySystemMessage("\n \n \n \n \n");
if (remain == 0) then
OFP:displaySystemMessage("captured Target!");
OFP:removeTimer("TEMPO");
end
OFP:setTimer ("TEMPO", 1000);
end
I want is:
1- four players (4) enter the triggerzone.
2- players entering the triggerzone activates a timer...
BUT!...triggerzone is activated by entering only one (1) player
.. I tried all the recommendations, but I still have the problem.
greetings!
juank.zero- Points : 19
Reputation : 0
Join date : 2013-02-26
Re: Help triggerzone!
Try this...
Greetings, Back at ya!
- Code:
function onMissionStart()
remain = 10
end
function onEnter_triggerzone(zoneName, unitName)
if OFP:isInEchelon(unitName, "Echelon") then -- players enter = activated triggerzone... script not working
OFP:displaySystemMessage("Soldiers Enter");
OFP:disableEvent("onEnter_triggerzone");
OFP:addTimer("TEMPO", 1000);
end
end
function onTimer_TEMPO ()
remain = remain - 1
OFP:displaySystemMessage("Target Capturing:"..remain);
OFP:displaySystemMessage("\n \n \n \n \n");
OFP:setTimer ("TEMPO", 1000);
if (remain == 0) then
OFP:displaySystemMessage("captured Target!");
OFP:removeTimer("TEMPO");
end
end
Greetings, Back at ya!
tjdagger- Admin
- Location : Silverdale, Queensland, Australia
Points : 107
Reputation : 7
Join date : 2012-12-17
Age : 48
Re: Help triggerzone!
Mdog?
Are you asking about the self generating table example? If you are, then yes and no.
...because in... do_stuff_triggers[zoneName] inside the onEnter or onLeave function "[zoneName]" is the variableName of the zone just entered or left.
Which is then checked to see weather or not it exists inside the table that is generated in onSpawnedReady, from the entityset spawned at mission start, which contains
all the triggerzones that we want to have an on off switch variable.
All this in turn can then be controlled by checking the zone status and if any "Echelon" member is inside a [triggerzone] before firering an event and switching the zone value to "off"...
or ... a whole "Echelon" leaving a triggerzone before fireing an event eg. "despawning props" then setting the zone back to "on".
hope that answers your question?
mdog wrote:would I be right in saying the OFP:activateEntitySet command needs a variable to be set for it first??
then that would be used again where you have the do_stuff_triggers[zoneName]--Variable placed in here.
Are you asking about the self generating table example? If you are, then yes and no.
...because in... do_stuff_triggers[zoneName] inside the onEnter or onLeave function "[zoneName]" is the variableName of the zone just entered or left.
Which is then checked to see weather or not it exists inside the table that is generated in onSpawnedReady, from the entityset spawned at mission start, which contains
all the triggerzones that we want to have an on off switch variable.
All this in turn can then be controlled by checking the zone status and if any "Echelon" member is inside a [triggerzone] before firering an event and switching the zone value to "off"...
or ... a whole "Echelon" leaving a triggerzone before fireing an event eg. "despawning props" then setting the zone back to "on".
hope that answers your question?
tjdagger- Admin
- Location : Silverdale, Queensland, Australia
Points : 107
Reputation : 7
Join date : 2012-12-17
Age : 48
Operation Flashpoint Dragon Rising OFDR Forums :: OPERATION FLASHPOINT: DRAGON RISING :: OFDR EDITING :: EDITING Q+A
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|