Page 3 of 3 FirstFirst 123
Results 21 to 29 of 29

Thread: Event System

  1. #21
    Banned
    Join Date
    May 2010
    Location
    fuck off?
    Posts
    1,145

    Default

    i'm curious what you're trying to make, maybe we could find a different solution. As im not too sure what your trying to achieve.

  2. #22
    Developer
    Join Date
    Jun 2010
    Location
    Hungary
    Posts
    291

    Default

    In my tank mod, the tank turret has coaxial machinegun. The player can't sit in the tank and control the mg at once. So that mg is empty and when the player hold the secondary attack button i force it to fire. And i want to make somehow to detect if that mg damage a player, and attach the playerdamage to the tank driver as attacker.

    I hope my english was understandable.

  3. #23
    Banned
    Join Date
    May 2010
    Location
    fuck off?
    Posts
    1,145

    Default

    ahh i see.

    how about doing what i did with the planes MG's?

    script the shooting. That way you can detect when you shoot someone. Sound good?


    EDIT:

    These are from admin pro Server_planes/damage.scr


    Code:
    
    main local.action:
    
    	switch(local.action)
    	{
    	case "BOMB":
    		self zoomoff	
    		self waitthread bomb
    	break
    	case "SHOOT":
    		self thread shoot
    		self.shooting=1
    		wait self.shootdelay
    		self.shooting=0
    	break
    	case "CHANGE_WEAPON":
    		self.canchange = 0 
    		self thread change_weapon
    		wait self.changedelay 
    		self.canchange = 1 
    	break
    	}
    end
    
    shoot:
    
    	local.fwd_vec = angles_toforward self.viewangles
    	local.start = self gettagposition "eyes bone"
    	local.hit = trace (local.start + local.fwd_vec * 64 ) (local.start + local.fwd_vec * 22000 ) 0
    	
    	switch(self.planeweap)
    	{
    	case 1: //mg
    		self.plane playsound mg42_gun_snd_fire
    		self thread checkhit local.hit
    	break
    	case 2: //30 call
    		self.plane playsound jeep_snd_fire
    		self thread checkhit local.hit
    	break	
    	case 3: 
    		self thread rocket local.hit
    	break
    	default:
    		self thread checkhit local.hit
    
    	}
    
    /*
    	self.plane light 1 1 0 10
    	waitframe
    	self.plane light 0 0 0 0
    
    	local.dirtleft = spawn script_model
    	local.dirtleft model "models/fx/corona_red.tik"
    	local.dirtleft.origin = local.hit
    	local.dirtleft.scale = .5
    	local.dirtleft notsolid
    	local.dirtleft commanddelay 1.0 remove
    */
    end
    
    checkhit local.place:
    
    	self thread mgeffect local.place
    
    	for(local.i = 1; local.i <= $player.size; local.i++)
    	{
    		local.player= $player[local.i]	
    		if(local.player!=self && local.player != NIL)
    		{
    			local.end_or_not = waitthread team_check local.player self
    
    			if(local.end_or_not==1)
    			{
    				end //end if same team and team team killing is not on
    			}
    
    			if(local.player.flying==1)
    			{
    
    				if(local.player.plane.scale == .75)
    				{
    					local.hitvec = local.place - local.player.plane.origin
    
    					local.hitvec_fwd = local.hitvec * local.player.plane.forwardvector
    					local.hitvec_lf = local.hitvec * local.player.plane.leftvector
    					local.hitvec_up = local.hitvec * local.player.plane.upvector 
    
    					local.is_hit_fwd = (abs local.hitvec_fwd) <= 200.0
    					local.is_hit_lf = (abs local.hitvec_lf) <= 200.0
    					local.is_hit_up = local.hitvec_up >= 0.0 && local.hitvec_up <= 35.0
    					local.damage = 20
    				}
    				else 
    				{
    
    
    					local.hitvec = local.place - local.player.plane.origin
    
    					local.hitvec_fwd = local.hitvec * local.player.plane.forwardvector
    					local.hitvec_lf = local.hitvec * local.player.plane.leftvector
    					local.hitvec_up = local.hitvec * local.player.plane.upvector 
    
    
    					local.is_hit_fwd = (abs local.hitvec_fwd) <= 120.0
    					local.is_hit_lf = (abs local.hitvec_lf) <= 120.0
    					local.is_hit_up = local.hitvec_up >= 0.0 && local.hitvec_up <= 15.0
    					local.damage = 30
    				}
    
    			}
    			else
    			{
    				local.hitvec = local.place - local.player.origin 
    
    				local.hitvec_fwd = local.hitvec * local.player.forwardvector
    				local.hitvec_lf = local.hitvec * local.player.leftvector
    				local.hitvec_up = local.hitvec * local.player.upvector 
    
    				local.is_hit_fwd = (abs local.hitvec_fwd) <= 32.0
    				local.is_hit_lf = (abs local.hitvec_lf) <= 32.0
    				local.is_hit_up = local.hitvec_up >= 0.0 && local.hitvec_up <= 92.0
    				local.damage = 45
    			}
    
    			if(local.is_hit_fwd && local.is_hit_lf && local.is_hit_up)
    			{
    				local.player damage self local.damage self.plane local.player.origin self.forwardvector (0 0 0) 10 1 18 -1
    			}
    		}
    
    	}
    
    end
    
    team_check local.player local.shooter:
    	
    	local.gametype = getcvar "g_gametype"
    	
    	if(local.gametype=="1")
    	{
    		end 0
    	}
    	
    	local.ff =  getcvar "g_teamdamage"
    
    	if(local.ff=="0")
    	{
    		if(local.player.dmteam == local.shooter.dmteam)
    		{
    			end 1
    		}
    	}
    
    end 0
    	
    mgeffect local.place:
    
    	if(self.spawnedmg==0)
    	{
    		self.spawnedmg=1
    		local.left = ( self.plane gettagposition "tag_barrel01")
    
    		self.plane.gunleft = spawn statweapons/mg42_gun_fake.tik "targetname" ("planesmgleft" + self.entnum)  spawnflags 1
    		self.plane.gunleft.angles = self.plane.angles
    		self.plane.gunleft.origin = local.left
    		self.plane.gunleft attach self.plane "tag_barrel01"
    		self.plane.gunleft setPlayerUsable 0
    
    		if(self.dmteam=="axis")
    		{
    			local.right = ( self.plane gettagposition "tag_barrel02")  
    			self.plane.gunright = spawn statweapons/mg42_gun_fake.tik targetname ("planesmgright" + self.entnum) spawnflags 1
    			self.plane.gunright.angles = self.plane.angles
    			self.plane.gunright.origin = local.right
    			self.plane.gunright attach self.plane "tag_barrel02"
    			self.plane.gunright setPlayerUsable 0
    		}
    		else
    		{
    			local.right = ( self.plane gettagposition "tag_barrel04") 
    			self.plane.gunright = spawn statweapons/mg42_gun_fake.tik "targetname" ("planesmgright" + self.entnum)  spawnflags 1
    			self.plane.gunright.angles = self.plane.angles
    			self.plane.gunright.origin = local.right
    			self.plane.gunright attach self.plane "tag_barrel04"
    			self.plane.gunright setPlayerUsable 0
    		}
    
    		self.plane.gunright hide
    		self.plane.gunleft hide
    		self.plane.gunright notsolid
    		self.plane.gunleft notsolid
    	}
    
    		local.org = spawn script_origin 
    		local.org.origin = local.place
    
    		self.plane.gunright.angles = self.viewangles
    		self.plane.gunleft.angles = self.viewangles
    
    		self.plane.gunright setaimtarget local.org
    		self.plane.gunleft setaimtarget local.org
    
    		self.plane.gunleft anim fire
    		self.plane.gunright anim fire
    
    		local.org remove
    	//self.plane anim blast
    
    end

    in the planes:

    a plane is spawned with 2 mg's on their wings.

    Above:
    The player presses shoot:
    The mg's fire blanks, they are dummys, they d not hurt you.
    The animations roll on:
    The script traces if it would of hit anyone...
    the script kills anyone it find with the payer as the attacker.

    done.
    Last edited by Elgan; August 4th, 2011 at 07:47 AM.

  4. #24
    Developer
    Join Date
    Jun 2010
    Location
    Hungary
    Posts
    291

    Default

    I will try this.

    I collected the means of death defines. Hope it will help someone...
    Code:
    // Means of Death
    0 - none
    1 - suicide
    2 - crush
    3 - crush_every_frame
    4 - telefrag
    5 - lava
    6 - slime
    7 - falling
    8 - last_self_inflicted
    9 - explosion
    10 - explodewall
    11 - electric
    12 - electricwater
    13 - thrownobject
    14 - grenade
    15 - beam
    16 - rocket
    17 - impact
    18 - bullet
    19 - fast_bullet
    20 - vehicle
    21 - fire
    22 - flashbang
    23 - on_fire
    24 - gib
    25 - impale
    26 - bash
    27 - shotgun

  5. #25
    Developer
    Join Date
    Jun 2010
    Location
    Hungary
    Posts
    291

    Default

    The certain locations modify the value of damage as the following:
    Code:
    // local.location
    -1 - 1.00
    0 - 2.00
    1 - 2.00
    2 - 2.00
    3 - 1.00
    4 - 0.95
    5 - 0.90
    6 - 0.85
    7 - 0.80
    8 - 0.80
    9 - 0.80
    10 - 0.80
    11 - 0.60
    12 - 0.60
    13 - 0.60
    14 - 0.60
    15 - 0.50
    16 - 0.50
    17 - 0.50
    18 - 0.50

  6. #26
    Banned
    Join Date
    May 2010
    Location
    fuck off?
    Posts
    1,145

    Default

    thanx veers and local.target.model might give you what yopu want.

    i noticed, if i print local.target.model, and nade myself, it prints the nade model

  7. #27
    Administrator James's Avatar
    Join Date
    May 2010
    Location
    on the intraweb
    Posts
    3,180

    Default

    Elgan, just a thought.

    1. I assume this is all serverside (I apologize for the stupid question)?
    2. Is it possible to store hit locations in an array per player? Lets say an array of 50?

    If the answer is yes, I have a pretty neat thought you may be interested in trying out as a POC . PM me or post in dev section and I will fill you in on the details.

  8. #28
    Developer
    Join Date
    Jun 2010
    Location
    Hungary
    Posts
    291

    Default

    Intermission event doesn't work always for me. It should be activated after each restart, map, etc.. commands, but sometimes for example the second restart is not detected.

  9. #29
    Über Prodigy & Developer Razo[R]apiD's Avatar
    Join Date
    May 2010
    Location
    Poland, Lublin
    Posts
    3,257

    Default

    Make sure you re-register the evemt handler. We don't detect it, we just know when it happens and inject the code on restarts to execute the script so it should be always executed. The thing is that it can be already executed if you restart twice with small delay between the restarts or the code in intermission event executes so long that it doesn't end before the next restart is issued.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •