2 Stage ClusterBomb wont work [acknowledged]

Moderator: NADEO

Post Reply
10000370
Posts: 15
Joined: 11 Aug 2014, 09:37

2 Stage ClusterBomb wont work [acknowledged]

Post by 10000370 » 12 Aug 2014, 23:37

Im tyring to make a weapon that acts like a Clusterbomb. It uses two Projectiles. The first one fires normally like other weapons. the second one is suppose to fire when and where the first one ends. I made the first projectile not do any damage or blow and use code to add a "Priming Time" prevent having the bomb explode on doing massive hits directly to somebody's face.

In testing this weapon, I cant get the second stage to fire when I call for CSmActionEvent::EType::OnProjectileEnd:

also i should point out that it works when I put the second stage firing fucntions in the CSmActionEvent::EType::OnPlayerHit: but thats not how I want it to work.

Heres the code:

Any help would be greatly appreciated.

Code: Select all

#RequireContext CSmAction

#Include "TextLib" as TextLib
#Setting C_Cooldown			300
#Setting C_EnergyCost		1600
#Setting C_EnergyMax			6400
#Setting C_EnergyReload		True
#Setting C_2Stage				False
#Setting C_PrimingTime		100
#Const C_ProjectileName1 "Projectile 1"
#Const C_ProjectileName2 "Projectile 2"
#Const C_AnimName "Anim1"

Cooldown = C_Cooldown;
EnergyMax = C_EnergyMax;
EnergyCost = C_EnergyCost;
EnergyReload = C_EnergyReload;

declare PrimeTime = C_PrimingTime;

declare AnimId0 = GetAnimModelId(C_AnimName);
declare ProjectileId1 = GetProjectileModelId(C_ProjectileName1);
declare ProjectileId2 = GetProjectileModelId(C_ProjectileName2);
declare Boolean Prime = False;
declare Integer StartTime; 

while (True) {
	foreach (Event in PendingEvents) {
		switch (Event.Type) {
			case CSmActionEvent::EType::OnHitPlayer : {
				SendRulesEvent("damage", [TextLib::ToText(Event.Damage)], Owner, Event.Player);
	
				}
			case CSmActionEvent::EType::OnProjectileEnd:{
				
				if(Event.ProjectileModelId  == ProjectileId1){
					if (Prime == True){
						if (Now >= StartTime + PrimeTime) {
					
							declare Vec3 EndPos = Event.Position;
							declare Vec3 EndDir = Event.Direction;
							declare Vec3 Speed = Event.Normal;
					
							CreateProjectile(Owner, ProjectileId2, EndPos, EndDir, Speed);
							SendRulesEvent("fire", Text[], Owner, Null);
						
						
						
							Prime = False;
						}
					}
				}
			}
		}
	}


	if (Owner.SpawnStatus == CSmPlayer::ESpawnStatus::Spawned && IsActive && (Energy >= EnergyCost) && Cooldown_IsReady(Now) && !Owner.IsOnTechNoWeapon && !Owner.IsInWater ) {
		Cooldown_Start();
		Energy -= EnergyCost;
		PlayAnimOnPlayer(AnimId0, Owner);
		if(C_2Stage == False){
			CreateShoot(Owner, ProjectileId1);
			SendRulesEvent("fire", Text[], Owner, Null);
		} else if (C_2Stage == True){
		
		CreateShoot(Owner, ProjectileId1);
		Prime = True;
		StartTime = Now;
		}
	}
	
	yield;
}

User avatar
fleo
Posts: 304
Joined: 02 Sep 2011, 12:56

Re: 2 Stage ClusterBomb wont work

Post by fleo » 12 Aug 2014, 23:51

Be sure to check the option "Explode on end life" in Gameplay Mode: Edit explosion.

I already had some troubles because of that setting...good luck if it's not because of that ^^
Follow me on my maniaflash. Try the new elitealternative! Feedbacks on this post. :thumbsup:

I need αεяø. I'm holding out for αεяø 'til the end of the night.

10000370
Posts: 15
Joined: 11 Aug 2014, 09:37

Re: 2 Stage ClusterBomb wont work

Post by 10000370 » 13 Aug 2014, 01:40

fleo wrote:Be sure to check the option "Explode on end life" in Gameplay Mode: Edit explosion.

I already had some troubles because of that setting...good luck if it's not because of that ^^
I have press that button multiple time with no success.

User avatar
Teardrop
Posts: 95
Joined: 02 Dec 2011, 19:47

Re: 2 Stage ClusterBomb wont work

Post by Teardrop » 02 Sep 2014, 14:49

First of all, to have access to ::OnProjectileEnd, you have to use :

Code: Select all

#Const UseProjectileEvents True
But the event is bugged in the release version (Direction and ModelId). I just fixed it, so it will be available next update.

Thanks for the report :thumbsup:

10000370
Posts: 15
Joined: 11 Aug 2014, 09:37

Re: 2 Stage ClusterBomb wont work

Post by 10000370 » 02 Sep 2014, 22:44

Thanks for Fixing

Welcome for reporting

How soon will the next update come out?

Post Reply

Return to “ActionMaker and Item editor”

Who is online

Users browsing this forum: No registered users and 1 guest