• 🏆 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!

How do i pick spell books at game start up?

Status
Not open for further replies.
Level 1
Joined
Nov 25, 2013
Messages
6
I needs help!

I want to make a game mode or w.e that when i click a dialog button or type "-books" it comes to 4 spell books with random spells every time the game starts.

eg.

type "-book 1" you get earthquake, inner fire, searing arrows and avatar
type "-book 2" you get 4 other spells etc. etc. but random spells every time.

Like this:
14n02t0.jpg


i know how to make spell books and how to make custom spells but this i cant get right. i tried several different triggers and variables but cant get it right..

so if you know how to do it, feel free to help me! :D

thx
RubbahLegz
 
Level 12
Joined
Mar 24, 2011
Messages
1,082
I think exactly what you want is impossible to do in conventional way for many spells.

1st way: HIGHLY UNRECOMENDED, does exactly what you want:
You have to make spell books for each possible variation of spell combination. Example:
You got spells: Fire, Ice, Earth, Storm, Air, Water
Spellbook can contain 3 spells.
You need the following spellbooks:
Fire, Ice, Earth
Fire, Ice, Storm
Fire, Ice, Air
Fire, Ice, Water
Fire, Earth, Storm
Fire, Earth, Air
Fire, Earth, Water
Etc. Etc.

And then catalog them in initialization trigger.
==================================================
2nd way, "workaround" with spellbooks
Another way is if the abilities are not random but the spellbooks.
You create X spellbooks with semi-different spells ( :p ).
Then you display a few of these spellbooks at random and the player can chose from them.


==================================================
3rd way, "workaround" no spellbooks
The best I could suggest you not to use spellbooks but make catalog of the abilities instead and display and add the abilities. It is a lot better in many ways. Espetialy the work needed and time consumed. But if you insist on spellbooks...


Edit: PS: I ( or someone else) will cover the "get the abilities" part when you decide the way you want to do it.
 
Level 1
Joined
Nov 25, 2013
Messages
6
==================================================
2nd way, "workaround" with spellbooks
Another way is if the abilities are not random but the spellbooks.
You create X spellbooks with semi-different spells ( :p ).
Then you display a few of these spellbooks at random and the player can chose from them.


==================================================
3rd way, "workaround" no spellbooks
The best I could suggest you not to use spellbooks but make catalog of the abilities instead and display and add the abilities. It is a lot better in many ways. Espetialy the work needed and time consumed. But if you insist on spellbooks...


Edit: PS: I ( or someone else) will cover the "get the abilities" part when you decide the way you want to do it.


i like the 2nd way, but the 3rd way sound cool too, with the less effort and time thing :p
i didnt quite get how its done though?

could you maybe give me a tutourial on how to do it?
cuz i want 4 random "books" with 4 random spells (somrthing u never used before every time) but i only want it to say book 1, book 2, book 3, book 4 when im picking a "book" not book 1, 5, 8, 3. if you know what i mean?
i want it to look like in the pic every time.

2nd way, i know how to do the spell books, but not the triggers.

3rd way, i never heard of before, so that im gonna need a full tut on lol.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
IIRC heres how you do it

1) Make the base spellbook with no spells, base order id to (x)

2) Make a spellbook for every specific spell, base id the SAME as the first spellbook. Make it contain the spell you want to add

3) Add the first spellbook to your unit

4) Add the second spellbook for each of the 4 spells you want to add

5) If done right, there should only be one spellbook containing the 4 spells

You might have to disable the second spellbooks, not sure.

As far as the book thing goes, you can do this

0) player types -books

1) 4 variables named bookSlot1, bookSlot2, bookSlot3, bookSlot4 each ability type arrays

1b) 1 variable for the spell book dummys made in the last tutoral, bookSpells pre-initialized to all of the different spell books

1c) 1 variable for the max of the bookSpells variable

1d) 1 dummy varable spellBooksTransfer, same properties as 1b

1e) 1 variable for max of the spellBooksTransfer, set to the same as 1c

2) Loop from 1 to spellBooksMax, setting spellBooksTransfer[loop] to bookSpells[loop]

3) set spellBooksTransferMax = bookSpellsMax

4) set tempInt = (random int betwen 1 and bookSpellsTransferMax)

5) set bookSlot1[currentBook] = spellBooksTransfer[tempInt]

6) set spellBooksTransfer[tempInt] = spellBooksTransfer[spellBooksTransferMax]

7) set spellBooksTransferMax -= 1

8) repeat steps 4 to 7 for each book slot (important you loop from 4, you dont want dupe spells

9) repeat steps 2 to 8 for each book currentBook (important you start back at 2 so different books can share spells, but same books dont dupe spells)



e/ on retrospect, i should've just made the damn trigger and not a step-by-step tutorial. If you cant follow this, ill make the trigger
 
Level 1
Joined
Nov 25, 2013
Messages
6
the one like five lines above that step..

oh! lol my bad.

what kind of variables i gotta do? like i got the ability vaiables but what kind of
vaiables is bookSpells, spellBooksTransfer, spellBooksMax, spellBooksTransferMax?

is it ability variables? or integers? or what?

im still pretty noob at this so every little bit of help is awesome :D
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
bookSpells - ability
spellBooksTransfer - tutorial explains
spellBooksMax - its an index of an array, so integer
spellBooksMaxTransfer - tutorial explains
 
Level 1
Joined
Nov 25, 2013
Messages
6
bookSpells - ability
spellBooksTransfer - tutorial explains
spellBooksMax - its an index of an array, so integer
spellBooksMaxTransfer - tutorial explains

I dont mean to be a drag but..

could you maybe printsceen the triggers with vaiables and stuff?
cuz that'd make it a whole lot easier for me, since im still new at this..
would really appreciate it
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
what u mean by "bookSpells pre-initialized to all of the different spell books"?
On map initialization. So like

bookSpells[1] = Firebolt [Spellbook]
bookSpells[2] = Frozen Orb [Spellbook]
...
bookSpells[9] = Blizzard
bookSpellsMax = 9

I dont mean to be a drag but..

could you maybe printsceen the triggers with vaiables and stuff?
cuz that'd make it a whole lot easier for me, since im still new at this..
would really appreciate it

no. (mainly because i never did them, i just did that on my ipod). I guess I should at least try to help you out though :p
 
Status
Not open for further replies.
Top