Traps! and other good stuff [Solved: see Darth's rev]

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
User avatar
asleeponduty
Private First Class
Posts: 77
Joined: Tue Jul 22, 2008 3:05 pm
Games I'm Playing :: AaaaaAAaaaAAAaaAAAA
xbox live or psn: No gamertag set
Location: Illinois

Traps! and other good stuff [Solved: see Darth's rev]

Post by asleeponduty »

Hey all!
I am about to begin making a new map, the first i will actually be releasing :shock:
As many you know, I have been here for a while with the appearance of doing absolutely nothing. That is hardly true, as I have been learning and making maps for some of my friends, myself, and my cousins. I just never have gotten around to releasig one yet, and I will do that eventually.
Allow me to step off my soapbox and ask a small question:

I have a few "traps" that I am working on, and it involves anybody walking into a region, spawning a landmine at a certain path, and blowing them to smithereens if they step on it. (in the process, it also disables the trap)
Heres me code:

Code: Select all

ActivateRegion("trapregion1")
   OnEnterRegion(
    function(regIn,character)
    CreateEntity("dro_weap_inf_mine_ord", point, "trap_path1")
    DeactivateRegion("trapregion1")
    end,
    "trapregion1"
    )
What I would like to know is if it is possible to spawn a mine that will blow anybody up if they steppped on it, regardless of team. (I am away from my normal computer, so I wont beabe to mess with this for a while)
Thanks!
Last edited by asleeponduty on Tue Apr 05, 2011 4:18 pm, edited 1 time in total.
User avatar
Firefang
Major
Major
Posts: 518
Joined: Mon Nov 15, 2010 8:55 pm
Location: California

Re: Traps! and other good stuff

Post by Firefang »

It should work if the mine is set to an unfriendly team to both teams. And be sure the mine odf is in the world's .req so it will spawn
User avatar
DarthD.U.C.K.
Master of the Force
Master of the Force
Posts: 6027
Joined: Wed Sep 27, 2006 11:05 am
Location: Duckburg, Germany

Re: Traps! and other good stuff

Post by DarthD.U.C.K. »

i think the code should look like this:

Code: Select all

	--Trapcode
	SetTeamAsEnemy(3,DEF)
	SetTeamAsEnemy(DEF,3)
	SetTeamAsEnemy(3,ATT)
	SetTeamAsEnemy(ATT,3)
	
	ActivateRegion("trapregion1")
		OnEnterRegion(
			function(regIn,character)
			MineSpawn = GetPathPoint("trap_path1", 0) --gives node 0 of path "trap_path1" the name "MineSpawn"
			CreateEntity("dro_weap_inf_mine_ord", MineSpawn, "mine") --spawns an entity of the class "dro_weap_inf_mine_ord" with name "mine"  on the node "MineSpawn"
			SetObjectTeam(mine, 3) --assigns the mine to team 3
			DeactivateRegion("trapregion1")
		end,
    "trapregion1"
    )
User avatar
asleeponduty
Private First Class
Posts: 77
Joined: Tue Jul 22, 2008 3:05 pm
Games I'm Playing :: AaaaaAAaaaAAAaaAAAA
xbox live or psn: No gamertag set
Location: Illinois

Re: Traps! and other good stuff

Post by asleeponduty »

Thank you! :bowdown:
I have had major trouble with "CreateEntity" in the past, and now i can safely say problem solved.
Post Reply