• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

CLASS SPECIFIC ITEMS please

Status
Not open for further replies.
Level 4
Joined
Jul 25, 2007
Messages
71
Hi, in my game there are 6 hero classes. I'll use the archer and knight for example.

As we all know, the model file of an archer doesnt use a sword. So, i dont want the archer to be able to buy or pick up a sword(item). And for the knight, i want to make it impossible for a knight to get his hands on a bow(item). Is this possible?
 
Level 3
Joined
May 3, 2008
Messages
44
I think this should serve your purposes. Make one of these for each of your unit classes. Tell me if it works for you

Event
A unit acquires an Item

Conditions
Unit Type of Triggering Unit is equal to Knight

Actions

(The following is using an "If/Then/Else Multiple Actions" action)

If Item-Type of Item being manipulated is equal to <Insert your units item here>
(as a second condition add a "Or-multiple conditions")
If Item-Type of Item being manipulated is equal to <Insert another item the knight can hold here>
If Item-Type of Item being manipulated is equal to <Insert another item the knight can hold here>
If Item-Type of Item being manipulated is equal to <Insert another item the knight can hold here>
If Item-Type of Item being manipulated is equal to <Insert another item the knight can hold here>

Then
-Do Nothing (Or anything else you want to happen when a unit picks up an item that it CAN hold)

Else
Unit - Order (Triggering unit) to drop (Item being manipulated) at (Position of (Triggering unit))
 
Level 4
Joined
Jul 25, 2007
Messages
71
thank you very much that worked nicely. But, what about if the knight buys the sword from a shop? then he wasted the gold. Is there a way to make the item un-buyable?
 
Level 4
Joined
Jul 25, 2007
Messages
71
ok on the sword i made a req. You must have knight. Then i chose an archer, and went to the shop in the game, and i was able to buy the sword. Wtf. why didnt it work?
 
Level 4
Joined
Jul 11, 2007
Messages
82
It will only prevent you from buying the item if you have no knights on the map. So, you could buy the item with an archer if you had a knight somewhere else on the map. But if each player will only have one hero anyway, this shouldn't be a problem.
 
Level 3
Joined
May 3, 2008
Messages
44
I dont know if you can restrict the SALE of items, but you can give the items a custom value which you can use to refund your players unit if he buys something he cant use

you'll need to add a trigger like this for all your items. I recommend giving these triggers their own category
______________________________________________
Events

A unit acquires an item

Conditions

Item Type of Item being Manipulated = <Your item here>

Actions

Item - Set the custom value of (Item being manipulated) to<what ever the item is worth>
______________________________________________

Be aware: If you have 10-15+ of these triggers, it can cause lag in "less gifted" computers because it will be all the item triggers executing at the same time. If you must have more than that amount, try using 1 trigger that uses multiple IF/THAN/ELSE actions like the one below

If Item Type of Item being manipulated = <item> Then Item - Set the custom value of (Item being manipulated) to <what ever the item is worth> ELSE Do nothing

now take the drop order out of the ELSE section of the code I gave you earlier(or else your players could get infin money with this), and then add these to the ELSE section

Player - Add (Custom value of (Item being manipulated)) to (Owner of (Item being manipulated)) Current gold

Finally add this to the ELSE section of that trigger i gave you

Item - Remove (Item being manipulated)

tell me how that works for you
 
Last edited:
Status
Not open for further replies.
Top