Jump to content


Photo

Random spawn of a Unit


  • Please log in to reply
7 replies to this topic

#1 TroDuS

TroDuS

    Modding Legend

  • Members
  • 443 posts
  • Location:Rivendell
  •  ambitious Modder (:

Posted 06 March 2008 - 08:20 PM

Hi guys, I wanna know how i´m able to let a random unit spawn/recruit in a building. If u click the button it should recruit randomness a Troll or Ork or Corsair or whatever... or is it only possible with heroes so explain it plz. THX

#2 Dwar the wolf

Dwar the wolf
  • Members
  • 155 posts

Posted 06 March 2008 - 08:26 PM

how can you choose a random hero give an examble ?

#3 Lauri

Lauri

    Old man Lauri

  • Hosted
  • 10,436 posts
  • Location:Norway
  • Projects:The 4th Age
  •  The very worst T3A Team Chamber Member

Posted 06 March 2008 - 09:33 PM

;------------------------------------------------------------------------------
;Creating this peasant will [b]randomize[/b] between several variations of the peasant.
;------------------------------------------------------------------------------
Object RohanPeasant

	SelectPortrait	= UPRohan_Peasant

	Draw = W3DScriptedModelDraw ModuleTag_01  
		DefaultModelConditionState
		;Give it a model so it'll show up in WB
			Model			   = RUPsnt_1_SKN
			Skeleton			= RUPsnt_1_SKL
		End
	End

	Side = Rohan
	EditorSorting = UNIT
	[b]BuildVariations = RohanPeasant1 RohanPeasant3 RohanPeasant4[/b]
	KindOf = PRELOAD SELECTABLE CAN_CAST_REFLECTIONS INFANTRY PATH_THROUGH_EACH_OTHER SCORE THROWN_OBJECT SWARM_DOZER GRAB_AND_DROP DOZER 

End
And the RohanPeasant1 is an object... RohanPeasant3 is also one, and RohanPeasant4 is one...
Still, this can be used for hordes as well :) RohanPeasantHorde, RohanArcherHorde ect...
Still, you should put the in the buildcost and buildtime here though, if not you don't know what your paying :ph34r:
yes, this is from BFME1, but should work ;)

T4A_Logo_-_article.png

The 4th Age version 0.8 has been released: Link


#4 Dwar the wolf

Dwar the wolf
  • Members
  • 155 posts

Posted 06 March 2008 - 10:42 PM

new informations . thanx Lauri :ph34r:

#5 TroDuS

TroDuS

    Modding Legend

  • Members
  • 443 posts
  • Location:Rivendell
  •  ambitious Modder (:

Posted 07 March 2008 - 05:39 AM

thx tooo :ph34r: Do this work with heroes, either?

#6 Sûlherokhh

Sûlherokhh

    Sagacious Engineer

  • Project Team
  • 3,754 posts
  • Location:Central Germany
  • Projects:S.E.E., Sage A.I., Code Advisor
  •  'Axe'er of the Gordic Knot

Posted 10 March 2008 - 07:52 PM

I never tried. Would be fun if it worked. But somehow i think the REVIVE mechanics will screw it or will get screwed by it. :sad:

bannerreal01mittelit3.jpg
Axed Head and A.I. Coder for S.E.E. and ... stuff

".. coding is basically boring. What's fun is finding out how things work, take them apart and then put them together in ways that were not intended nor even conceived."


#7 Lauri

Lauri

    Old man Lauri

  • Hosted
  • 10,436 posts
  • Location:Norway
  • Projects:The 4th Age
  •  The very worst T3A Team Chamber Member

Posted 10 March 2008 - 10:44 PM

I would belive it works, depending on what you really want that is...

You put the MaxStimulationOfType (or whatever it is) to 1 in the Main one, and keep different revies in the real heroes...
I'm pretty sure this wouldn't be as nice when your acctually reviving them though... suddenly your reviving Aragorn instead of the dead boromir :sad:

Object RohanPeasant

	EditorSorting = UNIT
	MaxStimulationOfType = 1
	[b]BuildVariations = RohanPeasant1 RohanPeasant3 RohanPeasant4[/b]
	KindOf = PRELOAD SELECTABLE CAN_CAST_REFLECTIONS INFANTRY PATH_THROUGH_EACH_OTHER SCORE THROWN_OBJECT SWARM_DOZER GRAB_AND_DROP DOZER 

End
Haven't tested it, but it could work... I think..

edit: Might have to put the revive stuff into the main one too...
As I don't know if the hero will change his pictures...

Edited by Lauri, 10 March 2008 - 10:46 PM.

T4A_Logo_-_article.png

The 4th Age version 0.8 has been released: Link


#8 Wolvman

Wolvman
  • Members
  • 71 posts
  • Location:Tennessee

Posted 23 August 2008 - 03:30 AM

This sounds interesting. How could I change the probability of a certain unit coming out if I used this code though? Like if I want more RohanPeasant1's to come out than RohanPeasant2's.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users