• 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.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

[Trigger] Save and Load IN GAME

Status
Not open for further replies.
Level 17
Joined
Jul 17, 2011
Messages
1,863
if the unit has its abilities set in world editor then you can use a hash table or a game cache to save and load it later in the game if it doesn't then you will have to add them again via triggers

first create 1 hash table and save the unit handle with whatever key you want dont forget they key so you can load the unit later

if the abilities are not set you will need to make a handle for abilities as well just dont make another hashtable as you can save everything in 1
 
Level 22
Joined
Jul 25, 2009
Messages
3,091
if the unit has its abilities set in world editor then you can use a hash table or a game cache to save and load it later in the game if it doesn't then you will have to add them again via triggers

first create 1 hash table and save the unit handle with whatever key you want dont forget they key so you can load the unit later

if the abilities are not set you will need to make a handle for abilities as well just dont make another hashtable as you can save everything in 1

Alright I'll try this out.

Edit: World Editor freezes every time I open the function Save Ability Handle, and I want to save multiple abilities not just one... I tried JNGP and vanilla WE, it gave me a "Worldedit.exe has stopped working" dialog every time.
 
Level 9
Joined
Jul 10, 2011
Messages
562
abilities arent able to be saved in hashs...^^ you have to use a workaround...save the rawcode as integer and load the integer when you need it and then loop through your abilitys and check whether saved rawcode is equal to rawcode of the spell and then do your actions....had to do the same with unit types^^
 
Level 17
Joined
Jul 17, 2011
Messages
1,863
yea apparently ability hash is not finished so use an array you can have all of your abilities preput in a table or something and then just add and remove whatever you need
for example you can have an ability array like this:
Add Ability_array_1[1] = war stomp
Add Ability_array_1[2] = bloodlust .......
then whatever abilities you need to add or remove depends on what unit you want to add them to.
you can use and If/Then/Else to know what unit is gaining the abilities
[trigger= lol]
Untitled Trigger 001
Events

Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Unit-type of (Triggering unit)) Equal to Footman
Then - Actions
Unit - Add Ability_array_1[44] to (Triggering unit)
Unit - Add Ability_array_1[45] to (Triggering unit)
Unit - Add Ability_array_1[46] to (Triggering unit)
Unit - Add Ability_array_1[47] to (Triggering unit)
Else - Actions
[/trigger]
you can save units the same way as well as remove abilities i have no idea what events you intend to have so this is all i got
 
Level 22
Joined
Jul 25, 2009
Messages
3,091
yea apparently ability hash is not finished so use an array you can have all of your abilities preput in a table or something and then just add and remove whatever you need
for example you can have an ability array like this:
Add Ability_array_1[1] = war stomp
Add Ability_array_1[2] = bloodlust .......
then whatever abilities you need to add or remove depends on what unit you want to add them to.
you can use and If/Then/Else to know what unit is gaining the abilities
[trigger= lol]
Untitled Trigger 001
Events

Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Unit-type of (Triggering unit)) Equal to Footman
Then - Actions
Unit - Add Ability_array_1[44] to (Triggering unit)
Unit - Add Ability_array_1[45] to (Triggering unit)
Unit - Add Ability_array_1[46] to (Triggering unit)
Unit - Add Ability_array_1[47] to (Triggering unit)
Else - Actions
[/trigger]
you can save units the same way as well as remove abilities i have no idea what events you intend to have so this is all i got

Hmmm. That could conceivably work.
 
Status
Not open for further replies.
Top