Monday, April 16, 2012

Help With Vampirism

I'm creating a vampirism type map, and need some assistance. It seems that ive set up 2 triggers so that when a unit constructs a gold mine he is supposed to get gold, however right now the triggers are malfunctioning and whenever a structure is constructed a gold is added.

Events

Unit- A unit owned by player(red) Finishes Construction

Conditions

(Unit type of (Constructed Structure)) equal to GoldMine

Actions

Set Goldmines = (0+1)

Next Trigger

Events

Time-Every 5.0 Seconds of game

Conditions

Actions

For each (Integer Golmines) from 1 to 1, do (Player - Add 1 to Player (Red)current gold)

I'm a little bit new to World Editor Thanks in advance.|||If I'm not mistake, you're trying to have it so that every five seconds red is given one gold for each gold mine he has? If so, create the following triggers:


Code:
Trigger1
Events
Unit - A unit owned by Player 1 (Red) Finishes construction
Conditions
(Unit-type of (Triggering unit)) Equal to GoldMine
Actions
Set Goldmines = (Goldmines + 1)


Code:
Trigger2
Events
Time - Every 5.00 seconds of game time
Conditions
Actions
Player - Add Goldmines to Player 1 (Red) Current gold

Alternatively, you could create a Unit Group variable called TempGroup and create the following single trigger:


Code:
Trigger3
Events
Time - Every 5.00 seconds of game time
Conditions
Actions
Set TempGroup = (Units owned by Player 1 (Red) of type GoldMine)
Player - Add (Number of units in TempGroup) to Player 1 (Red) Current gold
Custom script: call DestroyGroup(udg_TempGroup)
|||Thanks alot that really helped. BTW is there any way to make one single trigger for all players in HumanGroup? Sorry i don't really understand arrays.|||Code:
Trigger4
Events
Time - Every 5.00 seconds of game time
Conditions
Actions
For each (Integer A) from 1 to 12, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Player((Integer A))) is in HumanGroup) Equal to True
Then - Actions
Set TempGroup = (Units owned by (Player((Integer A))) of type GoldMine)
Player - Add (Number of units in TempGroup) to (Player((Integer A))) Current gold
Custom script: call DestroyGroup(udg_TempGroup)
Else - Actions
Do nothing

However, if you're planning to add all Human controlled players to HumanGroup, you can just scrap that variable and do this instead:


Code:
Trigger5
Events
Time - Every 5.00 seconds of game time
Conditions
Actions
For each (Integer A) from 1 to 12, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Player((Integer A))) controller) Equal to User
Then - Actions
Set TempGroup = (Units owned by (Player((Integer A))) of type GoldMine)
Player - Add (Number of units in TempGroup) to (Player((Integer A))) Current gold
Custom script: call DestroyGroup(udg_TempGroup)
Else - Actions
Do nothing
|||Thank you very much.

No comments:

Post a Comment