[Log in / Register]
| News | Chat | Pastebin | Donations | Tutorials | Rules | Forums |
| Maps | Skins | Icons | Models | Spells | Tools | Jass | Packs | Hosted Projects | Starcraft II Modding | Starcraft II Resources | Galaxy Wiki |
(Keeps Hive Alive)
Go Back   The Hive Workshop > Warcraft III Modding > WarCraft III Tutorials > Trigger (GUI) Editor Tutorials


Trigger (GUI) Editor Tutorials Contains tutorials concerning the usage of GUI features.
Read the Rules before posting.

Closed Thread
 
Thread Tools
Old 03-06-2009, 06:05 PM   #1 (permalink)
Registered User SlayerII
moving from jass to vjass
 
SlayerII's Avatar
 
Join Date: Aug 2008
Posts: 529
SlayerII is on a distinguished road (68)SlayerII is on a distinguished road (68)
Peon Power! Only 1 item of every type- the item-drop system

only 1 item of every type- the Item-drop-system

I know there is already a tutorial about this somewhere but if you follow it correctly you would need for every item class as many triggers as players are aviable. So 5 itemclasses*8players=40Triggers.
I was able do that in one trigger.(without jass and only 1 variable)


What is a item-drop-system?

If you ever have played one of the (o)rpg's you know that you are only allowed to carry only 1 item per type. So if you have 2 weapons 1 will be dropped and a message apears.In my system you are able to have 6 items classes.

How to start?


First of all you have to decide which item classes you will need.Lets say: weapon,offhand,armor,helmet,boots.
There are some standard item classes(called permanent ,campaign etc...). Now you just have to give them new names(note: only in your head they still have their names). So all weapons are artifacts, all armors are campaign etc... . Now give all your items their item class.
In this case every time you create a weapon you have to give it the class artifact.
Then you have to make a integer variable named item_integer.
(Thanks septimus for this)

The trigger

test all in one Copy
Events
Unit - A unit Acquires an item
Conditions
Or - Any (Conditions) are true
Conditions
(Item-class of (Item being manipulated)) Equal to Permanent
(Item-class of (Item being manipulated)) Equal to Artifact
(Item-class of (Item being manipulated)) Equal to Charged
(Item-class of (Item being manipulated)) Equal to Campaign
Actions
Set iteminteger = 0
For each (Integer A) from 1 to 6, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Item-class of (Item carried by (Hero manipulating item) in slot (Integer A))) Equal to (Item-class of (Item being manipulated))
Then - Actions
Set iteminteger = (iteminteger + 1)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
iteminteger Greater than 1
Then - Actions
Hero - Drop (Item being manipulated) from (Hero manipulating item)
Game - Display to (Owner of (Triggering unit)), at offset (0.00, 0.00) the text: |cffCE2919You cant ...
Else - Actions

What have we done? First off all we made a event and some conditions. This will make the trigger fire every time a hero acquieres a item which have one of the classes in the conditions. If you don't understand this please go to a easier tutorial.


The next step is to set our integer to 0. Wy? Cause we change it in the trigger, but need it as 0 again when the trigger fires again.

Set iteminteger = 0

Now lets start the important step.Now we make a loop which cheks the inventory for items with the same class as the acquired item. everytime it found a item our integer is growing bigger. So at least 1 time cause of the item itself.
For each (Integer A) from 1 to 6, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Item-class of (Item carried by (Hero manipulating item) in slot (Integer A))) Equal to (Item-class of (Item being manipulated))
Then - Actions
Set iteminteger = (iteminteger + 1)
Else - Actions

After this our integer could be only 1 or 2.
Now ,depending on the integer, we do nothing(integer=1) or we make the acquired item drop(integer=2).

If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
iteminteger Greater than 1
Then - Actions
Hero - Drop (Item being manipulated) from (Hero manipulating item)
Game - Display to (Owner of (Triggering unit)), at offset (0.00, 0.00) the text: |cffCE2919You cant ...
Else - Actions

Don't forget a nice message like: You cant carry 2 items of the same class.

Hope everything is clear.

Last edited by SlayerII; 12-06-2009 at 08:32 PM. Reason: Name was bad
SlayerII is offline  
Old 03-08-2009, 10:17 AM   #2 (permalink)
Registered User Septimus
Who called in the fleet?
 
Septimus's Avatar
 
Join Date: May 2008
Posts: 4,747
Septimus is a name known to all (741)Septimus is a name known to all (741)Septimus is a name known to all (741)Septimus is a name known to all (741)Septimus is a name known to all (741)
Former Staff Member: This user used to be on the Hive Workshop staff. 
I would give 3 reason of why this tutorial would likely to be rejected.

1) Lot's of spelling/grammar error.
2) There is a existense of such a tutorial.
3) The trigger wasn't at optimize and most efficient way.

Making it this way is much efficient and smooth.

Melee Initialization
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-class of (Item being manipulated)) Equal to Permanent
Then - Actions
Set Item_Integer = 0
For each (Integer Slot_Integer) from 1 to 6, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Item-class of (Item carried by (Hero manipulating item) in slot Slot_Integer)) Equal to Permanent
Then - Actions
Set Item_Integer = (Item_Integer + 1)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Item_Integer Greater than 1
Then - Actions
Hero - Drop (Item being manipulated) from (Hero manipulating item)
Else - Actions
Else - Actions
Septimus is offline  
Old 03-08-2009, 10:20 AM   #3 (permalink)
Registered User Just_Spectating
Hallow Evary Bady!
 
Just_Spectating's Avatar
 
Join Date: May 2007
Posts: 7,075
Just_Spectating is a name known to all (678)Just_Spectating is a name known to all (678)Just_Spectating is a name known to all (678)
i also made a system similar to this you can find linked in my sig.
__________________
JJAALuu!
Resurrection To Starcraft II Format
Making an RPG? Never Knows Best
eenii meenii weenii tiny microscopic minis
Just_Spectating is offline  
Old 03-08-2009, 10:36 AM   #4 (permalink)
Registered User SlayerII
moving from jass to vjass
 
SlayerII's Avatar
 
Join Date: Aug 2008
Posts: 529
SlayerII is on a distinguished road (68)SlayerII is on a distinguished road (68)
@septimus

1) ok i try to make this better today.
2) I said this at the beginning of my tutorial.(i only found TaaZ's one)
3) nice trigger but in that case i would have to copy it and change it for evry class. But i m going to test your idea with the integer instead of the bolean which should make the trigger even shorter and smoother. Ty for your ggod reply.
You forgot the message

Little question to you; is the Slot_item integer more efficent as the A integer at the loop?

Last edited by SlayerII; 03-08-2009 at 11:26 AM.
SlayerII is offline  
Old 03-08-2009, 12:50 PM   #5 (permalink)
Registered User Septimus
Who called in the fleet?
 
Septimus's Avatar
 
Join Date: May 2008
Posts: 4,747
Septimus is a name known to all (741)Septimus is a name known to all (741)Septimus is a name known to all (741)Septimus is a name known to all (741)Septimus is a name known to all (741)
Former Staff Member: This user used to be on the Hive Workshop staff. 
Quote:
Little question to you; is the Slot_item integer more efficent as the A integer at the loop?
They are both the same. However, it was always recommend to make variable integer for it.

It was quite difficult to be explain, to make it simple. I would just said "You cannot have your cake and eat it at the same time"

Ask Dr Super Good about it, he can elaborate about this matter better than I do.
Septimus is offline  
Old 04-21-2009, 11:43 AM   #6 (permalink)
Registered User Grantclan
User
 
Grantclan's Avatar
 
Join Date: Aug 2008
Posts: 111
Grantclan has little to show at this moment (10)Grantclan has little to show at this moment (10)
i did everything this said and it still didnt work
__________________
You're happy now! But when you smoke...

Only you can prevent forest fires!
Grantclan is offline  
Old 04-21-2009, 12:16 PM   #7 (permalink)
Registered User SlayerII
moving from jass to vjass
 
SlayerII's Avatar
 
Join Date: Aug 2008
Posts: 529
SlayerII is on a distinguished road (68)SlayerII is on a distinguished road (68)
it works proberly for me and everyone i know that he is using it maybe you made a msitake

Last edited by SlayerII; 06-10-2009 at 09:12 AM.
SlayerII is offline  
Old 06-10-2009, 09:04 AM   #8 (permalink)
Ricardo Irving
Banned
 
Join Date: May 2009
Posts: 510
Ricardo Irving has little to show at this moment (8)
A mistake? This is almost the same style of inventory I was gonna use for my canceled ORPG - and I made lots of mistakes.

Try this (note, not sure if it will work...): In lose item trigger, turn off acquire item trigger, then turn on acquire trigger to prevent getting 2 of a kind able to be picked up. And, In acquire item trigger, turn off lose item trigger then turn on lose item trigger.
Ricardo Irving is offline  
Old 07-03-2009, 02:09 PM   #9 (permalink)
Registered User ALiEN95
User
 
ALiEN95's Avatar
 
Join Date: Mar 2009
Posts: 1,163
ALiEN95 will become famous soon enough (114)ALiEN95 will become famous soon enough (114)ALiEN95 will become famous soon enough (114)
im not sure is this a write palace to post but.....

is it possible to drop item being manipulated if he already has one of that (item being manipulated in his inventory?

so you stop heroes from having 2 same item type in inventory
ALiEN95 is offline  
Old 07-03-2009, 04:08 PM   #10 (permalink)
Registered User SlayerII
moving from jass to vjass
 
SlayerII's Avatar
 
Join Date: Aug 2008
Posts: 529
SlayerII is on a distinguished road (68)SlayerII is on a distinguished road (68)
Thats exactly what the tutorial tries to teach you
SlayerII is offline  
Old 07-03-2009, 05:34 PM   #11 (permalink)
Registered User ALiEN95
User
 
ALiEN95's Avatar
 
Join Date: Mar 2009
Posts: 1,163
ALiEN95 will become famous soon enough (114)ALiEN95 will become famous soon enough (114)ALiEN95 will become famous soon enough (114)
Quote:
Originally Posted by SlayerII View Post
Thats exactly what the tutorial tries to teach you
sry,i didn´t read it at all xD

i did my trigger on this way i think its good

HERO ACQUIRES AN ITEM
Events
Unit - A unit Acquires an item
Conditions
Actions
Hero - Drop (Item being manipulated) from (Hero manipulating item)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Hero manipulating item) has an item of type (Item-type of (Last dropped item))) Not equal to True
Then - Actions
Set HERO = (Hero manipulating item)
Trigger - Run GIVE ITEM <gen> (checking conditions)
Else - Actions
Set PLAYER_G = (Player group((Owner of (Hero manipulating item))))
Game - Display to PLAYER_G the text: You cannot have 2 items of same type!
Custom script: call DestroyForce(udg_PLAYER_G)

GIVE ITEM
Events
Conditions
Actions
Trigger - Turn off HERO ACQUIRES <gen>
Hero - Give (Last dropped item) to HERO
Trigger - Turn on HERO ACQUIRES <gen>
ALiEN95 is offline  
Old 07-03-2009, 05:47 PM   #12 (permalink)
Registered User SlayerII
moving from jass to vjass
 
SlayerII's Avatar
 
Join Date: Aug 2008
Posts: 529
SlayerII is on a distinguished road (68)SlayerII is on a distinguished road (68)
i would add a contidion to avoid droping consumables.
and there shouldn't be a problem writing all in one trigger instead of using the run trigger function-there is no problem turning off the whole trigger .
In this case you also dont have use variables.
(players dont leak so you dont have to save him in a player group)

ermm and your trigger only drops if its exactly the same item if you want to drop for example a item of the same class lets say weapon you have to use my trigger at the begiining but maybe thats noz what you want.
SlayerII is offline  
Old 07-03-2009, 05:52 PM   #13 (permalink)
Registered User ALiEN95
User
 
ALiEN95's Avatar
 
Join Date: Mar 2009
Posts: 1,163
ALiEN95 will become famous soon enough (114)ALiEN95 will become famous soon enough (114)ALiEN95 will become famous soon enough (114)
i tried doing it all in one trigger but it cant work,all i get is fast crashing of warcraft
its because without turn off,on action trigger is runing 10000 times second

(condition- (hero manipulating) an item has an item of type (last dropped item) didnt work too)
ALiEN95 is offline  
Old 07-03-2009, 06:31 PM   #14 (permalink)
Registered User SlayerII
moving from jass to vjass
 
SlayerII's Avatar
 
Join Date: Aug 2008
Posts: 529
SlayerII is on a distinguished road (68)SlayerII is on a distinguished road (68)
i write it wait shortly...
edit:
Untitled Trigger 005
Events
Unit - A unit Acquires an item
Conditions
-------- whatever you want... --------
Actions
Hero - Drop (Item being manipulated) from (Triggering unit)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) has an item of type (Item-type of (Last dropped item))) Equal to True
Then - Actions
-------- message and that it was.... --------
Else - Actions
Trigger - Turn off (This trigger)
Hero - Give (Last dropped item) to (Triggering unit)
Trigger - Turn on (This trigger)

Thsis hould work-outherwise try out my trigger in the tutrial but use item type instaed of item class
SlayerII is offline  
Old 07-03-2009, 07:32 PM   #15 (permalink)
Registered User ALiEN95
User
 
ALiEN95's Avatar
 
Join Date: Mar 2009
Posts: 1,163
ALiEN95 will become famous soon enough (114)ALiEN95 will become famous soon enough (114)ALiEN95 will become famous soon enough (114)
Quote:
Originally Posted by SlayerII View Post
i write it wait shortly...
edit:
Untitled Trigger 005
Events
Unit - A unit Acquires an item
Conditions
-------- whatever you want... --------
Actions
Hero - Drop (Item being manipulated) from (Triggering unit)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) has an item of type (Item-type of (Last dropped item))) Equal to True
Then - Actions
-------- message and that it was.... --------
Else - Actions
Trigger - Turn off (This trigger)
Hero - Give (Last dropped item) to (Triggering unit)
Trigger - Turn on (This trigger)

Thsis hould work-outherwise try out my trigger in the tutrial but use item type instaed of item class
warcraft crash.....

BTW are you sure player groups don´t leak?,lot of people said that they do
i also don´t believe sound can leak -.-
ALiEN95 is offline  
Closed Thread

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Item Drop Werhampfter The Kingdom of Kaliron 6 11-17-2008 09:22 AM
[Trigger] random drop to drop a certain item T3MPL4R Triggers & Scripts 2 05-09-2008 04:18 AM
[Trigger] Item Drop system problem... need help Vengence Triggers & Scripts 4 03-01-2008 02:12 AM
Item Help - Item Class Drop EL-DarKo World Editor Help Zone 3 01-12-2008 05:35 PM

All times are GMT. The time now is 11:21 PM.





Powered by vBulletin
Copyright 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.5.1 PL2
Copyright © Ralle