HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Player picks attributes when hero levels?

10-02-2004, 12:51 AM#1
Jem1128
ok ive set it up so when your hero levels he can chose his own attributes
to do this i made an ability called attributes and when the hero levels he gains this ability and sets a Variable to that variable + 5. when the player clicks the abillity attribute it stores the current items in his inventory in an arey and then removes them. then it creats 4 new items (strength, agility, itellegence, and cancel) if you click one of these it adds 1 to that attribute and sets the variable to itself - 1. when that variable = 0 it removes the 4 items from its inventory then it is suposed to create the items from the stored array in the inventory. this doent happen though it creats only the first item and 2 of it ok im posting all my triggers:

Code:
Level Give Attribute
    Events
        Unit - A unit Gains a level
    Conditions
        ((Triggering unit) is A Hero) Equal to True
    Actions
        Set HeroSkillPoints[(Player number of (Owner of (Triggering unit)))] = (HeroSkillPoints[(Player number of (Owner of (Triggering unit)))] + 5)
        Unit - Add Attribute  to (Triggering unit)


Code:
Attribute button
    Events
        Unit - A unit Begins channeling an ability
    Conditions
        (Ability being cast) Equal to Attribute 
    Actions
        For each (Integer A) from 1 to 6, do (Actions)
            Loop - Actions
                Set item[((Integer A) + (Player number of (Owner of (Triggering unit))))] = (Item-type of (Item carried by (Triggering unit) in slot (Integer A)))
                Item - Remove (Item carried by (Triggering unit) in slot (Integer A))
        Unit - Remove Inventory (Hero) from (Triggering unit)
        Unit - Add Inventory (Attribute) (Hero) to (Triggering unit)
        Hero - Create Increment Agility and give it to (Triggering unit)
        Hero - Create Increment Intelligence and give it to (Triggering unit)
        Hero - Create Increment Strength and give it to (Triggering unit)
        Hero - Create Cancel and give it to (Triggering unit)

Code:
Agility
    Events
        Unit - A unit Uses an item
    Conditions
        (Item being manipulated) Equal to (Item carried by (Triggering unit) of type Increment Agility)
    Actions
        Set itemsHidden[(Player number of (Owner of (Triggering unit)))] = 0
        Hero - Modify Agility of (Triggering unit): Add 1
        Set HeroSkillPoints[(Player number of (Owner of (Triggering unit)))] = (HeroSkillPoints[(Player number of (Owner of (Triggering unit)))] - 1)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                HeroSkillPoints[(Player number of (Owner of (Triggering unit)))] Equal to 0
            Then - Actions
                Unit - Remove Attribute  from (Triggering unit)
                Item - Remove (Item carried by (Triggering unit) of type Increment Agility)
                Item - Remove (Item carried by (Triggering unit) of type Increment Intelligence)
                Item - Remove (Item carried by (Triggering unit) of type Increment Strength)
                Item - Remove (Item carried by (Triggering unit) of type Cancel)
                Unit - Remove Inventory (Attribute) (Hero) from (Triggering unit)
                Unit - Add Inventory (Hero) to (Triggering unit)
                Set itemsHidden[(Player number of (Owner of (Triggering unit)))] = 1
            Else - Actions
                Do nothing
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                itemsHidden[(Player number of (Owner of (Triggering unit)))] Equal to 1
            Then - Actions
                For each (Integer A) from 1 to 6, do (Actions)
                    Loop - Actions
                        Hero - Create item[((Integer A) + (Player number of (Owner of (Triggering unit))))] and give it to (Triggering unit)
            Else - Actions

Code:
Intelligence
    Events
        Unit - A unit Uses an item
    Conditions
        (Item being manipulated) Equal to (Item carried by (Triggering unit) of type Increment Intelligence)
    Actions
        Set itemsHidden[(Player number of (Owner of (Triggering unit)))] = 0
        Hero - Modify Intelligence of (Triggering unit): Add 1
        Set HeroSkillPoints[(Player number of (Owner of (Triggering unit)))] = (HeroSkillPoints[(Player number of (Owner of (Triggering unit)))] - 1)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                HeroSkillPoints[(Player number of (Owner of (Triggering unit)))] Equal to 0
            Then - Actions
                Unit - Remove Attribute  from (Triggering unit)
                Item - Remove (Item carried by (Triggering unit) of type Increment Agility)
                Item - Remove (Item carried by (Triggering unit) of type Increment Intelligence)
                Item - Remove (Item carried by (Triggering unit) of type Increment Strength)
                Item - Remove (Item carried by (Triggering unit) of type Cancel)
                Unit - Remove Inventory (Attribute) (Hero) from (Triggering unit)
                Unit - Add Inventory (Hero) to (Triggering unit)
                Set itemsHidden[(Player number of (Owner of (Triggering unit)))] = 1
            Else - Actions
                Do nothing
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                itemsHidden[(Player number of (Owner of (Triggering unit)))] Equal to 1
            Then - Actions
                For each (Integer A) from 1 to 6, do (Actions)
                    Loop - Actions
                        Hero - Create item[((Integer A) + (Player number of (Owner of (Triggering unit))))] and give it to (Triggering unit)
            Else - Actions

Code:
Strength
    Events
        Unit - A unit Uses an item
    Conditions
        (Item being manipulated) Equal to (Item carried by (Triggering unit) of type Increment Strength)
    Actions
        Set itemsHidden[(Player number of (Owner of (Triggering unit)))] = 0
        Hero - Modify Strength of (Triggering unit): Add 1
        Set HeroSkillPoints[(Player number of (Owner of (Triggering unit)))] = (HeroSkillPoints[(Player number of (Owner of (Triggering unit)))] - 1)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                HeroSkillPoints[(Player number of (Owner of (Triggering unit)))] Equal to 0
            Then - Actions
                Unit - Remove Attribute  from (Triggering unit)
                Item - Remove (Item carried by (Triggering unit) of type Increment Agility)
                Item - Remove (Item carried by (Triggering unit) of type Increment Intelligence)
                Item - Remove (Item carried by (Triggering unit) of type Increment Strength)
                Item - Remove (Item carried by (Triggering unit) of type Cancel)
                Unit - Remove Inventory (Attribute) (Hero) from (Triggering unit)
                Unit - Add Inventory (Hero) to (Triggering unit)
                Set itemsHidden[(Player number of (Owner of (Triggering unit)))] = 1
            Else - Actions
                Do nothing
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                itemsHidden[(Player number of (Owner of (Triggering unit)))] Equal to 1
            Then - Actions
                For each (Integer A) from 1 to 6, do (Actions)
                    Loop - Actions
                        Hero - Create item[((Integer A) + (Player number of (Owner of (Triggering unit))))] and give it to (Triggering unit)
            Else - Actions

Code:
Cancel
    Events
        Unit - A unit Uses an item
    Conditions
        (Item being manipulated) Equal to (Item carried by (Triggering unit) of type Cancel)
    Actions
        Item - Remove (Item carried by (Triggering unit) of type Increment Agility)
        Item - Remove (Item carried by (Triggering unit) of type Increment Intelligence)
        Item - Remove (Item carried by (Triggering unit) of type Increment Strength)
        Item - Remove (Item carried by (Triggering unit) of type Cancel)
        Unit - Remove Inventory (Attribute) (Hero) from (Triggering unit)
        Unit - Add Inventory (Hero) to (Triggering unit)
        Set itemsHidden[(Player number of (Owner of (Triggering unit)))] = 1
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                itemsHidden[(Player number of (Owner of (Triggering unit)))] Equal to 1
            Then - Actions
                For each (Integer A) from 1 to 6, do (Actions)
                    Loop - Actions
                        Hero - Create item[((Integer A) + (Player number of (Owner of (Triggering unit))))] and give it to (Triggering unit)
            Else - Actions


ok wow that alot of code
sry its so long but im not to hot at triggering so not sure how to condence it
ok if anyone can help me figure out why it not recreating all the items just 2 of the first item please tell me
thank you
sry again about its length
10-02-2004, 02:53 AM#2
BuRnInSpartan
be more specific... what do you mean by he chooses his own attributes? he can choose +1+2+3+4+5? i have know idea where you're going and besides no-one in the right mind will read this WHOLE thing
10-02-2004, 03:13 AM#3
Moose-Head_Man
omg that is insane! i made a map where when you start playing you create your own hero, model, and everyting, even the stats, just make an item that permantely increases that stat by 1, not that hard, requries no triggers
10-02-2004, 08:55 AM#4
Dead-Inside
@Jem1128
Your first problem lies here.
Code:
For each (Integer A) from 1 to 6, do (Actions)
            Loop - Actions
                Set item[((Integer A) + (Player number of (Owner of (Triggering unit))))] = (Item-type of (Item carried by (Triggering unit) in slot (Integer A)))

I'm going to suggest that you set it to something like this;
Code:
For each (Integer A) from 1 to 6, do (Actions)
            Loop - Actions
                Set IntegerTempVar = ((Integer A) x (12 x (Player number of (Owner of (Triggering unit)))))
                Set Item[IntegerTempVar] = (Item carried by (Triggering unit) in slot (Integer A))


That's fault number one. If someone else were to use the same trigger at the same time, they would have their items overrun if you do not do this. You can change the 12 to how many players there are on the map (Keep in mind though you gotta include comps even if they're not using heroes).

Possibly you could have another item array and do the same thing as above but have the 4 items used to "upgrade". Another way to store the items in the first place could be to simply store them whenever the hero picks them up and use slot-number as a replacement for Integer A from the above trigger. Not that it'd change much though.

I'm not sure on what the exact problem is. One other thing you could do is to make the current ability players cast to get this menu a spellbook instead. So whever they open the spellbook, the menu automatically disapears, the items remain, and you get whatever abilities/spells you put in there (This would be 3 dummyspells and a back-to-hero thingy).

Sorry if I can't help you more then this.
Regards
Dead-Inside
10-02-2004, 12:55 PM#5
image
Why not use this maps system and give credit. I know it is a backpack system but it also has pickable attribute bonuses.
10-02-2004, 03:18 PM#6
logik
what you are trying to do is make a system that is already created.

im just saying - its fun to try and make your own systems aswell.

try it out - check the repository
10-04-2004, 10:49 PM#7
Jem1128
Yea i like makin the triggers mostly on my own but i like others imput.
and i learn more if im not useing someone elses code and plus i understand my own more so i can make it fit the map better.

Right now i got it all working but when after you finish picking your stats it gives you 2 of each item you origianaly had.
10-04-2004, 11:39 PM#8
BuRnInSpartan
wow moose is right lol