HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Invaild Duplicates

03-01-2005, 04:15 PM#1
Zero
Ok. What I am trying to do is make it so that a hero class can't use more than one type of item. Like a warrior having two swords. So, what I did so far is set it up so that all weapons are classified as permanent, all armor is charged, and shields are power up.

I set up a trigger like this:

Event
- Unit Acquires an Item
Condition
- Owned of trigger unit equal to player 1
Action
- If all condtions are true then do actions else do else actions
If-Conditions
- P1_Heros_Weapon Equal to False
- Item-class of item being manipulated equal to Permanent
Then
- Set P1_Heros_Weapon to True
Else
- If all condtions are true then do actions else do else actions
If-Conditions
- P1_Heros_Weapon equal to True
Then
- Hero - Drop item being manipulated from triggering unit
- Game - Display text to owner of trigger unit "You cant use two weapons at the same time"
Else
- Do Nothing

This trigger works fine, except one thing. There is items that not all classes can use. So, if you still try to pick up an item that the class uses, it auto-drops it, BUT still sets P1_Heros_Weapon to True...

I made another trigger as well:

Event
- A unit loses an item
Condition
- Owner equal to P1
Action
- If all condtions are true then do actions else do else actions
If-Conditions
- P1_Heros_Weapon equal to true
- Item-class of item being manipulated equal to permanent
Then
- Set P1_Heros_Weapons to False
Else
- Do Nothing

Well, the only thing that is messed up here is, whenever any item is picked up, it auto drops if hero can't use or has that item class allready. So, it resets the first trigger any time an item is acquired.

I tried to counter this by adding a condition to the second trigger.

- Hero manipulating item has item being manipulated equal to false.

What I was trying to do here was make it so that if an item is droped and it wasn't something the hero allready previous had before picking up the new item, then don't fire the trigger.

This didn't work right :\

Can someone look at this set up and help me correct where I messed up at?
I need this system to work right :o
03-01-2005, 04:51 PM#2
Zero
Ok. Update! I figured out how to work this system, but there is still one thing that isn't working right.

Here is the updated triggers:

Event
- Unit Acquires an Item
Condition
- Owned of trigger unit equal to player 1
Action
- If all condtions are true then do actions else do else actions
If-Conditions
- P1_Heros_Weapon Equal to False
- Item-class of item being manipulated equal to Permanent
Then
- Set P1_Heros_Weapon to True
- Set Item_P1_Weapon to item being manipulated
Else
- If all condtions are true then do actions else do else actions
If-Conditions
- P1_Heros_Weapon equal to True
Then
- Hero - Drop item being manipulated from triggering unit
- Game - Display text to owner of trigger unit "You cant use two weapons at the same time"
Else
- Do Nothing

I made another trigger as well:

Event
- A unit loses an item
Condition
- Owner equal to P1
Action
- If all condtions are true then do actions else do else actions
If-Conditions
- P1_Heros_Weapon equal to true
- Item-class of item being manipulated equal to permanent
- Item being manipulated equal to Item_P1_Weapon
Then
- Set P1_Heros_Weapons to False
Else
- Do Nothing

Ok. Now, I have the same thing for armor and for shields. Now what is really screwy is that the condition "Item-class of item being manipulated equal to Permanent" isn't working apparently.

I try to pick up some armor and it treats it as a weapon; same with the shield. The triggers are set up correctly, it just seems that for some reason it isn't reading that one condition.

Does anyone know wtf is going on :(
03-01-2005, 05:09 PM#3
Zero
Ok... I changed the classification trigger to item level and the same thing still happens...

Is something conflicting within the trigger? Need help o_O
03-01-2005, 05:21 PM#4
Zero
Hehehe. It's all about trial and error :\

I split the first trigger into three triggers and it works fine now.

The only thing left to figgure out is, when you allready have a weapon and you try to pick up another weapon it displays text "You can only use one weapon at a time."

Well, if you have an weapon and try to pick up a item that your class can't use it still fires that text.

Is there a way to make it so that dosen't happen??
03-01-2005, 05:22 PM#5
aaero
Well, first of all, lets look at the general logic behind your triggers. We can improve that a bit, then we'll talk about the "Permanent" Item Class.

So, heroes can hold one of each item type. I think it might be a good idea to use the Item-Level, like you mentioned in your third consecutive post :p. You don't ever show the code for the "auto-drop"...but assuming that works correctly, I would do the following:

Take the Event off of your first trigger, and call it manually using "Trigger - Run Trigger" at the end of your auto-drop trigger (if it wasn't auto-dropped). This way, it will check and see if the hero can hold the item before it checks for duplicates. You can completely get rid of the second trigger.

That should solve your initial problem, and though I really don't recommend having a separate trigger for every player, we'll leave it like that for now - best to get it working first, then we'll talk about efficiency.

Now lets classify all your items using item level. This will be a little bit of a headache, but it's not a bad way to do things. Figure out a level number for each of your "slots". I would suggest counting down from 9, for example:
Weapons = 9
Shields = 8
Armor = 7

Once you've done this, run through and change the level of every item to match it's type. Once you've done this, you can identify the type of weapon by using it's level. If it's item type is 9 and the hero can use it, then P1_Hero_Weapon would be set to true.

Try this out and see how it works for you. I haven't explained everything so if you get stuck for too long post again and someone will help you.
03-01-2005, 05:43 PM#6
Zero
Quote:
Originally Posted by aaero
Well, first of all, lets look at the general logic behind your triggers. We can improve that a bit, then we'll talk about the "Permanent" Item Class.

So, heroes can hold one of each item type. I think it might be a good idea to use the Item-Level, like you mentioned in your third consecutive post :p. You don't ever show the code for the "auto-drop"...but assuming that works correctly, I would do the following:

Take the Event off of your first trigger, and call it manually using "Trigger - Run Trigger" at the end of your auto-drop trigger (if it wasn't auto-dropped). This way, it will check and see if the hero can hold the item before it checks for duplicates. You can completely get rid of the second trigger.

That should solve your initial problem, and though I really don't recommend having a separate trigger for every player, we'll leave it like that for now - best to get it working first, then we'll talk about efficiency.

Now lets classify all your items using item level. This will be a little bit of a headache, but it's not a bad way to do things. Figure out a level number for each of your "slots". I would suggest counting down from 9, for example:
Weapons = 9
Shields = 8
Armor = 7

Once you've done this, run through and change the level of every item to match it's type. Once you've done this, you can identify the type of weapon by using it's level. If it's item type is 9 and the hero can use it, then P1_Hero_Weapon would be set to true.

Try this out and see how it works for you. I haven't explained everything so if you get stuck for too long post again and someone will help you.

It works fine the way I have it set up currently. If I run into any more problems. I might consider changing it into the way you have it set up, but for now, it works fine :D

Just got done testing and the only problem left is the text being displayed as I posted above before your post.
03-01-2005, 10:54 PM#7
Raptor--
see, wouldn't it have been easier to use the indexing i showed u in another post :p... er, anyways, as for your problem

anyways, you'll need some way to identify which hero can use which items, if you already have a trigger that drops items if your class can't use it, then just remove the event of this trigger here and use a "run trigger" action at the end of the other trigger (or at least in the parts where you're allowed to pick up the item)
03-02-2005, 02:44 PM#8
Jackyquah
Perhaps this works ?
Event
- Unit Acquires an Item
Condition
- Owned of trigger unit equal to player 1
Action
- If all condtions are true then do actions else do else actions
If-Conditions
- Item_P1_Weapon Equal to NULL
- Item-class of item being manipulated equal to Permanent
Then
- Set Item_P1_Weapon to item being manipulated
Else
- If all condtions are true then do actions else do else actions
If-Conditions
- Item_P1_Weapon not equal to NULL
- Item-class of item being manipulated equal to Permanent
Then
- Hero - Drop item being manipulated from triggering unit
- Game - Display text to owner of trigger unit "You cant use two weapons at the same time"
Else
- Do Nothing

I made another trigger as well:

Event
- A unit loses an item
Condition
- Owner equal to P1
Action
- If all condtions are true then do actions else do else actions
If-Conditions
- Item-class of item being manipulated equal to permanent
- Item being manipulated equal to Item_P1_Weapon
Then
- Set Item_P1_Weapon = NULL
Else
- Do Nothing

And Incase the Trigger can't set Item to NULL
create Global Variable Call NullItem and initialized NullItem
and create one unused Item type in Object Editor.
Create Item with Unused Item Type, then set it to NullItem Variable
Initialized all your Item_P1_Weapon to NullItem.