Page 1 of 1

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

Posted: Mon Apr 04, 2011 11:07 pm
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!

Re: Traps! and other good stuff

Posted: Mon Apr 04, 2011 11:38 pm
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

Re: Traps! and other good stuff

Posted: Tue Apr 05, 2011 7:48 am
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"
    )

Re: Traps! and other good stuff

Posted: Tue Apr 05, 2011 4:16 pm
by asleeponduty
Thank you! :bowdown:
I have had major trouble with "CreateEntity" in the past, and now i can safely say problem solved.