• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Cancelation of Upgrades

Status
Not open for further replies.
Level 26
Joined
Jun 5, 2008
Messages
1,768
Yes, well. It's a pretty straight forward question. I am working on game with a lot of techs.
To successfully activate an upgrade, you need to have the right amount of items.

For example, To upgrade the technology "Iron Saw", you need:
- 2 Pieces of Lumber
- 1 Hot Coal
- 1 Iron Bar
- 1 Steel Bar

If the building doesn't have these items in its inventory, the upgrade should be canceled.
The problem is how? I'm clueless how to do it. I'd ask for a request but I'm unsure if it's actually even possible.

It might, just maybe, be possible in JASS or vJass. So yeah, asking for help. If possible, could anyone of you dudes help me out? :O
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
This is how to make the research cost claws and crown. If the unit doesn't have both, then the research is instantly cancelled.

The sim error call plays an error sound and displays an error message. You can leave it out. If you're using JNGP editor then you can use it: http://www.wc3c.net/showthread.php?t=101260



  • IFS
    • Events
      • Unit - A unit Begins research
    • Conditions
      • (Researched tech-type) Equal to Iron Forged Swords
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) has an item of type Claws of Attack +15) Equal to True
          • ((Triggering unit) has an item of type Crown of Kings +5) Equal to True
        • Then - Actions
          • Item - Remove (Item carried by (Triggering unit) of type Claws of Attack +15)
          • Item - Remove (Item carried by (Triggering unit) of type Crown of Kings +5)
        • Else - Actions
          • Custom script: call SimError( GetTriggerPlayer() , "Requires claws and crown!" )
          • Custom script: call IssueImmediateOrderById( GetTriggerUnit(), 0xD0008 )
 
Level 26
Joined
Jun 5, 2008
Messages
1,768
This is how to make the research cost claws and crown. If the unit doesn't have both, then the research is instantly cancelled.

The sim error call plays an error sound and displays an error message. You can leave it out. If you're using JNGP editor then you can use it: http://www.wc3c.net/showthread.php?t=101260



  • IFS
    • Events
      • Unit - A unit Begins research
    • Conditions
      • (Researched tech-type) Equal to Iron Forged Swords
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) has an item of type Claws of Attack +15) Equal to True
          • ((Triggering unit) has an item of type Crown of Kings +5) Equal to True
        • Then - Actions
          • Item - Remove (Item carried by (Triggering unit) of type Claws of Attack +15)
          • Item - Remove (Item carried by (Triggering unit) of type Crown of Kings +5)
        • Else - Actions
          • Custom script: call SimError( GetTriggerPlayer() , "Requires claws and crown!" )
          • Custom script: call IssueImmediateOrderById( GetTriggerUnit(), 0xD0008 )

Hm, sweet. But what should I do If I need multiple items of the same kind? Let's say I need 4 identical claws of attack +15 and one crown of kings?
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
This will make it require 3xClaws and 1xCrown.

  • Sansel
    • Events
      • Unit - A unit Begins research
    • Conditions
      • (Researched tech-type) Equal to Iron Forged Swords
    • Actions
      • Set u = (Triggering unit)
      • Set i = 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-type of (Item carried by u in slot (Integer A))) Equal to Claws of Attack +15
            • Then - Actions
              • Set i = (i + 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • i Equal to 3
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Triggering unit) has an item of type Crown of Kings +5) Equal to True
                    • Then - Actions
                      • Item - Remove (Item carried by (Triggering unit) of type Claws of Attack +15)
                      • Item - Remove (Item carried by (Triggering unit) of type Claws of Attack +15)
                      • Item - Remove (Item carried by (Triggering unit) of type Claws of Attack +15)
                      • Item - Remove (Item carried by (Triggering unit) of type Crown of Kings +5)
                    • Else - Actions
                  • Skip remaining actions
                • Else - Actions
            • Else - Actions
      • Custom script: call IssueImmediateOrderById( GetTriggerUnit(), 0xD0008 )
      • Custom script: call SimError( GetTriggerPlayer() , "Requires claws and crown!" )
 
Level 26
Joined
Jun 5, 2008
Messages
1,768
Indeed, it's quite similar in many ways. A little more complex than its predecessor though. Building roads now has an actual purpose, once you've built all buildings, you're not done. You can (eventually) build troops.

Actual quests is being added which enables the player to choose how to enjoy the map, countless fun bosses for those that only enjoy the true rpg part of the game. Instead of building a building that spams resources until the game crashes. There is now several locations of mines. Taking over a mine is about taking over a node, which automatically spawns miners which go back and forth with items (It's being coded by a friend of mine). Oh yeah and I perfected the building system.

The technological part of it is very similar to empire earth. Which this thread was about. I prefer Maker's suggestion. It works flawlessly. To be quite honest, his solution can be modified to pretty much solve all of my major problems when it comes to creating items, buying troops or whatever. xd

Was going to create a map thread as soon as CRAZYRUSSIAN was done doing the minor fixing with my UI, but sending him replies doesn't seem to do anything as of now. :/
 
Status
Not open for further replies.
Top