Jump to content

GRAW SP Scripting 4


GRIN_Wolfsong

Recommended Posts

Excuse me if i am wrong here! Can we now end the game if X Enemy are killed before Y Location is reached?

I think you can. But I'll have to think a little about how the script should be setup.

:D You should be able to implement this over any basic mission?

I`m looking at Mission now, but... :pirate:

help

Tinker

*EDIT*

<element type="UseVar" id="No_Deaths" set="0" />

<element type="UseVar" id="Enemy_Down" add="1" />

<element type="ActivateEventIf" id="Enemy_Down" equals="5" event="End_Game" />

Hope i am on the right tracks, just need to find an enemy down script to call the counter i think?

Link to comment
Share on other sites

Excuse me if i am wrong here! Can we now end the game if X Enemy are killed before Y Location is reached?

I think you can. But I'll have to think a little about how the script should be setup.

:D You should be able to implement this over any basic mission?

I`m looking at Mission now, but... :pirate:

help

Tinker

Ok. I think this will work.

You need two areas defeined. Both are the same world area, I called it goal_area, but one is true when the player isn't there and the other when he/she is. I called those death_area and safe_area.

<area_group name="safe_area" area_name="goal_area" group_id="friendly1" interval="0.3" condition="1"/>

<area_group name="death_area" area_name="goal_area" group_id="friendly1" interval="1.0" condition="0"/>

Then you need a trigger to check if the player has reached safe_area, and if such trigger en event that turns of the death_area and itself.

<user name="safe_area" type="once">

<trigger type="UnitInArea" area="safe_area"/>

<event name="player_safe"/>

</user>

Then you'll need a trigger for each of the teams that the player can kill before reaching safe_area. I've used teams with only one human in each to make it the exact number of kills, you'd have to go for entire team kills so this is the way to do it to count every kill made.

In these you'll also have to add the death_area condition, which is true when the player is not in the safe/death_area.

<user name="cleared_team1" type="once">

<trigger type="EnemyGroup" name="enemy_team1">

<enemy group_id="enemy_team1" condition="all"/>

</trigger>

<trigger type="UnitInArea" area="death_area"/>

<event name="killed_team"/>

</user>

<user name="cleared_team2" type="once">

<trigger type="EnemyGroup" name="enemy_team2">

<enemy group_id="enemy_team2" condition="all"/>

</trigger>

<trigger type="UnitInArea" area="death_area"/>

<event name="killed_team"/>

</user>

<user name="cleared_team3" type="once">

.

.

.

Then, to make it simple, lets say it's in the beginning og hte mission. So we set out variable "kills" to 0 and activate both areas to detect the player.

<event name="start_game">

<element type="UseVar" id="kills" set="0"/>

<element type="UnitInArea" area="death_area" state="activate"/>

<element type="UnitInArea" area="safe_area" state="activate" start_time="10.0"/>

</event>

This is the event triggered by the player in safe_area. It turns of the death_area, and then makes it impossible for any of the other triggers to run sucessfully, and itself as it has served it's purpose.

<event name="player_safe" once="true">

<element type="UnitInArea" area="death_area" state="deactivate"/>

<element type="UnitInArea" area="safe_area" state="deactivate"/>

</event>

This is the event called by each team killed trigger. It adds to the variable the number of members the team had, use the saem number in each team to make the script simpler. And then checks if it's enough to end the game, if so it calls another event. I set the limt to 6 in this example. Make sure this is NOT set to only run once!

<event name="killed_team">

<element type="UseVar" id="kills" add="1" start_time="1.0"/>

<element type="ActivateEventIfVar" id="kills" greater_than="6" event="game_over" start_time="2.0"/>

</event>

This is the event triggered if the player has killed enough enemies, and it ends the game.

<event name="game_over">

<element type="GameOver"/>

</event>

I think that would be it.

Edited by Wolfsong
Link to comment
Share on other sites

Excuse me if i am wrong here! Can we now end the game if X Enemy are killed before Y Location is reached?

I think you can. But I'll have to think a little about how the script should be setup.

:D You should be able to implement this over any basic mission?

I`m looking at Mission now, but... :pirate:

help

Tinker

Ok. I think this will work.

You need two areas defeined. Both are the same world area, I called it goal_area, but one is true when the player isn't there and the other when he/she is. I called those death_area and safe_area.

<area_group name="safe_area" area_name="goal_area" group_id="friendly1" interval="0.3" condition="1"/>

<area_group name="death_area" area_name="goal_area" group_id="friendly1" interval="1.0" condition="0"/>

Then you need a trigger to check if the player has reached safe_area, and if such trigger en event that turns of the death_area and itself.

<user name="safe_area" type="once">

<trigger type="UnitInArea" area="safe_area"/>

<event name="player_safe"/>

</user>

Then you'll need a trigger for each of the teams that the player can kill before reaching safe_area. I've used teams with only one human in each to make it the exact number of kills, you'd have to go for entire team kills so this is the way to do it to count every kill made.

In these you'll also have to add the death_area condition, which is true when the player is not in the safe/death_area.

<user name="cleared_team1" type="once">

<trigger type="EnemyGroup" name="enemy_team1">

<enemy group_id="enemy_team1" condition="all"/>

</trigger>

<trigger type="UnitInArea" area="death_area"/>

<event name="killed_team"/>

</user>

<user name="cleared_team2" type="once">

<trigger type="EnemyGroup" name="enemy_team2">

<enemy group_id="enemy_team2" condition="all"/>

</trigger>

<trigger type="UnitInArea" area="death_area"/>

<event name="killed_team"/>

</user>

<user name="cleared_team3" type="once">

.

.

.

Then, to make it simple, lets say it's in the beginning og hte mission. So we set out variable "kills" to 0 and activate both areas to detect the player.

<event name="start_game">

<element type="UseVar" id="kills" set="0"/>

<element type="UnitInArea" area="death_area" state="activate"/>

<element type="UnitInArea" area="safe_area" state="activate" start_time="10.0"/>

</event>

This is the event triggered by the player in safe_area. It turns of the death_area, and then makes it impossible for any of the other triggers to run sucessfully, and itself as it has served it's purpose.

<event name="player_safe" once="true">

<element type="UnitInArea" area="death_area" state="deactivate"/>

<element type="UnitInArea" area="safe_area" state="deactivate"/>

</event>

This is the event called by each team killed trigger. It adds to the variable the number of members the team had, use the saem number in each team to make the script simpler. And then checks if it's enough to end the game, if so it calls another event. I set the limt to 6 in this example. Make sure this is NOT set to only run once!

<event name="killed_team">

<element type="UseVar" id="kills" add="1" start_time="1.0"/>

<element type="ActivateEventIf" id="kills" greater_than="6" event="game_over" start_time="2.0"/>

</event>

This is the event triggered if the player has killed enough enemies, and it ends the game.

<event name="game_over">

<element type="GameOver"/>

</event>

I think that would be it.

:huh: You always have to type so much! :rofl:

I`ll give it a go, but i think you are correct with the original question.

Excuse me if i am wrong here! Can we now end the game if X Enemy are killed before Y Location is reached?

YES

Thnx a lot.

Tinker

Link to comment
Share on other sites

Sorry to keep pounding the Questions!

:unsure:

Making 1 man teams is going to be the simplest way for the counter to work? I do this a lot in GR anyhows, not a drama, just checking?

Tinker

Well. If you want to count EVERY human killed it is. You see, otherwise if you have a 4 man group_id, you'd have to have one trigger that goes off when 1 is killed, one that goes off when two have been killed, one that goes of when three have been killed and one that goes off when the forth have been killed.

Actually, now that I think some more on it there would be the same amount of trigges... So forget what I said. What is important is that you need one trigger that will execute each time a single human is killed, if you want the exact count.

Of you could set it to cound number of killed groups instead, which I would perfer. Then I would make a few 2-3 man teams and decide how many such teams that had to be killed to end the mission. Less amount of triggers.

Edited by Wolfsong
Link to comment
Share on other sites

Great ideas. Just wanted to add this though, your syntax seems to be off for the variable check command Tinker. It's ActivateEventIfVar and not ActivateEventIf. See GRIN_GeckoGore's corrective post above.

Thnx :thumbsup:

All i am trying to do here is:

For this purpose i am going to use the stripped down version of Mission 5.

We will need to think about adding :

1 Objective

6 Single Enemy Teams

1 Counter

Random of 2 patrols for Enemy Team 1

OBJECTIVE

You will need to reach the Objective killing no more than 3 guys. We should be able to see after several plays that Enemy #1 has 2 diffrent patterns. The game should end if you kill more than 3 Enemy.

Tinker

:D

If i can get this to work...

Link to comment
Share on other sites

Arghh! I have some bad news, i did a test for the "event_from_var" in the ActivateEventIfVar tag and it doesnt work :( only "event" in ActivateEventIfVar works as i should.

Instead "event_from_var" works just like "event" ie it activates the event you state inte there, not an event-name stored in a var.

The rest seems to work as i planned it though.

I hope you can live with this... but.. dang.. would have been sweet...

I've removed that part from the description above.

-GG

Link to comment
Share on other sites

Arghh! I have some bad news, i did a test for the "event_from_var" in the ActivateEventIfVar tag and it doesnt work :( only "event" in ActivateEventIfVar works as i should.

Instead "event_from_var" works just like "event" ie it activates the event you state inte there, not an event-name stored in a var.

The rest seems to work as i planned it though.

I hope you can live with this... but.. dang.. would have been sweet...

I've removed that part from the description above.

-GG

Hmm ok, thnx for the info. Still struggling with placing the AI actually.. :wacko: but i am sure i will get by.

Tinker

Link to comment
Share on other sites

Great ideas. Just wanted to add this though, your syntax seems to be off for the variable check command Tinker. It's ActivateEventIfVar and not ActivateEventIf. See GRIN_GeckoGore's corrective post above.

I think that was my fault. Wrote it wrong in the list. But it's fixed now.

Also remove the event_from_var attribute description.

Link to comment
Share on other sites

Great ideas. Just wanted to add this though, your syntax seems to be off for the variable check command Tinker. It's ActivateEventIfVar and not ActivateEventIf. See GRIN_GeckoGore's corrective post above.

I think that was my fault. Wrote it wrong in the list. But it's fixed now.

Also remove the event_from_var attribute description.

No Fear, let me finish TrainRide for GR, then next week i will want some success!

Tinker

:yes:

Link to comment
Share on other sites

Ok. I think this will work.

You need two areas defeined. Both are the same world area, I called it goal_area, but one is true when the player isn't there and the other when he/she is. I called those death_area and safe_area.

<area_group name="safe_area" area_name="goal_area" group_id="friendly1" interval="0.3" condition="1"/>

<area_group name="death_area" area_name="goal_area" group_id="friendly1" interval="1.0" condition="0"/>

Then you need a trigger to check if the player has reached safe_area, and if such trigger en event that turns of the death_area and itself.

<user name="safe_area" type="once">

<trigger type="UnitInArea" area="safe_area"/>

<event name="player_safe"/>

</user>

Then you'll need a trigger for each of the teams that the player can kill before reaching safe_area. I've used teams with only one human in each to make it the exact number of kills, you'd have to go for entire team kills so this is the way to do it to count every kill made.

In these you'll also have to add the death_area condition, which is true when the player is not in the safe/death_area.

<user name="cleared_team1" type="once">

<trigger type="EnemyGroup" name="enemy_team1">

<enemy group_id="enemy_team1" condition="all"/>

</trigger>

<trigger type="UnitInArea" area="death_area"/>

<event name="killed_team"/>

</user>

<user name="cleared_team2" type="once">

<trigger type="EnemyGroup" name="enemy_team2">

<enemy group_id="enemy_team2" condition="all"/>

</trigger>

<trigger type="UnitInArea" area="death_area"/>

<event name="killed_team"/>

</user>

<user name="cleared_team3" type="once">

.

.

.

Then, to make it simple, lets say it's in the beginning og hte mission. So we set out variable "kills" to 0 and activate both areas to detect the player.

<event name="start_game">

<element type="UseVar" id="kills" set="0"/>

<element type="UnitInArea" area="death_area" state="activate"/>

<element type="UnitInArea" area="safe_area" state="activate" start_time="10.0"/>

</event>

This is the event triggered by the player in safe_area. It turns of the death_area, and then makes it impossible for any of the other triggers to run sucessfully, and itself as it has served it's purpose.

<event name="player_safe" once="true">

<element type="UnitInArea" area="death_area" state="deactivate"/>

<element type="UnitInArea" area="safe_area" state="deactivate"/>

</event>

This is the event called by each team killed trigger. It adds to the variable the number of members the team had, use the saem number in each team to make the script simpler. And then checks if it's enough to end the game, if so it calls another event. I set the limt to 6 in this example. Make sure this is NOT set to only run once!

<event name="killed_team">

<element type="UseVar" id="kills" add="1" start_time="1.0"/>

<element type="ActivateEventIf" id="kills" greater_than="6" event="game_over" start_time="2.0"/>

</event>

This is the event triggered if the player has killed enough enemies, and it ends the game.

<event name="game_over">

<element type="GameOver"/>

</event>

I think that would be it.

Ok... Started thinking about this on the train to work this morning, and it could be made easier if you just set all the enemy teams the player can kill before reaching the safe area as the same "group_id", then you won't need a variable at all, and only one enemy death trigger. And it would still be exact for the number of enemies killed. It would only complicate it without reason if a variable is used.

This is the rewritten script for it.

You need two areas defeined. Both are the same world area, I called it goal_area, but one is true when the player isn't there and the other when he/she is. I called those death_area and safe_area.

<area_group name="safe_area" area_name="goal_area" group_id="friendly1" interval="0.3" condition="1"/>

<area_group name="death_area" area_name="goal_area" group_id="friendly1" interval="1.0" condition="0"/>

Then you need a trigger to check if the player has reached safe_area, and if such trigger en event that turns of the death_area and itself.

<user name="safe_area" type="once">

<trigger type="UnitInArea" area="safe_area"/>

<event name="player_safe"/>

</user>

Then you'll need a trigger for the team that the player can kill before reaching safe_area. Here you set how many enemies the player must kill to fail the mission.

In these you'll also have to add the death_area condition, which is true when the player is not in the safe/death_area.

<user name="cleared_team" type="once">

<trigger type="EnemyGroup" name="enemy_team">

<trigger type="UnitInArea" area="death_area"/>

<enemy group_id="enemy_team" condition="6"/>

</trigger>

<event name="killed_team"/>

</user>

Then, to make it simple, lets say it's in the beginning of the mission. So we set out variable "kills" to 0 and activate both areas to detect the player.

<event name="start_game">

<element type="UnitInArea" area="death_area" state="activate"/>

<element type="UnitInArea" area="safe_area" state="activate" start_time="10.0"/>

</event>

This is the event triggered by the player in safe_area. It turns of the death_area, and then makes it impossible for any of the other triggers to run sucessfully, and itself as it has served it's purpose.

<event name="player_safe" once="true">

<element type="UnitInArea" area="death_area" state="deactivate"/>

<element type="UnitInArea" area="safe_area" state="deactivate"/>

</event>

This is the event triggered if the player has killed enough enemies, and it ends the game.

<event name="killed_team">

<element type="GameOver"/>

</event>

Edited by Wolfsong
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...