Ranged attacks - possible?

Exel said:
Perhaps. But it could be exploited and used to scout fog of war. Of course for ranges of just a couple of tiles this is not an issue, but for weapons that have greater ranges this could be a problem.

That's one reason I'm doing the bomber air strike style of ranged combat, though with my mod, you can shoot blindly into fogged and undiscovered territory, but you won't know if you hit anything if you can't see it. (units that are there WILL be damaged, though)
 
Expanding air strike to other units (when the SDK is available) seems like the best way to impliment ranged combat, as the code base for mechanics and the AI is already there. Different projectile types could be exposed to the XML (Aircraft, shell, missile, etc), and units could then have interception chances against different types, firing back at the attacker.
 
Déja said:
That's one reason I'm doing the bomber air strike style of ranged combat, though with my mod, you can shoot blindly into fogged and undiscovered territory, but you won't know if you hit anything if you can't see it. (units that are there WILL be damaged, though)

Could you care to elaborate the system you are using?

Thalassicus said:
Expanding air strike to other units (when the SDK is available) seems like the best way to impliment ranged combat, as the code base for mechanics and the AI is already there. Different projectile types could be exposed to the XML (Aircraft, shell, missile, etc), and units could then have interception chances against different types, firing back at the attacker.

I agree, this seems like the best way to go.
 
Exel said:
Could you care to elaborate the system you are using?

I think I've already mentioned it earlier in this thread, but basically you click bombard (or attack or whatever it turns out being for that unit) and then you get the bomber targeting system. You click on the square you want to bombard, and it damages that square and the squares around it (if the unit can do collateral damage)
 
Forgive me for sounding daft but I just don't get it. Correct me if I am wrong , but it seems like Kael and Deja seemed to have the ranged art thing resolved to some degree, right?

If that is correct, then why do we not have at the an Alpha of something that could provide this system to the Art in the game? Clearly this thing is over the heads of 90% of us and that includes people that now how to mod like me, its the coding part where I and about 90% of us loose out.

Since that is the case refferals to other threads about spells etc. is really not helpful to those of us that don't know python(90%). What would be helpful is an Alpha release with instructions on how to implement the system for wider testing(this might actually help perfect the system). Just a thought.;)
 
Déja said:
I think I've already mentioned it earlier in this thread, but basically you click bombard (or attack or whatever it turns out being for that unit) and then you get the bomber targeting system. You click on the square you want to bombard, and it damages that square and the squares around it (if the unit can do collateral damage)

Could you give me the code you are using so I can inspect it and possibly do further development on it? I'd be most appreciative.

At least describe the exact mechanics involved. I'm a little lost here trying to figure out who did what exactly, so bare with me. If I understood correctly it is based on Kael's summoning code, right? Does it work by summoning a new "bomber" unit that is then able to carry out the bombing mission, or how?
 
No, I don't use Kael's summoning trick. Mine actually plots a circle of targets and highlights the one under the mouse... then after the user clicks, it performs the strike.
 
Déja said:
No, I don't use Kael's summoning trick. Mine actually plots a circle of targets and highlights the one under the mouse... then after the user clicks, it performs the strike.

Could you share your invention with us?
 
I have... I use the spell targeting selection demo I've linked a few times on these boards. Look under the Completed Mods section.
 
RED DIAMOND said:
Finally got the spell demo to work. There is no visual attached to it though?
No, although it may be possible, I am no good with visuals. There is a CyEngine.triggerEffect that might work though. It uses Assets/XML//Misc/CIV4EffectInfos.xml and you would use CvEffectInfo to figure out which was which and call the function. (all speculation, no testing done)
 
Déja said:
Right now it's not very efficient. It's just a messy proof of concept at the moment. I would be willing to write up a little how-I-did-it if you would be interested, however.
In case you're curious, there's a magic spell mod that helped me see how this sort of ranged mod is possible. You can find it here: http://forums.civfanatics.com/showthread.php?t=151941
Without that demo, I wouldn't have gotten very far.

Looked at the spell demo and got it to work. Still awaiting the offered write up on your method:D
 
talchas said:
No, although it may be possible, I am no good with visuals. There is a CyEngine.triggerEffect that might work though. It uses Assets/XML//Misc/CIV4EffectInfos.xml and you would use CvEffectInfo to figure out which was which and call the function. (all speculation, no testing done)

Thx, but do you or does anyone else know exactly how to use this CyEngine thing in the spell demo files? Clearly, my python skills are limited so I really would not know how to invoke this command without crashing the .py file:lol:
 
Ooh, this is nice.
Add this to a copy of your CIV4EffectInfos.xml:
Code:
		<EffectInfo>
			<Type>EFFECT_SPELL</Type>
			<Description>Boom</Description>
			<fScale>0.2</fScale>
			<fUpdateRate>1.2</fUpdateRate>
			<Path>Art/Interface/Effects/EmpBlast.nif</Path>
			<bIsProjectile>0</bIsProjectile>
		</EffectInfo>
Then add this to the same file as whereever your spells are defined:
Code:
def getEffectInfo(name):
	for i in range(gc.getNumEffectInfos()):
		item=gc.getEffectInfo(i)
		if(item.getType()==name):
			return i
and add this at the bottom of your spell function:
Code:
CyEngine().triggerEffect(getEffectInfo("EFFECT_SPELL"),targetPlot.getPoint())
where targetPlot is the name of the second parameter. This causes the ping effect (which looks like a pseudo-explosion, probably why its called empburst) to be displayed at whatever tile you clicked, running at 20% size and 20% more speed.

Art/Interface/Effects/LaserHit.nif looks cool too - green ball giving off sparks.
Art/Interface/Effects/ResourceBOMB.nif at 1/3 size or so would be ok for an earthquake - bit short though
Art/Interface/Effects/Stasis.nif is nice - red ball and swirly stuff, but it would need to be moved down a bit, cause it is currently above the unit
Art/Effects/fireworks/fx_fireworks_red.nif and of course fireworks!
 
When I get home tonite I will try it. Talchas you da man:goodjob: :king:

Edit: Well I tried this and I am obviously inept when it comes to python.:blush:

I tried putting the info into the spelldemo files in the places where it appeared/seemed like you said it should go(frankly I don't know exactly where in the 9 different spelldemo .py files the info really should go:confused: ) I got it working past the python hit and miss errors:D , but never got any visual effect:crazyeye:

It would be ultra cool if some kind person that does know python would just add this one tiny little effect to the spelldemo:scan:

If not, I will just have to be satisfied with no graphics or sound upon attack. Heck at least I was able to get it working and place it in some ranged units for my game. That was the bottom line anyway.:D
 
Well, there is now an updated version with the graphics in the spelldemo thread. No sound currently, although that is doable.

On another note, it is possible to have the AI do stuff without the SDK (limited stuff). In CvGameUtils override AI_unitUpdate and place your AI code there. To make a unit move call pUnit.getGroup().pushMoveToMission(x,y), where pUnit = argsList[0]. It may be that if you return true from this method, the AI won't do anything, I'm not sure. If you want to do something afterward, I think you need to override CvEventManager's onUnitMove. You might want to just make a method doAI(unit) in something like MyMod.py and call MyMod.doAI in each of these methods to ensure you do what you want. Use the scriptData to make your code remember long term stuff. If you want to do something like trigger a ranged attack, do whatever you do in the ui code that lets the player do so in this location. So if you call MyMod.fireAt(tile) there, call it in the AI method too
 
I have to say that nothing comes close to being as much of a disaster as the missing ability to attack units with the bombard ability from ships and artillery in civ4!! It is in civ3 so i have no idea why it vanished, I must assume people must have requested it at some point although I cannot imagine why?? Has everyone forgotten how annoying it is to throw away five frigates just to take out one cheating AI frigate?? Or am I the only unlucky player here? I need to be able to use the first 4 frigates to bombard the enemy ship instead of sacrificing them all for nothing.
Is it possible to modify ships and artillery to work the same as they do in civilisation3?
 
talchas said:
Ooh, this is nice.
Add this to a copy of your CIV4EffectInfos.xml:
Code:
		<EffectInfo>
			<Type>EFFECT_SPELL</Type>
			<Description>Boom</Description>
			<fScale>0.2</fScale>
			<fUpdateRate>1.2</fUpdateRate>
			<Path>Art/Interface/Effects/EmpBlast.nif</Path>
			<bIsProjectile>0</bIsProjectile>
		</EffectInfo>
Then add this to the same file as whereever your spells are defined:
Code:
def getEffectInfo(name):
	for i in range(gc.getNumEffectInfos()):
		item=gc.getEffectInfo(i)
		if(item.getType()==name):
			return i
and add this at the bottom of your spell function:
Code:
CyEngine().triggerEffect(getEffectInfo("EFFECT_SPELL"),targetPlot.getPoint())
where targetPlot is the name of the second parameter. This causes the ping effect (which looks like a pseudo-explosion, probably why its called empburst) to be displayed at whatever tile you clicked, running at 20% size and 20% more speed.

Art/Interface/Effects/LaserHit.nif looks cool too - green ball giving off sparks.
Art/Interface/Effects/ResourceBOMB.nif at 1/3 size or so would be ok for an earthquake - bit short though
Art/Interface/Effects/Stasis.nif is nice - red ball and swirly stuff, but it would need to be moved down a bit, cause it is currently above the unit
Art/Effects/fireworks/fx_fireworks_red.nif and of course fireworks!

This system worked beautifully! :D Brilliant work coming up with it and thanks for sharing it with us. Im going to use it to spice up some of the spells in FfH.
 
Top Bottom