Change unit depending on what item in slot 1
Mon 24 Dec 2007, 12:31
I need a trigger that changes the unit u are using depending on what item is in slot 1
for example
slot1=empty -> Unit=UnarmedDude
slot1=Handgun -> Unit=handgun dude with same current hp/mana etc
for example
slot1=empty -> Unit=UnarmedDude
slot1=Handgun -> Unit=handgun dude with same current hp/mana etc
- Sunny_DLTG
- Posts : 1653
Réputation : 3
Regist Date : 2006-02-04
Re: Change unit depending on what item in slot 1
Mon 24 Dec 2007, 14:13
you are triggering today? ^_^
anyway, you know i don't have WE atm, but if i remember correctly it would be something like:
the second one below is for being unarmed:
anyway, you know i don't have WE atm, but if i remember correctly it would be something like:
- Code:
EVENT
Unit acquired an item
COND
ACTIONS
if
Item in slot 1 equal to handgun (should be boolean comparison...)
then
Unit - Replace Unit with unit-type handgunner
if
Item in slot 1 equal to shotgun
then
Unit - Replace with shotgunner etc...
the second one below is for being unarmed:
- Code:
EVENT
Unit looses an item
COND
Item slot 1 is empty (i believe that cond exists in booleans as well)
ACTIONS
Unit - replace with Unit (Unarmed)
- Asgard_RagnaCOL
- Posts : 750
Réputation : 7
Regist Date : 2006-01-20
Re: Change unit depending on what item in slot 1
Mon 24 Dec 2007, 16:20
Sunny_D wrote:you are triggering today? ^_^
anyway, you know i don't have WE atm, but if i remember correctly it would be something like:
- Code:
EVENT
Unit acquired an item
COND
ACTIONS
if
Item in slot 1 equal to handgun (should be boolean comparison...)
then
Unit - Replace Unit with unit-type handgunner
if
Item in slot 1 equal to shotgun
then
Unit - Replace with shotgunner etc...
the second one below is for being unarmed:
- Code:
EVENT
Unit looses an item
COND
Item slot 1 is empty (i believe that cond exists in booleans as well)
ACTIONS
Unit - replace with Unit (Unarmed)
Doesn't have Wc3 on my new computer but i think you are right, replacing the unit with a dummy unit is the only way it should work.
Re: Change unit depending on what item in slot 1
Mon 24 Dec 2007, 18:30
But then I will have to drop the item and pick it up to get the trigger to run right?
I could have something that looks every 2sec or so, but that would slow down a lot.
EDIT: Well I tested sunnys idea and well it worked as far as picking up an item before the game crashed >_> I must have made something wrong.
I could have something that looks every 2sec or so, but that would slow down a lot.
EDIT: Well I tested sunnys idea and well it worked as far as picking up an item before the game crashed >_> I must have made something wrong.
- Code:
Ninemm
Events
Unit - A unit Acquires an item
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Item carried by (Triggering unit) in slot 1) Equal to (Item carried by (Triggering unit) of type 9mmNightHawk)
Then - Actions
Unit - Replace (Triggering unit) with a 9mmNightHawk using The old unit's relative life and mana
Else - Actions
- Sunny_DLTG
- Posts : 1653
Réputation : 3
Regist Date : 2006-02-04
Re: Change unit depending on what item in slot 1
Wed 26 Dec 2007, 07:08
geez, if just my WE would freaking work! did it crash because of this code btw?
1) ok, is it necessary to have it restricted to a specific slot? in DotDS i would have solved it with restricting 1 weapon per inventory (let only pick up 1 weapon, if you want another, you'd have to drop your current one).
2) would it probably be possible to replace the unit when clicking on the item? or you used that for reloading or something already?
3) besides that, i don't know exactly if the acquired item is already "connected" to slot1 when picking it up. you could try a small wait (0.1) just before the if-then-else.
1) ok, is it necessary to have it restricted to a specific slot? in DotDS i would have solved it with restricting 1 weapon per inventory (let only pick up 1 weapon, if you want another, you'd have to drop your current one).
2) would it probably be possible to replace the unit when clicking on the item? or you used that for reloading or something already?
3) besides that, i don't know exactly if the acquired item is already "connected" to slot1 when picking it up. you could try a small wait (0.1) just before the if-then-else.
Permissions in this forum:
You cannot reply to topics in this forum