• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Learning a Spell From a SpellBook

Status
Not open for further replies.
Level 2
Joined
Mar 19, 2006
Messages
11
I need a little help creating items that allow my Heroes to learn certain spells. Do be more specific, I want my heroes to only be able to learn spells by purchasing or finding items called spell books, but I don't know how to enable that ability. The spells don't have to be level-able, just learn able. Any help?

-Arbon
 
Level 2
Joined
Mar 19, 2006
Messages
11
Does this auto learn when they pick it up? I would like them to be able to sell if they don't want. Is there a way to insure they only learn is when they use it?
 

Rui

Rui

Level 41
Joined
Jan 7, 2005
Messages
7,550
Welcome to the Hive Workshop, Arbon. If you want to introduce yourself to the Community, you may do so here. If not, you should at least read the important Site Rules, to make sure you won't run in trouble.


For your problem; yes, they auto-learn when they pick them up. But you can use the "Unit Uses Item" (or something like that) event.
 
Level 4
Joined
Jul 30, 2007
Messages
79
  • Flag1
    • Events
      • Unit - A unit Uses an item
    • Conditions
      • (Item being manipulated) Equal to Book_x
    • Actions
      • Unit - Add Book Ability to (Triggering unit)
just make sure the books are based off say the scrolls that give effects so it has is used up when they use it
 
Level 2
Joined
Mar 19, 2006
Messages
11
Could anyone help me with creep item drops? I understand how to change what drops and using percentage drops, but how do I reset the drop when the unit dies. Any help?
 
Level 9
Joined
Jun 26, 2007
Messages
659
don't use the WE drp system
use a trigger like this one instead:

event: a unit die
condition: trig unit type = drop creep
actions:
set integer = random number between 1 and 100
if (integer>0 and integer<=10) then create your item 1 // 10%
if (integer>10 and integer<=20) then create your item 2 // 10% too
if (integer>20 and integer<=35) then create your item 3 // 15%
if (integer>35 and integer<=55) then create your item 4 // 20%
if (integer>55 and integer<=95) then create your item 5 // 40%
else do nothing // integer>95, 5%
 
Level 2
Joined
Mar 19, 2006
Messages
11
Custom Hero Survival didn't help, any other maps I can look into?
Also Yoshi, I'd like to use your trigger but I'm very weak in triggering and I'll need a little more explanation to use that type of trigger. Trigger types, etc.
 
Level 9
Joined
Jun 26, 2007
Messages
659
you need an integer variable : random_percent
you need also to use a specific type for your unit

Event: Unit - generic unit event - a unit die
Condition: Unit-type comparison - (Unit-type of (Triggering unit)) Equal to Dropper creep
Actions:
Set variable - Set random_percent = random number between 1 and 100
If/Then/Else do multiple action
- If Condition : And
- - Integer comparison - random_percent Greater than 0
- - Integer comparison - random_percent Lower or equal to 10
// explanation : check if the value of the variable is 1,2,3,4,5,6,7,8,9 or 10; that's 10% of the value it may have
- Then Action :
- - Item - Create item at point - Create 1 item_1 at (Position of (triggering unit))
If/Then/Else do multiple action
- If Condition : And
- - Integer comparison - random_percent Greater than 10
- - Integer comparison - random_percent Lower or equal to 20
// explanation : check if the value of the variable is 11,12,13,14,15,16,17,18,19 or 20; that's 10% of the value it may have but not the same 10% than the first ones
- Then Action :
- - Item - Create item at point - Create 1 item_2 at (Position of (triggering unit))
etc etc
 
Level 2
Joined
Mar 19, 2006
Messages
11
Thank you YoshiRyu. I got it now. ^_^

Sorry to ask for so much help, I hope its alright. I need a good and understandable creep revival trigger. The one I'm using works, but for some reason it won't revive past 3 creeps.
 
Last edited by a moderator:
Level 2
Joined
Mar 19, 2006
Messages
11
SpawnSystem Initialization
Events
Map initialization
Conditions
Actions
Trigger - Run SpawnSystem Spawnunit <gen> (checking conditions)
Wait 1.00 seconds
Trigger - Run SpawnSystem Spawnpoint <gen> (checking conditions)


SpawnSystem Respawn
Events
Unit - A unit owned by Neutral Hostile Dies
Conditions
Actions
Custom script: local unit udg_SystemSpawn_RespawnUnit
Custom script: local integer udg_SystemSpawn_RespawnUnitIndex
For each (Integer A) from 1 to 4, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Dying unit) Equal to SystemSpawn_SpawnUnit[(Integer A)]
Then - Actions
Set SystemSpawn_RespawnUnitIndex = (Integer A)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
SystemSpawn_RespawnUnitIndex Greater than 0
Then - Actions
Skip remaining actions
Else - Actions
Unit - Create 1 (Unit-type of (Dying unit)) for Neutral Hostile at ((Center of (Entire map)) offset by (SystemSpawn_SpawnPointX[SystemSpawn_RespawnUnitIndex], SystemSpawn_SpawnPointY[SystemSpawn_RespawnUnitIndex])) facing Default building facing degrees
Set SystemSpawn_SpawnUnit[SystemSpawn_RespawnUnitIndex] = (Last created unit)
Set SystemSpawn_RespawnUnit = SystemSpawn_SpawnUnit[SystemSpawn_RespawnUnitIndex]
Unit - Hide SystemSpawn_RespawnUnit
Wait 5.00 seconds
Unit - Unhide SystemSpawn_RespawnUnit


SpawnSystem Spawnunit
Events
Conditions
Actions
Set SystemSpawn_SpawnUnit[1] = Bandit 0019 <gen>
Set SystemSpawn_SpawnUnit[2] = Bandit 0021 <gen>
Set SystemSpawn_SpawnUnit[3] = Bandit 0020 <gen>
Set SystemSpawn_SpawnUnit[4] = Bandit 0022 <gen>


SpawnSystem Spawnpoint
Events
Conditions
Actions
For each (Integer A) from 1 to 3, do (Actions)
Loop - Actions
Set SystemSpawn_SpawnPointX[(Integer A)] = (X of (Position of SystemSpawn_SpawnUnit[(Integer A)]))
Set SystemSpawn_SpawnPointY[(Integer A)] = (Y of (Position of SystemSpawn_SpawnUnit[(Integer A)]))
 
Level 9
Joined
Jun 26, 2007
Messages
659
trigger tag make it easier to understand
  • SpawnSystem Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Trigger - Run SpawnSystem Spawnunit <gen> (checking conditions)
      • Wait 1.00 seconds
      • Trigger - Run SpawnSystem Spawnpoint <gen> (checking conditions)
  • SpawnSystem Respawn
    • Events
      • Unit - A unit owned by Neutral Hostile Dies
    • Conditions
    • Actions
      • Custom script: local unit udg_SystemSpawn_RespawnUnit
      • Custom script: local integer udg_SystemSpawn_RespawnUnitIndex
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Dying unit) Equal to SystemSpawn_SpawnUnit[(Integer A)]
            • Then - Actions
              • Set SystemSpawn_RespawnUnitIndex = (Integer A)
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • SystemSpawn_RespawnUnitIndex Greater than 0
        • Then - Actions
          • Skip remaining actions
        • Else - Actions
      • Unit - Create 1 (Unit-type of (Dying unit)) for Neutral Hostile at ((Center of (Entire map)) offset by (SystemSpawn_SpawnPointX[SystemSpawn_RespawnUnitIndex], SystemSpawn_SpawnPointY[SystemSpawn_RespawnUnitIndex])) facing Default building facing degrees
      • Set SystemSpawn_SpawnUnit[SystemSpawn_RespawnUnitIndex] = (Last created unit)
      • Set SystemSpawn_RespawnUnit = SystemSpawn_SpawnUnit[SystemSpawn_RespawnUnitIndex]
      • Unit - Hide SystemSpawn_RespawnUnit
      • Wait 5.00 seconds
      • Unit - Unhide SystemSpawn_RespawnUnit
  • SpawnSystem Spawnunit
    • Events
    • Conditions
    • Actions
      • Set SystemSpawn_SpawnUnit[1] = Bandit 0019 <gen>
      • Set SystemSpawn_SpawnUnit[2] = Bandit 0021 <gen>
      • Set SystemSpawn_SpawnUnit[3] = Bandit 0020 <gen>
      • Set SystemSpawn_SpawnUnit[4] = Bandit 0022 <gen>
  • SpawnSystem Spawnpoint
    • Events
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 3, do (Actions)
        • Loop - Actions
          • Set SystemSpawn_SpawnPointX[(Integer A)] = (X of (Position of SystemSpawn_SpawnUnit[(Integer A)]))
          • Set SystemSpawn_SpawnPointY[(Integer A)] = (Y of (Position of SystemSpawn_SpawnUnit[(Integer A)]))
 
Level 9
Joined
Jun 26, 2007
Messages
659
now, what i notice:

1) you could use a points array instead of two reals arrays
  • Set SystemSpawn_SpawnPoint[(Integer A)] = (Position of SystemSpawn_SpawnUnit[(Integer A)])
2) "Custom script: local unit udg_SystemSpawn_RespawnUnit"... that's works that?
udg is the prefix of global variable (user definied global); you souldn't use this prefix on a local variable, that's not proper
but anyway, if it's work, who care about properness?

3) set a value to RespawnUnitIndex before the loop, you doesn't control its value without initialise it, it could be 1, 2, 3 or 4.
  • Set SystemSpawn_RespawnUnitIndex = 0
4) your "skip actions" condition is up side down
  • SystemSpawn_RespawnUnitIndex Greater than 0
it is true if the unit is a good one
after making my "3)", replace this condition by
  • SystemSpawn_RespawnUnitIndex Equal to 0
5) unless the center of the map has coord (0,0), this is wrong:
  • at ((Center of (Entire map)) offset by (SystemSpawn_SpawnPointX[SystemSpawn_RespawnUnitIndex], SystemSpawn_SpawnPointY[SystemSpawn_RespawnUnitIndex]
that sould be:
  • at Point(SystemSpawn_SpawnPointX[SystemSpawn_RespawnUnitIndex], SystemSpawn_SpawnPointY[SystemSpawn_RespawnUnitIndex]
or with my "1)":
  • at SystemSpawn_SpawnPoint[SystemSpawn_RespawnUnitIndex]
 
Status
Not open for further replies.
Top