Two compleatly unrelated questions

Status
Not open for further replies.
Level 7
Joined
Jun 14, 2009
Messages
235
Question 1: Whats the best way to randomize something in triggers, I want it to randomly do 1 of 2 things, or on cahnce when a spell is cast.

Question 2: How do you use more than one map for the same thing? Like the Bonus Campaign, where you can go to a different map to do something, then comeback where you started? Please explain if possible
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,285
1.
Using random numbers. There is a native capable of returning them. All you have to do is set a variable (local or global) to one (I advise an integer) then using integer conditions you check for ranges. Each range demonstrates for a random event to occur. Pesudo code example below.

set randominteger = GetRandomInt(0,2).
if randominteger == 0 then
//code here for random event 1.
elseif randominteger == 1 then
//other random code here.
else
//final random code here.
endif

Adjusting the ranges of the cnditions and random native will alter the chances.

2.
Only possiable in single player, as you have guessed by the lack of it being done in multiplayer.

How the orc campaign does it is by saving the heroes and quests in the campaign gamecache, then saving the map and finally loading the save of the map to go into or loading a new instance of that map and then loading the heroes from the game cache.
If you want to see it in more detail, I would advise getting a fixed GUI WE with the missing actions added and then loading and seeing it for yourself, after all the campaign is open source inside the data MPQs of WC3.

For multiplayer, the closest way to obtain this is to make 2 maps use the same save and load system (identical in every way). Thus when changing map the player will get a string which represents his character and can leave and remake the other map and then load his character from the string there. Game caches do not work in multiplayer and never will without an illegal mod which stops battlenet use, please save your map idea for SC2 if it is absolulty vital that it supports this in multiplayer.
 
Level 7
Joined
Jun 14, 2009
Messages
235
ok, thank you, i tried the first part to randomize, and it kinda worked. the multiple map part might be hard...
 
Status
Not open for further replies.
Top