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

Is it possible to make this spell?

Status
Not open for further replies.
Level 11
Joined
Oct 11, 2012
Messages
711
I would like to make the following spell. Is it possible?

Summon unit A, last for 30 sec. Moreover, A has the following ability: upon death, A can revive and double A's str, agi and int. For example:
A is summoned --> 10 sec passes, A dies (20 sec remaining life time) --> A revive, will last for 20 secs, has twice str, agi and int than the original A.

The difficult part is to calculate the remaining time of A when A dies. Is it possible to do that? Thank you guys.
 
Level 5
Joined
Jan 30, 2013
Messages
123
I would like to make the following spell. Is it possible?

Summon unit A, last for 30 sec. Moreover, A has the following ability: upon death, A can revive and double A's str, agi and int. For example:
A is summoned --> 10 sec passes, A dies (20 sec remaining life time) --> A revive, will last for 20 secs, has twice str, agi and int than the original A.

The difficult part is to calculate the remaining time of A when A dies. Is it possible to do that? Thank you guys.

I think this is impossible :|
 
Level 16
Joined
Dec 15, 2011
Messages
1,423
Hi there.

I will write some pseudo-code for you to follow. This is not MUI btw.

Summon unit event
Unit summoned is A
Store base stats here
Turn on periodic trigger

Every 0.5s
Set realCounter = realCounter + 0.5
If realCounter <30.0 then
If Unit A is dead then
Revive A
Double stat for A
Store new stat value for A
Endif
Else
Kill A
Do some more thing here
Endif
 

Kusanagi Kuro

Hosted Project: SC
Level 10
Joined
Mar 11, 2012
Messages
708
U didnt read a whole thread didnt u? He said that if the summonned unit dies (while within the duration of summoning), it will be reborn with the amount of time left and double its stat. How can u define the duration it has left if u dont use timer?
 
Level 11
Joined
Oct 11, 2012
Messages
711
Hi there.

I will write some pseudo-code for you to follow. This is not MUI btw.

Summon unit event
Unit summoned is A
Store base stats here
Turn on periodic trigger

Every 0.5s
Set realCounter = realCounter + 0.5
If realCounter <30.0 then
If Unit A is dead then
Revive A
Double stat for A
Store new stat value for A
Endif
Else
Kill A
Do some more thing here
Endif

Thank you! It is inspiring! I will try it, +Rep.

Edit: the system does not allow me to +Rep.... I need to spread some reputation around first.... -_-

Edit: final questions.....
First, how to store stats? -_- handle or something like that?
Second, in your code, where did you apply the remaining life time?
 
First, how to store stats? -_- handle or something like that?
Second, in your code, where did you apply the remaining life time?
You can either set the start via triggering (reduces confusion & easier save load) or search for the event that store hero stat (forgot if its exist or not in GUI)
 
Level 16
Joined
Dec 15, 2011
Messages
1,423
Thank you! It is inspiring! I will try it, +Rep.

Edit: the system does not allow me to +Rep.... I need to spread some reputation around first.... -_-

Edit: final questions.....
First, how to store stats? -_- handle or something like that?
Second, in your code, where did you apply the remaining life time?

Thank you in advance ^^

You can use Unit Indexer then store the stat for unit A with 3 integer arrays. Like this

  • Set StrengthArray[(Custom value of unit A)] = 10
  • Set AgilityArray[(Custom value of unit A)] = 15
  • Set IntelligenceArray[(Custom value of unit A)] = 20
I didn't apply a life time buff. I use a timer to check when the unit's time span expires then kill/remove it.

Off-topic: 1001th post <3
 
Level 11
Joined
Oct 11, 2012
Messages
711
Thank you in advance ^^

You can use Unit Indexer then store the stat for unit A with 3 integer arrays. Like this

  • Set StrengthArray[(Custom value of unit A)] = 10
  • Set AgilityArray[(Custom value of unit A)] = 15
  • Set IntelligenceArray[(Custom value of unit A)] = 20
I didn't apply a life time buff. I use a timer to check when the unit's time span expires then kill/remove it.

Off-topic: 1001th post <3

Thanks! lol

Now I am trying to make it MUI.
 
Status
Not open for further replies.
Top