[Trigger] Save and Load IN GAME

Status
Not open for further replies.
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
 
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.
 
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^^
 
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
 
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.
Back
Top